Skip to content

Commit 2a95315

Browse files
committed
fix(nano-build): Add check for package.json existence
1 parent bf215b6 commit 2a95315

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

packages/nano-build/nano-build.cjs

+6
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
11
const {context, build} = require('esbuild');
22
const {resolve} = require('path');
3+
const {existsSync} = require('fs');
4+
35
const packageJsonPath = resolve(process.cwd(), 'package.json');
6+
if (existsSync(packageJsonPath) === false) {
7+
console.error('package.json not found', {path: packageJsonPath});
8+
process.exit(1);
9+
}
410
const packageJson = require(packageJsonPath);
511

612
console.log('🚀 nano-build');

0 commit comments

Comments
 (0)