| const download = require('download-git-repo') | ||
| download('git@github.com:zhaowei-plus/zw-pool-front.git', './temp', { | ||
| clone: true | ||
| }, err => { | ||
| if (err) { | ||
| console.error('error:', err); | ||
| return false; | ||
| } | ||
| console.info('git clone success'); | ||
| }); |
+29
-104
| #!/usr/bin/env node | ||
| const download = require('git-clone') | ||
| const program = require('commander') | ||
| const download = require('download-git-repo') | ||
| const exists = require('fs').existsSync | ||
@@ -9,4 +8,2 @@ const path = require('path') | ||
| const home = require('user-home') | ||
| const tildify = require('tildify') | ||
| const chalk = require('chalk') | ||
| const inquirer = require('inquirer') | ||
@@ -17,110 +14,38 @@ const rm = require('rimraf').sync | ||
| const generate = require('../lib/generate') | ||
| const checkVersion = require('../lib/check-version') | ||
| const warnings = require('../lib/warnings') | ||
| const localPath = require('../lib/local-path') | ||
| const isLocalPath = localPath.isLocalPath | ||
| const getTemplatePath = localPath.getTemplatePath | ||
| class Project { | ||
| constructor(name) { | ||
| let template = 'spa'; // 脚手架类型 | ||
| const inPlace = !name || name === '.' | ||
| const proName = inPlace ? path.relative('../', process.cwd()) : name | ||
| const to = path.resolve(name || '.') | ||
| /** | ||
| * 使用方法 | ||
| */ | ||
| program | ||
| .usage('<template-name> [project-name]') | ||
| .option('-c, --clone', 'use git clone') | ||
| .option('--offline', 'use cached template') | ||
| const tmp = path.join(home, '.gt-templates', template); | ||
| /** | ||
| * 帮助信息 | ||
| */ | ||
| program.on('--help', () => { | ||
| console.log(' Examples:') | ||
| console.log() | ||
| console.log(chalk.gray(' # 使用模板创建一个新项目')) | ||
| console.log(' $ zw init new-project') | ||
| console.log() | ||
| }) | ||
| this.downloadAndGenerate(proName, tmp, to); | ||
| } | ||
| /** | ||
| * Help. | ||
| */ | ||
| function help () { | ||
| program.parse(process.argv) | ||
| if (program.args.length < 1) return program.help() | ||
| } | ||
| help() | ||
| downloadAndGenerate(name, tmp, to) { | ||
| const spinner = ora('下载模板') | ||
| spinner.start() | ||
| /** | ||
| * Settings. | ||
| */ | ||
| // 模板名称 | ||
| let template = program.args[0] | ||
| const hasSlash = template.indexOf('/') > -1 | ||
| // 项目名称 | ||
| const rawName = program.args[1] | ||
| const inPlace = !rawName || rawName === '.' | ||
| const name = inPlace ? path.relative('../', process.cwd()) : rawName | ||
| const to = path.resolve(rawName || '.') | ||
| if (exists(tmp)) | ||
| rm(tmp) | ||
| // 缓存模板的路径 | ||
| const tmp = path.join(home, '.zw-templates', template) | ||
| /** | ||
| * Padding. | ||
| */ | ||
| console.log() | ||
| process.on('exit', () => { | ||
| console.log() | ||
| }) | ||
| if (inPlace || exists(to)) { | ||
| inquirer.prompt([{ | ||
| type: 'confirm', | ||
| message: inPlace | ||
| ? '是否在当前目录创建新项目?' | ||
| : '目录已存在,是否继续?', | ||
| name: 'ok' | ||
| }]).then(answers => { | ||
| if (answers.ok) { | ||
| run() | ||
| download('git@github.com:zhaowei-plus/zw-pool-front.git#template/spa', tmp, { | ||
| clone: true | ||
| }, err => { | ||
| spinner.stop() | ||
| if (err) logger.fatal('Failed to download repo: ' + err.message.trim()) | ||
| generate(name, tmp, to, err => { | ||
| if (err) logger.fatal(err) | ||
| console.log() | ||
| logger.success('Generated "%s".', name) | ||
| }) | ||
| }); | ||
| } | ||
| }).catch(logger.fatal) | ||
| } else { | ||
| run() | ||
| } | ||
| /** | ||
| * Check, download and generate the project. | ||
| */ | ||
| function run () { | ||
| //检查版本并输出信息 | ||
| downloadAndGenerate() | ||
| } | ||
| /** | ||
| * Download a generate from a template repo. | ||
| * | ||
| * @param {String} template | ||
| */ | ||
| function downloadAndGenerate () { | ||
| const spinner = ora('下载模板') | ||
| spinner.start() | ||
| if (exists(tmp)) | ||
| rm(tmp) | ||
| download("git@github.com:zhaowei-plus/zw-pool-front.git", tmp, { | ||
| clone: true | ||
| }, err => { | ||
| spinner.stop() | ||
| if (err) logger.fatal('Failed to download repo: ' + err.message.trim()) | ||
| generate(name, tmp, to, err => { | ||
| if (err) logger.fatal(err) | ||
| console.log() | ||
| logger.success('Generated "%s".', name) | ||
| }) | ||
| }) | ||
| } | ||
| module.exports = { | ||
| Project, | ||
| }; |
+32
-5
| #!/usr/bin/env node | ||
| const program = require('commander') | ||
| const { | ||
| Project | ||
| } = require('./gt-init'); | ||
| const program = require('commander'); | ||
| const chalk = require('chalk'); | ||
| program | ||
| .version(require('../package').version) | ||
| .usage('<command> [options]') | ||
| .command('init', 'generate a new project from a template') | ||
| .command('list', 'list available official templates') | ||
| .version(require('../package').version) | ||
| .usage('<command> [options]'); | ||
| program | ||
| .command('init [project-name]') | ||
| .description("创建新项目") | ||
| .action(async(options) => { | ||
| if (!options) { | ||
| console.log('请输入项目名'); | ||
| } | ||
| new Project(options); | ||
| }); | ||
| /** | ||
| * 帮助信息 | ||
| */ | ||
| program.on('--help', () => { | ||
| console.log(' Examples:') | ||
| console.log() | ||
| console.log(chalk.gray(' # 使用模板创建一个新项目')) | ||
| console.log(' $ gt init new-project') | ||
| console.log() | ||
| }); | ||
| program.parse(process.argv) |
+13
-13
@@ -8,3 +8,3 @@ const chalk = require('chalk') | ||
| const prefix = ' code-cli' | ||
| const prefix = ' gt-cli' | ||
| const sep = chalk.gray('·') | ||
@@ -18,5 +18,5 @@ | ||
| exports.log = function (...args) { | ||
| const msg = format.apply(format, args) | ||
| console.log(chalk.white(prefix), sep, msg) | ||
| exports.log = function(...args) { | ||
| const msg = format.apply(format, args) | ||
| console.log(chalk.white(prefix), sep, msg) | ||
| } | ||
@@ -30,7 +30,7 @@ | ||
| exports.fatal = function (...args) { | ||
| if (args[0] instanceof Error) args[0] = args[0].message.trim() | ||
| const msg = format.apply(format, args) | ||
| console.error(chalk.red(prefix), sep, msg) | ||
| process.exit(1) | ||
| exports.fatal = function(...args) { | ||
| if (args[0] instanceof Error) args[0] = args[0].message.trim() | ||
| const msg = format.apply(format, args) | ||
| console.error(chalk.red(prefix), sep, msg) | ||
| process.exit(1) | ||
| } | ||
@@ -44,5 +44,5 @@ | ||
| exports.success = function (...args) { | ||
| const msg = format.apply(format, args) | ||
| console.log(chalk.white(prefix), sep, msg) | ||
| } | ||
| exports.success = function(...args) { | ||
| const msg = format.apply(format, args) | ||
| console.log(chalk.white(prefix), sep, msg) | ||
| } |
+35
-42
| { | ||
| "name": "zw-cli", | ||
| "version": "1.0.0", | ||
| "dependencies": { | ||
| "async": "^2.4.0", | ||
| "chalk": "^2.1.0", | ||
| "coffee-script": "1.12.7", | ||
| "commander": "^2.9.0", | ||
| "consolidate": "^0.14.0", | ||
| "download-git-repo": "^1.0.1", | ||
| "handlebars": "^4.0.5", | ||
| "inquirer": "^6.0.0", | ||
| "metalsmith": "^2.1.0", | ||
| "minimatch": "^3.0.0", | ||
| "multimatch": "^2.1.0", | ||
| "ora": "^1.3.0", | ||
| "read-metadata": "^1.0.0", | ||
| "request": "^2.67.0", | ||
| "rimraf": "^2.5.0", | ||
| "semver": "^5.1.0", | ||
| "shelljs": "^0.8.3", | ||
| "tildify": "^1.2.0", | ||
| "uid": "0.0.2", | ||
| "user-home": "^2.0.0", | ||
| "validate-npm-package-name": "^3.0.0" | ||
| }, | ||
| "scripts": { | ||
| "test": "echo \"Error: no test specified\" && exit 1" | ||
| }, | ||
| "bin": { | ||
| "code": "bin/code", | ||
| "code-init": "bin/code-init", | ||
| "code-list": "bin/code-list" | ||
| }, | ||
| "author": "", | ||
| "license": "ISC", | ||
| "description": "", | ||
| "devDependencies": { | ||
| "chalk": "^2.4.2", | ||
| "inquirer": "^6.2.2", | ||
| "ora": "^3.1.0", | ||
| "semver": "^5.6.0" | ||
| } | ||
| "name": "zw-cli", | ||
| "version": "1.0.1", | ||
| "dependencies": { | ||
| "async": "^2.4.0", | ||
| "chalk": "^2.4.2", | ||
| "coffee-script": "1.12.7", | ||
| "commander": "^2.9.0", | ||
| "consolidate": "^0.14.0", | ||
| "download-git-repo": "^1.1.0", | ||
| "handlebars": "^4.0.5", | ||
| "inquirer": "^6.2.2", | ||
| "metalsmith": "^2.1.0", | ||
| "minimatch": "^3.0.0", | ||
| "multimatch": "^2.1.0", | ||
| "ora": "^3.1.0", | ||
| "read-metadata": "^1.0.0", | ||
| "request": "^2.67.0", | ||
| "rimraf": "^2.5.0", | ||
| "semver": "^5.6.0", | ||
| "shelljs": "^0.8.3", | ||
| "tildify": "^1.2.0", | ||
| "uid": "0.0.2", | ||
| "user-home": "^2.0.0", | ||
| "validate-npm-package-name": "^3.0.0" | ||
| }, | ||
| "scripts": { | ||
| "test": "echo \"Error: no test specified\" && exit 1" | ||
| }, | ||
| "bin": { | ||
| "gs": "bin/gs.js" | ||
| }, | ||
| "author": "", | ||
| "license": "ISC", | ||
| "description": "", | ||
| "devDependencies": {} | ||
| } |
| <?xml version="1.0" encoding="UTF-8"?> | ||
| <project version="4"> | ||
| <component name="JavaScriptSettings"> | ||
| <option name="languageLevel" value="ES6" /> | ||
| </component> | ||
| </project> |
| <?xml version="1.0" encoding="UTF-8"?> | ||
| <project version="4"> | ||
| <component name="ProjectModuleManager"> | ||
| <modules> | ||
| <module fileurl="file://$PROJECT_DIR$/.idea/zw-cli.iml" filepath="$PROJECT_DIR$/.idea/zw-cli.iml" /> | ||
| </modules> | ||
| </component> | ||
| </project> |
| <?xml version="1.0" encoding="UTF-8"?> | ||
| <project version="4"> | ||
| <component name="ChangeListManager"> | ||
| <list default="true" id="edb8718a-2457-4b4f-99a8-2309521362ed" name="Default" comment="" /> | ||
| <ignored path="$PROJECT_DIR$/.tmp/" /> | ||
| <ignored path="$PROJECT_DIR$/temp/" /> | ||
| <ignored path="$PROJECT_DIR$/tmp/" /> | ||
| <option name="EXCLUDED_CONVERTED_TO_IGNORED" value="true" /> | ||
| <option name="TRACKING_ENABLED" value="true" /> | ||
| <option name="SHOW_DIALOG" value="false" /> | ||
| <option name="HIGHLIGHT_CONFLICTS" value="true" /> | ||
| <option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" /> | ||
| <option name="LAST_RESOLUTION" value="IGNORE" /> | ||
| </component> | ||
| <component name="FileEditorManager"> | ||
| <leaf SIDE_TABS_SIZE_LIMIT_KEY="300"> | ||
| <file leaf-file-name="zw.js" pinned="false" current-in-tab="false"> | ||
| <entry file="file://$PROJECT_DIR$/bin/zw.js"> | ||
| <provider selected="true" editor-type-id="text-editor"> | ||
| <state relative-caret-position="75"> | ||
| <caret line="5" column="41" selection-start-line="5" selection-start-column="41" selection-end-line="5" selection-end-column="41" /> | ||
| </state> | ||
| </provider> | ||
| </entry> | ||
| </file> | ||
| <file leaf-file-name="package.json" pinned="false" current-in-tab="true"> | ||
| <entry file="file://$PROJECT_DIR$/package.json"> | ||
| <provider selected="true" editor-type-id="text-editor"> | ||
| <state relative-caret-position="30"> | ||
| <caret line="2" column="21" selection-start-line="2" selection-start-column="21" selection-end-line="2" selection-end-column="21" /> | ||
| </state> | ||
| </provider> | ||
| </entry> | ||
| </file> | ||
| <file leaf-file-name="README.MD" pinned="false" current-in-tab="false"> | ||
| <entry file="file://$PROJECT_DIR$/README.MD"> | ||
| <provider selected="true" editor-type-id="text-editor"> | ||
| <state relative-caret-position="240"> | ||
| <caret line="16" column="12" selection-start-line="16" selection-start-column="12" selection-end-line="16" selection-end-column="12" /> | ||
| </state> | ||
| </provider> | ||
| </entry> | ||
| </file> | ||
| <file leaf-file-name="zw-list.js" pinned="false" current-in-tab="false"> | ||
| <entry file="file://$PROJECT_DIR$/bin/zw-list.js"> | ||
| <provider selected="true" editor-type-id="text-editor"> | ||
| <state relative-caret-position="105"> | ||
| <caret line="7" selection-start-line="7" selection-end-line="7" /> | ||
| </state> | ||
| </provider> | ||
| </entry> | ||
| </file> | ||
| <file leaf-file-name="ask.js" pinned="false" current-in-tab="false"> | ||
| <entry file="file://$PROJECT_DIR$/lib/ask.js"> | ||
| <provider selected="true" editor-type-id="text-editor"> | ||
| <state relative-caret-position="120"> | ||
| <caret line="8" column="1" selection-start-line="8" selection-start-column="1" selection-end-line="8" selection-end-column="1" /> | ||
| </state> | ||
| </provider> | ||
| </entry> | ||
| </file> | ||
| <file leaf-file-name="zw-init.js" pinned="false" current-in-tab="false"> | ||
| <entry file="file://$PROJECT_DIR$/bin/zw-init.js"> | ||
| <provider selected="true" editor-type-id="text-editor"> | ||
| <state relative-caret-position="1605"> | ||
| <caret line="107" column="17" selection-start-line="107" selection-start-column="17" selection-end-line="107" selection-end-column="17" /> | ||
| </state> | ||
| </provider> | ||
| </entry> | ||
| </file> | ||
| </leaf> | ||
| </component> | ||
| <component name="IdeDocumentHistory"> | ||
| <option name="CHANGED_PATHS"> | ||
| <list> | ||
| <option value="$PROJECT_DIR$/meta.js" /> | ||
| <option value="$PROJECT_DIR$/README.md" /> | ||
| <option value="$PROJECT_DIR$/index.js" /> | ||
| <option value="$PROJECT_DIR$/README.MD" /> | ||
| <option value="$PROJECT_DIR$/bin/zw-init.js" /> | ||
| <option value="$PROJECT_DIR$/package.json" /> | ||
| </list> | ||
| </option> | ||
| </component> | ||
| <component name="JsBuildToolGruntFileManager" detection-done="true" sorting="DEFINITION_ORDER" /> | ||
| <component name="JsBuildToolPackageJson" detection-done="true" sorting="DEFINITION_ORDER" /> | ||
| <component name="JsGulpfileManager"> | ||
| <detection-done>true</detection-done> | ||
| <sorting>DEFINITION_ORDER</sorting> | ||
| </component> | ||
| <component name="NodeModulesDirectoryManager"> | ||
| <handled-path value="$PROJECT_DIR$/node_modules" /> | ||
| </component> | ||
| <component name="NodePackageJsonFileManager"> | ||
| <packageJsonPaths> | ||
| <path value="$PROJECT_DIR$/package.json" /> | ||
| </packageJsonPaths> | ||
| </component> | ||
| <component name="ProjectFrameBounds" extendedState="6"> | ||
| <option name="y" value="23" /> | ||
| <option name="width" value="1440" /> | ||
| <option name="height" value="827" /> | ||
| </component> | ||
| <component name="ProjectView"> | ||
| <navigator proportions="" version="1"> | ||
| <foldersAlwaysOnTop value="true" /> | ||
| </navigator> | ||
| <panes> | ||
| <pane id="ProjectPane"> | ||
| <subPane> | ||
| <expand> | ||
| <path> | ||
| <item name="zw-cli" type="b2602c69:ProjectViewProjectNode" /> | ||
| <item name="zw-cli" type="462c0819:PsiDirectoryNode" /> | ||
| </path> | ||
| </expand> | ||
| <select /> | ||
| </subPane> | ||
| </pane> | ||
| <pane id="Scope" /> | ||
| </panes> | ||
| </component> | ||
| <component name="PropertiesComponent"> | ||
| <property name="WebServerToolWindowFactoryState" value="false" /> | ||
| <property name="last_opened_file_path" value="$PROJECT_DIR$" /> | ||
| <property name="nodejs_interpreter_path.stuck_in_default_project" value="undefined stuck path" /> | ||
| <property name="nodejs_npm_path_reset_for_default_project" value="true" /> | ||
| <property name="nodejs_package_manager_path" value="npm" /> | ||
| </component> | ||
| <component name="RecentsManager"> | ||
| <key name="CopyFile.RECENT_KEYS"> | ||
| <recent name="$PROJECT_DIR$" /> | ||
| </key> | ||
| </component> | ||
| <component name="RunDashboard"> | ||
| <option name="ruleStates"> | ||
| <list> | ||
| <RuleState> | ||
| <option name="name" value="ConfigurationTypeDashboardGroupingRule" /> | ||
| </RuleState> | ||
| <RuleState> | ||
| <option name="name" value="StatusDashboardGroupingRule" /> | ||
| </RuleState> | ||
| </list> | ||
| </option> | ||
| </component> | ||
| <component name="SvnConfiguration"> | ||
| <configuration /> | ||
| </component> | ||
| <component name="TaskManager"> | ||
| <task active="true" id="Default" summary="Default task"> | ||
| <changelist id="edb8718a-2457-4b4f-99a8-2309521362ed" name="Default" comment="" /> | ||
| <created>1552304165476</created> | ||
| <option name="number" value="Default" /> | ||
| <option name="presentableId" value="Default" /> | ||
| <updated>1552304165476</updated> | ||
| <workItem from="1552304167844" duration="771000" /> | ||
| <workItem from="1552306647811" duration="650000" /> | ||
| <workItem from="1552307316300" duration="146000" /> | ||
| </task> | ||
| <servers /> | ||
| </component> | ||
| <component name="TimeTrackingManager"> | ||
| <option name="totallyTimeSpent" value="1567000" /> | ||
| </component> | ||
| <component name="ToolWindowManager"> | ||
| <frame x="0" y="23" width="1440" height="827" extended-state="6" /> | ||
| <editor active="true" /> | ||
| <layout> | ||
| <window_info active="true" content_ui="combo" id="Project" order="0" visible="true" weight="0.25" /> | ||
| <window_info anchor="bottom" id="TODO" order="6" /> | ||
| <window_info anchor="bottom" id="Docker" order="7" show_stripe_button="false" /> | ||
| <window_info anchor="bottom" id="Event Log" order="7" side_tool="true" /> | ||
| <window_info anchor="bottom" id="Run" order="2" /> | ||
| <window_info anchor="bottom" id="Version Control" order="7" show_stripe_button="false" /> | ||
| <window_info id="Structure" order="1" side_tool="true" weight="0.25" /> | ||
| <window_info anchor="bottom" id="Terminal" order="7" visible="true" weight="0.3439575" /> | ||
| <window_info anchor="bottom" id="Debug" order="3" weight="0.4" /> | ||
| <window_info id="Favorites" order="2" side_tool="true" /> | ||
| <window_info anchor="right" content_ui="combo" id="Hierarchy" order="2" weight="0.25" /> | ||
| <window_info anchor="bottom" id="Inspection" order="5" weight="0.4" /> | ||
| <window_info anchor="right" id="Commander" internal_type="SLIDING" order="0" type="SLIDING" weight="0.4" /> | ||
| <window_info anchor="right" id="Ant Build" order="1" weight="0.25" /> | ||
| <window_info anchor="bottom" id="Message" order="0" /> | ||
| <window_info anchor="bottom" id="Cvs" order="4" weight="0.25" /> | ||
| <window_info anchor="bottom" id="Find" order="1" /> | ||
| </layout> | ||
| </component> | ||
| <component name="TypeScriptGeneratedFilesManager"> | ||
| <option name="version" value="1" /> | ||
| </component> | ||
| <component name="VcsContentAnnotationSettings"> | ||
| <option name="myLimit" value="2678400000" /> | ||
| </component> | ||
| <component name="editorHistoryManager"> | ||
| <entry file="file://$PROJECT_DIR$/bin/zw.js"> | ||
| <provider selected="true" editor-type-id="text-editor"> | ||
| <state relative-caret-position="75"> | ||
| <caret line="5" column="41" selection-start-line="5" selection-start-column="41" selection-end-line="5" selection-end-column="41" /> | ||
| </state> | ||
| </provider> | ||
| </entry> | ||
| <entry file="file://$PROJECT_DIR$/package.json"> | ||
| <provider selected="true" editor-type-id="text-editor"> | ||
| <state relative-caret-position="90"> | ||
| <caret line="6" column="10" selection-start-line="6" selection-start-column="10" selection-end-line="6" selection-end-column="10" /> | ||
| </state> | ||
| </provider> | ||
| </entry> | ||
| <entry file="file://$PROJECT_DIR$/bin/zw-list.js"> | ||
| <provider selected="true" editor-type-id="text-editor"> | ||
| <state relative-caret-position="105"> | ||
| <caret line="7" selection-start-line="7" selection-end-line="7" /> | ||
| </state> | ||
| </provider> | ||
| </entry> | ||
| <entry file="file://$PROJECT_DIR$/lib/ask.js"> | ||
| <provider selected="true" editor-type-id="text-editor"> | ||
| <state relative-caret-position="120"> | ||
| <caret line="8" column="1" selection-start-line="8" selection-start-column="1" selection-end-line="8" selection-end-column="1" /> | ||
| </state> | ||
| </provider> | ||
| </entry> | ||
| <entry file="file://$PROJECT_DIR$/bin/zw-init.js"> | ||
| <provider selected="true" editor-type-id="text-editor"> | ||
| <state relative-caret-position="1605"> | ||
| <caret line="107" column="17" selection-start-line="107" selection-start-column="17" selection-end-line="107" selection-end-column="17" /> | ||
| </state> | ||
| </provider> | ||
| </entry> | ||
| <entry file="file://$PROJECT_DIR$/index.js" /> | ||
| <entry file="file://$PROJECT_DIR$/package.json"> | ||
| <provider selected="true" editor-type-id="text-editor"> | ||
| <state relative-caret-position="435"> | ||
| <caret line="29" column="4" lean-forward="true" selection-start-line="29" selection-start-column="4" selection-end-line="29" selection-end-column="4" /> | ||
| </state> | ||
| </provider> | ||
| </entry> | ||
| <entry file="file://$PROJECT_DIR$/bin/zw.js"> | ||
| <provider selected="true" editor-type-id="text-editor"> | ||
| <state relative-caret-position="150"> | ||
| <caret line="10" column="27" lean-forward="true" selection-start-line="10" selection-start-column="27" selection-end-line="10" selection-end-column="27" /> | ||
| </state> | ||
| </provider> | ||
| </entry> | ||
| <entry file="file://$PROJECT_DIR$/bin/zw-init.js"> | ||
| <provider selected="true" editor-type-id="text-editor"> | ||
| <state relative-caret-position="1740"> | ||
| <caret line="116" column="49" selection-start-line="116" selection-start-column="43" selection-end-line="116" selection-end-column="49" /> | ||
| </state> | ||
| </provider> | ||
| </entry> | ||
| <entry file="file://$PROJECT_DIR$/README.MD"> | ||
| <provider selected="true" editor-type-id="text-editor"> | ||
| <state relative-caret-position="270"> | ||
| <caret line="18" column="5" selection-start-line="18" selection-end-line="18" selection-end-column="13" /> | ||
| </state> | ||
| </provider> | ||
| </entry> | ||
| <entry file="file://$PROJECT_DIR$/meta.js" /> | ||
| <entry file="file://$PROJECT_DIR$/template/README.md" /> | ||
| <entry file="file://$PROJECT_DIR$/template/postcss.config.js" /> | ||
| <entry file="file://$PROJECT_DIR$/template/.stylelintrc" /> | ||
| <entry file="file://$PROJECT_DIR$/template/.gitignore" /> | ||
| <entry file="file://$PROJECT_DIR$/template/.eslintrc" /> | ||
| <entry file="file://$PROJECT_DIR$/template/.eslintignore" /> | ||
| <entry file="file://$PROJECT_DIR$/template/.babelrc" /> | ||
| <entry file="file://$PROJECT_DIR$/template/src/index.hbs" /> | ||
| <entry file="file://$PROJECT_DIR$/template/src/main.js" /> | ||
| <entry file="file://$PROJECT_DIR$/template/src/router.js" /> | ||
| <entry file="file://$PROJECT_DIR$/template/build/build.js" /> | ||
| <entry file="file://$PROJECT_DIR$/template/build/webpack.base.conf.js" /> | ||
| <entry file="file://$PROJECT_DIR$/utils/index.js" /> | ||
| <entry file="file://$PROJECT_DIR$/bin/demo.js" /> | ||
| <entry file="file://$PROJECT_DIR$/bin/zw-list.js"> | ||
| <provider selected="true" editor-type-id="text-editor"> | ||
| <state relative-caret-position="105"> | ||
| <caret line="7" selection-start-line="7" selection-end-line="7" /> | ||
| </state> | ||
| </provider> | ||
| </entry> | ||
| <entry file="file://$PROJECT_DIR$/lib/ask.js"> | ||
| <provider selected="true" editor-type-id="text-editor"> | ||
| <state relative-caret-position="120"> | ||
| <caret line="8" column="1" selection-start-line="8" selection-start-column="1" selection-end-line="8" selection-end-column="1" /> | ||
| </state> | ||
| </provider> | ||
| </entry> | ||
| <entry file="file://$PROJECT_DIR$/package-lock.json"> | ||
| <provider selected="true" editor-type-id="text-editor" /> | ||
| </entry> | ||
| <entry file="file://$PROJECT_DIR$/bin/zw-init.js"> | ||
| <provider selected="true" editor-type-id="text-editor"> | ||
| <state relative-caret-position="1605"> | ||
| <caret line="107" column="17" selection-start-line="107" selection-start-column="17" selection-end-line="107" selection-end-column="17" /> | ||
| </state> | ||
| </provider> | ||
| </entry> | ||
| <entry file="file://$PROJECT_DIR$/index.js" /> | ||
| <entry file="file://$PROJECT_DIR$/bin/zw.js"> | ||
| <provider selected="true" editor-type-id="text-editor"> | ||
| <state relative-caret-position="75"> | ||
| <caret line="5" column="41" selection-start-line="5" selection-start-column="41" selection-end-line="5" selection-end-column="41" /> | ||
| </state> | ||
| </provider> | ||
| </entry> | ||
| <entry file="file://$PROJECT_DIR$/README.MD"> | ||
| <provider selected="true" editor-type-id="text-editor"> | ||
| <state relative-caret-position="240"> | ||
| <caret line="16" column="12" selection-start-line="16" selection-start-column="12" selection-end-line="16" selection-end-column="12" /> | ||
| </state> | ||
| </provider> | ||
| </entry> | ||
| <entry file="file://$PROJECT_DIR$/package.json"> | ||
| <provider selected="true" editor-type-id="text-editor"> | ||
| <state relative-caret-position="30"> | ||
| <caret line="2" column="21" selection-start-line="2" selection-start-column="21" selection-end-line="2" selection-end-column="21" /> | ||
| </state> | ||
| </provider> | ||
| </entry> | ||
| </component> | ||
| </project> |
Sorry, the diff of this file is not supported yet
| #!/usr/bin/env node | ||
| const clone = require('git-clone') | ||
| const program = require('commander') | ||
| const shell = require('shelljs'); | ||
| // const log = require('tracer').colorConsole() | ||
| program | ||
| .version('1.0.0') | ||
| .description('xserver中间件应用模板工程的cli') | ||
| program | ||
| .command('* <tpl> <project>') | ||
| .action(function(tpl, project) { | ||
| console.info('目前xserver-cli支持以下模板:') | ||
| console.info('使用例子:x-cli x-express myproject') | ||
| if (tpl && project) { | ||
| let pwd = shell.pwd() | ||
| console.info(`正在拉取模板代码,下载位置:${pwd}/${project}/ ...`) | ||
| clone(`https://github.com/zhaowei-plus/wb-layout.git`, pwd + `/${project}`, { clone: true }, function() { | ||
| shell.rm('-rf', pwd + `/${project}/.git`) | ||
| console.info('模板工程建立完成') | ||
| }) | ||
| } else { | ||
| console.error('正确命令例子:x-cli x-express myproject') | ||
| } | ||
| }) | ||
| program.parse(process.argv) |
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
Uses eval
Supply chain riskPackage uses dynamic code execution (e.g., eval()), which is a dangerous practice. This can prevent the code from running in certain environments and increases the risk that the code may contain exploits or malicious behavior.
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
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
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
Uses eval
Supply chain riskPackage uses dynamic code execution (e.g., eval()), which is a dangerous practice. This can prevent the code from running in certain environments and increases the risk that the code may contain exploits or malicious behavior.
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
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
Found 1 instance in 1 package
0
-100%17173
-50.8%15
-21.05%500
-11.03%+ Added
+ Added
+ Added
+ Added
+ Added
- Removed
- Removed
Updated
Updated
Updated
Updated
Updated