forked from saltyshiomix/nextron
-
Notifications
You must be signed in to change notification settings - Fork 0
/
dev.js
33 lines (27 loc) · 855 Bytes
/
dev.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
const { remove, existsSync } = require('fs-extra');
const { resolve } = require('path');
const { execSync } = require('child_process');
const chalk = require('chalk');
async function dev() {
process.env.NODE_ENV = 'testing';
let example = 'with-javascript-emotion';
if (3 <= process.argv.length) {
const newExample = process.argv[2];
if (!existsSync(resolve(__dirname, `examples/${newExample}`))) {
console.log(chalk.red(`Not found examples/${newExample}`));
console.log('');
process.exit(1);
}
example = newExample;
}
await remove('workspace');
execSync('node ' + resolve(__dirname, 'bin/nextron') + ` init workspace --example ${example}`, {
cwd: __dirname,
stdio: 'inherit',
});
execSync('yarn && yarn dev', {
cwd: resolve(__dirname, 'workspace'),
stdio: 'inherit',
});
}
dev();