11"use strict" ;
22
3+ // Disabling promise ESLint rules because we can't use async/await here
4+ // before all supported Node versions support it.
5+ /* eslint-disable promise/always-return, promise/prefer-await-to-callbacks */
6+
37const os = require ( "os" ) ;
48const fs = require ( "fs" ) ;
59const path = require ( "path" ) ;
@@ -38,7 +42,7 @@ const tries = [
3842 } ,
3943] ;
4044
41- process . stderr . write ( `Downloading public suffix list from ${ PUBLIC_SUFFIX_URL } ... ` ) ;
45+ process . stderr . write ( `Downloading public suffix list from ${ PUBLIC_SUFFIX_URL } ... ` ) ;
4246
4347got ( PUBLIC_SUFFIX_URL )
4448 . then ( res => {
@@ -61,24 +65,25 @@ got(PUBLIC_SUFFIX_URL)
6165 } ;
6266 } )
6367 . forEach ( file => {
64- process . stderr . write ( `Writing ${ file . path } ... ` ) ;
68+ process . stderr . write ( `Writing ${ file . path } ... ` ) ;
6569 mkdirp . sync ( path . dirname ( file . path ) ) ;
6670 fs . writeFileSync ( file . path , file . content , "utf8" ) ;
6771 process . stderr . write ( "ok" + os . EOL ) ;
6872 } )
6973 )
7074 . then ( ( ) => {
7175 process . stderr . write ( "Running sanity check... " ) ;
72- childProcess . spawnSync ( "mocha -R dot" , {
76+
77+ childProcess . execFileSync ( process . execPath , [ require . resolve ( "mocha/bin/_mocha" ) , "-R" , "dot" ] , {
7378 cwd : rootPath ,
7479 encoding : "utf8" ,
75- stdio : "ignore" ,
7680 } ) ;
81+
7782 process . stderr . write ( "ok" + os . EOL ) ;
7883 } )
7984 . catch ( err => {
8085 console . error ( "" ) ;
81- console . error ( " Could not update list of known top-level domains for parse-domain because of " + err . message ) ;
86+ console . error ( ` Could not update list of known top-level domains for parse-domain because of "${ err . message } "` ) ;
8287
8388 const prebuiltList = JSON . parse ( fs . readFileSync ( path . resolve ( triesPath , tries [ 0 ] . filename ) , "utf8" ) ) ;
8489
0 commit comments