diff --git a/.travis.yml b/.travis.yml index 0209611..e6dc057 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,4 +1,3 @@ import: - - source: hapipal/ci-config-travis:os_all.yml@master - - source: hapipal/ci-config-travis:node_js.yml@master - - source: hapipal/ci-config-travis:hapi_all.yml@master + - source: hapipal/ci-config-travis:node_js.yml@node-v16-min + - source: hapipal/ci-config-travis:hapi_all.yml@node-v16-min \ No newline at end of file diff --git a/README.md b/README.md index a215c30..d525839 100644 --- a/README.md +++ b/README.md @@ -27,7 +27,7 @@ npx @hapipal/hpal docs --ver 20.0.0 h.response ``` ## Usage -> The hpal CLI is intended for use with hapi v19+ and nodejs v12+ (_see v2 for lower support_). +> The hpal CLI is intended for use with hapi v20+ and nodejs v16+ (_see v3 for lower support_). ``` Usage: hpal diff --git a/lib/commands/new.js b/lib/commands/new.js index a49c173..8f08ec1 100644 --- a/lib/commands/new.js +++ b/lib/commands/new.js @@ -149,17 +149,16 @@ internals.npmInit = (cwd, ctx) => { data = data.toString(); - if (data.toLowerCase().includes('is this ok?')) { - ctx.options.in.once('data', () => subproc.stdin.end()); + // npm init exits with code 0 if aborted in npm v9, so we + // must explicitly check for abort here. + if (data.toLowerCase().includes('aborted')) { + return reject(new Error(`Init aborted`)); } }); - subproc.once('close', (code) => { - - if (code !== 0) { - return reject(new Error(`Failed with code: ${code}`)); - } + subproc.once('close', (code, signal) => { + subproc.stdin.end(); return resolve(); }); }); diff --git a/package.json b/package.json index 05ebddc..f2d94d5 100644 --- a/package.json +++ b/package.json @@ -4,7 +4,7 @@ "description": "hapi pal CLI", "main": "lib/index.js", "engines": { - "node": ">=12" + "node": ">=16" }, "directories": { "test": "test" @@ -44,8 +44,8 @@ "@hapipal/toys": "3.x.x", "bin-v8-flags-filter": ">=1.2.0 <2", "glob": "7.x.x", - "marked": "1.x.x", - "marked-terminal": "4.x.x", + "marked": "4.0.16", + "marked-terminal": "^5.1.0", "mkdirp": "1.x.x", "mo-walk": ">=1.1.0 <2", "pkg-dir": "5.x.x", @@ -68,7 +68,7 @@ "@hapi/boom": "9.x.x", "@hapi/code": "8.x.x", "@hapi/hapi": "20.x.x", - "@hapi/lab": "24.x.x", + "@hapi/lab": "25.x.x", "@hapipal/haute-couture": "4.x.x", "@types/hapi__hapi": "20.x.x", "coveralls": "3.x.x", diff --git a/test/index.js b/test/index.js index 12b248c..37f126b 100644 --- a/test/index.js +++ b/test/index.js @@ -1011,7 +1011,7 @@ describe('hpal', () => { return { calls, cleanup }; }; - const normalizeVersion = (str) => str.replace(/(19|20)\.[\d]+\.[\d]+/g, '20.x.x'); + const normalizeVersion = (str) => str.replace(/(19|20|21)\.[\d]+\.[\d]+/g, '20.x.x'); it('errors when fetching docs 404s.', async (flags) => { @@ -1090,7 +1090,8 @@ describe('hpal', () => { expect(err).to.be.instanceof(Error); expect(err).to.not.be.instanceof(DisplayError); - expect(err.message).to.contain('Cannot read property \'version\' of null'); + expect(err.message).to.contain('Cannot read properties of null (reading \'version\')'); + }); it('errors when can\'t find a manifest for an unknown reason.', async (flags) => {