-
Notifications
You must be signed in to change notification settings - Fork 2
/
cli.js
executable file
·41 lines (36 loc) · 1.1 KB
/
cli.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
34
35
36
37
38
39
40
41
#!/usr/bin/env node
'use strict';
import { readFileSync } from 'fs';
import chalk from 'chalk';
import yargs from 'yargs';
import boxen from 'boxen';
import * as commands from './commands/index.js';
const { version } = JSON.parse(
readFileSync(new URL('./package.json', import.meta.url), {
encoding: 'utf8',
}),
);
const greeting = chalk.white.bold(`Podium Podlet Server (v${version})`);
const args = process.argv.slice(2);
const msgBox = boxen(greeting, { padding: 0.5 });
// eslint-disable-next-line
console.clear();
// eslint-disable-next-line
!args.includes('start') && console.log(msgBox);
// eslint-disable-next-line
yargs(args)
.command(commands.build)
.command(commands.start)
.command(commands.dev)
.command(commands.i18n)
.example('podlet build', 'Builds the podlet ready for production use')
.example('podlet start', 'Serves the podlet in production')
.example('podlet dev', 'Builds and serves the podlet in development mode')
.example(
'podlet i18n [command]',
'Handles extraction and compilation of messages',
)
.demandCommand()
.wrap(150)
.version(false)
.help().argv;