From 6ecd52a2d29dcdd510e60f1108c467da68cfff6d Mon Sep 17 00:00:00 2001 From: Jesse Chan Date: Sat, 10 Apr 2021 13:30:08 +0800 Subject: [PATCH] Drop references to Node < 8 --- README.md | 12 ++++---- lib/help.ts | 4 +-- test/test-42-fetch-all/main.js | 7 ++--- test/test-50-reject-4/main.js | 40 -------------------------- test/test-50-reject-4/test-x-index.js | 7 ----- test/test-50-reject-4/test-x-warmup.js | 3 -- test/test-50-reject-6/main.js | 40 -------------------------- test/test-50-reject-6/test-x-index.js | 11 ------- test/test-50-reject-6/test-x-warmup.js | 3 -- 9 files changed, 10 insertions(+), 117 deletions(-) delete mode 100644 test/test-50-reject-4/main.js delete mode 100644 test/test-50-reject-4/test-x-index.js delete mode 100644 test/test-50-reject-4/test-x-warmup.js delete mode 100644 test/test-50-reject-6/main.js delete mode 100644 test/test-50-reject-6/test-x-index.js delete mode 100644 test/test-50-reject-6/test-x-warmup.js diff --git a/README.md b/README.md index 567e4c3cf..741dc877f 100644 --- a/README.md +++ b/README.md @@ -42,13 +42,13 @@ The entrypoint of your project is a mandatory CLI argument. It may be: `pkg` can generate executables for several target machines at a time. You can specify a comma-separated list of targets via `--targets` option. A canonical target consists of 3 elements, separated by -dashes, for example `node6-macos-x64` or `node4-linux-armv6`: +dashes, for example `node12-macos-x64` or `node14-linux-arm64`: - **nodeRange** node${n} or latest -- **platform** freebsd, linux, alpine, macos, win -- **arch** x64, x86, armv6, armv7 +- **platform** linux, win, macos, (freebsd, alpine) +- **arch** x64, arm64, (armv6, armv7) -You may omit any element (and specify just `node6` for example). +You may omit any element (and specify just `node14` for example). The omitted elements will be taken from current platform or system-wide Node.js installation (its version and arch). There is also an alias `host`, that means that all 3 elements @@ -79,13 +79,13 @@ your `package.json` file. "pkg": { "scripts": "build/**/*.js", "assets": "views/**/*", - "targets": [ "node4-linux-armv6" ], + "targets": [ "node14-linux-arm64" ], "outputPath": "dist" } ``` The above example will include everything in `assets/` and -every .js file in `build/`, build only for `node4-linux-armv6`, +every .js file in `build/`, build only for `node14-linux-arm64`, and place the executable inside `dist/`. You may also specify arrays of globs: diff --git a/lib/help.ts b/lib/help.ts index 6a18fc017..059996b1f 100644 --- a/lib/help.ts +++ b/lib/help.ts @@ -25,9 +25,9 @@ export default function help() { ${chalk.gray('–')} Takes package.json from cwd and follows 'bin' entry ${chalk.cyan('$ pkg .')} ${chalk.gray('–')} Makes executable for particular target machine - ${chalk.cyan('$ pkg -t node6-alpine-x64 index.js')} + ${chalk.cyan('$ pkg -t node14-win-arm64 index.js')} ${chalk.gray('–')} Makes executables for target machines of your choice - ${chalk.cyan('$ pkg -t node4-linux,node6-linux,node6-win index.js')} + ${chalk.cyan('$ pkg -t node12-linux,node14-linux,node14-win index.js')} ${chalk.gray('–')} Bakes '--expose-gc' into executable ${chalk.cyan('$ pkg --options expose-gc index.js')} `); diff --git a/test/test-42-fetch-all/main.js b/test/test-42-fetch-all/main.js index 087553afb..e965be790 100644 --- a/test/test-42-fetch-all/main.js +++ b/test/test-42-fetch-all/main.js @@ -15,15 +15,12 @@ function nodeRangeToNodeVersion(nodeRange) { for (const platform of knownPlatforms) { const nodeRanges = ['node8', 'node10', 'node12']; - if (platform === 'linux' || platform === 'alpine') - nodeRanges.unshift('node6'); - if (platform === 'linux') nodeRanges.unshift('node4'); for (const nodeRange of nodeRanges) { const nodeVersion = nodeRangeToNodeVersion(nodeRange); const archs = ['x64']; if (platform === 'win') archs.unshift('x86'); - if (platform === 'linux') archs.push('armv7'); - // linux-armv7 is needed in multi-arch tests, + if (platform === 'linux') archs.push('arm64'); + // linux-arm64 is needed in multi-arch tests, // so keeping it here as obligatory. but let's // leave compiling for freebsd to end users if (platform === 'freebsd') continue; diff --git a/test/test-50-reject-4/main.js b/test/test-50-reject-4/main.js deleted file mode 100644 index ffd6640ea..000000000 --- a/test/test-50-reject-4/main.js +++ /dev/null @@ -1,40 +0,0 @@ -#!/usr/bin/env node - -'use strict'; - -const path = require('path'); -const assert = require('assert'); -const utils = require('../utils.js'); - -assert(!module.parent); -assert(__dirname === process.cwd()); - -// only linux has node4 -if (process.platform !== 'linux') return; - -const target = 'node4'; -const inputs = { index: './test-x-index.js', warmup: './test-x-warmup.js' }; -const output = './run-time/test-output.exe'; - -utils.mkdirp.sync(path.dirname(output)); - -utils.pkg.sync( - [ - '--target', - target, - '--output', - output, - inputs.warmup, // fetch this particular node version - ], - { stdio: ['inherit', 'inherit', 'pipe'] } -); - -let right = utils.pkg.sync( - ['--target', target, '--output', output, inputs.index], - { stdio: 'pipe' } -); - -assert(right.stdout.indexOf('\x1B\x5B') < 0, 'colors detected'); -assert(right.stdout.indexOf('Warning') >= 0); -assert(right.stdout.indexOf(target) >= 0); -utils.vacuum.sync(path.dirname(output)); diff --git a/test/test-50-reject-4/test-x-index.js b/test/test-50-reject-4/test-x-index.js deleted file mode 100644 index af9d3396a..000000000 --- a/test/test-50-reject-4/test-x-index.js +++ /dev/null @@ -1,7 +0,0 @@ -'use strict'; - -function multiply(a, b = 1) { - return a * b; -} - -console.log(multiply(5)); diff --git a/test/test-50-reject-4/test-x-warmup.js b/test/test-50-reject-4/test-x-warmup.js deleted file mode 100644 index e73c91425..000000000 --- a/test/test-50-reject-4/test-x-warmup.js +++ /dev/null @@ -1,3 +0,0 @@ -'use strict'; - -console.log(5); diff --git a/test/test-50-reject-6/main.js b/test/test-50-reject-6/main.js deleted file mode 100644 index ddff4e139..000000000 --- a/test/test-50-reject-6/main.js +++ /dev/null @@ -1,40 +0,0 @@ -#!/usr/bin/env node - -'use strict'; - -const path = require('path'); -const assert = require('assert'); -const utils = require('../utils.js'); - -assert(!module.parent); -assert(__dirname === process.cwd()); - -// only linux and alpine have node6 -if (process.platform !== 'linux' && process.platform !== 'alpine') return; - -const target = 'node6'; -const inputs = { index: './test-x-index.js', warmup: './test-x-warmup.js' }; -const output = './run-time/test-output.exe'; - -utils.mkdirp.sync(path.dirname(output)); - -utils.pkg.sync( - [ - '--target', - target, - '--output', - output, - inputs.warmup, // fetch this particular node version - ], - { stdio: ['inherit', 'inherit', 'pipe'] } -); - -let right = utils.pkg.sync( - ['--target', target, '--output', output, inputs.index], - { stdio: 'pipe' } -); - -assert(right.stdout.indexOf('\x1B\x5B') < 0, 'colors detected'); -assert(right.stdout.indexOf('Warning') >= 0); -assert(right.stdout.indexOf(target) >= 0); -utils.vacuum.sync(path.dirname(output)); diff --git a/test/test-50-reject-6/test-x-index.js b/test/test-50-reject-6/test-x-index.js deleted file mode 100644 index 799b5f26f..000000000 --- a/test/test-50-reject-6/test-x-index.js +++ /dev/null @@ -1,11 +0,0 @@ -/* eslint-disable require-await */ - -'use strict'; - -async function multiply(a, b = 1) { - return a * b; -} - -multiply(5).then((result) => { - console.log(result); -}); diff --git a/test/test-50-reject-6/test-x-warmup.js b/test/test-50-reject-6/test-x-warmup.js deleted file mode 100644 index e73c91425..000000000 --- a/test/test-50-reject-6/test-x-warmup.js +++ /dev/null @@ -1,3 +0,0 @@ -'use strict'; - -console.log(5);