diff --git a/.github/workflows/nodejs.yml b/.github/workflows/nodejs.yml index d4efe407..d92d9ee0 100644 --- a/.github/workflows/nodejs.yml +++ b/.github/workflows/nodejs.yml @@ -14,7 +14,7 @@ jobs: fail-fast: false matrix: os: [ubuntu-latest, windows-latest, macos-latest] - node-version: [8.x, 10.x, 12.x] + node-version: [8.x, 10.x, 12.x, 14.x] browser: [chrome, firefox] steps: diff --git a/package-lock.json b/package-lock.json index 5b301622..ca274e98 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "zwitterion", - "version": "0.45.0", + "version": "0.47.0", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/package.json b/package.json index 99282188..211a5ef6 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "zwitterion", - "version": "0.46.0", + "version": "0.47.0", "description": "A web dev server that lets you import anything*", "scripts": { "start": "ts-node --transpile-only src/app.ts --port 5050", diff --git a/src/command-line.ts b/src/command-line.ts index 0b74bc0d..d0d2e124 100644 --- a/src/command-line.ts +++ b/src/command-line.ts @@ -2,12 +2,10 @@ import * as program from 'commander'; import * as fs from 'fs-extra'; import { CommandLineOptions } from '../index.d'; -const packageJSON: { - version: string; -} = JSON.parse(fs.readFileSync('./package.json').toString()); +const zwitterionVersion: string = getZwitterionVersion(); program - .version(packageJSON.version) + .version(zwitterionVersion) .option('--port [port]', 'Specify the server\'s port') // .option('-nw, --no-watch-files', 'Do not watch files in current directory and do not reload browser on changes') // .option('--ts-warning', 'Report TypeScript errors in the browser console as warnings') @@ -48,4 +46,22 @@ export const commandLineOptions: Readonly = { ascOptionsFilePath, tscOptionsFilePath, spaRoot -}; \ No newline at end of file +}; + +function getZwitterionVersion(): string { + try { + const packageJSON: { + version: string; + } = JSON.parse(fs.readFileSync(require.resolve('zwitterion/package.json')).toString()); + + return packageJSON.version; + } + catch(error) { + if (error.code === 'MODULE_NOT_FOUND') { + return '0.0.0'; + } + else { + throw error; + } + } +} \ No newline at end of file