mirror of
https://github.com/c8r/x0.git
synced 2024-09-11 13:45:52 +03:00
35 lines
610 B
JavaScript
Executable File
35 lines
610 B
JavaScript
Executable File
#!/usr/bin/env node
|
|
const path = require('path')
|
|
const init = require('initit')
|
|
const chalk = require('chalk')
|
|
|
|
const [ name ] = process.argv.slice(2)
|
|
const template = 'c8r/x0/examples/basic'
|
|
|
|
if (!name) {
|
|
console.log('name is required: $ create-x0 my-project')
|
|
process.exit(1)
|
|
}
|
|
|
|
console.log('Creating x0 project ', chalk.green(name))
|
|
console.log()
|
|
|
|
init({
|
|
name,
|
|
template,
|
|
})
|
|
.then(res => {
|
|
console.log(
|
|
chalk.green(
|
|
'Successfully created new x0 project'
|
|
)
|
|
)
|
|
process.exit(0)
|
|
})
|
|
.catch(err => {
|
|
console.log(
|
|
chalk.red(err)
|
|
)
|
|
process.exit(1)
|
|
})
|