Skip to content

Commit fc80bb3

Browse files
committed
feat!: remove default license for npm init
BREAKING CHANGE: The default license for `npm init` has been changed from "ISC" to an empty string. If not set, the license field will be omitted from new packages.
1 parent be8053c commit fc80bb3

5 files changed

Lines changed: 16 additions & 27 deletions

File tree

smoke-tests/tap-snapshots/test/index.js.test.cjs

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,6 @@ Wrote to {NPM}/{TESTDIR}/project/package.json:
190190
"test": "echo /"Error: no test specified/" && exit 1"
191191
},
192192
"keywords": [],
193-
"license": "ISC",
194193
"type": "commonjs"
195194
}
196195
`
@@ -207,7 +206,6 @@ Object {
207206
"devDependencies": Object {
208207
"promise-all-reject-late": "^5.0.0",
209208
},
210-
"license": "ISC",
211209
"name": "project",
212210
"version": "1.0.0",
213211
},
@@ -239,7 +237,6 @@ Object {
239237
"promise-all-reject-late": "^5.0.0",
240238
},
241239
"keywords": Array [],
242-
"license": "ISC",
243240
"main": "index.js",
244241
"name": "project",
245242
"scripts": Object {
@@ -270,7 +267,6 @@ Object {
270267
"dependencies": Object {
271268
"abbrev": "^1.0.4",
272269
},
273-
"license": "ISC",
274270
"name": "project",
275271
"version": "1.0.0",
276272
},
@@ -291,7 +287,6 @@ Object {
291287
},
292288
"description": "",
293289
"keywords": Array [],
294-
"license": "ISC",
295290
"main": "index.js",
296291
"name": "project",
297292
"scripts": Object {
@@ -320,7 +315,6 @@ Object {
320315
},
321316
"description": "",
322317
"keywords": Array [],
323-
"license": "ISC",
324318
"main": "index.js",
325319
"name": "project",
326320
"scripts": Object {
@@ -339,7 +333,6 @@ Object {
339333
},
340334
"description": "",
341335
"keywords": Array [],
342-
"license": "ISC",
343336
"main": "index.js",
344337
"name": "project",
345338
"scripts": Object {
@@ -361,7 +354,7 @@ exports[`test/index.js TAP basic npm pkg > should have expected pkg delete outpu
361354
`
362355

363356
exports[`test/index.js TAP basic npm pkg > should have expected pkg get output 1`] = `
364-
ISC
357+
365358
`
366359

367360
exports[`test/index.js TAP basic npm pkg > should have expected pkg set output 1`] = `
@@ -378,7 +371,6 @@ scripts = {
378371
hello: 'echo Hello'
379372
}
380373
keywords = []
381-
license = 'ISC'
382374
type = 'commonjs'
383375
dependencies = { abbrev: '^1.0.4' }
384376
tap = { 'test-env': [ 'LC_ALL=sk' ] }
@@ -394,7 +386,6 @@ Object {
394386
"promise-all-reject-late": "^5.0.0",
395387
},
396388
"keywords": Array [],
397-
"license": "ISC",
398389
"main": "index.js",
399390
"name": "project",
400391
"scripts": Object {
@@ -427,7 +418,6 @@ Object {
427418
"dependencies": Object {
428419
"abbrev": "^1.0.4",
429420
},
430-
"license": "ISC",
431421
"name": "project",
432422
"version": "1.0.0",
433423
},
@@ -448,7 +438,6 @@ Object {
448438
},
449439
"description": "",
450440
"keywords": Array [],
451-
"license": "ISC",
452441
"main": "index.js",
453442
"name": "project",
454443
"scripts": Object {
@@ -476,7 +465,6 @@ Object {
476465
"devDependencies": Object {
477466
"promise-all-reject-late": "^5.0.0",
478467
},
479-
"license": "ISC",
480468
"name": "project",
481469
"version": "1.0.0",
482470
},
@@ -508,7 +496,6 @@ Object {
508496
"promise-all-reject-late": "^5.0.0",
509497
},
510498
"keywords": Array [],
511-
"license": "ISC",
512499
"main": "index.js",
513500
"name": "project",
514501
"scripts": Object {

tap-snapshots/test/lib/commands/config.js.test.cjs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ exports[`test/lib/commands/config.js TAP config list --json > output matches sna
9090
"init.author.email": "",
9191
"init.author.name": "",
9292
"init.author.url": "",
93-
"init.license": "ISC",
93+
"init.license": "",
9494
"init.module": "{CWD}/home/.npm-init.js",
9595
"init.version": "1.0.0",
9696
"install-links": false,
@@ -271,15 +271,15 @@ include-workspace-root = false
271271
init-author-email = ""
272272
; init-author-name = "" ; overridden by user
273273
init-author-url = ""
274-
; init-license = "ISC" ; overridden by global
274+
; init-license = "" ; overridden by global
275275
init-module = "{CWD}/home/.npm-init.js"
276276
init-private = false
277277
init-type = "commonjs"
278278
init-version = "1.0.0"
279279
init.author.email = ""
280280
init.author.name = ""
281281
init.author.url = ""
282-
init.license = "ISC"
282+
init.license = ""
283283
init.module = "{CWD}/home/.npm-init.js"
284284
init.version = "1.0.0"
285285
install-links = false

tap-snapshots/test/lib/docs.js.test.cjs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1044,10 +1044,11 @@ homepage.
10441044
10451045
#### \`init-license\`
10461046
1047-
* Default: "ISC"
1047+
* Default: ""
10481048
* Type: String
10491049
1050-
The value \`npm init\` should use by default for the package license.
1050+
The value \`npm init\` should use by default for the package license. If not
1051+
set, the license field will be omitted from new packages.
10511052
10521053
10531054
@@ -2356,7 +2357,7 @@ Alias for \`--init-author-url\`
23562357
23572358
#### \`init.license\`
23582359
2359-
* Default: "ISC"
2360+
* Default: ""
23602361
* Type: String
23612362
* DEPRECATED: Use \`--init-license\` instead.
23622363

test/lib/commands/init.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ t.test('classic npm init -y', async t => {
4343

4444
const pkg = require(resolve(prefix, 'package.json'))
4545
t.equal(pkg.version, '1.0.0')
46-
t.equal(pkg.license, 'ISC')
46+
t.equal(pkg.license, undefined, 'license is omitted by default')
4747
})
4848

4949
t.test('classic interactive npm init', async t => {
@@ -273,7 +273,7 @@ t.test('workspaces', async t => {
273273
const pkg = require(resolve(prefix, 'a/package.json'))
274274
t.equal(pkg.name, 'a')
275275
t.equal(pkg.version, '1.0.0')
276-
t.equal(pkg.license, 'ISC')
276+
t.equal(pkg.license, undefined, 'license is omitted by default')
277277

278278
t.matchSnapshot(joinedOutput(), 'should print helper info')
279279

@@ -306,7 +306,7 @@ t.test('workspaces', async t => {
306306
const pkg = require(resolve(prefix, 'packages/a/package.json'))
307307
t.equal(pkg.name, 'a')
308308
t.equal(pkg.version, '2.0.0')
309-
t.equal(pkg.license, 'ISC')
309+
t.equal(pkg.license, undefined, 'license is omitted by default')
310310
})
311311

312312
await t.test('fail parsing top-level package.json to set workspace', async t => {
@@ -422,12 +422,12 @@ t.test('workspaces', async t => {
422422

423423
const pkg = require(resolve(npm.localPrefix, 'package.json'))
424424
t.equal(pkg.version, '1.0.0')
425-
t.equal(pkg.license, 'ISC')
425+
t.equal(pkg.license, undefined, 'license is omitted by default')
426426
t.strictSame(pkg.workspaces, ['packages/a'])
427427

428428
const ws = require(resolve(npm.localPrefix, 'packages/a/package.json'))
429429
t.equal(ws.version, '1.0.0')
430-
t.equal(ws.license, 'ISC')
430+
t.equal(ws.license, undefined, 'license is omitted by default')
431431
})
432432
t.test('init pkg - installed workspace package', async t => {
433433
const { npm } = await mockNpm(t, {

workspaces/config/lib/definitions/definitions.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1121,11 +1121,12 @@ const definitions = {
11211121
`,
11221122
}),
11231123
'init-license': new Definition('init-license', {
1124-
default: 'ISC',
1124+
default: '',
11251125
hint: '<license>',
11261126
type: String,
11271127
description: `
11281128
The value \`npm init\` should use by default for the package license.
1129+
If not set, the license field will be omitted from new packages.
11291130
`,
11301131
}),
11311132
'init-module': new Definition('init-module', {
@@ -1196,7 +1197,7 @@ const definitions = {
11961197
`,
11971198
}),
11981199
'init.license': new Definition('init.license', {
1199-
default: 'ISC',
1200+
default: '',
12001201
type: String,
12011202
deprecated: `
12021203
Use \`--init-license\` instead.

0 commit comments

Comments
 (0)