Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: raineorshine/npm-check-updates
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v15.1.0
Choose a base ref
...
head repository: raineorshine/npm-check-updates
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: v15.2.0
Choose a head ref
  • 2 commits
  • 4 files changed
  • 1 contributor

Commits on Jul 6, 2022

  1. Copy the full SHA
    a354042 View commit details
  2. 15.2.0

    raineorshine committed Jul 6, 2022
    Copy the full SHA
    6990c61 View commit details
Showing with 33 additions and 7 deletions.
  1. +2 −2 package-lock.json
  2. +2 −2 package.json
  3. +28 −2 src/lib/runLocal.ts
  4. +1 −1 src/lib/upgradePackageData.ts
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "npm-check-updates",
"version": "15.1.0",
"version": "15.2.0",
"author": "Tomas Junnonen <tomas1@gmail.com>",
"license": "Apache-2.0",
"contributors": [
@@ -73,7 +73,7 @@
"pacote": "^13.6.1",
"parse-github-url": "^1.0.2",
"progress": "^2.0.3",
"prompts-ncu": "^2.5.0",
"prompts-ncu": "^2.5.1",
"rc-config-loader": "^4.1.0",
"remote-git-tags": "^3.0.0",
"rimraf": "^3.0.2",
30 changes: 28 additions & 2 deletions src/lib/runLocal.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import fs from 'fs'
import path from 'path'
import prompts from 'prompts-ncu'
import spawn from 'spawn-please'
import { promisify } from 'util'
import * as cint from 'cint'
import _ from 'lodash'
@@ -182,8 +184,32 @@ async function runLocal(
writePromise = Promise.all([
getPackageManagerForInstall(options, pkgFile),
writePackageFile(pkgFile, newPkgData),
]).then(([packageManager]) => {
print(options, `\nRun ${chalk.cyan(packageManager + ' install')} to install new versions.\n`)
]).then(async ([packageManager]) => {
const installMessage = `${chalk.cyan(packageManager + ' install')} to install new versions`

// prompt the user if they want ncu to run "npm install"
if (options.interactive) {
console.log('')
const response = await prompts({
type: 'confirm',
name: 'value',
message: `${installMessage}?`,
initial: true,
// allow Ctrl+C to kill the process
onState: (state: any) => {
if (state.aborted) {
process.nextTick(() => process.exit(1))
}
},
})
if (response.value) {
await spawn(packageManager, ['install'])
}
}
// otherwise just offer the install command as a suggestion
else {
print(options, `\nRun ${installMessage}.`)
}
})
} else {
const ncuCmd = process.env.npm_lifecycle_event === 'npx' ? 'npx npm-check-updates' : 'ncu'
2 changes: 1 addition & 1 deletion src/lib/upgradePackageData.ts
Original file line number Diff line number Diff line change
@@ -145,7 +145,7 @@ async function upgradePackageData(
}))

const response = await prompts({
choices,
choices: [...choices, { title: ' ', heading: true }],
hint: 'Space to deselect. Enter to upgrade.',
instructions: false,
message: 'Choose which packages to update',