This repository has been archived by the owner on May 4, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 80
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: support bundleDependencies: true
What ends up in the parsed output is still an array of names, but we generate that name from the keys if it's set to true. Also, avoid the footgun of people not realizing that bundleDependencies should be an array of names, rather than a {name:version} object. If bundleDependencies is something other than a boolean or array, it is removed from the manifest.
- Loading branch information
Showing
6 changed files
with
148 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
const t = require('tap') | ||
const read = require('../') | ||
const { resolve } = require('path') | ||
|
||
t.test('bundle-true', t => { | ||
const fixture = resolve(__dirname, 'fixtures/bundle-true.json') | ||
read(fixture, (er, data) => { | ||
if (er) { | ||
throw er | ||
} | ||
t.match(data, { | ||
name: 'bundletrue', | ||
version: '1.2.3', | ||
dependencies: { a: '', b: '' }, | ||
optionalDependencies: { b: '' }, | ||
devDependencies: { c: '' }, | ||
bundleDependencies: [ 'a' ], | ||
readme: 'ERROR: No README data found!', | ||
_id: 'bundletrue@1.2.3' | ||
}) | ||
t.end() | ||
}) | ||
}) | ||
|
||
t.test('bundle-null', t => { | ||
const fixture = resolve(__dirname, 'fixtures/bundle-null.json') | ||
read(fixture, (er, data) => { | ||
if (er) { | ||
throw er | ||
} | ||
t.notOk(data.bundleDependencies, 'no bundleDependencies') | ||
t.notOk(data.bundledDependencies, 'no bundledDependencies') | ||
t.end() | ||
}) | ||
}) | ||
|
||
t.test('bundle-array', t => { | ||
const fixture = resolve(__dirname, 'fixtures/bundle-array.json') | ||
read(fixture, (er, data) => { | ||
t.match(data, { | ||
name: 'bundlearray', | ||
version: '1.2.3', | ||
dependencies: { a: '', b: '', c: '*' }, | ||
optionalDependencies: { b: '' }, | ||
devDependencies: { c: '' }, | ||
bundleDependencies: [ 'a', 'b', 'c' ], | ||
readme: 'ERROR: No README data found!', | ||
_id: 'bundlearray@1.2.3' | ||
}) | ||
t.end() | ||
}) | ||
}) | ||
|
||
t.test('bundle-false', t => { | ||
const fixture = resolve(__dirname, 'fixtures/bundle-false.json') | ||
read(fixture, (er, data) => { | ||
t.match(data, { | ||
name: 'bundlefalse', | ||
version: '1.2.3', | ||
dependencies: { a: '', b: '' }, | ||
optionalDependencies: { b: '' }, | ||
devDependencies: { c: '' }, | ||
readme: 'ERROR: No README data found!', | ||
_id: 'bundlefalse@1.2.3' | ||
}) | ||
t.end() | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
{ | ||
"name": "bundlearray", | ||
"version": "1.2.3", | ||
"dependencies": { | ||
"a": "" | ||
}, | ||
"optionalDependencies": { | ||
"b": "" | ||
}, | ||
"devDependencies": { | ||
"c": "" | ||
}, | ||
"bundledDependencies": [ | ||
"a", | ||
"b", | ||
"c" | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
{ | ||
"name": "bundlefalse", | ||
"version": "1.2.3", | ||
"dependencies": { | ||
"a": "" | ||
}, | ||
"optionalDependencies": { | ||
"b": "" | ||
}, | ||
"devDependencies": { | ||
"c": "" | ||
}, | ||
"bundleDependencies": false, | ||
"bundledDependencies": true | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
{ | ||
"name": "bundlenull", | ||
"version": "1.2.3", | ||
"dependencies": { | ||
"a": "" | ||
}, | ||
"optionalDependencies": { | ||
"b": "" | ||
}, | ||
"devDependencies": { | ||
"c": "" | ||
}, | ||
"bundleDependencies": null, | ||
"bundledDependencies": true | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
{ | ||
"name": "bundletrue", | ||
"version": "1.2.3", | ||
"dependencies": { | ||
"a": "" | ||
}, | ||
"optionalDependencies": { | ||
"b": "" | ||
}, | ||
"devDependencies": { | ||
"c": "" | ||
}, | ||
"bundledDependencies": true | ||
} |