commander-scripts-ivan
Advanced tools
@@ -64,20 +64,16 @@ #!/usr/bin/env node | ||
| new Promise((resolve, reject) => { | ||
| const packageJson = { name, version: '0.0.1', private: true } | ||
| fs.writeFileSync(path.join(root, 'package.json'), JSON.stringify(packageJson, null, 2)) | ||
| const packageJson = { name, version: '0.0.1', private: true } | ||
| fs.writeFileSync(path.join(root, 'package.json'), JSON.stringify(packageJson, null, 2)) | ||
| process.chdir(root) | ||
| console.log(chalk.cyan('Installing packages. This might take a couple of minutes...')) | ||
| const command = shouldUseYarn() ? 'yarn' : 'npm' | ||
| // 异步执行npm install指令以promise resolve得到 | ||
| const child = spawn(command, args, { stdio: 'inherit' }) | ||
| child.on('close', (code) => { | ||
| if (code !== 0) { | ||
| red(`\n\nAborting installation.\n npm ${args.join(' ')}`) | ||
| reject() | ||
| return | ||
| } | ||
| resolve(STARTER) | ||
| }) | ||
| }) | ||
| process.chdir(root) | ||
| console.log(chalk.cyan('Installing packages. This might take a couple of minutes...\n\n')) | ||
| const command = shouldUseYarn() ? 'yarn' : 'npm' | ||
| // 异步执行npm install指令以promise resolve得到 | ||
| const child = spawn.sync(command, args, { stdio: 'inherit' }) | ||
| if (child.status !== 0) { | ||
| red('\n\nAborting installation.') | ||
| process.exit(1) | ||
| } | ||
| console.log(chalk.green(`\n\n${STARTER} has been installed...\n\n`)) | ||
| Promise.resolve(STARTER) | ||
| .then((packageName) => { | ||
@@ -92,6 +88,7 @@ // 执行对应打包库里的文件配置 | ||
| const init = require(scriptsPath) // eslint-disable-line | ||
| return init(root, name) | ||
| init(root, name) | ||
| }) | ||
| .catch((error) => { | ||
| if (error) { | ||
| console.error(chalk.red('\n\nExecute init script failed...')) | ||
| console.error(error) | ||
@@ -98,0 +95,0 @@ } |
+1
-1
| { | ||
| "name": "commander-scripts-ivan", | ||
| "version": "0.0.10", | ||
| "version": "0.0.11", | ||
| "description": "Node.js命令行脚本", | ||
@@ -5,0 +5,0 @@ "bin": "./commander-scripts-ivan.js", |
Shell access
Supply chain riskThis module accesses the system shell. Accessing the system shell increases the risk of executing arbitrary code.
Found 1 instance in 1 package
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
Shell access
Supply chain riskThis module accesses the system shell. Accessing the system shell increases the risk of executing arbitrary code.
Found 1 instance in 1 package
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
4735
0.28%109
-2.68%