forked from github/docs
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Automatically run npm install when running npm start (github#35283)
Co-authored-by: Robert Sese <734194+rsese@users.noreply.github.com>
- Loading branch information
Showing
4 changed files
with
38 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -32,3 +32,4 @@ user-code/ | |
# Logs from scripts | ||
script/logs/ | ||
external-link-checker-db.json | ||
.installed.package-lock.json |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,7 @@ | ||
# skip installing optional dependencies to avoid issues with troublesome `fsevents` module | ||
omit=optional | ||
|
||
# For 15-25% faster npm install | ||
# https://www.peterbe.com/plog/benchmarking-npm-install-with-or-without-audit | ||
# Also we have Dependabot alerts configured in the GitHub repo. | ||
audit=false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
#!/usr/bin/env node | ||
|
||
// [start-readme] | ||
// | ||
// Given N files. Exit 0 if they all exist and are identical in content. | ||
// | ||
// [end-readme] | ||
|
||
import fs from 'fs' | ||
|
||
import { program } from 'commander' | ||
|
||
program.description('Compare N files').arguments('[files...]', '').parse(process.argv) | ||
|
||
main(program.args) | ||
|
||
function main(files) { | ||
if (files.length < 2) throw new Error('Must be at least 2 files') | ||
try { | ||
const contents = files.map((file) => fs.readFileSync(file, 'utf-8')) | ||
if (new Set(contents).size > 1) { | ||
process.exit(1) | ||
} | ||
} catch (error) { | ||
if (error.code === 'ENOENT') { | ||
process.exit(1) | ||
} else { | ||
throw error | ||
} | ||
} | ||
} |