-
Notifications
You must be signed in to change notification settings - Fork 326
/
Copy pathcli.js
57 lines (52 loc) · 1.65 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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
#!/usr/bin/env node
import { render } from 'ink';
import meow from 'meow';
import React from 'react';
import App from './app.js';
import sdks from './constants/sdks.js';
const cli = meow(
`
Usage
$ clerk-upgrade
Options
--from Major version number you're upgrading from
--to Major version number you're upgrading to
--sdk Name of the SDK you're upgrading
--dir Directory you'd like to scan for files
--ignore Any files or directories you'd like to ignore
--noWarnings Do not print warnings, only items that must be fixed
--disableTelemetry Do not send anonymous usage telemetry
Examples
$ clerk-upgrade --sdk=nextjs --dir=src/**
$ clerk-upgrade --ignore=**/public/** --ignore=**/dist/**
$ clerk-upgrade --from=core-1 --to=core-2
`,
{
importMeta: import.meta,
flags: {
from: { type: 'string' },
to: { type: 'string' },
sdk: { type: 'string', choices: sdks.map(i => i.value) },
dir: { type: 'string' },
ignore: { type: 'string', isMultiple: true },
yolo: { type: 'boolean' },
noWarnings: { type: 'boolean' },
disableTelemetry: { type: 'boolean' },
},
},
);
render(
<App
dir={cli.flags.dir}
disableTelemetry={cli.flags.disableTelemetry}
fromVersion={cli.flags.from}
ignore={cli.flags.ignore}
noWarnings={cli.flags.noWarnings}
packageManager={cli.flags.packageManager}
sdk={cli.flags.sdk}
toVersion={cli.flags.to}
yolo={cli.flags.yolo}
/>,
// if having issues with errors being swallowed, uncomment this
// { debug: true },
);