Skip to content

Commit 1de21dc

Browse files
ruyadornodarcyclarke
authored andcommitted
fix: init config aliases
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
1 parent 60769d7 commit 1de21dc

File tree

2 files changed

+57
-0
lines changed

2 files changed

+57
-0
lines changed

lib/utils/config.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,12 @@ const defaults = {
102102
'init-license': 'ISC',
103103
'init-module': '~/.npm-init.js',
104104
'init-version': '1.0.0',
105+
'init.author.email': '',
106+
'init.author.name': '',
107+
'init.author.url': '',
108+
'init.license': 'ISC',
109+
'init.module': '~/.npm-init.js',
110+
'init.version': '1.0.0',
105111
json: false,
106112
key: null,
107113
'legacy-bundling': false,
@@ -238,6 +244,12 @@ const types = {
238244
'init-license': String,
239245
'init-module': path,
240246
'init-version': semver,
247+
'init.author.email': String,
248+
'init.author.name': String,
249+
'init.author.url': ['', url],
250+
'init.license': String,
251+
'init.module': path,
252+
'init.version': semver,
241253
json: Boolean,
242254
key: [null, String],
243255
'legacy-bundling': Boolean,

tap-snapshots/test-lib-utils-config.js-TAP.test.js

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,12 @@ Object {
6464
"init-license": "ISC",
6565
"init-module": "~/.npm-init.js",
6666
"init-version": "1.0.0",
67+
"init.author.email": "",
68+
"init.author.name": "",
69+
"init.author.url": "",
70+
"init.license": "ISC",
71+
"init.module": "~/.npm-init.js",
72+
"init.version": "1.0.0",
6773
"json": false,
6874
"key": null,
6975
"legacy-bundling": false,
@@ -377,6 +383,15 @@ Object {
377383
"init-license": "{String TYPE}",
378384
"init-module": "{PATH MODULE}",
379385
"init-version": "{SEMVER MODULE}",
386+
"init.author.email": "{String TYPE}",
387+
"init.author.name": "{String TYPE}",
388+
"init.author.url": Array [
389+
"",
390+
"{URL MODULE}",
391+
],
392+
"init.license": "{String TYPE}",
393+
"init.module": "{PATH MODULE}",
394+
"init.version": "{SEMVER MODULE}",
380395
"json": "{Boolean TYPE}",
381396
"key": Array [
382397
null,
@@ -578,6 +593,12 @@ Object {
578593
"init-license": "ISC",
579594
"init-module": "~/.npm-init.js",
580595
"init-version": "1.0.0",
596+
"init.author.email": "",
597+
"init.author.name": "",
598+
"init.author.url": "",
599+
"init.license": "ISC",
600+
"init.module": "~/.npm-init.js",
601+
"init.version": "1.0.0",
581602
"json": false,
582603
"key": null,
583604
"legacy-bundling": false,
@@ -891,6 +912,15 @@ Object {
891912
"init-license": "{String TYPE}",
892913
"init-module": "{PATH MODULE}",
893914
"init-version": "{SEMVER MODULE}",
915+
"init.author.email": "{String TYPE}",
916+
"init.author.name": "{String TYPE}",
917+
"init.author.url": Array [
918+
"",
919+
"{URL MODULE}",
920+
],
921+
"init.license": "{String TYPE}",
922+
"init.module": "{PATH MODULE}",
923+
"init.version": "{SEMVER MODULE}",
894924
"json": "{Boolean TYPE}",
895925
"key": Array [
896926
null,
@@ -1092,6 +1122,12 @@ Object {
10921122
"init-license": "ISC",
10931123
"init-module": "~/.npm-init.js",
10941124
"init-version": "1.0.0",
1125+
"init.author.email": "",
1126+
"init.author.name": "",
1127+
"init.author.url": "",
1128+
"init.license": "ISC",
1129+
"init.module": "~/.npm-init.js",
1130+
"init.version": "1.0.0",
10951131
"json": false,
10961132
"key": null,
10971133
"legacy-bundling": false,
@@ -1405,6 +1441,15 @@ Object {
14051441
"init-license": "{String TYPE}",
14061442
"init-module": "{PATH MODULE}",
14071443
"init-version": "{SEMVER MODULE}",
1444+
"init.author.email": "{String TYPE}",
1445+
"init.author.name": "{String TYPE}",
1446+
"init.author.url": Array [
1447+
"",
1448+
"{URL MODULE}",
1449+
],
1450+
"init.license": "{String TYPE}",
1451+
"init.module": "{PATH MODULE}",
1452+
"init.version": "{SEMVER MODULE}",
14081453
"json": "{Boolean TYPE}",
14091454
"key": Array [
14101455
null,

0 commit comments

Comments
 (0)