Skip to content

Commit 8930d85

Browse files
authored
Merge pull request #330 from lastmjs/add-node-tests
add node 14 tests
2 parents 7bd2bd1 + 96bb942 commit 8930d85

File tree

4 files changed

+24
-8
lines changed

4 files changed

+24
-8
lines changed

.github/workflows/nodejs.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ jobs:
1414
fail-fast: false
1515
matrix:
1616
os: [ubuntu-latest, windows-latest, macos-latest]
17-
node-version: [8.x, 10.x, 12.x]
17+
node-version: [8.x, 10.x, 12.x, 14.x]
1818
browser: [chrome, firefox]
1919

2020
steps:

package-lock.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "zwitterion",
3-
"version": "0.46.0",
3+
"version": "0.47.0",
44
"description": "A web dev server that lets you import anything*",
55
"scripts": {
66
"start": "ts-node --transpile-only src/app.ts --port 5050",

src/command-line.ts

Lines changed: 21 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,10 @@ import * as program from 'commander';
22
import * as fs from 'fs-extra';
33
import { CommandLineOptions } from '../index.d';
44

5-
const packageJSON: {
6-
version: string;
7-
} = JSON.parse(fs.readFileSync('./package.json').toString());
5+
const zwitterionVersion: string = getZwitterionVersion();
86

97
program
10-
.version(packageJSON.version)
8+
.version(zwitterionVersion)
119
.option('--port [port]', 'Specify the server\'s port')
1210
// .option('-nw, --no-watch-files', 'Do not watch files in current directory and do not reload browser on changes')
1311
// .option('--ts-warning', 'Report TypeScript errors in the browser console as warnings')
@@ -48,4 +46,22 @@ export const commandLineOptions: Readonly<CommandLineOptions> = {
4846
ascOptionsFilePath,
4947
tscOptionsFilePath,
5048
spaRoot
51-
};
49+
};
50+
51+
function getZwitterionVersion(): string {
52+
try {
53+
const packageJSON: {
54+
version: string;
55+
} = JSON.parse(fs.readFileSync(require.resolve('zwitterion/package.json')).toString());
56+
57+
return packageJSON.version;
58+
}
59+
catch(error) {
60+
if (error.code === 'MODULE_NOT_FOUND') {
61+
return '0.0.0';
62+
}
63+
else {
64+
throw error;
65+
}
66+
}
67+
}

0 commit comments

Comments
 (0)