-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathcode-mod
executable file
·31 lines (23 loc) · 940 Bytes
/
code-mod
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
#!/usr/bin/env node
const utils = require('node:util')
const { positionals } = utils.parseArgs({ allowPositionals: true });
if (positionals.length < 1) {
console.error('please provide command.');
console.log('command can be on of the following:');
console.log(' - deprecate-create');
process.exit(1);
}
if (positionals[0] === 'deprecate-create') {
const dcOptions = utils.parseArgs({
allowPositionals: true,
options: { 'dry-run': { type: 'boolean' } }
})
if (dcOptions.positionals.length < 2) {
console.error('please provide the file path to process');
console.log('example: code-mod deprecate-create ./src/index.js');
process.exit(1);
}
const mod = require('./dist/mods/deprecate-create');
console.log('running this code mode may requires you to reformat the code afterward, so deal file by file is the best')
mod.processFile(dcOptions.positionals[1], dcOptions.values['dry-run']);
}