-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.ts
75 lines (65 loc) · 1.6 KB
/
index.ts
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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
#!/usr/bin/env node
/**
* **`@sgrud/bin`** - The [SGRUD](https://sgrud.github.io) CLI.
*
* ```text
* Description
* @sgrud/bin - The SGRUD CLI
*
* Usage
* $ sgrud <command> [options]
*
* Available Commands
* construct Builds a SGRUD-based project using `microbundle`
* kickstart Kickstarts a SGRUD-based project using `simple-git`
* postbuild Replicates exported package metadata for SGRUD-based projects
* runtimify Creates ESM or UMD bundles for ES6 modules using `microbundle`
* universal Runs SGRUD in universal (SSR) mode using `puppeteer`
*
* For more info, run any command with the `--help` flag
* $ sgrud construct --help
* $ sgrud kickstart --help
*
* Options
* -v, --version Displays current version
* -h, --help Displays this message
* ```
*
* @packageDocumentation
*/
import { cli } from './src/.cli';
import { construct } from './src/construct';
import { kickstart } from './src/kickstart';
import { postbuild } from './src/postbuild';
import { runtimify } from './src/runtimify';
import { universal } from './src/universal';
declare global {
/**
* Global [SGRUD](https://sgrud.github.io) namespace.
*/
namespace sgrud {
/**
* `@sgrud/bin` - The [SGRUD](https://sgrud.github.io) CLI.
*/
const bin: typeof module;
}
}
const module = {
construct,
kickstart,
postbuild,
runtimify,
universal
};
if (process.argv[1]?.endsWith('sgrud')) {
cli.parse(process.argv);
} else {
global.sgrud = { bin: module } as typeof sgrud;
}
export {
construct,
kickstart,
postbuild,
runtimify,
universal
};