Skip to content

Commit

Permalink
Remove erroneous --dep bundle option (#1256).
Browse files Browse the repository at this point in the history
  • Loading branch information
raineorshine committed Dec 21, 2022
1 parent 8f71eb4 commit 9e92537
Show file tree
Hide file tree
Showing 9 changed files with 13 additions and 22 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ If you have a use case where this change is not what is desired, please [report
### Breaking

- node >= 12 is required. Time to upgrade that old-ass server you never touch.
- `peerDependencies` are now excluded by default. Peer dependencies should use the **lowest** possible version that works. The old behavior encouraged a bad practice of uprading peer dependencies. You can use `--dep prod,dev,bundle,optional,peer` for the old behavior ([#951](https://github.com/raineorshine/npm-check-updates/issues/951)).
- `peerDependencies` are now excluded by default. Peer dependencies should use the **lowest** possible version that works. The old behavior encouraged a bad practice of uprading peer dependencies. You can use `--dep prod,dev,optional,peer` for the old behavior ([#951](https://github.com/raineorshine/npm-check-updates/issues/951)).
- Dependencies with `>` will be converted to `>=`. The old behavior was causing upgrades to `> [latest]` which was impossible ([#957](https://github.com/raineorshine/npm-check-updates/issues/957)).

## Other
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -150,9 +150,9 @@ ncu "/^(?!react-).*$/" # windows
--deep Run recursively in current working directory.
Alias of (--packageFile '**/package.json').
--dep <value> Check one or more sections of dependencies only:
dev, optional, peer, prod, bundle, packageManager
dev, optional, peer, prod, or packageManager
(comma-delimited). (default:
["prod","dev","bundle","optional"])
["prod","dev","optional"])
--deprecated Include deprecated packages.
-d, --doctor Iteratively installs upgrades and runs tests to
identify breaking upgrades. Requires "-u" to
Expand Down
4 changes: 2 additions & 2 deletions src/cli-options.ts
Original file line number Diff line number Diff line change
Expand Up @@ -375,8 +375,8 @@ const cliOptions: CLIOption[] = [
long: 'dep',
arg: 'value',
description:
'Check one or more sections of dependencies only: dev, optional, peer, prod, bundle, packageManager (comma-delimited).',
default: ['prod', 'dev', 'bundle', 'optional'],
'Check one or more sections of dependencies only: dev, optional, peer, prod, or packageManager (comma-delimited).',
default: ['prod', 'dev', 'optional'],
parse: value => (value && typeof value === 'string' ? value.split(',') : value),
type: 'string | string[]',
},
Expand Down
1 change: 0 additions & 1 deletion src/lib/doctor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,6 @@ const doctor = async (run: Run, options: Options): Promise<void> => {
...pkg.dependencies,
...pkg.devDependencies,
...pkg.optionalDependencies,
...pkg.bundleDependencies,
}

/** Install dependencies using "npm run install" or a custom script given by --doctorInstall. */
Expand Down
4 changes: 2 additions & 2 deletions src/lib/getCurrentDependencies.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ const parsePackageManager = (pkgData: PackageFile) => {
/**
* Get the current dependencies from the package file.
*
* @param [pkgData={}] Object with dependencies, devDependencies, peerDependencies, optionalDependencies, and/or bundleDependencies properties
* @param [pkgData={}] Object with dependencies, devDependencies, peerDependencies, and/or optionalDependencies properties.
* @param [options={}]
* @param options.dep
* @param options.filter
Expand All @@ -36,7 +36,7 @@ function getCurrentDependencies(pkgData: PackageFile = {}, options: Options = {}
? typeof options.dep === 'string'
? options.dep.split(',')
: options.dep
: ['prod', 'dev', 'bundle', 'optional']
: ['prod', 'dev', 'optional']

// map the dependency section option to a full dependency section name
const depSections = depOptions.map(
Expand Down
2 changes: 1 addition & 1 deletion src/lib/upgradePackageData.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ async function upgradePackageData(
? typeof options.dep === 'string'
? options.dep.split(',')
: options.dep
: ['prod', 'dev', 'bundle', 'optional']
: ['prod', 'dev', 'optional']

// map the dependency section option to a full dependency section name
const depSections = depOptions.map(
Expand Down
1 change: 0 additions & 1 deletion src/types/PackageFile.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import { VersionSpec } from './VersionSpec'

/** The relevant bits of a parsed package.json file. */
export interface PackageFile {
bundleDependencies?: Index<VersionSpec>
dependencies?: Index<VersionSpec>
devDependencies?: Index<VersionSpec>
engines?: Index<VersionSpec>
Expand Down
2 changes: 1 addition & 1 deletion src/types/RunOptions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ export interface RunOptions {
/** Run recursively in current working directory. Alias of (--packageFile '**\/package.json'). */
deep?: boolean

/** Check one or more sections of dependencies only: dev, optional, peer, prod, bundle, packageManager (comma-delimited). (default: ["prod","dev","bundle","optional"]) */
/** Check one or more sections of dependencies only: dev, optional, peer, prod, or packageManager (comma-delimited). (default: ["prod","dev","optional"]) */
dep?: string | string[]

/** Include deprecated packages. */
Expand Down
15 changes: 4 additions & 11 deletions test/getCurrentDependencies.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ describe('getCurrentDependencies', () => {
beforeEach(() => {
deps = {
dependencies: {
bluebird: '^1.0.0',
mocha: '1.2',
},
devDependencies: {
Expand All @@ -22,9 +23,6 @@ describe('getCurrentDependencies', () => {
optionalDependencies: {
chalk: '^1.1.0',
},
bundleDependencies: {
bluebird: '^1.0.0',
},
}
})

Expand All @@ -34,19 +32,20 @@ describe('getCurrentDependencies', () => {
getCurrentDependencies({}, {}).should.eql({})
})

it('get dependencies, devDependencies, and bundleDependencies, and optionalDependencies by default', () => {
it('get dependencies, devDependencies, and optionalDependencies by default', () => {
getCurrentDependencies(deps).should.eql({
bluebird: '^1.0.0',
mocha: '1.2',
lodash: '^3.9.3',
chalk: '^1.1.0',
bluebird: '^1.0.0',
moment: '^1.0.0',
})
})

describe('dep', () => {
it('only get dependencies with --dep prod', () => {
getCurrentDependencies(deps, { dep: 'prod' }).should.eql({
bluebird: '^1.0.0',
mocha: '1.2',
})
})
Expand All @@ -70,12 +69,6 @@ describe('getCurrentDependencies', () => {
})
})

it('only get bundleDependencies with --dep bundle', () => {
getCurrentDependencies(deps, { dep: 'bundle' }).should.eql({
bluebird: '^1.0.0',
})
})

it('only get devDependencies and peerDependencies with --dep dev,peer', () => {
getCurrentDependencies(deps, { dep: 'dev,peer' }).should.eql({
lodash: '^3.9.3',
Expand Down

0 comments on commit 9e92537

Please sign in to comment.