Skip to content

Commit

Permalink
Merge pull request #11 from neogeek/hotfix/package-version
Browse files Browse the repository at this point in the history
[hotfix] Fixed issue with getting version from package.json
  • Loading branch information
neogeek authored May 7, 2024
2 parents 11bce6f + f14f984 commit 8db98ab
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 15 deletions.
19 changes: 4 additions & 15 deletions bin/index.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@
#!/usr/bin/env node

import { readFile } from 'node:fs/promises';
import { dirname, join } from 'node:path';
import { fileURLToPath } from 'node:url';
#!/usr/bin/env node --no-warnings

import 'dotenv/config';

Expand All @@ -13,21 +9,14 @@ import parseCmdArgs from 'parse-cmd-args';
import { buildFiles } from '../src/build.js';
import { copyFiles } from '../src/copy.js';

import pkg from '../package.json' assert { type: 'json' };

const args = parseCmdArgs(null, {
requireUserInput: false
});

if (args.flags['--version'] || args.flags['-v']) {
process.stdout.write(
`${
JSON.parse(
await readFile(
join(dirname(fileURLToPath(import.meta.url)), '../package.json'),
'utf8'
)
).version
}\n`
);
process.stdout.write(`${pkg.version}\n`);
process.exit();
} else if (args.flags['--help'] || args.flags['-h']) {
process.stdout.write(`Usage: onlybuild <path> [options]
Expand Down
1 change: 1 addition & 0 deletions tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"module": "NodeNext",
"esModuleInterop": true,
"moduleResolution": "NodeNext",
"resolveJsonModule": true,
"declaration": true,
"outDir": "./dist",
"strict": true
Expand Down

0 comments on commit 8db98ab

Please sign in to comment.