File tree Expand file tree Collapse file tree 4 files changed +38
-0
lines changed Expand file tree Collapse file tree 4 files changed +38
-0
lines changed Original file line number Diff line number Diff line change @@ -32,3 +32,4 @@ user-code/
32
32
# Logs from scripts
33
33
script /logs /
34
34
external-link-checker-db.json
35
+ .installed.package-lock.json
Original file line number Diff line number Diff line change 1
1
# skip installing optional dependencies to avoid issues with troublesome `fsevents` module
2
2
omit = optional
3
+
4
+ # For 15-25% faster npm install
5
+ # https://www.peterbe.com/plog/benchmarking-npm-install-with-or-without-audit
6
+ # Also we have Dependabot alerts configured in the GitHub repo.
7
+ audit = false
Original file line number Diff line number Diff line change 198
198
"prevent-pushes-to-main" : " node script/prevent-pushes-to-main.js" ,
199
199
"rest-dev" : " src/rest/scripts/update-files.js" ,
200
200
"show-action-deps" : " echo 'Action Dependencies:' && rg '^[\\ s|-]*(uses:.*)$' .github -I -N --no-heading -r '$1$2' | sort | uniq | cut -c 7-" ,
201
+ "prestart" : " script/cmp-files.js package-lock.json .installed.package-lock.json || npm install && cp package-lock.json .installed.package-lock.json" ,
201
202
"start" : " cross-env NODE_ENV=development ENABLED_LANGUAGES=en nodemon server.js" ,
202
203
"start-all-languages" : " cross-env NODE_ENV=development nodemon server.js" ,
203
204
"sync-search" : " cross-env NODE_OPTIONS='--max_old_space_size=8192' start-server-and-test sync-search-server 4002 sync-search-indices" ,
Original file line number Diff line number Diff line change
1
+ #!/usr/bin/env node
2
+
3
+ // [start-readme]
4
+ //
5
+ // Given N files. Exit 0 if they all exist and are identical in content.
6
+ //
7
+ // [end-readme]
8
+
9
+ import fs from 'fs'
10
+
11
+ import { program } from 'commander'
12
+
13
+ program . description ( 'Compare N files' ) . arguments ( '[files...]' , '' ) . parse ( process . argv )
14
+
15
+ main ( program . args )
16
+
17
+ function main ( files ) {
18
+ if ( files . length < 2 ) throw new Error ( 'Must be at least 2 files' )
19
+ try {
20
+ const contents = files . map ( ( file ) => fs . readFileSync ( file , 'utf-8' ) )
21
+ if ( new Set ( contents ) . size > 1 ) {
22
+ process . exit ( 1 )
23
+ }
24
+ } catch ( error ) {
25
+ if ( error . code === 'ENOENT' ) {
26
+ process . exit ( 1 )
27
+ } else {
28
+ throw error
29
+ }
30
+ }
31
+ }
You can’t perform that action at this time.
0 commit comments