mirror of
https://github.com/c8r/x0.git
synced 2024-08-17 01:10:32 +03:00
Add create-x0 package
This commit is contained in:
parent
abfcf8f70a
commit
0b75d3715c
34
create-x0/cli.js
Executable file
34
create-x0/cli.js
Executable file
@ -0,0 +1,34 @@
|
||||
#!/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)
|
||||
})
|
14
create-x0/package.json
Normal file
14
create-x0/package.json
Normal file
@ -0,0 +1,14 @@
|
||||
{
|
||||
"name": "create-x0",
|
||||
"version": "1.0.0",
|
||||
"description": "Create an x0 starter project",
|
||||
"bin": {
|
||||
"create-x0": "./cli.js"
|
||||
},
|
||||
"keywords": [],
|
||||
"author": "Brent Jackson",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"initit": "^1.0.0-2"
|
||||
}
|
||||
}
|
@ -11,7 +11,7 @@ npm install
|
||||
npm start
|
||||
```
|
||||
|
||||
Editing `index.js` will live update in the development server.
|
||||
Editing `src/index.js` will live update in the development server.
|
||||
|
||||
## Static Build
|
||||
|
||||
|
@ -2,8 +2,8 @@
|
||||
"name": "x0-basic-example",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"start": "x0 . -o",
|
||||
"build": "x0 build ."
|
||||
"start": "x0 src -o",
|
||||
"build": "x0 build src"
|
||||
},
|
||||
"dependencies": {
|
||||
"@compositor/x0": "^5.0.0"
|
||||
|
Loading…
Reference in New Issue
Block a user