This repository has been archived by the owner on Dec 3, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Christopher Mühl
committed
Apr 14, 2021
1 parent
776226a
commit 4b370a4
Showing
15 changed files
with
170 additions
and
147 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import tar from 'tar' | ||
import fs from 'fs-extra' | ||
import path from 'path' | ||
import Service from './service' | ||
|
||
interface PackServiceConfig { | ||
sourceDir: string, | ||
outFile: string | ||
} | ||
|
||
export default class PackService extends Service<PackServiceConfig> { | ||
defaultConfig = { | ||
sourceDir: path.join(this.path, 'dist'), | ||
outFile: path.join(this.path, `${this.json.name}@${this.json.version}.tar.gz`), | ||
} | ||
|
||
async run (config?: Partial<PackServiceConfig>) { | ||
config = { ...this.defaultConfig, ...config } | ||
|
||
const dirContent = await fs.readdir(config.sourceDir!) | ||
const archive = tar.create({ | ||
gzip: true, cwd: config.sourceDir!, | ||
}, dirContent) | ||
|
||
archive.pipe(fs.createWriteStream(config.outFile!)) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import fs from 'fs-extra' | ||
import path from 'path' | ||
import { Types } from '@awtrix/common' | ||
|
||
export default abstract class Service<Config> { | ||
defaultConfig!: Config | ||
path: string | ||
json: Types.Application.ApplicationConfig | ||
|
||
constructor (jsonPath: string) { | ||
this.path = path.dirname(jsonPath) | ||
this.json = JSON.parse(fs.readFileSync(jsonPath, 'utf-8')) | ||
} | ||
|
||
abstract run (config?: Partial<Config>): Promise<any> | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
dist |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,15 @@ | ||
<template> | ||
<div> | ||
{{name}} | ||
{{ app.name }}@{{ app.version }} | ||
</div> | ||
</template> | ||
|
||
<script lang="ts"> | ||
import { createFrontend } from '@awtrix/common' | ||
import { defineComponent } from '@awtrix/common' | ||
export default createFrontend({ | ||
export default defineComponent({ | ||
mounted () { | ||
console.log(`${this.app.name} has been mounted.`) | ||
}, | ||
}) | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
{} |
Oops, something went wrong.