UNPKG

1.87 kBPlain TextView Raw
1#!/usr/bin/env node
2const cli = require('yargs').version();
3
4//FIXME: uses cli.js instead of vitreum in the help
5cli.command('* [targets...]', 'Build your project', (yargs)=>{
6 yargs
7 .positional('targets', {
8 describe: 'Entrypoints to build'
9 })
10 .option('dev', {
11 alias : 'd',
12 type : 'boolean',
13 describe : 'Run a dev build of the project'
14 })
15 .option('static', {
16 alias : 's',
17 type : 'boolean',
18 describe : 'Create static renders of the entrypoints'
19 })
20}, (args)=>{
21 (args.dev
22 ? require('../dev.js')
23 : require('../build.js')
24 )(args.targets, args)
25 .catch((err)=>{
26 // console.log('---------------------');
27 console.log(err)
28 console.log('THERE ARE ERRORS');
29 process.exit(0);
30 })
31});
32
33cli.command('init', 'Bootstrap a vitreum project', (yargs)=>{
34 yargs
35 .option('lint', {
36 alias : 'l',
37 type : 'boolean',
38 describe : 'Add in eslint config',
39 })
40 .option('tests', {
41 alias : 't',
42 type : 'boolean',
43 describe : 'Add in tests',
44 })
45 .option('flux', {
46 alias : 'f',
47 type : 'boolean',
48 describe : 'Add in flux stores, actions, and smart component',
49 })
50 .option('all', {
51 alias : 'y',
52 type : 'boolean',
53 describe : 'Select everything',
54 })
55}, (args)=>require('./templates/init.js')(args));
56
57cli.command('jsx <component>', 'Create a jsx component', (yargs)=>{
58 yargs
59 .positional('component', {
60 describe: 'name of component',
61 })
62 .option('class',{
63 alias : 'c',
64 type : 'boolean',
65 describe : 'Create a class-based component',
66 })
67 .option('smart',{
68 alias : 's',
69 type : 'boolean',
70 describe : 'Create a smart component',
71 })
72 .option('yaml',{
73 alias : 'y',
74 type : 'boolean',
75 describe : 'Adds a yaml content file',
76 })
77}, (args)=>require('./templates/jsx.js')(args));
78
79cli.help('help').alias('help', 'h').argv;
\No newline at end of file