@easyv/cli
Advanced tools
Comparing version 1.0.12 to 1.0.13
{ | ||
"name": "@easyv/cli", | ||
"version": "1.0.12", | ||
"version": "1.0.13", | ||
"description": "Easy[V] component tools", | ||
@@ -5,0 +5,0 @@ "engines": { |
@@ -5,5 +5,2 @@ const validateProjectName = require('validate-npm-package-name'); | ||
const chalk = require('chalk'); | ||
const cmd = require('cross-spawn'); | ||
const execSync = require('child_process').execSync; | ||
const os = require('os'); | ||
const { appRoot, appPackage, getPluginRoot } = require('./paths'); | ||
@@ -59,45 +56,45 @@ const generate = require('./generate'); | ||
const builers = { | ||
'react': 'react-component-builder' | ||
} | ||
// 默认创建react项目 | ||
const withBuilders = builers['react']; | ||
// const builers = { | ||
// 'react': 'react-component-builder' | ||
// } | ||
// // 默认创建react项目 | ||
// const withBuilders = builers['react']; | ||
checkNameDuplication(folderName); | ||
// checkNameDuplication(folderName); | ||
console.log(); | ||
console.log(chalk.blueBright(`Creating a new easyv project`)); | ||
console.log(); | ||
// console.log(); | ||
// console.log(chalk.blueBright(`Creating a new easyv project`)); | ||
// console.log(); | ||
const dir = path.resolve(folderName) | ||
if (!fs.existsSync(dir)) { | ||
fs.mkdirSync(dir) | ||
} | ||
// const dir = path.resolve(folderName) | ||
// if (!fs.existsSync(dir)) { | ||
// fs.mkdirSync(dir) | ||
// } | ||
// 生成package.json | ||
const createdBy = withBuilders; | ||
const templatePackage = require(`./template/${createdBy}.package.json`); | ||
templatePackage.name = folderName; | ||
templatePackage.easyv.by = createdBy; | ||
fs.writeFileSync( | ||
path.join(appRoot, 'package.json'), | ||
JSON.stringify(templatePackage, null, 2) + os.EOL | ||
); | ||
// // 生成package.json | ||
// const createdBy = withBuilders; | ||
// const templatePackage = require(`./template/${createdBy}.package.json`); | ||
// templatePackage.name = folderName; | ||
// templatePackage.easyv.by = createdBy; | ||
// fs.writeFileSync( | ||
// path.join(appRoot, 'package.json'), | ||
// JSON.stringify(templatePackage, null, 2) + os.EOL | ||
// ); | ||
// copy 用例 | ||
const appPackageJSON = require(appPackage); | ||
const componentsPath = path.join(appRoot, appPackageJSON.easyv.components) | ||
fs.mkdirSync(componentsPath, { recursive: true }) | ||
// // copy 用例 | ||
// const appPackageJSON = require(appPackage); | ||
// const componentsPath = path.join(appRoot, appPackageJSON.easyv.components) | ||
// fs.mkdirSync(componentsPath, { recursive: true }) | ||
// 下载包 | ||
yarnVersion = execSync('yarnpkg --version') | ||
.toString() | ||
.trim(); | ||
if (yarnVersion) { | ||
cmd.sync('yarn', ['install', '--registry=https://registry.npm.taobao.org'], { stdio: 'inherit', cwd: appRoot }); | ||
} else { | ||
cmd.sync('npm', ['install', '--registry=https://registry.npm.taobao.org'], { stdio: 'inherit', cwd: appRoot }); | ||
} | ||
// // 下载包 | ||
// yarnVersion = execSync('yarnpkg --version') | ||
// .toString() | ||
// .trim(); | ||
// if (yarnVersion) { | ||
// cmd.sync('yarn', ['install', '--registry=https://registry.npm.taobao.org'], { stdio: 'inherit', cwd: appRoot }); | ||
// } else { | ||
// cmd.sync('npm', ['install', '--registry=https://registry.npm.taobao.org'], { stdio: 'inherit', cwd: appRoot }); | ||
// } | ||
await generate() | ||
await generate(); | ||
@@ -104,0 +101,0 @@ console.log(); |
@@ -9,3 +9,3 @@ 'use strict'; | ||
const run = require(path.join(getPluginRoot(packageJSON.easyv.by), 'launcher/generate.js')); | ||
run() | ||
return run() | ||
} |
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
11
1
114429
3583