-
Notifications
You must be signed in to change notification settings - Fork 3
/
index.js
51 lines (48 loc) · 1.15 KB
/
index.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
#!/usr/bin/env node
const jscodeshift = require('jscodeshift/src/Runner');
const path = require('path');
const options = require('yargs')
.option('path', {
alias: 'p',
demandOption: true
})
.option('current-import-sources', {
alias: 's',
array: true,
demandOption: true
})
.option('target-import-source', {
alias: 't',
demandOption: true
})
.option('only-imported-exports', {
alias: 'e',
array: true,
default: []
})
.option('dry-run', {
alias: 'd',
boolean: true,
default: false
})
.option('fuzzy-match', {
alias: 'f',
boolean: true,
default: false
})
.argv;
jscodeshift.run(
path.resolve(__dirname, 'transform.js'),
[options.path],
{
extensions: 'ts',
parser: 'ts',
dry: options.dryRun,
transformOptions: {
fuzzyMatch: options.fuzzyMatch,
currentImportSources: options.currentImportSources,
targetImportSource: options.targetImportSource,
onlyImportedExports: options.onlyImportedExports
}
}
);