first commit

This commit is contained in:
编码猿
2024-09-27 00:52:52 +08:00
commit d5a61090de
72 changed files with 11656 additions and 0 deletions

1
whtml-cli/bin/.pydio Normal file
View File

@@ -0,0 +1 @@
31a084b9-4616-4629-9b7e-1b1a17db3970

8
whtml-cli/bin/whtml Executable file
View File

@@ -0,0 +1,8 @@
#!/usr/bin/env node
require('commander')
.version(require('../package').version)
.usage('<command> [options]')
.command('init', 'generate a new project from a template')
.command('list', 'list available official templates')
.parse(process.argv)

50
whtml-cli/bin/whtml-init Executable file
View File

@@ -0,0 +1,50 @@
#!/usr/bin/env node
const program = require('commander')
const exec = require('child_process').exec
const chalk = require('chalk')
const ora = require('ora')
const { GetUserInfo } = require('./../lib')
const config = require('../package')
program.on('--help', () => {
console.log()
console.log(' Examples:')
console.log()
console.log(chalk.gray(' # create a new project with an official template'))
console.log(' $ whtml init my-project')
console.log()
})
function help () {
program.parse(process.argv)
if (program.args.length < 1) return program.help()
}
help()
let projectName = program.args[0], gitUrl, branch, cmdStr
gitUrl = config.git.url, branch = config.git.branch
cmdStr = `git clone ${gitUrl} ${projectName} && cd ${projectName} && git checkout ${branch}`
run(cmdStr)
GetUserInfo()
const spinner = ora('downloading template...')
spinner.start()
function run(url){
exec(url, (error, stdout, stderr) => {
if (error) {
console.log(error)
process.exit()
}
spinner.stop()
console.log(chalk.green('\n √ Download Success...'))
console.log(chalk.green(`\n cd ${projectName} #Enter the folder\n npm install #Resolve dependence\n npm run all #Running project`))
console.log()
process.exit()
})
}

13
whtml-cli/bin/whtml-list Executable file
View File

@@ -0,0 +1,13 @@
#!/usr/bin/env node
const config = require('../package')
const chalk = require('chalk')
console.log()
console.log(
chalk.green(
`作者:${config.git.auto}\n项目地址:${config.git.url} \n分支${config.git.branch}`
)
)
console.log()
process.exit()