-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcli.js
More file actions
executable file
·75 lines (64 loc) · 1.93 KB
/
Copy pathcli.js
File metadata and controls
executable file
·75 lines (64 loc) · 1.93 KB
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
import { program } from 'commander';
import './src/defaultCommand.js';
import { create, serve, build, pack, preview, update } from './index.js';
import { version } from './src/pluginCliHelper.js';
import setupMapUi from './src/setupMapUi.js';
import buildStagingApp from './src/buildStagingApp.js';
import ensureTypes from './src/ensureTypes.js';
program.version(version);
program
.command('create')
.summary('create new plugin')
.defaultOptions()
.option('-t --typescript', 'Create a plugin using typescript')
.option('-d --default <name>', 'use defaults')
.safeAction(create);
program
.command('bundle')
.summary('pack tar for production')
.defaultOptions()
.alias('pack')
.safeAction(pack);
program
.command('preview')
.summary('start preview server')
.defaultOptions()
.defaultServeOptions()
.option('--vcm [url]', 'URL to a VC MAP application', (val) =>
val.replace(/\/$/, ''),
)
.safeAction(preview);
program
.command('serve')
.summary('start dev server')
.defaultOptions()
.defaultServeOptions()
.option(
'--appConfig [config]',
'an optional app config (either file or URL) to use',
)
.safeAction(serve);
program
.command('build')
.description('builds plugin including assets using vite')
.defaultOptions()
.option('--development', 'set mode to development')
.option('--watch', 'watch file changes')
.safeAction(build);
program.command('buildStagingApp').defaultOptions().safeAction(buildStagingApp);
program
.command('setup-map-ui')
.description('make other plugins of @vcmap/ui available in dev server')
.safeAction(setupMapUi);
program
.command('update')
.description('update to (latest) VC Map version')
.defaultOptions()
.option(
'--mapVersion [semver]',
'an optional semver range to update to, e.g. 5.0 (Default is latest)',
)
.safeAction(update);
program.command('ensure-types').action(ensureTypes);
program.parse(process.argv);