From 4b370a40bdd3827ba693710a5bea74d227dd84a9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christopher=20M=C3=BChl?= Date: Wed, 14 Apr 2021 16:06:10 +0200 Subject: [PATCH] Almost finished `awtrix pack` --- packages/awtrix/package-lock.json | 18 +++- packages/awtrix/package.json | 4 +- packages/awtrix/src/app/ApplicationManager.ts | 3 +- packages/awtrix/src/cli/commands/pack.ts | 98 ++----------------- .../awtrix/src/cli/services/buildService.ts | 84 +++++++++++++--- .../awtrix/src/cli/services/packService.ts | 27 +++++ packages/awtrix/src/cli/services/service.ts | 16 +++ packages/awtrix/templates/app/_.gitignore | 1 + packages/awtrix/templates/app/frontend.vue | 8 +- .../awtrix/templates/app/translations/de.json | 1 + .../awtrix/web/components/Application.vue | 10 +- packages/common/package-lock.json | 38 +++---- packages/common/package.json | 6 +- packages/example-app/package-lock.json | 2 +- packages/example-app/translations/en.json | 1 + 15 files changed, 170 insertions(+), 147 deletions(-) create mode 100644 packages/awtrix/src/cli/services/packService.ts create mode 100644 packages/awtrix/src/cli/services/service.ts create mode 100644 packages/awtrix/templates/app/_.gitignore create mode 100644 packages/awtrix/templates/app/translations/de.json create mode 100644 packages/example-app/translations/en.json diff --git a/packages/awtrix/package-lock.json b/packages/awtrix/package-lock.json index 246f012..e53bc6a 100644 --- a/packages/awtrix/package-lock.json +++ b/packages/awtrix/package-lock.json @@ -591,10 +591,10 @@ "resolved": "https://registry.npmjs.org/@types/minimatch/-/minimatch-3.0.4.tgz", "integrity": "sha512-1z8k4wzFnNjVK/tlxvrWuK5WMt6mydWWP7+zvH5eFep4oj+UkrfiJTRtjCeBXNpwaA/FYqqtb4/QS4ianFpIRA==" }, - "@types/mkdirp": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/@types/mkdirp/-/mkdirp-1.0.1.tgz", - "integrity": "sha512-HkGSK7CGAXncr8Qn/0VqNtExEE+PHMWb+qlR1faHMao7ng6P3tAaoWWBMdva0gL5h4zprjIO89GJOLXsMcDm1Q==", + "@types/minipass": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/@types/minipass/-/minipass-2.2.0.tgz", + "integrity": "sha512-wuzZksN4w4kyfoOv/dlpov4NOunwutLA/q7uc00xU02ZyUY+aoM5PWIXEKBMnm0NHd4a+N71BMjq+x7+2Af1fg==", "dev": true, "requires": { "@types/node": "*" @@ -664,6 +664,16 @@ "integrity": "sha512-Lzia5OTQFJZJ5R4HsEEldywiiqT9+W2rDbyHJiiTGqOcju89sCsQ8aUXDljY6Ls33wKZZGC0bfMhr/VpOyjtXg==", "dev": true }, + "@types/tar": { + "version": "4.0.4", + "resolved": "https://registry.npmjs.org/@types/tar/-/tar-4.0.4.tgz", + "integrity": "sha512-0Xv+xcmkTsOZdIF4yCnd7RkOOyfyqPaqJ7RZFKnwdxfDbkN3eAAE9sHl8zJFqBz4VhxolW9EErbjR1oyH7jK2A==", + "dev": true, + "requires": { + "@types/minipass": "*", + "@types/node": "*" + } + }, "@types/text-table": { "version": "0.2.1", "resolved": "https://registry.npmjs.org/@types/text-table/-/text-table-0.2.1.tgz", diff --git a/packages/awtrix/package.json b/packages/awtrix/package.json index 4ea2128..1bedf50 100644 --- a/packages/awtrix/package.json +++ b/packages/awtrix/package.json @@ -45,7 +45,6 @@ "hammerjs": "^2.0.8", "lodash": "^4.17.20", "lowdb": "^1.0.0", - "mkdirp": "^1.0.3", "node-fetch": "^2.6.0", "nodemon": "^2.0.7", "on-change": "^2.1.4", @@ -55,6 +54,7 @@ "socket.io": "^2.3.0", "stylus": "^0.54.8", "stylus-loader": "^3.0.2", + "tar": "^6.1.0", "typed-vuex": "^0.1.22", "vue": "^3.0.10", "vue-flip-toolkit": "^1.6.0", @@ -73,13 +73,13 @@ "@types/hammerjs": "^2.0.36", "@types/lodash": "^4.14.159", "@types/lowdb": "^1.0.9", - "@types/mkdirp": "^1.0.0", "@types/node": "^13.9.1", "@types/node-fetch": "^2.5.7", "@types/puppeteer": "^3.0.1", "@types/shortid": "0.0.29", "@types/socket.io": "^2.1.11", "@types/socket.io-client": "^1.4.34", + "@types/tar": "^4.0.4", "@types/yargs": "^16.0.1", "@types/yeoman-environment": "^2.10.2", "@types/yeoman-generator": "^4.11.3", diff --git a/packages/awtrix/src/app/ApplicationManager.ts b/packages/awtrix/src/app/ApplicationManager.ts index 9399856..2e1414f 100644 --- a/packages/awtrix/src/app/ApplicationManager.ts +++ b/packages/awtrix/src/app/ApplicationManager.ts @@ -3,7 +3,6 @@ import { exec } from 'child_process' import axios from 'axios' import fs from 'fs-extra' import decompress from 'decompress' -import mkdirp from 'mkdirp' import { ApplicationIdentifier, ApplicationConfig, @@ -48,7 +47,7 @@ export default class ApplicationManager { async download(app: ApplicationIdentifier) { // First, make sure the app path exists const appPath = this.path(app) - await mkdirp(appPath) + await fs.mkdirp(appPath) // Fetch the download URL from npm const url = await this.getDownloadUrl(app) diff --git a/packages/awtrix/src/cli/commands/pack.ts b/packages/awtrix/src/cli/commands/pack.ts index d778772..3987910 100644 --- a/packages/awtrix/src/cli/commands/pack.ts +++ b/packages/awtrix/src/cli/commands/pack.ts @@ -1,19 +1,8 @@ import { Arguments, CommandModule } from 'yargs' import BuildService from '../services/buildService' +import PackService from '../services/packService' import fs from 'fs' -import os from 'os' -import { ChildProcess, fork } from 'child_process' import path from 'path' -// @ts-ignore -import copyTemplateDir from 'copy-template-dir' -import buildBackend from '../packer/buildBackend' -import buildFrontend from '../packer/buildFrontend' -import copyAssets from '../packer/copyAssets' -import copyPackageJson from '../packer/copyPackageJson' - -process.on('unhandledRejection', (reason, promise) => { - console.log(promise) -}) interface DevCommandArguments extends Arguments { home?: string, @@ -28,88 +17,17 @@ export default { }, handler: async (flags: DevCommandArguments) => { // For testing - process.chdir('../example-app') + let target = path.join(process.cwd(), '../example-app') - const jsonPath = path.join(process.cwd(), 'package.json') + const jsonPath = path.join(target, 'package.json') if (!fs.existsSync(jsonPath)) { console.log('Could not find a "package.json" in your current directory.') } - const service = new BuildService(jsonPath) - await service.run() + const build = new BuildService(jsonPath) + await build.run() + + const pack = new PackService(jsonPath) + await pack.run() }, } as CommandModule - -class Start implements CommandModule { - childProcess?: ChildProcess - - async handler() { - if (!fs.existsSync('package.json')) { - // return this.error('Could not find a "package.json" in your current directory.') - } - - const packageJson = fs.readFileSync('package.json', 'utf-8') - let config = JSON.parse(packageJson) - - try { - await this.createAwtrixHome(config) - await copyPackageJson(config) - await copyAssets(config, 'translations') - - if (config.awtrix.frontend) await buildFrontend(config, null) - if (config.awtrix.backend) await buildBackend(config, null) - if (config.awtrix.assets) await copyAssets(config, 'assets') - - this.startReloadingAwtrix(config) - } catch (error) { - // this.error(error) - } - - // 1. Start watcher that compiles sources (extract from pack.ts) - // 3. Symlink watcher output (dist/) to the awtrix app directory - // 4. Create awtrix configuration that includes the current app - // 5. Start awtrix - - // TODO: Find out if hot reloading for backend is possible - // TODO: Find out how to handle automatic reloading for assets - // TODO: Find out how to use hot reloading for compiled frontend component - - // TODO: Automatically generate empty translations directory, if it doesn't - // already exist. Show warning to user so they know to add it. - // TODO: Don't raise if the assets directory is missing. - } - - startReloadingAwtrix (config: any) { - this.restartAwtrixServer() - - fs.watchFile(`.awtrix/apps/${config.name}/${config.version}/backend.js`, () => { - this.restartAwtrixServer() - }) - } - - async createAwtrixHome (config: any): Promise { - return new Promise((resolve, reject) => { - const source = path.join(__dirname, '../../templates', 'development') - const variables = { name: config.name, version: config.version } - - copyTemplateDir(source, '.awtrix', variables, (error: Error | null) => { - if (error) return reject(error) - resolve() - }) - }) - } - - restartAwtrixServer () { - if (this.childProcess) { - this.childProcess.on('exit', () => { - this.childProcess = undefined - this.restartAwtrixServer() - }) - - this.childProcess.kill('SIGTERM') - return - } - - this.childProcess = fork(path.join(__dirname, '../thread/awtrix.js')) - } -} diff --git a/packages/awtrix/src/cli/services/buildService.ts b/packages/awtrix/src/cli/services/buildService.ts index 3c57003..8d31cba 100644 --- a/packages/awtrix/src/cli/services/buildService.ts +++ b/packages/awtrix/src/cli/services/buildService.ts @@ -1,22 +1,33 @@ -import fs from 'fs' -import { dirname } from 'path' +import fs from 'fs-extra' +import path from 'path' import { Types } from '@awtrix/common' import { build as buildVue } from 'vite' import vue from '@vitejs/plugin-vue' +import esbuild from 'esbuild' +import Service from './service' -export default class BuildService { - path: string - json: Types.Application.ApplicationConfig +interface BuildServiceConfig { + watch: boolean, +} - constructor (jsonPath: string) { - this.path = dirname(jsonPath) - this.json = JSON.parse(fs.readFileSync(jsonPath, 'utf-8')) +export default class BuildService extends Service { + defaultConfig = { + watch: false, } - async run (config?: any) { - console.log(this.json, this.path) + async run (config?: Partial) { + config = { ...this.defaultConfig, ...config } + + const outDir = config.watch ? `.awtrix/apps/${this.json.name}/${this.json.version}` : 'dist' + await fs.mkdirp(path.join(this.path, outDir)) + + // It is important to run Vite first, because it will empty the outDir + if (this.json.build.frontend) await this.vite(config.watch) + if (this.json.build.backend) await this.backend(config.watch) + if (this.json.build.assets) await this.assets(config.watch) - await this.vite() + await this.packageJson() + await this.translations(config.watch) } async vite (watch: boolean = false) { @@ -26,10 +37,11 @@ export default class BuildService { vue(), ], build: { + outDir: 'dist', minify: false, lib: { entry: 'frontend.vue', - name: `AwtrixComponent.${this.json.name}`, + name: `AwtrixComponent.${this.json.name}@${this.json.version!.replace(/\./g, '-')}`, formats: ['umd'], }, rollupOptions: { @@ -41,4 +53,52 @@ export default class BuildService { }, }) } + + async backend (watch: boolean = false) { + // We need to set the ESBUILD_BINARY_PATH so that `esbuild.build` can properly + // spawn the correct binary. + process.env.ESBUILD_BINARY_PATH = path.resolve(__dirname, '../node_modules/esbuild/bin/esbuild') + + // TODO: Verify types with tsc + + await esbuild.build({ + entryPoints: [path.join(this.path, 'backend.ts')], + outfile: path.join(this.path, 'dist/backend.js'), + watch: false, // true for watch mode + }) + } + + async packageJson () { + const source = path.join(this.path, 'package.json') + const dest = path.join(this.path, 'dist/package.json') + + // TODO: Figure out if we want to also copy the `package-lock.json` + await fs.copy(source, dest) + } + + async assets (watch: boolean = false) { + const source = path.join(this.path, 'assets') + const dest = path.join(this.path, 'dist/assets') + + await fs.copy(source, dest) + + // // Watch for asset changes + // chokidar.watch(source).on('all', debounce(() => { + // fs.copySync(source, dest) + // }, 500)) + } + + async translations (watch: boolean = false) { + const source = path.join(this.path, 'translations') + const englishLocale = path.join(source, 'en.json') + + // Create the translations if they don't already exist + if (!fs.pathExistsSync(source)) await fs.mkdirp(source) + if (!fs.pathExistsSync(englishLocale)) { + // TODO: Add log/info + await fs.writeFile(englishLocale, '{ }\n') + } + + await fs.copy(source, path.join(this.path, 'dist/translations')) + } } diff --git a/packages/awtrix/src/cli/services/packService.ts b/packages/awtrix/src/cli/services/packService.ts new file mode 100644 index 0000000..a9496fa --- /dev/null +++ b/packages/awtrix/src/cli/services/packService.ts @@ -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 { + defaultConfig = { + sourceDir: path.join(this.path, 'dist'), + outFile: path.join(this.path, `${this.json.name}@${this.json.version}.tar.gz`), + } + + async run (config?: Partial) { + 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!)) + } +} diff --git a/packages/awtrix/src/cli/services/service.ts b/packages/awtrix/src/cli/services/service.ts new file mode 100644 index 0000000..aeb2fda --- /dev/null +++ b/packages/awtrix/src/cli/services/service.ts @@ -0,0 +1,16 @@ +import fs from 'fs-extra' +import path from 'path' +import { Types } from '@awtrix/common' + +export default abstract class Service { + 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): Promise +} diff --git a/packages/awtrix/templates/app/_.gitignore b/packages/awtrix/templates/app/_.gitignore new file mode 100644 index 0000000..1521c8b --- /dev/null +++ b/packages/awtrix/templates/app/_.gitignore @@ -0,0 +1 @@ +dist diff --git a/packages/awtrix/templates/app/frontend.vue b/packages/awtrix/templates/app/frontend.vue index 7977a9a..18e0dc9 100644 --- a/packages/awtrix/templates/app/frontend.vue +++ b/packages/awtrix/templates/app/frontend.vue @@ -1,15 +1,15 @@ diff --git a/packages/awtrix/templates/app/translations/de.json b/packages/awtrix/templates/app/translations/de.json new file mode 100644 index 0000000..0967ef4 --- /dev/null +++ b/packages/awtrix/templates/app/translations/de.json @@ -0,0 +1 @@ +{} diff --git a/packages/awtrix/web/components/Application.vue b/packages/awtrix/web/components/Application.vue index 9fed450..8029c8a 100644 --- a/packages/awtrix/web/components/Application.vue +++ b/packages/awtrix/web/components/Application.vue @@ -51,21 +51,21 @@ export default defineComponent({ methods: { async importComponent (name: string, version: string): Promise> { - const url = `/static/apps/${name}/${version}/AwtrixComponent.${name}.umd.js` + const url = `/static/apps/${name}/${version}/${name}.umd.js` // This is to get around index errors when accessing unknown keys on // the global window object - // TODO: Figure out versioning! + const libName = `${name}@${version.replace(/\./g, '-')}` const castedWindow = window as any - if (castedWindow.AwtrixComponent && castedWindow.AwtrixComponent[name]) { - return castedWindow.AwtrixComponent[name] + if (castedWindow.AwtrixComponent && castedWindow.AwtrixComponent[libName]) { + return castedWindow.AwtrixComponent[libName] } const generate: GeneratorType = await new Promise(async (resolve, reject) => { const script = document.createElement('script') script.async = true script.addEventListener('load', () => { - resolve(castedWindow.AwtrixComponent[name]) + resolve(castedWindow.AwtrixComponent[libName]) }) script.addEventListener('error', () => { reject(new Error(`Error loading ${url}`)) diff --git a/packages/common/package-lock.json b/packages/common/package-lock.json index da94bc8..bd3efea 100644 --- a/packages/common/package-lock.json +++ b/packages/common/package-lock.json @@ -1,26 +1,23 @@ { "name": "@awtrix/common", - "version": "0.1.3", + "version": "0.1.8", "lockfileVersion": 1, "requires": true, "dependencies": { "@babel/helper-validator-identifier": { "version": "7.12.11", "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.12.11.tgz", - "integrity": "sha512-np/lG3uARFybkoHokJUmf1QfEvRVCPbmQeUQpKow5cQ3xWrV9i3rUHodKDJPQfTVX61qKi+UdYk8kik84n7XOw==", - "dev": true + "integrity": "sha512-np/lG3uARFybkoHokJUmf1QfEvRVCPbmQeUQpKow5cQ3xWrV9i3rUHodKDJPQfTVX61qKi+UdYk8kik84n7XOw==" }, "@babel/parser": { "version": "7.13.13", "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.13.13.tgz", - "integrity": "sha512-OhsyMrqygfk5v8HmWwOzlYjJrtLaFhF34MrfG/Z73DgYCI6ojNUTUp2TYbtnjo8PegeJp12eamsNettCQjKjVw==", - "dev": true + "integrity": "sha512-OhsyMrqygfk5v8HmWwOzlYjJrtLaFhF34MrfG/Z73DgYCI6ojNUTUp2TYbtnjo8PegeJp12eamsNettCQjKjVw==" }, "@babel/types": { "version": "7.13.14", "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.13.14.tgz", "integrity": "sha512-A2aa3QTkWoyqsZZFl56MLUsfmh7O0gN41IPvXAE/++8ojpbz12SszD7JEGYVdn4f9Kt4amIei07swF1h4AqmmQ==", - "dev": true, "requires": { "@babel/helper-validator-identifier": "^7.12.11", "lodash": "^4.17.19", @@ -67,14 +64,12 @@ "@types/socket.io-client": { "version": "1.4.34", "resolved": "https://registry.npmjs.org/@types/socket.io-client/-/socket.io-client-1.4.34.tgz", - "integrity": "sha512-Lzia5OTQFJZJ5R4HsEEldywiiqT9+W2rDbyHJiiTGqOcju89sCsQ8aUXDljY6Ls33wKZZGC0bfMhr/VpOyjtXg==", - "dev": true + "integrity": "sha512-Lzia5OTQFJZJ5R4HsEEldywiiqT9+W2rDbyHJiiTGqOcju89sCsQ8aUXDljY6Ls33wKZZGC0bfMhr/VpOyjtXg==" }, "@vue/compiler-core": { "version": "3.0.11", "resolved": "https://registry.npmjs.org/@vue/compiler-core/-/compiler-core-3.0.11.tgz", "integrity": "sha512-6sFj6TBac1y2cWCvYCA8YzHJEbsVkX7zdRs/3yK/n1ilvRqcn983XvpBbnN3v4mZ1UiQycTvOiajJmOgN9EVgw==", - "dev": true, "requires": { "@babel/parser": "^7.12.0", "@babel/types": "^7.12.0", @@ -87,7 +82,6 @@ "version": "3.0.11", "resolved": "https://registry.npmjs.org/@vue/compiler-dom/-/compiler-dom-3.0.11.tgz", "integrity": "sha512-+3xB50uGeY5Fv9eMKVJs2WSRULfgwaTJsy23OIltKgMrynnIj8hTYY2UL97HCoz78aDw1VDXdrBQ4qepWjnQcw==", - "dev": true, "requires": { "@vue/compiler-core": "3.0.11", "@vue/shared": "3.0.11" @@ -97,7 +91,6 @@ "version": "3.0.11", "resolved": "https://registry.npmjs.org/@vue/reactivity/-/reactivity-3.0.11.tgz", "integrity": "sha512-SKM3YKxtXHBPMf7yufXeBhCZ4XZDKP9/iXeQSC8bBO3ivBuzAi4aZi0bNoeE2IF2iGfP/AHEt1OU4ARj4ao/Xw==", - "dev": true, "requires": { "@vue/shared": "3.0.11" } @@ -106,7 +99,6 @@ "version": "3.0.11", "resolved": "https://registry.npmjs.org/@vue/runtime-core/-/runtime-core-3.0.11.tgz", "integrity": "sha512-87XPNwHfz9JkmOlayBeCCfMh9PT2NBnv795DSbi//C/RaAnc/bGZgECjmkD7oXJ526BZbgk9QZBPdFT8KMxkAg==", - "dev": true, "requires": { "@vue/reactivity": "3.0.11", "@vue/shared": "3.0.11" @@ -116,7 +108,6 @@ "version": "3.0.11", "resolved": "https://registry.npmjs.org/@vue/runtime-dom/-/runtime-dom-3.0.11.tgz", "integrity": "sha512-jm3FVQESY3y2hKZ2wlkcmFDDyqaPyU3p1IdAX92zTNeCH7I8zZ37PtlE1b9NlCtzV53WjB4TZAYh9yDCMIEumA==", - "dev": true, "requires": { "@vue/runtime-core": "3.0.11", "@vue/shared": "3.0.11", @@ -126,20 +117,17 @@ "@vue/shared": { "version": "3.0.11", "resolved": "https://registry.npmjs.org/@vue/shared/-/shared-3.0.11.tgz", - "integrity": "sha512-b+zB8A2so8eCE0JsxjL24J7vdGl8rzPQ09hZNhystm+KqSbKcAej1A+Hbva1rCMmTTqA+hFnUSDc5kouEo0JzA==", - "dev": true + "integrity": "sha512-b+zB8A2so8eCE0JsxjL24J7vdGl8rzPQ09hZNhystm+KqSbKcAej1A+Hbva1rCMmTTqA+hFnUSDc5kouEo0JzA==" }, "csstype": { "version": "2.6.16", "resolved": "https://registry.npmjs.org/csstype/-/csstype-2.6.16.tgz", - "integrity": "sha512-61FBWoDHp/gRtsoDkq/B1nWrCUG/ok1E3tUrcNbZjsE9Cxd9yzUirjS3+nAATB8U4cTtaQmAHbNndoFz5L6C9Q==", - "dev": true + "integrity": "sha512-61FBWoDHp/gRtsoDkq/B1nWrCUG/ok1E3tUrcNbZjsE9Cxd9yzUirjS3+nAATB8U4cTtaQmAHbNndoFz5L6C9Q==" }, "estree-walker": { "version": "2.0.2", "resolved": "https://registry.npmjs.org/estree-walker/-/estree-walker-2.0.2.tgz", - "integrity": "sha512-Rfkk/Mp/DL7JVje3u18FxFujQlTNR2q6QfMSMB7AvCBx91NGj/ba3kCfza0f6dVDbw7YlRf/nDrn7pQrCCyQ/w==", - "dev": true + "integrity": "sha512-Rfkk/Mp/DL7JVje3u18FxFujQlTNR2q6QfMSMB7AvCBx91NGj/ba3kCfza0f6dVDbw7YlRf/nDrn7pQrCCyQ/w==" }, "lodash": { "version": "4.17.20", @@ -149,14 +137,17 @@ "source-map": { "version": "0.6.1", "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", - "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", - "dev": true + "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==" }, "to-fast-properties": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/to-fast-properties/-/to-fast-properties-2.0.0.tgz", - "integrity": "sha1-3F5pjL0HkmW8c+A3doGk5Og/YW4=", - "dev": true + "integrity": "sha1-3F5pjL0HkmW8c+A3doGk5Og/YW4=" + }, + "type-fest": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-1.0.2.tgz", + "integrity": "sha512-a720oz3Kjbp3ll0zkeN9qjRhO7I34MKMhPGQiQJAmaZQZQ1lo+NWThK322f7sXV+kTg9B1Ybt16KgBXWgteT8w==" }, "typescript": { "version": "4.2.3", @@ -168,7 +159,6 @@ "version": "3.0.11", "resolved": "https://registry.npmjs.org/vue/-/vue-3.0.11.tgz", "integrity": "sha512-3/eUi4InQz8MPzruHYSTQPxtM3LdZ1/S/BvaU021zBnZi0laRUyH6pfuE4wtUeLvI8wmUNwj5wrZFvbHUXL9dw==", - "dev": true, "requires": { "@vue/compiler-dom": "3.0.11", "@vue/runtime-dom": "3.0.11", diff --git a/packages/common/package.json b/packages/common/package.json index aeb5fa3..f74ed1a 100644 --- a/packages/common/package.json +++ b/packages/common/package.json @@ -12,14 +12,14 @@ "tsconfig.app.json" ], "devDependencies": { - "@schemastore/package": "0.0.6", "@types/lodash": "^4.14.165", "@types/socket.io": "^2.1.11", "typescript": "^4.2" }, "dependencies": { + "@types/socket.io-client": "^1.4.34", "lodash": "^4.17.20", - "vue": "^3.0.11", - "@types/socket.io-client": "^1.4.34" + "type-fest": "^1.0.2", + "vue": "^3.0.11" } } diff --git a/packages/example-app/package-lock.json b/packages/example-app/package-lock.json index ada0a39..232ce97 100644 --- a/packages/example-app/package-lock.json +++ b/packages/example-app/package-lock.json @@ -1,5 +1,5 @@ { - "name": "@awtrix/example-app", + "name": "example", "version": "0.1.0", "lockfileVersion": 1, "requires": true, diff --git a/packages/example-app/translations/en.json b/packages/example-app/translations/en.json new file mode 100644 index 0000000..ffcd441 --- /dev/null +++ b/packages/example-app/translations/en.json @@ -0,0 +1 @@ +{ }