Skip to content

Commit

Permalink
fix: init config aliases
Browse files Browse the repository at this point in the history
The `init-*` family of config properties should also support
dot-separated aliases defined in a npmrc ini file.

relates to: npm/init-package-json@c0ace81
  • Loading branch information
ruyadorno authored and darcyclarke committed Oct 12, 2020
1 parent 60769d7 commit 1de21dc
Show file tree
Hide file tree
Showing 2 changed files with 57 additions and 0 deletions.
12 changes: 12 additions & 0 deletions lib/utils/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,12 @@ const defaults = {
'init-license': 'ISC',
'init-module': '~/.npm-init.js',
'init-version': '1.0.0',
'init.author.email': '',
'init.author.name': '',
'init.author.url': '',
'init.license': 'ISC',
'init.module': '~/.npm-init.js',
'init.version': '1.0.0',
json: false,
key: null,
'legacy-bundling': false,
Expand Down Expand Up @@ -238,6 +244,12 @@ const types = {
'init-license': String,
'init-module': path,
'init-version': semver,
'init.author.email': String,
'init.author.name': String,
'init.author.url': ['', url],
'init.license': String,
'init.module': path,
'init.version': semver,
json: Boolean,
key: [null, String],
'legacy-bundling': Boolean,
Expand Down
45 changes: 45 additions & 0 deletions tap-snapshots/test-lib-utils-config.js-TAP.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,12 @@ Object {
"init-license": "ISC",
"init-module": "~/.npm-init.js",
"init-version": "1.0.0",
"init.author.email": "",
"init.author.name": "",
"init.author.url": "",
"init.license": "ISC",
"init.module": "~/.npm-init.js",
"init.version": "1.0.0",
"json": false,
"key": null,
"legacy-bundling": false,
Expand Down Expand Up @@ -377,6 +383,15 @@ Object {
"init-license": "{String TYPE}",
"init-module": "{PATH MODULE}",
"init-version": "{SEMVER MODULE}",
"init.author.email": "{String TYPE}",
"init.author.name": "{String TYPE}",
"init.author.url": Array [
"",
"{URL MODULE}",
],
"init.license": "{String TYPE}",
"init.module": "{PATH MODULE}",
"init.version": "{SEMVER MODULE}",
"json": "{Boolean TYPE}",
"key": Array [
null,
Expand Down Expand Up @@ -578,6 +593,12 @@ Object {
"init-license": "ISC",
"init-module": "~/.npm-init.js",
"init-version": "1.0.0",
"init.author.email": "",
"init.author.name": "",
"init.author.url": "",
"init.license": "ISC",
"init.module": "~/.npm-init.js",
"init.version": "1.0.0",
"json": false,
"key": null,
"legacy-bundling": false,
Expand Down Expand Up @@ -891,6 +912,15 @@ Object {
"init-license": "{String TYPE}",
"init-module": "{PATH MODULE}",
"init-version": "{SEMVER MODULE}",
"init.author.email": "{String TYPE}",
"init.author.name": "{String TYPE}",
"init.author.url": Array [
"",
"{URL MODULE}",
],
"init.license": "{String TYPE}",
"init.module": "{PATH MODULE}",
"init.version": "{SEMVER MODULE}",
"json": "{Boolean TYPE}",
"key": Array [
null,
Expand Down Expand Up @@ -1092,6 +1122,12 @@ Object {
"init-license": "ISC",
"init-module": "~/.npm-init.js",
"init-version": "1.0.0",
"init.author.email": "",
"init.author.name": "",
"init.author.url": "",
"init.license": "ISC",
"init.module": "~/.npm-init.js",
"init.version": "1.0.0",
"json": false,
"key": null,
"legacy-bundling": false,
Expand Down Expand Up @@ -1405,6 +1441,15 @@ Object {
"init-license": "{String TYPE}",
"init-module": "{PATH MODULE}",
"init-version": "{SEMVER MODULE}",
"init.author.email": "{String TYPE}",
"init.author.name": "{String TYPE}",
"init.author.url": Array [
"",
"{URL MODULE}",
],
"init.license": "{String TYPE}",
"init.module": "{PATH MODULE}",
"init.version": "{SEMVER MODULE}",
"json": "{Boolean TYPE}",
"key": Array [
null,
Expand Down

0 comments on commit 1de21dc

Please sign in to comment.