diff --git a/lib/fabricator.ts b/lib/fabricator.ts index dad06ace8..8f9451a79 100644 --- a/lib/fabricator.ts +++ b/lib/fabricator.ts @@ -41,8 +41,10 @@ const script = ` process.stdin.resume(); `; -const children: Record> = - {}; +const children: Record< + string, + ChildProcessByStdio +> = {}; export function fabricate( bakes: string[], diff --git a/lib/index.ts b/lib/index.ts index a95dfbc0e..624ccac20 100644 --- a/lib/index.ts +++ b/lib/index.ts @@ -540,7 +540,7 @@ export async function exec(argv2: string[]) { const { bytecode } = argv; - const nativeBuild = argv['native-build'] + const nativeBuild = argv['native-build']; for (const target of targets) { target.forceBuild = forceBuild; @@ -678,7 +678,7 @@ export async function exec(argv2: string[]) { target: target as Target, symLinks, doCompress, - nativeBuild + nativeBuild, }); if (target.platform !== 'win' && target.output) { diff --git a/package.json b/package.json index 98369077c..debd59251 100644 --- a/package.json +++ b/package.json @@ -71,8 +71,10 @@ "clean": "rimraf lib-es5", "build": "npm run clean && tsc", "start": "tsc --watch", - "lint": "eslint lib prelude test", - "lint:fix": "npm run lint -- --fix", + "lint": "npm run lint:style && npm run lint:code", + "lint:style": "prettier -c \"{lib,prelude,test}/**/*.{ts,js}\"", + "lint:code": "eslint lib prelude test", + "fix": "npm run lint:style -- -w && npm run lint:code -- --fix", "prepare": "npm run build", "prepublishOnly": "npm run lint", "test": "npm run build && node test/test.js node14 no-npm && node test/test.js node12 no-npm && node test/test.js node10 no-npm && node test/test.js host only-npm" diff --git a/test/test-46-input-package-json-outputdir/main.js b/test/test-46-input-package-json-outputdir/main.js index 08575ff83..b105169d0 100644 --- a/test/test-46-input-package-json-outputdir/main.js +++ b/test/test-46-input-package-json-outputdir/main.js @@ -13,14 +13,12 @@ const input = '.'; const newcomers = [ 'out/palookaville-linux', 'out/palookaville-macos', - 'out/palookaville-win.exe' + 'out/palookaville-win.exe', ]; const before = utils.filesBefore(newcomers); -utils.pkg.sync([ - input -], { stdio: 'inherit' }); +utils.pkg.sync([input], { stdio: 'inherit' }); utils.filesAfter(before, newcomers); utils.vacuum.sync('out'); diff --git a/test/test-50-signature/main.js b/test/test-50-signature/main.js index 5de2d5ee6..adde7c286 100644 --- a/test/test-50-signature/main.js +++ b/test/test-50-signature/main.js @@ -22,117 +22,16 @@ let spoiler = fs.readFileSync(output); spoiler = Buffer.concat([ spoiler, Buffer.from([ - 0x01, - 0x12, - 0x23, - 0x34, - 0x45, - 0x56, - 0x67, - 0x78, - 0x89, - 0x9a, - 0xab, - 0xbc, - 0xcd, - 0xde, - 0xef, - 0xfe, - 0x01, - 0x12, - 0x23, - 0x34, - 0x45, - 0x56, - 0x67, - 0x78, - 0x89, - 0x9a, - 0xab, - 0xbc, - 0xcd, - 0xde, - 0xef, - 0xfe, - 0x01, - 0x12, - 0x23, - 0x34, - 0x45, - 0x56, - 0x67, - 0x78, - 0x89, - 0x9a, - 0xab, - 0xbc, - 0xcd, - 0xde, - 0xef, - 0xfe, - 0x01, - 0x12, - 0x23, - 0x34, - 0x45, - 0x56, - 0x67, - 0x78, - 0x89, - 0x9a, - 0xab, - 0xbc, - 0xcd, - 0xde, - 0xef, - 0xfe, - 0x01, - 0x12, - 0x23, - 0x34, - 0x45, - 0x56, - 0x67, - 0x78, - 0x89, - 0x9a, - 0xab, - 0xbc, - 0xcd, - 0xde, - 0xef, - 0xfe, - 0x01, - 0x12, - 0x23, - 0x34, - 0x45, - 0x56, - 0x67, - 0x78, - 0x89, - 0x9a, - 0xab, - 0xbc, - 0xcd, - 0xde, - 0xef, - 0xfe, - 0x01, - 0x12, - 0x23, - 0x34, - 0x45, - 0x56, - 0x67, - 0x78, - 0x89, - 0x9a, - 0xab, - 0xbc, - 0xcd, - 0xde, - 0xef, + 0x01, 0x12, 0x23, 0x34, 0x45, 0x56, 0x67, 0x78, 0x89, 0x9a, 0xab, 0xbc, + 0xcd, 0xde, 0xef, 0xfe, 0x01, 0x12, 0x23, 0x34, 0x45, 0x56, 0x67, 0x78, + 0x89, 0x9a, 0xab, 0xbc, 0xcd, 0xde, 0xef, 0xfe, 0x01, 0x12, 0x23, 0x34, + 0x45, 0x56, 0x67, 0x78, 0x89, 0x9a, 0xab, 0xbc, 0xcd, 0xde, 0xef, 0xfe, + 0x01, 0x12, 0x23, 0x34, 0x45, 0x56, 0x67, 0x78, 0x89, 0x9a, 0xab, 0xbc, + 0xcd, 0xde, 0xef, 0xfe, 0x01, 0x12, 0x23, 0x34, 0x45, 0x56, 0x67, 0x78, + 0x89, 0x9a, 0xab, 0xbc, 0xcd, 0xde, 0xef, 0xfe, 0x01, 0x12, 0x23, 0x34, + 0x45, 0x56, 0x67, 0x78, 0x89, 0x9a, 0xab, 0xbc, 0xcd, 0xde, 0xef, 0xfe, + 0x01, 0x12, 0x23, 0x34, 0x45, 0x56, 0x67, 0x78, 0x89, 0x9a, 0xab, 0xbc, + 0xcd, 0xde, 0xef, ]), ]); fs.writeFileSync(output, spoiler); diff --git a/test/test-79-npm/node-notifier/node-notifier.js b/test/test-79-npm/node-notifier/node-notifier.js index 71a262ffe..c39c1b42a 100644 --- a/test/test-79-npm/node-notifier/node-notifier.js +++ b/test/test-79-npm/node-notifier/node-notifier.js @@ -6,16 +6,17 @@ var notifier = require('node-notifier'); var utils = require('node-notifier/lib/utils.js'); var whichArgument; -utils.command = utils.fileCommandJson = utils.immediateFileCommand = function ( - filename -) { - var forLinux = filename === whichArgument; // 'notify-send' is built-in on linux - var forNonLinux = fs.existsSync(filename) && path.isAbsolute(filename); - if ((forLinux || forNonLinux) && filename.indexOf('snapshot') < 0) { - console.log('ok'); - } - process.exit(); -}; +utils.command = + utils.fileCommandJson = + utils.immediateFileCommand = + function (filename) { + var forLinux = filename === whichArgument; // 'notify-send' is built-in on linux + var forNonLinux = fs.existsSync(filename) && path.isAbsolute(filename); + if ((forLinux || forNonLinux) && filename.indexOf('snapshot') < 0) { + console.log('ok'); + } + process.exit(); + }; var which = require('which'); which.sync = function (filename) { diff --git a/test/utils.js b/test/utils.js index 227db6cab..969744720 100644 --- a/test/utils.js +++ b/test/utils.js @@ -171,10 +171,15 @@ module.exports.shouldSkipPnpm = function () { const REQUIRED_MINOR_VERSION = 19; const MAJOR_VERSION = parseInt(process.version.match(/v([0-9]+)/)[1], 10); - const MINOR_VERSION = parseInt(process.version.match(/v[0-9]+\.([0-9]+)/)[1], 10); - - const isDisallowedMajor = MAJOR_VERSION < REQUIRED_MAJOR_VERSION - const isDisallowedMinor = MAJOR_VERSION === REQUIRED_MAJOR_VERSION && MINOR_VERSION < REQUIRED_MINOR_VERSION; + const MINOR_VERSION = parseInt( + process.version.match(/v[0-9]+\.([0-9]+)/)[1], + 10 + ); + + const isDisallowedMajor = MAJOR_VERSION < REQUIRED_MAJOR_VERSION; + const isDisallowedMinor = + MAJOR_VERSION === REQUIRED_MAJOR_VERSION && + MINOR_VERSION < REQUIRED_MINOR_VERSION; if (isDisallowedMajor || isDisallowedMinor) { const need = `${REQUIRED_MAJOR_VERSION}.${REQUIRED_MINOR_VERSION}`; const got = `${MAJOR_VERSION}.${MINOR_VERSION}`; @@ -183,4 +188,4 @@ module.exports.shouldSkipPnpm = function () { } return false; -} +};