Comparing version 1.0.0 to 1.0.1
47
index.js
#!/usr/bin/env node | ||
console.log('this is a mini create cli'); | ||
const minimist = require('minimist'); | ||
const fse = require('fs-extra'); | ||
const path = require('path'); | ||
const prompts = require('prompts'); | ||
const argv = minimist(process.argv.slice(2)); | ||
async function init() { | ||
const { template, name } = argv; | ||
const result = await prompts([ | ||
{ | ||
type: name ? null : 'text', | ||
name: 'name', | ||
message: 'please input your project name', | ||
}, | ||
{ | ||
type: template ? null : 'select', | ||
name: 'template', | ||
message: 'please select a template', | ||
choices: [ | ||
{ | ||
title: 'templateA', | ||
value: 'a', | ||
}, | ||
{ | ||
title: 'templateB', | ||
value: 'b', | ||
}, | ||
], | ||
}, | ||
]); | ||
const templateName = template || result.template; | ||
const projectName = name || result.name; | ||
const targetDir = path.resolve(process.cwd(), projectName); | ||
const templateDir = path.resolve(__dirname, `template-${templateName}`); | ||
fse.copySync(templateDir, targetDir); | ||
let pkg = JSON.parse(fse.readFileSync(path.resolve(targetDir, 'package.json'), 'utf-8')); | ||
pkg.name = projectName; | ||
fse.writeFileSync(path.resolve(targetDir, 'package.json'), JSON.stringify(pkg, null, 2)); | ||
} | ||
init(); |
{ | ||
"name": "create-ab", | ||
"version": "1.0.0", | ||
"version": "1.0.1", | ||
"description": "", | ||
@@ -14,3 +14,8 @@ "main": "index.js", | ||
"author": "xiaoyao", | ||
"license": "ISC" | ||
"license": "ISC", | ||
"dependencies": { | ||
"fs-extra": "^11.1.1", | ||
"minimist": "^1.2.8", | ||
"prompts": "^2.4.2" | ||
} | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
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
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Trivial Package
Supply chain riskPackages less than 10 lines of code are easily copied into your own project and may not warrant the additional supply chain risk of an external dependency.
Found 1 instance in 1 package
2469
12
42
0
3
2
+ Addedfs-extra@^11.1.1
+ Addedminimist@^1.2.8
+ Addedprompts@^2.4.2
+ Addedfs-extra@11.2.0(transitive)
+ Addedgraceful-fs@4.2.11(transitive)
+ Addedjsonfile@6.1.0(transitive)
+ Addedkleur@3.0.3(transitive)
+ Addedminimist@1.2.8(transitive)
+ Addedprompts@2.4.2(transitive)
+ Addedsisteransi@1.0.5(transitive)
+ Addeduniversalify@2.0.1(transitive)