Skip to content

Commit c3b630a

Browse files
committed
Try replacing sh.cat with native file reading
See if such replacement works well on a Windows machine.
1 parent e1a96fa commit c3b630a

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

scripts/smoke-test-npm-scripts.js

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,18 @@ program.parse(process.argv)
2626

2727
const main = () => {
2828
const opts = program.opts()
29-
3029
const cwd = path.resolve(opts.dir)
3130

32-
const pkg = JSON.parse(sh.cat(path.join(cwd, 'package.json')))
31+
let pkg
32+
const packageJson = path.join(cwd, 'package.json')
33+
34+
try {
35+
pkg = JSON.parse(fs.readFileSync(packageJson))
36+
} catch (err) {
37+
console.error(`Error reading or parsing ${packageJson}:`)
38+
console.error(err)
39+
sh.exit(1)
40+
}
3341

3442
// The excluded scripts are either already part of our CI steps or are not safe to run.
3543
const exclude = [

0 commit comments

Comments
 (0)