-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathvariables.js
More file actions
48 lines (43 loc) · 1.17 KB
/
Copy pathvariables.js
File metadata and controls
48 lines (43 loc) · 1.17 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
import { program } from 'commander';
import os from 'node:os';
import path from 'node:path';
import { version } from '../package.json';
/**
* @type String
*/
export const curDir = process.cwd();
/**
* @type String
*/
export const tmpDir = os.tmpdir();
/**
* @type String
*/
export const patchDir = path.join(curDir, 'patches');
program
.name('custompatch')
.usage('[options] [packageName ...]')
.version(version)
.description(
'Tool for patching buggy NPM packages instead of forking them.\n' +
'When invoked without arguments - apply all patches from the "patches" folder.\n' +
'If one or more package names are specified - create a patch for the given NPM package ' +
'(already patched by you in your "node_modules" folder) and save it inside "patches" folder.'
)
.option(
'-a, --all',
'Include "package.json" files in the patch, by default these are ignored'
)
.option(
'-r, --reverse',
'Reverse the patch(es) instead of applying them'
)
.option(
'-p, --patch',
'Apply the patch(es) to the specified package(s) instead of all patches'
);
program.parse();
/**
* @type Object
*/
export const programOptions = program.opts();