Skip to content

Commit

Permalink
Merge pull request #330 from lastmjs/add-node-tests
Browse files Browse the repository at this point in the history
add node 14 tests
  • Loading branch information
lastmjs authored Feb 25, 2021
2 parents 7bd2bd1 + 96bb942 commit 8930d85
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 8 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/nodejs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down
26 changes: 21 additions & 5 deletions src/command-line.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand Down Expand Up @@ -48,4 +46,22 @@ export const commandLineOptions: Readonly<CommandLineOptions> = {
ascOptionsFilePath,
tscOptionsFilePath,
spaRoot
};
};

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;
}
}
}

0 comments on commit 8930d85

Please sign in to comment.