yarn-upgrade-all
Advanced tools
Comparing version 0.2.1 to 0.3.0
19
index.js
@@ -6,3 +6,10 @@ #!/usr/bin/env node | ||
const chalk = require('chalk') | ||
const commander = require('commander') | ||
const pkg = require('./package.json') | ||
commander.version(pkg.version) | ||
.option('-g --global', 'upgrade packages globally', false) | ||
.parse(process.argv) | ||
const logError = (message) => { | ||
@@ -18,3 +25,11 @@ console.log(chalk.red('[Error]: ' + message)) | ||
const packagePath = path.resolve(process.cwd(), 'package.json') | ||
let packagePath = null | ||
let global = '' | ||
if (commander.global) { | ||
global = ' global' | ||
packagePath = path.resolve(process.env[process.platform === 'win32' ? 'USERPROFILE' : 'HOME'], '.config', 'yarn', 'global', 'package.json') | ||
} else { | ||
packagePath = path.resolve(process.cwd(), 'package.json') | ||
} | ||
if (!fs.existsSync(packagePath)) { | ||
@@ -36,3 +51,3 @@ logError('Cannot find package.json file in the current directory') | ||
for (let pkg of packages) { | ||
const command = `yarn remove ${pkg} && yarn add${option} ${pkg}` | ||
const command = `yarn${global} remove ${pkg} && yarn${global} add${option} ${pkg}` | ||
try { | ||
@@ -39,0 +54,0 @@ logInfo(command) |
{ | ||
"name": "yarn-upgrade-all", | ||
"version": "0.2.1", | ||
"version": "0.3.0", | ||
"description": "This is a command line utility program to upgrade all the packages in your package.json to the latest version (potentially upgrading packages across major versions).", | ||
@@ -18,4 +18,5 @@ "bin": { | ||
"dependencies": { | ||
"chalk": "^2.3.0" | ||
"chalk": "^2.3.0", | ||
"commander": "^2.12.2" | ||
} | ||
} |
@@ -37,3 +37,9 @@ # yarn-upgrade-all | ||
Or upgrade global packages: | ||
``` | ||
yarn-upgrade-all --global | ||
``` | ||
## How does it work? | ||
@@ -40,0 +46,0 @@ |
Sorry, the diff of this file is not supported yet
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 1 instance in 1 package
44142
53
54
2
4
+ Addedcommander@^2.12.2
+ Addedcommander@2.20.3(transitive)