Comparing version 1.0.4 to 1.0.5
{ | ||
"name": "django-cli", | ||
"version": "1.0.4", | ||
"version": "1.0.5", | ||
"description": "", | ||
@@ -18,4 +18,5 @@ "main": "idnex.js", | ||
"fs-extra": "^9.0.1", | ||
"path": "^0.12.7" | ||
"path": "^0.12.7", | ||
"shelljs": "^0.8.4" | ||
} | ||
} |
@@ -6,23 +6,64 @@ #! /usr/bin/env node | ||
const chalk = require('chalk') | ||
const path = require('path') | ||
var shell = require('shelljs'); | ||
exports.copyTemplate = function (p) { | ||
exports.copyTemplate = async function (args) { | ||
console.log(process.cwd()) | ||
console.log(__dirname) | ||
console.log(process.execPath) | ||
let dest = process.cwd() + '/assets/components'; | ||
let temp = __dirname + '/../desc' | ||
if (!fs.existsSync(dest)) { | ||
fs.mkdirSync(dest); | ||
} else { | ||
if (!program.force) { | ||
console.log(chalk.red('文件夹已存在 请使用 -f 命令')) | ||
return | ||
} | ||
// 用户输入路径 | ||
let cpath = args[0]; | ||
const cwdPath = process.cwd(); | ||
if (!shell.which('git')) { | ||
shell.echo('Sorry, this script requires git'); | ||
shell.exit(1); | ||
} | ||
console.log(chalk.yellow('正在移植...')) | ||
shell.cd(__dirname + '/../') | ||
const libDir = __dirname + '/../django-lib/' | ||
if (fs.existsSync(libDir)) { | ||
await exec(`rm -rf ${libDir}`) | ||
} | ||
const s = Date.now() | ||
fs.copySync(temp, dest) | ||
const e = Date.now() | ||
console.log(chalk.green(`移植成功...${e-s}ms`)) | ||
shell.exec('git clone git@gitee.com:django_d/django-lib.git', { | ||
async: true, | ||
}, function () { | ||
const e = Date.now() | ||
let temp = __dirname + '/../django-lib/src/' | ||
if (!cpath) cpath = 'DjangoLib' | ||
let assets = cwdPath + '/assets/'; | ||
if (!fs.existsSync(assets)) { | ||
console.log(chalk.red('未发现 "assets" 文件夹')) | ||
return; | ||
} | ||
const target = assets + cpath | ||
if (!fs.existsSync(target)) { | ||
fs.mkdirSync(target); | ||
} else { | ||
if (!program.force) { | ||
console.log(chalk.red(`${cpath} 文件夹已存在 请使用 -f 命令`)) | ||
return | ||
} | ||
} | ||
console.log(chalk.yellow('正在移植...')) | ||
fs.copySync(temp, target) | ||
console.log(chalk.green(`移植成功...${e-s}ms`)) | ||
}) | ||
} | ||
async function exec(command) { | ||
return new Promise((resolve, reject) => { | ||
shell.exec(command, { | ||
async: true | ||
}, (e) => { | ||
resolve() | ||
}) | ||
}); | ||
} |
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
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
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
2757
5
4
81
1
+ Addedshelljs@^0.8.4
+ Addedbalanced-match@1.0.2(transitive)
+ Addedbrace-expansion@1.1.11(transitive)
+ Addedconcat-map@0.0.1(transitive)
+ Addedfs.realpath@1.0.0(transitive)
+ Addedfunction-bind@1.1.2(transitive)
+ Addedglob@7.2.3(transitive)
+ Addedhasown@2.0.2(transitive)
+ Addedinflight@1.0.6(transitive)
+ Addedinherits@2.0.4(transitive)
+ Addedinterpret@1.4.0(transitive)
+ Addedis-core-module@2.15.1(transitive)
+ Addedminimatch@3.1.2(transitive)
+ Addedonce@1.4.0(transitive)
+ Addedpath-is-absolute@1.0.1(transitive)
+ Addedpath-parse@1.0.7(transitive)
+ Addedrechoir@0.6.2(transitive)
+ Addedresolve@1.22.8(transitive)
+ Addedshelljs@0.8.5(transitive)
+ Addedsupports-preserve-symlinks-flag@1.0.0(transitive)
+ Addedwrappy@1.0.2(transitive)