-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* perf(tua-mp, cli, service): add test for test/ * fix: close #58, update npm deps, fix mock * feat(cli): update template for tua-api * refactor: commander -> yargs
- Loading branch information
Showing
53 changed files
with
375 additions
and
272 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
#!/usr/bin/env node | ||
|
||
const semver = require('semver') | ||
|
||
const packageJson = require('../package.json') | ||
|
||
const { | ||
name: projectName, | ||
engines: { node: requiredVersion }, | ||
} = packageJson | ||
|
||
// 检查 node 版本 | ||
if (!semver.satisfies(process.version, requiredVersion)) { | ||
console.error( | ||
`You are using Node ${process.version}, but ${projectName} ` + | ||
`requires Node ${requiredVersion}.` + | ||
`Please upgrade your Node version.` | ||
) | ||
process.exit(1) | ||
} | ||
|
||
require('yargs') | ||
.alias('v', 'version') | ||
.alias('h', 'help') | ||
// 命令目录 | ||
.commandDir('../commands/') | ||
.demandCommand(1) | ||
.parse() |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
exports.desc = 'add some template code to your project' | ||
exports.aliases = 'a' | ||
exports.command = 'add <command>' | ||
|
||
exports.builder = yargs => yargs.commandDir('./addCmds') | ||
|
||
exports.handler = () => {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
// 新增 api | ||
|
||
exports.desc = 'add an api for your project' | ||
exports.aliases = 'a' | ||
exports.command = 'api <name>' | ||
exports.builder = {} | ||
|
||
exports.handler = (argv) => { | ||
const name = argv.name | ||
|
||
require('../../lib/addApi')(name) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
// 新增组件 | ||
|
||
exports.desc = 'add a component for your project' | ||
exports.aliases = 'c' | ||
exports.command = 'comp <name>' | ||
|
||
exports.builder = (yargs) => yargs | ||
.option('global', { | ||
alias: 'g', | ||
default: false, | ||
describe: 'add a global component in src/comps/', | ||
}) | ||
|
||
exports.handler = (argv) => { | ||
const name = argv.name | ||
const global = argv.global | ||
|
||
require('../../lib/addComp')(name, { global }) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
// 新增页面 | ||
|
||
exports.desc = 'add a page for your project' | ||
exports.aliases = 'p' | ||
exports.command = 'page <name>' | ||
|
||
exports.builder = {} | ||
|
||
exports.handler = (argv) => { | ||
const name = argv.name | ||
|
||
require('../../lib/addPage')(name) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
// 初始化项目(代理 vue-cli v2 的 init) | ||
|
||
exports.desc = 'init project by vue-cli v2' | ||
exports.aliases = 'i' | ||
exports.command = 'init <template> <name>' | ||
|
||
exports.builder = {} | ||
exports.handler = () => { require('@vue/cli-init') } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.