commander-scripts-ivan
Advanced tools
@@ -51,3 +51,2 @@ #!/usr/bin/env node | ||
| } | ||
| fs.ensureDirSync(name) // Like mkdir -p | ||
@@ -63,21 +62,23 @@ function shouldUseYarn() { | ||
| const root = path.resolve(name) // 把一个路径或路径片段的序列解析为一个绝对路径 | ||
| Promise.resolve(STARTER) | ||
| .then((packageName) => { | ||
| fs.ensureDirSync(name) // Like mkdir -p | ||
| const root = path.resolve(name) // 把一个路径或路径片段的序列解析为一个绝对路径 | ||
| const args = shouldUseYarn() ? ['add', '-D', '-E', STARTER, '--cwd', root] : ['install', '-D', '-E', STARTER] | ||
| const args = shouldUseYarn() ? ['add', '-D', '-E', packageName, '--cwd', root] : ['install', '-D', '-E', packageName] | ||
| 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...\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) => { | ||
| 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${packageName} has been installed...\n\n`)) | ||
| // 执行对应打包库里的文件配置 | ||
@@ -84,0 +85,0 @@ const scriptsPath = path.resolve( |
+1
-1
| { | ||
| "name": "commander-scripts-ivan", | ||
| "version": "0.0.12", | ||
| "version": "0.0.13", | ||
| "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
4855
1.53%