1
1
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:
Brent Jackson 2018-06-03 19:05:31 -04:00
parent abfcf8f70a
commit 0b75d3715c
5 changed files with 51 additions and 3 deletions

34
create-x0/cli.js Executable file
View 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
View 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"
}
}

View File

@ -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

View File

@ -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"