@zkochan/cmd-shim 5.2.1 → 5.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +27 -27
- package/README.md +51 -51
- package/index.d.ts +72 -72
- package/index.js +404 -404
- package/index.js.map +1 -1
- package/package.json +1 -1
package/LICENSE
CHANGED
|
@@ -1,27 +1,27 @@
|
|
|
1
|
-
Copyright (c) Isaac Z. Schlueter ("Author")
|
|
2
|
-
All rights reserved.
|
|
3
|
-
|
|
4
|
-
The BSD License
|
|
5
|
-
|
|
6
|
-
Redistribution and use in source and binary forms, with or without
|
|
7
|
-
modification, are permitted provided that the following conditions
|
|
8
|
-
are met:
|
|
9
|
-
|
|
10
|
-
1. Redistributions of source code must retain the above copyright
|
|
11
|
-
notice, this list of conditions and the following disclaimer.
|
|
12
|
-
|
|
13
|
-
2. Redistributions in binary form must reproduce the above copyright
|
|
14
|
-
notice, this list of conditions and the following disclaimer in the
|
|
15
|
-
documentation and/or other materials provided with the distribution.
|
|
16
|
-
|
|
17
|
-
THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
|
|
18
|
-
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
19
|
-
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
|
20
|
-
PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS
|
|
21
|
-
BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
|
22
|
-
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
|
23
|
-
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
|
|
24
|
-
BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
|
25
|
-
WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
|
|
26
|
-
OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
|
|
27
|
-
IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
1
|
+
Copyright (c) Isaac Z. Schlueter ("Author")
|
|
2
|
+
All rights reserved.
|
|
3
|
+
|
|
4
|
+
The BSD License
|
|
5
|
+
|
|
6
|
+
Redistribution and use in source and binary forms, with or without
|
|
7
|
+
modification, are permitted provided that the following conditions
|
|
8
|
+
are met:
|
|
9
|
+
|
|
10
|
+
1. Redistributions of source code must retain the above copyright
|
|
11
|
+
notice, this list of conditions and the following disclaimer.
|
|
12
|
+
|
|
13
|
+
2. Redistributions in binary form must reproduce the above copyright
|
|
14
|
+
notice, this list of conditions and the following disclaimer in the
|
|
15
|
+
documentation and/or other materials provided with the distribution.
|
|
16
|
+
|
|
17
|
+
THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
|
|
18
|
+
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
19
|
+
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
|
20
|
+
PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS
|
|
21
|
+
BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
|
22
|
+
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
|
23
|
+
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
|
|
24
|
+
BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
|
25
|
+
WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
|
|
26
|
+
OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
|
|
27
|
+
IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
package/README.md
CHANGED
|
@@ -1,51 +1,51 @@
|
|
|
1
|
-
# @zkochan/cmd-shim
|
|
2
|
-
|
|
3
|
-
> Used in pnpm for command line application support
|
|
4
|
-
|
|
5
|
-
<!--@shields('travis', 'appveyor', 'npm')-->
|
|
6
|
-
[](https://travis-ci.org/pnpm/cmd-shim) [](https://ci.appveyor.com/project/zkochan/cmd-shim-8ah3a/branch/master) [](https://www.npmjs.com/package/@zkochan/cmd-shim)
|
|
7
|
-
<!--/@-->
|
|
8
|
-
|
|
9
|
-
The cmd-shim used in [pnpm](https://github.com/rstacruz/pnpm) to create executable scripts.
|
|
10
|
-
|
|
11
|
-
## Installation
|
|
12
|
-
|
|
13
|
-
```sh
|
|
14
|
-
npm install --save @zkochan/cmd-shim
|
|
15
|
-
```
|
|
16
|
-
|
|
17
|
-
## API
|
|
18
|
-
|
|
19
|
-
### `cmdShim(src, to, opts?): Promise<void>`
|
|
20
|
-
|
|
21
|
-
Create a cmd shim at `to` for the command line program at `from`.
|
|
22
|
-
e.g.
|
|
23
|
-
|
|
24
|
-
```javascript
|
|
25
|
-
const cmdShim = require('@zkochan/cmd-shim')
|
|
26
|
-
cmdShim(__dirname + '/cli.js', '/usr/bin/command-name')
|
|
27
|
-
.catch(err => console.error(err))
|
|
28
|
-
```
|
|
29
|
-
|
|
30
|
-
### `cmdShim.ifExists(src, to, opts?): Promise<void>`
|
|
31
|
-
|
|
32
|
-
The same as above, but will just continue if the file does not exist.
|
|
33
|
-
|
|
34
|
-
#### Arguments:
|
|
35
|
-
|
|
36
|
-
- `opts.preserveSymlinks` - _Boolean_ - if true, `--preserve-symlinks` is added to the options passed to NodeJS.
|
|
37
|
-
- `opts.nodePath` - _String_ - sets the [NODE_PATH](https://nodejs.org/api/cli.html#cli_node_path_path) env variable.
|
|
38
|
-
- `opts.nodeExecPath` - _String_ - sets the path to the Node.js executable.
|
|
39
|
-
- `opts.createCmdFile` - _Boolean_ - is `true` on Windows by default. If true, creates a cmd file.
|
|
40
|
-
- `opts.createPwshFile` - _Boolean_ - is `true` by default. If true, creates a powershell file.
|
|
41
|
-
- `opts.progArgs` - String - optional arguments that will be prepend to any CLI arguments
|
|
42
|
-
|
|
43
|
-
```javascript
|
|
44
|
-
const cmdShim = require('@zkochan/cmd-shim')
|
|
45
|
-
cmdShim(__dirname + '/cli.js', '/usr/bin/command-name', { preserveSymlinks: true })
|
|
46
|
-
.catch(err => console.error(err))
|
|
47
|
-
```
|
|
48
|
-
|
|
49
|
-
## License
|
|
50
|
-
|
|
51
|
-
[BSD-2-Clause](./LICENSE) © [Zoltan Kochan](http://kochan.io)
|
|
1
|
+
# @zkochan/cmd-shim
|
|
2
|
+
|
|
3
|
+
> Used in pnpm for command line application support
|
|
4
|
+
|
|
5
|
+
<!--@shields('travis', 'appveyor', 'npm')-->
|
|
6
|
+
[](https://travis-ci.org/pnpm/cmd-shim) [](https://ci.appveyor.com/project/zkochan/cmd-shim-8ah3a/branch/master) [](https://www.npmjs.com/package/@zkochan/cmd-shim)
|
|
7
|
+
<!--/@-->
|
|
8
|
+
|
|
9
|
+
The cmd-shim used in [pnpm](https://github.com/rstacruz/pnpm) to create executable scripts.
|
|
10
|
+
|
|
11
|
+
## Installation
|
|
12
|
+
|
|
13
|
+
```sh
|
|
14
|
+
npm install --save @zkochan/cmd-shim
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
## API
|
|
18
|
+
|
|
19
|
+
### `cmdShim(src, to, opts?): Promise<void>`
|
|
20
|
+
|
|
21
|
+
Create a cmd shim at `to` for the command line program at `from`.
|
|
22
|
+
e.g.
|
|
23
|
+
|
|
24
|
+
```javascript
|
|
25
|
+
const cmdShim = require('@zkochan/cmd-shim')
|
|
26
|
+
cmdShim(__dirname + '/cli.js', '/usr/bin/command-name')
|
|
27
|
+
.catch(err => console.error(err))
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
### `cmdShim.ifExists(src, to, opts?): Promise<void>`
|
|
31
|
+
|
|
32
|
+
The same as above, but will just continue if the file does not exist.
|
|
33
|
+
|
|
34
|
+
#### Arguments:
|
|
35
|
+
|
|
36
|
+
- `opts.preserveSymlinks` - _Boolean_ - if true, `--preserve-symlinks` is added to the options passed to NodeJS.
|
|
37
|
+
- `opts.nodePath` - _String_ - sets the [NODE_PATH](https://nodejs.org/api/cli.html#cli_node_path_path) env variable.
|
|
38
|
+
- `opts.nodeExecPath` - _String_ - sets the path to the Node.js executable.
|
|
39
|
+
- `opts.createCmdFile` - _Boolean_ - is `true` on Windows by default. If true, creates a cmd file.
|
|
40
|
+
- `opts.createPwshFile` - _Boolean_ - is `true` by default. If true, creates a powershell file.
|
|
41
|
+
- `opts.progArgs` - String - optional arguments that will be prepend to any CLI arguments
|
|
42
|
+
|
|
43
|
+
```javascript
|
|
44
|
+
const cmdShim = require('@zkochan/cmd-shim')
|
|
45
|
+
cmdShim(__dirname + '/cli.js', '/usr/bin/command-name', { preserveSymlinks: true })
|
|
46
|
+
.catch(err => console.error(err))
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
## License
|
|
50
|
+
|
|
51
|
+
[BSD-2-Clause](./LICENSE) © [Zoltan Kochan](http://kochan.io)
|
package/index.d.ts
CHANGED
|
@@ -1,73 +1,73 @@
|
|
|
1
|
-
declare namespace cmdShim {
|
|
2
|
-
interface Options {
|
|
3
|
-
/**
|
|
4
|
-
* If a PowerShell script should be created.
|
|
5
|
-
*
|
|
6
|
-
* @default true
|
|
7
|
-
*/
|
|
8
|
-
createPwshFile?: boolean;
|
|
9
|
-
/**
|
|
10
|
-
* If a Windows Command Prompt script should be created.
|
|
11
|
-
*
|
|
12
|
-
* @default false
|
|
13
|
-
*/
|
|
14
|
-
createCmdFile?: boolean;
|
|
15
|
-
/**
|
|
16
|
-
* If symbolic links should be preserved.
|
|
17
|
-
*
|
|
18
|
-
* @default false
|
|
19
|
-
*/
|
|
20
|
-
preserveSymlinks?: boolean;
|
|
21
|
-
/**
|
|
22
|
-
* The path to the executable file.
|
|
23
|
-
*/
|
|
24
|
-
prog?: string;
|
|
25
|
-
/**
|
|
26
|
-
* The arguments to initialize the `node` process with.
|
|
27
|
-
*/
|
|
28
|
-
args?: string;
|
|
29
|
-
/**
|
|
30
|
-
* The arguments to initialize the target process with, before the actual CLI arguments
|
|
31
|
-
*/
|
|
32
|
-
progArgs?: string[];
|
|
33
|
-
/**
|
|
34
|
-
* The value of the $NODE_PATH environment variable.
|
|
35
|
-
*
|
|
36
|
-
* The single `string` format is only kept for legacy compatibility,
|
|
37
|
-
* and the array form should be preferred.
|
|
38
|
-
*/
|
|
39
|
-
nodePath?: string | string[];
|
|
40
|
-
/**
|
|
41
|
-
* fs implementation to use. Must implement node's `fs` module interface.
|
|
42
|
-
*/
|
|
43
|
-
fs?: typeof import('fs');
|
|
44
|
-
nodeExecPath?: string;
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
declare type Options = cmdShim.Options;
|
|
48
|
-
export = cmdShim;
|
|
49
|
-
/**
|
|
50
|
-
* Try to create shims.
|
|
51
|
-
*
|
|
52
|
-
* @param src Path to program (executable or script).
|
|
53
|
-
* @param to Path to shims.
|
|
54
|
-
* Don't add an extension if you will create multiple types of shims.
|
|
55
|
-
* @param opts Options.
|
|
56
|
-
* @throws If `src` is missing.
|
|
57
|
-
*/
|
|
58
|
-
declare function cmdShim(src: string, to: string, opts?: Options): Promise<void>;
|
|
59
|
-
declare namespace cmdShim {
|
|
60
|
-
var ifExists: typeof cmdShimIfExists;
|
|
61
|
-
}
|
|
62
|
-
/**
|
|
63
|
-
* Try to create shims.
|
|
64
|
-
*
|
|
65
|
-
* Does nothing if `src` doesn't exist.
|
|
66
|
-
*
|
|
67
|
-
* @param src Path to program (executable or script).
|
|
68
|
-
* @param to Path to shims.
|
|
69
|
-
* Don't add an extension if you will create multiple types of shims.
|
|
70
|
-
* @param opts Options.
|
|
71
|
-
*/
|
|
72
|
-
declare function cmdShimIfExists(src: string, to: string, opts?: Options): Promise<void>;
|
|
1
|
+
declare namespace cmdShim {
|
|
2
|
+
interface Options {
|
|
3
|
+
/**
|
|
4
|
+
* If a PowerShell script should be created.
|
|
5
|
+
*
|
|
6
|
+
* @default true
|
|
7
|
+
*/
|
|
8
|
+
createPwshFile?: boolean;
|
|
9
|
+
/**
|
|
10
|
+
* If a Windows Command Prompt script should be created.
|
|
11
|
+
*
|
|
12
|
+
* @default false
|
|
13
|
+
*/
|
|
14
|
+
createCmdFile?: boolean;
|
|
15
|
+
/**
|
|
16
|
+
* If symbolic links should be preserved.
|
|
17
|
+
*
|
|
18
|
+
* @default false
|
|
19
|
+
*/
|
|
20
|
+
preserveSymlinks?: boolean;
|
|
21
|
+
/**
|
|
22
|
+
* The path to the executable file.
|
|
23
|
+
*/
|
|
24
|
+
prog?: string;
|
|
25
|
+
/**
|
|
26
|
+
* The arguments to initialize the `node` process with.
|
|
27
|
+
*/
|
|
28
|
+
args?: string;
|
|
29
|
+
/**
|
|
30
|
+
* The arguments to initialize the target process with, before the actual CLI arguments
|
|
31
|
+
*/
|
|
32
|
+
progArgs?: string[];
|
|
33
|
+
/**
|
|
34
|
+
* The value of the $NODE_PATH environment variable.
|
|
35
|
+
*
|
|
36
|
+
* The single `string` format is only kept for legacy compatibility,
|
|
37
|
+
* and the array form should be preferred.
|
|
38
|
+
*/
|
|
39
|
+
nodePath?: string | string[];
|
|
40
|
+
/**
|
|
41
|
+
* fs implementation to use. Must implement node's `fs` module interface.
|
|
42
|
+
*/
|
|
43
|
+
fs?: typeof import('fs');
|
|
44
|
+
nodeExecPath?: string;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
declare type Options = cmdShim.Options;
|
|
48
|
+
export = cmdShim;
|
|
49
|
+
/**
|
|
50
|
+
* Try to create shims.
|
|
51
|
+
*
|
|
52
|
+
* @param src Path to program (executable or script).
|
|
53
|
+
* @param to Path to shims.
|
|
54
|
+
* Don't add an extension if you will create multiple types of shims.
|
|
55
|
+
* @param opts Options.
|
|
56
|
+
* @throws If `src` is missing.
|
|
57
|
+
*/
|
|
58
|
+
declare function cmdShim(src: string, to: string, opts?: Options): Promise<void>;
|
|
59
|
+
declare namespace cmdShim {
|
|
60
|
+
var ifExists: typeof cmdShimIfExists;
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* Try to create shims.
|
|
64
|
+
*
|
|
65
|
+
* Does nothing if `src` doesn't exist.
|
|
66
|
+
*
|
|
67
|
+
* @param src Path to program (executable or script).
|
|
68
|
+
* @param to Path to shims.
|
|
69
|
+
* Don't add an extension if you will create multiple types of shims.
|
|
70
|
+
* @param opts Options.
|
|
71
|
+
*/
|
|
72
|
+
declare function cmdShimIfExists(src: string, to: string, opts?: Options): Promise<void>;
|
|
73
73
|
//# sourceMappingURL=index.d.ts.map
|
package/index.js
CHANGED
|
@@ -1,244 +1,244 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
cmdShim.ifExists = cmdShimIfExists;
|
|
3
|
-
const util_1 = require("util");
|
|
4
|
-
const path = require("path");
|
|
5
|
-
const isWindows = require("is-windows");
|
|
6
|
-
const CMD_EXTENSION = require("cmd-extension");
|
|
7
|
-
const shebangExpr = /^#!\s*(?:\/usr\/bin\/env)?\s*([^ \t]+)(.*)$/;
|
|
8
|
-
const DEFAULT_OPTIONS = {
|
|
9
|
-
// Create PowerShell file by default if the option hasn't been specified
|
|
10
|
-
createPwshFile: true,
|
|
11
|
-
createCmdFile: isWindows(),
|
|
12
|
-
fs: require('fs')
|
|
13
|
-
};
|
|
14
|
-
/**
|
|
15
|
-
* Map from extensions of files that this module is frequently used for to their runtime.
|
|
16
|
-
* @type {Map<string, string>}
|
|
17
|
-
*/
|
|
18
|
-
const extensionToProgramMap = new Map([
|
|
19
|
-
['.js', 'node'],
|
|
20
|
-
['.cjs', 'node'],
|
|
21
|
-
['.mjs', 'node'],
|
|
22
|
-
['.cmd', 'cmd'],
|
|
23
|
-
['.bat', 'cmd'],
|
|
24
|
-
['.ps1', 'pwsh'],
|
|
25
|
-
['.sh', 'sh']
|
|
26
|
-
]);
|
|
27
|
-
function ingestOptions(opts) {
|
|
28
|
-
const opts_ = { ...DEFAULT_OPTIONS, ...opts };
|
|
29
|
-
const fs = opts_.fs;
|
|
30
|
-
opts_.fs_ = {
|
|
31
|
-
chmod: fs.chmod ? util_1.promisify(fs.chmod) : (async () => { }),
|
|
32
|
-
mkdir: util_1.promisify(fs.mkdir),
|
|
33
|
-
readFile: util_1.promisify(fs.readFile),
|
|
34
|
-
stat: util_1.promisify(fs.stat),
|
|
35
|
-
unlink: util_1.promisify(fs.unlink),
|
|
36
|
-
writeFile: util_1.promisify(fs.writeFile)
|
|
37
|
-
};
|
|
38
|
-
return opts_;
|
|
39
|
-
}
|
|
40
|
-
/**
|
|
41
|
-
* Try to create shims.
|
|
42
|
-
*
|
|
43
|
-
* @param src Path to program (executable or script).
|
|
44
|
-
* @param to Path to shims.
|
|
45
|
-
* Don't add an extension if you will create multiple types of shims.
|
|
46
|
-
* @param opts Options.
|
|
47
|
-
* @throws If `src` is missing.
|
|
48
|
-
*/
|
|
49
|
-
async function cmdShim(src, to, opts) {
|
|
50
|
-
const opts_ = ingestOptions(opts);
|
|
51
|
-
await opts_.fs_.stat(src);
|
|
52
|
-
await cmdShim_(src, to, opts_);
|
|
53
|
-
}
|
|
54
|
-
/**
|
|
55
|
-
* Try to create shims.
|
|
56
|
-
*
|
|
57
|
-
* Does nothing if `src` doesn't exist.
|
|
58
|
-
*
|
|
59
|
-
* @param src Path to program (executable or script).
|
|
60
|
-
* @param to Path to shims.
|
|
61
|
-
* Don't add an extension if you will create multiple types of shims.
|
|
62
|
-
* @param opts Options.
|
|
63
|
-
*/
|
|
64
|
-
function cmdShimIfExists(src, to, opts) {
|
|
65
|
-
return cmdShim(src, to, opts).catch(() => { });
|
|
66
|
-
}
|
|
67
|
-
/**
|
|
68
|
-
* Try to unlink, but ignore errors.
|
|
69
|
-
* Any problems will surface later.
|
|
70
|
-
*
|
|
71
|
-
* @param path File to be removed.
|
|
72
|
-
*/
|
|
73
|
-
function rm(path, opts) {
|
|
74
|
-
return opts.fs_.unlink(path).catch(() => { });
|
|
75
|
-
}
|
|
76
|
-
/**
|
|
77
|
-
* Try to create shims **even if `src` is missing**.
|
|
78
|
-
*
|
|
79
|
-
* @param src Path to program (executable or script).
|
|
80
|
-
* @param to Path to shims.
|
|
81
|
-
* Don't add an extension if you will create multiple types of shims.
|
|
82
|
-
* @param opts Options.
|
|
83
|
-
*/
|
|
84
|
-
async function cmdShim_(src, to, opts) {
|
|
85
|
-
const srcRuntimeInfo = await searchScriptRuntime(src, opts);
|
|
86
|
-
// Always tries to create all types of shims by calling `writeAllShims` as of now.
|
|
87
|
-
// Append your code here to change the behavior in response to `srcRuntimeInfo`.
|
|
88
|
-
// Create 3 shims for (Ba)sh in Cygwin / MSYS, no extension) & CMD (.cmd) & PowerShell (.ps1)
|
|
89
|
-
await writeShimsPreCommon(to, opts);
|
|
90
|
-
return writeAllShims(src, to, srcRuntimeInfo, opts);
|
|
91
|
-
}
|
|
92
|
-
/**
|
|
93
|
-
* Do processes before **all** shims are created.
|
|
94
|
-
* This must be called **only once** for one call of `cmdShim(IfExists)`.
|
|
95
|
-
*
|
|
96
|
-
* @param target Path of shims that are going to be created.
|
|
97
|
-
*/
|
|
98
|
-
function writeShimsPreCommon(target, opts) {
|
|
99
|
-
return opts.fs_.mkdir(path.dirname(target), { recursive: true });
|
|
100
|
-
}
|
|
101
|
-
/**
|
|
102
|
-
* Write all types (sh & cmd & pwsh) of shims to files.
|
|
103
|
-
* Extensions (`.cmd` and `.ps1`) are appended to cmd and pwsh shims.
|
|
104
|
-
*
|
|
105
|
-
*
|
|
106
|
-
* @param src Path to program (executable or script).
|
|
107
|
-
* @param to Path to shims **without extensions**.
|
|
108
|
-
* Extensions are added for CMD and PowerShell shims.
|
|
109
|
-
* @param srcRuntimeInfo Return value of `await searchScriptRuntime(src)`.
|
|
110
|
-
* @param opts Options.
|
|
111
|
-
*/
|
|
112
|
-
function writeAllShims(src, to, srcRuntimeInfo, opts) {
|
|
113
|
-
const opts_ = ingestOptions(opts);
|
|
114
|
-
const generatorAndExts = [{ generator: generateShShim, extension: '' }];
|
|
115
|
-
if (opts_.createCmdFile) {
|
|
116
|
-
generatorAndExts.push({ generator: generateCmdShim, extension: CMD_EXTENSION });
|
|
117
|
-
}
|
|
118
|
-
if (opts_.createPwshFile) {
|
|
119
|
-
generatorAndExts.push({ generator: generatePwshShim, extension: '.ps1' });
|
|
120
|
-
}
|
|
121
|
-
return Promise.all(generatorAndExts.map((generatorAndExt) => writeShim(src, to + generatorAndExt.extension, srcRuntimeInfo, generatorAndExt.generator, opts_)));
|
|
122
|
-
}
|
|
123
|
-
/**
|
|
124
|
-
* Do processes before writing shim.
|
|
125
|
-
*
|
|
126
|
-
* @param target Path to shim that is going to be created.
|
|
127
|
-
*/
|
|
128
|
-
function writeShimPre(target, opts) {
|
|
129
|
-
return rm(target, opts);
|
|
130
|
-
}
|
|
131
|
-
/**
|
|
132
|
-
* Do processes after writing the shim.
|
|
133
|
-
*
|
|
134
|
-
* @param target Path to just created shim.
|
|
135
|
-
*/
|
|
136
|
-
function writeShimPost(target, opts) {
|
|
137
|
-
// Only chmoding shims as of now.
|
|
138
|
-
// Some other processes may be appended.
|
|
139
|
-
return chmodShim(target, opts);
|
|
140
|
-
}
|
|
141
|
-
/**
|
|
142
|
-
* Look into runtime (e.g. `node` & `sh` & `pwsh`) and its arguments
|
|
143
|
-
* of the target program (script or executable).
|
|
144
|
-
*
|
|
145
|
-
* @param target Path to the executable or script.
|
|
146
|
-
* @return Promise of infomation of runtime of `target`.
|
|
147
|
-
*/
|
|
148
|
-
async function searchScriptRuntime(target, opts) {
|
|
149
|
-
const data = await opts.fs_.readFile(target, 'utf8');
|
|
150
|
-
// First, check if the bin is a #! of some sort.
|
|
151
|
-
const firstLine = data.trim().split(/\r*\n/)[0];
|
|
152
|
-
const shebang = firstLine.match(shebangExpr);
|
|
153
|
-
if (!shebang) {
|
|
154
|
-
// If not, infer script type from its extension.
|
|
155
|
-
// If the inference fails, it's something that'll be compiled, or some other
|
|
156
|
-
// sort of script, and just call it directly.
|
|
157
|
-
const targetExtension = path.extname(target).toLowerCase();
|
|
158
|
-
return {
|
|
159
|
-
// undefined if extension is unknown but it's converted to null.
|
|
160
|
-
program: extensionToProgramMap.get(targetExtension) || null,
|
|
161
|
-
additionalArgs: ''
|
|
162
|
-
};
|
|
163
|
-
}
|
|
164
|
-
return {
|
|
165
|
-
program: shebang[1],
|
|
166
|
-
additionalArgs: shebang[2]
|
|
167
|
-
};
|
|
168
|
-
}
|
|
169
|
-
/**
|
|
170
|
-
* Write shim to the file system while executing the pre- and post-processes
|
|
171
|
-
* defined in `WriteShimPre` and `WriteShimPost`.
|
|
172
|
-
*
|
|
173
|
-
* @param src Path to the executable or script.
|
|
174
|
-
* @param to Path to the (sh) shim(s) that is going to be created.
|
|
175
|
-
* @param srcRuntimeInfo Result of `await searchScriptRuntime(src)`.
|
|
176
|
-
* @param generateShimScript Generator of shim script.
|
|
177
|
-
* @param opts Other options.
|
|
178
|
-
*/
|
|
179
|
-
async function writeShim(src, to, srcRuntimeInfo, generateShimScript, opts) {
|
|
180
|
-
const defaultArgs = opts.preserveSymlinks ? '--preserve-symlinks' : '';
|
|
181
|
-
// `Array.prototype.filter` removes ''.
|
|
182
|
-
// ['--foo', '--bar'].join(' ') and [].join(' ') returns '--foo --bar' and '' respectively.
|
|
183
|
-
const args = [srcRuntimeInfo.additionalArgs, defaultArgs].filter(arg => arg).join(' ');
|
|
184
|
-
opts = Object.assign({}, opts, {
|
|
185
|
-
prog: srcRuntimeInfo.program,
|
|
186
|
-
args: args
|
|
187
|
-
});
|
|
188
|
-
await writeShimPre(to, opts);
|
|
189
|
-
await opts.fs_.writeFile(to, generateShimScript(src, to, opts), 'utf8');
|
|
190
|
-
return writeShimPost(to, opts);
|
|
191
|
-
}
|
|
192
|
-
/**
|
|
193
|
-
* Generate the content of a shim for CMD.
|
|
194
|
-
*
|
|
195
|
-
* @param src Path to the executable or script.
|
|
196
|
-
* @param to Path to the shim to be created.
|
|
197
|
-
* It is highly recommended to end with `.cmd` (or `.bat`).
|
|
198
|
-
* @param opts Options.
|
|
199
|
-
* @return The content of shim.
|
|
200
|
-
*/
|
|
201
|
-
function generateCmdShim(src, to, opts) {
|
|
202
|
-
// `shTarget` is not used to generate the content.
|
|
203
|
-
const shTarget = path.relative(path.dirname(to), src);
|
|
204
|
-
let target = shTarget.split('/').join('\\');
|
|
205
|
-
const quotedPathToTarget = path.isAbsolute(target) ? `"${target}"` : `"%~dp0\\${target}"`;
|
|
206
|
-
let longProg;
|
|
207
|
-
let prog = opts.prog;
|
|
208
|
-
let args = opts.args || '';
|
|
209
|
-
const nodePath = normalizePathEnvVar(opts.nodePath).win32;
|
|
210
|
-
if (!prog) {
|
|
211
|
-
prog = quotedPathToTarget;
|
|
212
|
-
args = '';
|
|
213
|
-
target = '';
|
|
214
|
-
}
|
|
215
|
-
else if (prog === 'node' && opts.nodeExecPath) {
|
|
216
|
-
prog = `"${opts.nodeExecPath}"`;
|
|
217
|
-
target = quotedPathToTarget;
|
|
218
|
-
}
|
|
219
|
-
else {
|
|
220
|
-
longProg = `"%~dp0\\${prog}.exe"`;
|
|
221
|
-
target = quotedPathToTarget;
|
|
222
|
-
}
|
|
223
|
-
let progArgs = opts.progArgs ? `${opts.progArgs.join(` `)} ` : '';
|
|
224
|
-
// @IF EXIST "%~dp0\node.exe" (
|
|
225
|
-
// "%~dp0\node.exe" "%~dp0\.\node_modules\npm\bin\npm-cli.js" %*
|
|
226
|
-
// ) ELSE (
|
|
227
|
-
// SETLOCAL
|
|
228
|
-
// SET PATHEXT=%PATHEXT:;.JS;=;%
|
|
229
|
-
// node "%~dp0\.\node_modules\npm\bin\npm-cli.js" %*
|
|
230
|
-
// )
|
|
231
|
-
let cmd = '@SETLOCAL\r\n';
|
|
232
|
-
if (nodePath) {
|
|
1
|
+
'use strict';
|
|
2
|
+
cmdShim.ifExists = cmdShimIfExists;
|
|
3
|
+
const util_1 = require("util");
|
|
4
|
+
const path = require("path");
|
|
5
|
+
const isWindows = require("is-windows");
|
|
6
|
+
const CMD_EXTENSION = require("cmd-extension");
|
|
7
|
+
const shebangExpr = /^#!\s*(?:\/usr\/bin\/env)?\s*([^ \t]+)(.*)$/;
|
|
8
|
+
const DEFAULT_OPTIONS = {
|
|
9
|
+
// Create PowerShell file by default if the option hasn't been specified
|
|
10
|
+
createPwshFile: true,
|
|
11
|
+
createCmdFile: isWindows(),
|
|
12
|
+
fs: require('fs')
|
|
13
|
+
};
|
|
14
|
+
/**
|
|
15
|
+
* Map from extensions of files that this module is frequently used for to their runtime.
|
|
16
|
+
* @type {Map<string, string>}
|
|
17
|
+
*/
|
|
18
|
+
const extensionToProgramMap = new Map([
|
|
19
|
+
['.js', 'node'],
|
|
20
|
+
['.cjs', 'node'],
|
|
21
|
+
['.mjs', 'node'],
|
|
22
|
+
['.cmd', 'cmd'],
|
|
23
|
+
['.bat', 'cmd'],
|
|
24
|
+
['.ps1', 'pwsh'],
|
|
25
|
+
['.sh', 'sh']
|
|
26
|
+
]);
|
|
27
|
+
function ingestOptions(opts) {
|
|
28
|
+
const opts_ = { ...DEFAULT_OPTIONS, ...opts };
|
|
29
|
+
const fs = opts_.fs;
|
|
30
|
+
opts_.fs_ = {
|
|
31
|
+
chmod: fs.chmod ? util_1.promisify(fs.chmod) : (async () => { }),
|
|
32
|
+
mkdir: util_1.promisify(fs.mkdir),
|
|
33
|
+
readFile: util_1.promisify(fs.readFile),
|
|
34
|
+
stat: util_1.promisify(fs.stat),
|
|
35
|
+
unlink: util_1.promisify(fs.unlink),
|
|
36
|
+
writeFile: util_1.promisify(fs.writeFile)
|
|
37
|
+
};
|
|
38
|
+
return opts_;
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Try to create shims.
|
|
42
|
+
*
|
|
43
|
+
* @param src Path to program (executable or script).
|
|
44
|
+
* @param to Path to shims.
|
|
45
|
+
* Don't add an extension if you will create multiple types of shims.
|
|
46
|
+
* @param opts Options.
|
|
47
|
+
* @throws If `src` is missing.
|
|
48
|
+
*/
|
|
49
|
+
async function cmdShim(src, to, opts) {
|
|
50
|
+
const opts_ = ingestOptions(opts);
|
|
51
|
+
await opts_.fs_.stat(src);
|
|
52
|
+
await cmdShim_(src, to, opts_);
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Try to create shims.
|
|
56
|
+
*
|
|
57
|
+
* Does nothing if `src` doesn't exist.
|
|
58
|
+
*
|
|
59
|
+
* @param src Path to program (executable or script).
|
|
60
|
+
* @param to Path to shims.
|
|
61
|
+
* Don't add an extension if you will create multiple types of shims.
|
|
62
|
+
* @param opts Options.
|
|
63
|
+
*/
|
|
64
|
+
function cmdShimIfExists(src, to, opts) {
|
|
65
|
+
return cmdShim(src, to, opts).catch(() => { });
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* Try to unlink, but ignore errors.
|
|
69
|
+
* Any problems will surface later.
|
|
70
|
+
*
|
|
71
|
+
* @param path File to be removed.
|
|
72
|
+
*/
|
|
73
|
+
function rm(path, opts) {
|
|
74
|
+
return opts.fs_.unlink(path).catch(() => { });
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Try to create shims **even if `src` is missing**.
|
|
78
|
+
*
|
|
79
|
+
* @param src Path to program (executable or script).
|
|
80
|
+
* @param to Path to shims.
|
|
81
|
+
* Don't add an extension if you will create multiple types of shims.
|
|
82
|
+
* @param opts Options.
|
|
83
|
+
*/
|
|
84
|
+
async function cmdShim_(src, to, opts) {
|
|
85
|
+
const srcRuntimeInfo = await searchScriptRuntime(src, opts);
|
|
86
|
+
// Always tries to create all types of shims by calling `writeAllShims` as of now.
|
|
87
|
+
// Append your code here to change the behavior in response to `srcRuntimeInfo`.
|
|
88
|
+
// Create 3 shims for (Ba)sh in Cygwin / MSYS, no extension) & CMD (.cmd) & PowerShell (.ps1)
|
|
89
|
+
await writeShimsPreCommon(to, opts);
|
|
90
|
+
return writeAllShims(src, to, srcRuntimeInfo, opts);
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* Do processes before **all** shims are created.
|
|
94
|
+
* This must be called **only once** for one call of `cmdShim(IfExists)`.
|
|
95
|
+
*
|
|
96
|
+
* @param target Path of shims that are going to be created.
|
|
97
|
+
*/
|
|
98
|
+
function writeShimsPreCommon(target, opts) {
|
|
99
|
+
return opts.fs_.mkdir(path.dirname(target), { recursive: true });
|
|
100
|
+
}
|
|
101
|
+
/**
|
|
102
|
+
* Write all types (sh & cmd & pwsh) of shims to files.
|
|
103
|
+
* Extensions (`.cmd` and `.ps1`) are appended to cmd and pwsh shims.
|
|
104
|
+
*
|
|
105
|
+
*
|
|
106
|
+
* @param src Path to program (executable or script).
|
|
107
|
+
* @param to Path to shims **without extensions**.
|
|
108
|
+
* Extensions are added for CMD and PowerShell shims.
|
|
109
|
+
* @param srcRuntimeInfo Return value of `await searchScriptRuntime(src)`.
|
|
110
|
+
* @param opts Options.
|
|
111
|
+
*/
|
|
112
|
+
function writeAllShims(src, to, srcRuntimeInfo, opts) {
|
|
113
|
+
const opts_ = ingestOptions(opts);
|
|
114
|
+
const generatorAndExts = [{ generator: generateShShim, extension: '' }];
|
|
115
|
+
if (opts_.createCmdFile) {
|
|
116
|
+
generatorAndExts.push({ generator: generateCmdShim, extension: CMD_EXTENSION });
|
|
117
|
+
}
|
|
118
|
+
if (opts_.createPwshFile) {
|
|
119
|
+
generatorAndExts.push({ generator: generatePwshShim, extension: '.ps1' });
|
|
120
|
+
}
|
|
121
|
+
return Promise.all(generatorAndExts.map((generatorAndExt) => writeShim(src, to + generatorAndExt.extension, srcRuntimeInfo, generatorAndExt.generator, opts_)));
|
|
122
|
+
}
|
|
123
|
+
/**
|
|
124
|
+
* Do processes before writing shim.
|
|
125
|
+
*
|
|
126
|
+
* @param target Path to shim that is going to be created.
|
|
127
|
+
*/
|
|
128
|
+
function writeShimPre(target, opts) {
|
|
129
|
+
return rm(target, opts);
|
|
130
|
+
}
|
|
131
|
+
/**
|
|
132
|
+
* Do processes after writing the shim.
|
|
133
|
+
*
|
|
134
|
+
* @param target Path to just created shim.
|
|
135
|
+
*/
|
|
136
|
+
function writeShimPost(target, opts) {
|
|
137
|
+
// Only chmoding shims as of now.
|
|
138
|
+
// Some other processes may be appended.
|
|
139
|
+
return chmodShim(target, opts);
|
|
140
|
+
}
|
|
141
|
+
/**
|
|
142
|
+
* Look into runtime (e.g. `node` & `sh` & `pwsh`) and its arguments
|
|
143
|
+
* of the target program (script or executable).
|
|
144
|
+
*
|
|
145
|
+
* @param target Path to the executable or script.
|
|
146
|
+
* @return Promise of infomation of runtime of `target`.
|
|
147
|
+
*/
|
|
148
|
+
async function searchScriptRuntime(target, opts) {
|
|
149
|
+
const data = await opts.fs_.readFile(target, 'utf8');
|
|
150
|
+
// First, check if the bin is a #! of some sort.
|
|
151
|
+
const firstLine = data.trim().split(/\r*\n/)[0];
|
|
152
|
+
const shebang = firstLine.match(shebangExpr);
|
|
153
|
+
if (!shebang) {
|
|
154
|
+
// If not, infer script type from its extension.
|
|
155
|
+
// If the inference fails, it's something that'll be compiled, or some other
|
|
156
|
+
// sort of script, and just call it directly.
|
|
157
|
+
const targetExtension = path.extname(target).toLowerCase();
|
|
158
|
+
return {
|
|
159
|
+
// undefined if extension is unknown but it's converted to null.
|
|
160
|
+
program: extensionToProgramMap.get(targetExtension) || null,
|
|
161
|
+
additionalArgs: ''
|
|
162
|
+
};
|
|
163
|
+
}
|
|
164
|
+
return {
|
|
165
|
+
program: shebang[1],
|
|
166
|
+
additionalArgs: shebang[2]
|
|
167
|
+
};
|
|
168
|
+
}
|
|
169
|
+
/**
|
|
170
|
+
* Write shim to the file system while executing the pre- and post-processes
|
|
171
|
+
* defined in `WriteShimPre` and `WriteShimPost`.
|
|
172
|
+
*
|
|
173
|
+
* @param src Path to the executable or script.
|
|
174
|
+
* @param to Path to the (sh) shim(s) that is going to be created.
|
|
175
|
+
* @param srcRuntimeInfo Result of `await searchScriptRuntime(src)`.
|
|
176
|
+
* @param generateShimScript Generator of shim script.
|
|
177
|
+
* @param opts Other options.
|
|
178
|
+
*/
|
|
179
|
+
async function writeShim(src, to, srcRuntimeInfo, generateShimScript, opts) {
|
|
180
|
+
const defaultArgs = opts.preserveSymlinks ? '--preserve-symlinks' : '';
|
|
181
|
+
// `Array.prototype.filter` removes ''.
|
|
182
|
+
// ['--foo', '--bar'].join(' ') and [].join(' ') returns '--foo --bar' and '' respectively.
|
|
183
|
+
const args = [srcRuntimeInfo.additionalArgs, defaultArgs].filter(arg => arg).join(' ');
|
|
184
|
+
opts = Object.assign({}, opts, {
|
|
185
|
+
prog: srcRuntimeInfo.program,
|
|
186
|
+
args: args
|
|
187
|
+
});
|
|
188
|
+
await writeShimPre(to, opts);
|
|
189
|
+
await opts.fs_.writeFile(to, generateShimScript(src, to, opts), 'utf8');
|
|
190
|
+
return writeShimPost(to, opts);
|
|
191
|
+
}
|
|
192
|
+
/**
|
|
193
|
+
* Generate the content of a shim for CMD.
|
|
194
|
+
*
|
|
195
|
+
* @param src Path to the executable or script.
|
|
196
|
+
* @param to Path to the shim to be created.
|
|
197
|
+
* It is highly recommended to end with `.cmd` (or `.bat`).
|
|
198
|
+
* @param opts Options.
|
|
199
|
+
* @return The content of shim.
|
|
200
|
+
*/
|
|
201
|
+
function generateCmdShim(src, to, opts) {
|
|
202
|
+
// `shTarget` is not used to generate the content.
|
|
203
|
+
const shTarget = path.relative(path.dirname(to), src);
|
|
204
|
+
let target = shTarget.split('/').join('\\');
|
|
205
|
+
const quotedPathToTarget = path.isAbsolute(target) ? `"${target}"` : `"%~dp0\\${target}"`;
|
|
206
|
+
let longProg;
|
|
207
|
+
let prog = opts.prog;
|
|
208
|
+
let args = opts.args || '';
|
|
209
|
+
const nodePath = normalizePathEnvVar(opts.nodePath).win32;
|
|
210
|
+
if (!prog) {
|
|
211
|
+
prog = quotedPathToTarget;
|
|
212
|
+
args = '';
|
|
213
|
+
target = '';
|
|
214
|
+
}
|
|
215
|
+
else if (prog === 'node' && opts.nodeExecPath) {
|
|
216
|
+
prog = `"${opts.nodeExecPath}"`;
|
|
217
|
+
target = quotedPathToTarget;
|
|
218
|
+
}
|
|
219
|
+
else {
|
|
220
|
+
longProg = `"%~dp0\\${prog}.exe"`;
|
|
221
|
+
target = quotedPathToTarget;
|
|
222
|
+
}
|
|
223
|
+
let progArgs = opts.progArgs ? `${opts.progArgs.join(` `)} ` : '';
|
|
224
|
+
// @IF EXIST "%~dp0\node.exe" (
|
|
225
|
+
// "%~dp0\node.exe" "%~dp0\.\node_modules\npm\bin\npm-cli.js" %*
|
|
226
|
+
// ) ELSE (
|
|
227
|
+
// SETLOCAL
|
|
228
|
+
// SET PATHEXT=%PATHEXT:;.JS;=;%
|
|
229
|
+
// node "%~dp0\.\node_modules\npm\bin\npm-cli.js" %*
|
|
230
|
+
// )
|
|
231
|
+
let cmd = '@SETLOCAL\r\n';
|
|
232
|
+
if (nodePath) {
|
|
233
233
|
cmd += `\
|
|
234
234
|
@IF NOT DEFINED NODE_PATH (\r
|
|
235
235
|
@SET "NODE_PATH=${nodePath}"\r
|
|
236
236
|
) ELSE (\r
|
|
237
237
|
@SET "NODE_PATH=%NODE_PATH%;${nodePath}"\r
|
|
238
238
|
)\r
|
|
239
|
-
`;
|
|
240
|
-
}
|
|
241
|
-
if (longProg) {
|
|
239
|
+
`;
|
|
240
|
+
}
|
|
241
|
+
if (longProg) {
|
|
242
242
|
cmd += `\
|
|
243
243
|
@IF EXIST ${longProg} (\r
|
|
244
244
|
${longProg} ${args} ${target} ${progArgs}%*\r
|
|
@@ -246,58 +246,58 @@ function generateCmdShim(src, to, opts) {
|
|
|
246
246
|
@SET PATHEXT=%PATHEXT:;.JS;=;%\r
|
|
247
247
|
${prog} ${args} ${target} ${progArgs}%*\r
|
|
248
248
|
)\r
|
|
249
|
-
`;
|
|
250
|
-
}
|
|
251
|
-
else {
|
|
252
|
-
cmd += `@${prog} ${args} ${target} ${progArgs}%*\r\n`;
|
|
253
|
-
}
|
|
254
|
-
return cmd;
|
|
255
|
-
}
|
|
256
|
-
/**
|
|
257
|
-
* Generate the content of a shim for (Ba)sh in, for example, Cygwin and MSYS(2).
|
|
258
|
-
*
|
|
259
|
-
* @param src Path to the executable or script.
|
|
260
|
-
* @param to Path to the shim to be created.
|
|
261
|
-
* It is highly recommended to end with `.sh` or to contain no extension.
|
|
262
|
-
* @param opts Options.
|
|
263
|
-
* @return The content of shim.
|
|
264
|
-
*/
|
|
265
|
-
function generateShShim(src, to, opts) {
|
|
266
|
-
let shTarget = path.relative(path.dirname(to), src);
|
|
267
|
-
let shProg = opts.prog && opts.prog.split('\\').join('/');
|
|
268
|
-
let shLongProg;
|
|
269
|
-
shTarget = shTarget.split('\\').join('/');
|
|
270
|
-
const quotedPathToTarget = path.isAbsolute(shTarget) ? `"${shTarget}"` : `"$basedir/${shTarget}"`;
|
|
271
|
-
let args = opts.args || '';
|
|
272
|
-
const shNodePath = normalizePathEnvVar(opts.nodePath).posix;
|
|
273
|
-
if (!shProg) {
|
|
274
|
-
shProg = quotedPathToTarget;
|
|
275
|
-
args = '';
|
|
276
|
-
shTarget = '';
|
|
277
|
-
}
|
|
278
|
-
else if (opts.prog === 'node' && opts.nodeExecPath) {
|
|
279
|
-
shProg = `"${opts.nodeExecPath}"`;
|
|
280
|
-
shTarget = quotedPathToTarget;
|
|
281
|
-
}
|
|
282
|
-
else {
|
|
283
|
-
shLongProg = `"$basedir/${opts.prog}"`;
|
|
284
|
-
shTarget = quotedPathToTarget;
|
|
285
|
-
}
|
|
286
|
-
let progArgs = opts.progArgs ? `${opts.progArgs.join(` `)} ` : '';
|
|
287
|
-
// #!/bin/sh
|
|
288
|
-
// basedir=`dirname "$0"`
|
|
289
|
-
//
|
|
290
|
-
// case `uname` in
|
|
291
|
-
// *CYGWIN*) basedir=`cygpath -w "$basedir"`;;
|
|
292
|
-
// esac
|
|
293
|
-
//
|
|
294
|
-
// export NODE_PATH="<nodepath>"
|
|
295
|
-
//
|
|
296
|
-
// if [ -x "$basedir/node.exe" ]; then
|
|
297
|
-
// exec "$basedir/node.exe" "$basedir/node_modules/npm/bin/npm-cli.js" "$@"
|
|
298
|
-
// else
|
|
299
|
-
// exec node "$basedir/node_modules/npm/bin/npm-cli.js" "$@"
|
|
300
|
-
// fi
|
|
249
|
+
`;
|
|
250
|
+
}
|
|
251
|
+
else {
|
|
252
|
+
cmd += `@${prog} ${args} ${target} ${progArgs}%*\r\n`;
|
|
253
|
+
}
|
|
254
|
+
return cmd;
|
|
255
|
+
}
|
|
256
|
+
/**
|
|
257
|
+
* Generate the content of a shim for (Ba)sh in, for example, Cygwin and MSYS(2).
|
|
258
|
+
*
|
|
259
|
+
* @param src Path to the executable or script.
|
|
260
|
+
* @param to Path to the shim to be created.
|
|
261
|
+
* It is highly recommended to end with `.sh` or to contain no extension.
|
|
262
|
+
* @param opts Options.
|
|
263
|
+
* @return The content of shim.
|
|
264
|
+
*/
|
|
265
|
+
function generateShShim(src, to, opts) {
|
|
266
|
+
let shTarget = path.relative(path.dirname(to), src);
|
|
267
|
+
let shProg = opts.prog && opts.prog.split('\\').join('/');
|
|
268
|
+
let shLongProg;
|
|
269
|
+
shTarget = shTarget.split('\\').join('/');
|
|
270
|
+
const quotedPathToTarget = path.isAbsolute(shTarget) ? `"${shTarget}"` : `"$basedir/${shTarget}"`;
|
|
271
|
+
let args = opts.args || '';
|
|
272
|
+
const shNodePath = normalizePathEnvVar(opts.nodePath).posix;
|
|
273
|
+
if (!shProg) {
|
|
274
|
+
shProg = quotedPathToTarget;
|
|
275
|
+
args = '';
|
|
276
|
+
shTarget = '';
|
|
277
|
+
}
|
|
278
|
+
else if (opts.prog === 'node' && opts.nodeExecPath) {
|
|
279
|
+
shProg = `"${opts.nodeExecPath}"`;
|
|
280
|
+
shTarget = quotedPathToTarget;
|
|
281
|
+
}
|
|
282
|
+
else {
|
|
283
|
+
shLongProg = `"$basedir/${opts.prog}"`;
|
|
284
|
+
shTarget = quotedPathToTarget;
|
|
285
|
+
}
|
|
286
|
+
let progArgs = opts.progArgs ? `${opts.progArgs.join(` `)} ` : '';
|
|
287
|
+
// #!/bin/sh
|
|
288
|
+
// basedir=`dirname "$0"`
|
|
289
|
+
//
|
|
290
|
+
// case `uname` in
|
|
291
|
+
// *CYGWIN*) basedir=`cygpath -w "$basedir"`;;
|
|
292
|
+
// esac
|
|
293
|
+
//
|
|
294
|
+
// export NODE_PATH="<nodepath>"
|
|
295
|
+
//
|
|
296
|
+
// if [ -x "$basedir/node.exe" ]; then
|
|
297
|
+
// exec "$basedir/node.exe" "$basedir/node_modules/npm/bin/npm-cli.js" "$@"
|
|
298
|
+
// else
|
|
299
|
+
// exec node "$basedir/node_modules/npm/bin/npm-cli.js" "$@"
|
|
300
|
+
// fi
|
|
301
301
|
let sh = `\
|
|
302
302
|
#!/bin/sh
|
|
303
303
|
basedir=$(dirname "$(echo "$0" | sed -e 's,\\\\,/,g')")
|
|
@@ -306,101 +306,101 @@ case \`uname\` in
|
|
|
306
306
|
*CYGWIN*) basedir=\`cygpath -w "$basedir"\`;;
|
|
307
307
|
esac
|
|
308
308
|
|
|
309
|
-
`;
|
|
310
|
-
if (
|
|
309
|
+
`;
|
|
310
|
+
if (shNodePath) {
|
|
311
311
|
sh += `\
|
|
312
312
|
if [ -z "$NODE_PATH" ]; then
|
|
313
313
|
export NODE_PATH="${shNodePath}"
|
|
314
314
|
else
|
|
315
315
|
export NODE_PATH="$NODE_PATH:${shNodePath}"
|
|
316
316
|
fi
|
|
317
|
-
`;
|
|
318
|
-
}
|
|
319
|
-
if (shLongProg) {
|
|
317
|
+
`;
|
|
318
|
+
}
|
|
319
|
+
if (shLongProg) {
|
|
320
320
|
sh += `\
|
|
321
321
|
if [ -x ${shLongProg} ]; then
|
|
322
322
|
exec ${shLongProg} ${args} ${shTarget} ${progArgs}"$@"
|
|
323
323
|
else
|
|
324
324
|
exec ${shProg} ${args} ${shTarget} ${progArgs}"$@"
|
|
325
325
|
fi
|
|
326
|
-
`;
|
|
327
|
-
}
|
|
328
|
-
else {
|
|
326
|
+
`;
|
|
327
|
+
}
|
|
328
|
+
else {
|
|
329
329
|
sh += `\
|
|
330
330
|
${shProg} ${args} ${shTarget} ${progArgs}"$@"
|
|
331
331
|
exit $?
|
|
332
|
-
`;
|
|
333
|
-
}
|
|
334
|
-
return sh;
|
|
335
|
-
}
|
|
336
|
-
/**
|
|
337
|
-
* Generate the content of a shim for PowerShell.
|
|
338
|
-
*
|
|
339
|
-
* @param src Path to the executable or script.
|
|
340
|
-
* @param to Path to the shim to be created.
|
|
341
|
-
* It is highly recommended to end with `.ps1`.
|
|
342
|
-
* @param opts Options.
|
|
343
|
-
* @return The content of shim.
|
|
344
|
-
*/
|
|
345
|
-
function generatePwshShim(src, to, opts) {
|
|
346
|
-
let shTarget = path.relative(path.dirname(to), src);
|
|
347
|
-
const shProg = opts.prog && opts.prog.split('\\').join('/');
|
|
348
|
-
let pwshProg = shProg && `"${shProg}$exe"`;
|
|
349
|
-
let pwshLongProg;
|
|
350
|
-
shTarget = shTarget.split('\\').join('/');
|
|
351
|
-
const quotedPathToTarget = path.isAbsolute(shTarget) ? `"${shTarget}"` : `"$basedir/${shTarget}"`;
|
|
352
|
-
let args = opts.args || '';
|
|
353
|
-
let normalizedPathEnvVar = normalizePathEnvVar(opts.nodePath);
|
|
354
|
-
const nodePath = normalizedPathEnvVar.win32;
|
|
355
|
-
const shNodePath = normalizedPathEnvVar.posix;
|
|
356
|
-
if (!pwshProg) {
|
|
357
|
-
pwshProg = quotedPathToTarget;
|
|
358
|
-
args = '';
|
|
359
|
-
shTarget = '';
|
|
360
|
-
}
|
|
361
|
-
else if (opts.prog === 'node' && opts.nodeExecPath) {
|
|
362
|
-
pwshProg = `"${opts.nodeExecPath}"`;
|
|
363
|
-
shTarget = quotedPathToTarget;
|
|
364
|
-
}
|
|
365
|
-
else {
|
|
366
|
-
pwshLongProg = `"$basedir/${opts.prog}$exe"`;
|
|
367
|
-
shTarget = quotedPathToTarget;
|
|
368
|
-
}
|
|
369
|
-
let progArgs = opts.progArgs ? `${opts.progArgs.join(` `)} ` : '';
|
|
370
|
-
// #!/usr/bin/env pwsh
|
|
371
|
-
// $basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent
|
|
372
|
-
//
|
|
373
|
-
// $ret=0
|
|
374
|
-
// $exe = ""
|
|
375
|
-
// if ($PSVersionTable.PSVersion -lt "6.0" -or $IsWindows) {
|
|
376
|
-
// # Fix case when both the Windows and Linux builds of Node
|
|
377
|
-
// # are installed in the same directory
|
|
378
|
-
// $exe = ".exe"
|
|
379
|
-
// }
|
|
380
|
-
// if (Test-Path "$basedir/node") {
|
|
381
|
-
// # Support pipeline input
|
|
382
|
-
// if ($MyInvocation.ExpectingInput) {
|
|
383
|
-
// $input | & "$basedir/node$exe" "$basedir/node_modules/npm/bin/npm-cli.js" $args
|
|
384
|
-
// } else {
|
|
385
|
-
// & "$basedir/node$exe" "$basedir/node_modules/npm/bin/npm-cli.js" $args
|
|
386
|
-
// }
|
|
387
|
-
// $ret=$LASTEXITCODE
|
|
388
|
-
// } else {
|
|
389
|
-
// # Support pipeline input
|
|
390
|
-
// if ($MyInvocation.ExpectingInput) {
|
|
391
|
-
// $input | & "node$exe" "$basedir/node_modules/npm/bin/npm-cli.js" $args
|
|
392
|
-
// } else {
|
|
393
|
-
// & "node$exe" "$basedir/node_modules/npm/bin/npm-cli.js" $args
|
|
394
|
-
// }
|
|
395
|
-
// $ret=$LASTEXITCODE
|
|
396
|
-
// }
|
|
397
|
-
// exit $ret
|
|
332
|
+
`;
|
|
333
|
+
}
|
|
334
|
+
return sh;
|
|
335
|
+
}
|
|
336
|
+
/**
|
|
337
|
+
* Generate the content of a shim for PowerShell.
|
|
338
|
+
*
|
|
339
|
+
* @param src Path to the executable or script.
|
|
340
|
+
* @param to Path to the shim to be created.
|
|
341
|
+
* It is highly recommended to end with `.ps1`.
|
|
342
|
+
* @param opts Options.
|
|
343
|
+
* @return The content of shim.
|
|
344
|
+
*/
|
|
345
|
+
function generatePwshShim(src, to, opts) {
|
|
346
|
+
let shTarget = path.relative(path.dirname(to), src);
|
|
347
|
+
const shProg = opts.prog && opts.prog.split('\\').join('/');
|
|
348
|
+
let pwshProg = shProg && `"${shProg}$exe"`;
|
|
349
|
+
let pwshLongProg;
|
|
350
|
+
shTarget = shTarget.split('\\').join('/');
|
|
351
|
+
const quotedPathToTarget = path.isAbsolute(shTarget) ? `"${shTarget}"` : `"$basedir/${shTarget}"`;
|
|
352
|
+
let args = opts.args || '';
|
|
353
|
+
let normalizedPathEnvVar = normalizePathEnvVar(opts.nodePath);
|
|
354
|
+
const nodePath = normalizedPathEnvVar.win32;
|
|
355
|
+
const shNodePath = normalizedPathEnvVar.posix;
|
|
356
|
+
if (!pwshProg) {
|
|
357
|
+
pwshProg = quotedPathToTarget;
|
|
358
|
+
args = '';
|
|
359
|
+
shTarget = '';
|
|
360
|
+
}
|
|
361
|
+
else if (opts.prog === 'node' && opts.nodeExecPath) {
|
|
362
|
+
pwshProg = `"${opts.nodeExecPath}"`;
|
|
363
|
+
shTarget = quotedPathToTarget;
|
|
364
|
+
}
|
|
365
|
+
else {
|
|
366
|
+
pwshLongProg = `"$basedir/${opts.prog}$exe"`;
|
|
367
|
+
shTarget = quotedPathToTarget;
|
|
368
|
+
}
|
|
369
|
+
let progArgs = opts.progArgs ? `${opts.progArgs.join(` `)} ` : '';
|
|
370
|
+
// #!/usr/bin/env pwsh
|
|
371
|
+
// $basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent
|
|
372
|
+
//
|
|
373
|
+
// $ret=0
|
|
374
|
+
// $exe = ""
|
|
375
|
+
// if ($PSVersionTable.PSVersion -lt "6.0" -or $IsWindows) {
|
|
376
|
+
// # Fix case when both the Windows and Linux builds of Node
|
|
377
|
+
// # are installed in the same directory
|
|
378
|
+
// $exe = ".exe"
|
|
379
|
+
// }
|
|
380
|
+
// if (Test-Path "$basedir/node") {
|
|
381
|
+
// # Support pipeline input
|
|
382
|
+
// if ($MyInvocation.ExpectingInput) {
|
|
383
|
+
// $input | & "$basedir/node$exe" "$basedir/node_modules/npm/bin/npm-cli.js" $args
|
|
384
|
+
// } else {
|
|
385
|
+
// & "$basedir/node$exe" "$basedir/node_modules/npm/bin/npm-cli.js" $args
|
|
386
|
+
// }
|
|
387
|
+
// $ret=$LASTEXITCODE
|
|
388
|
+
// } else {
|
|
389
|
+
// # Support pipeline input
|
|
390
|
+
// if ($MyInvocation.ExpectingInput) {
|
|
391
|
+
// $input | & "node$exe" "$basedir/node_modules/npm/bin/npm-cli.js" $args
|
|
392
|
+
// } else {
|
|
393
|
+
// & "node$exe" "$basedir/node_modules/npm/bin/npm-cli.js" $args
|
|
394
|
+
// }
|
|
395
|
+
// $ret=$LASTEXITCODE
|
|
396
|
+
// }
|
|
397
|
+
// exit $ret
|
|
398
398
|
let pwsh = `\
|
|
399
399
|
#!/usr/bin/env pwsh
|
|
400
400
|
$basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent
|
|
401
401
|
|
|
402
402
|
$exe=""
|
|
403
|
-
${
|
|
403
|
+
${nodePath ? `\
|
|
404
404
|
$pathsep=":"
|
|
405
405
|
$env_node_path=$env:NODE_PATH
|
|
406
406
|
$new_node_path="${nodePath}"
|
|
@@ -409,9 +409,9 @@ if ($PSVersionTable.PSVersion -lt "6.0" -or $IsWindows) {
|
|
|
409
409
|
# Fix case when both the Windows and Linux builds of Node
|
|
410
410
|
# are installed in the same directory
|
|
411
411
|
$exe=".exe"
|
|
412
|
-
${
|
|
413
|
-
}`;
|
|
414
|
-
if (
|
|
412
|
+
${nodePath ? ' $pathsep=";"\n' : ''}\
|
|
413
|
+
}`;
|
|
414
|
+
if (shNodePath) {
|
|
415
415
|
pwsh += `\
|
|
416
416
|
else {
|
|
417
417
|
$new_node_path="${shNodePath}"
|
|
@@ -421,9 +421,9 @@ if ([string]::IsNullOrEmpty($env_node_path)) {
|
|
|
421
421
|
} else {
|
|
422
422
|
$env:NODE_PATH="$env_node_path$pathsep$new_node_path"
|
|
423
423
|
}
|
|
424
|
-
`;
|
|
425
|
-
}
|
|
426
|
-
if (pwshLongProg) {
|
|
424
|
+
`;
|
|
425
|
+
}
|
|
426
|
+
if (pwshLongProg) {
|
|
427
427
|
pwsh += `
|
|
428
428
|
$ret=0
|
|
429
429
|
if (Test-Path ${pwshLongProg}) {
|
|
@@ -443,11 +443,11 @@ if (Test-Path ${pwshLongProg}) {
|
|
|
443
443
|
}
|
|
444
444
|
$ret=$LASTEXITCODE
|
|
445
445
|
}
|
|
446
|
-
${
|
|
446
|
+
${nodePath ? '$env:NODE_PATH=$env_node_path\n' : ''}\
|
|
447
447
|
exit $ret
|
|
448
|
-
`;
|
|
449
|
-
}
|
|
450
|
-
else {
|
|
448
|
+
`;
|
|
449
|
+
}
|
|
450
|
+
else {
|
|
451
451
|
pwsh += `
|
|
452
452
|
# Support pipeline input
|
|
453
453
|
if ($MyInvocation.ExpectingInput) {
|
|
@@ -455,37 +455,37 @@ if ($MyInvocation.ExpectingInput) {
|
|
|
455
455
|
} else {
|
|
456
456
|
& ${pwshProg} ${args} ${shTarget} ${progArgs}$args
|
|
457
457
|
}
|
|
458
|
-
${
|
|
458
|
+
${nodePath ? '$env:NODE_PATH=$env_node_path\n' : ''}\
|
|
459
459
|
exit $LASTEXITCODE
|
|
460
|
-
`;
|
|
461
|
-
}
|
|
462
|
-
return pwsh;
|
|
463
|
-
}
|
|
464
|
-
/**
|
|
465
|
-
* Chmod just created shim and make it executable
|
|
466
|
-
*
|
|
467
|
-
* @param to Path to shim.
|
|
468
|
-
*/
|
|
469
|
-
function chmodShim(to, opts) {
|
|
470
|
-
return opts.fs_.chmod(to, 0o755);
|
|
471
|
-
}
|
|
472
|
-
function normalizePathEnvVar(nodePath) {
|
|
473
|
-
if (!nodePath) {
|
|
474
|
-
return {
|
|
475
|
-
win32: '',
|
|
476
|
-
posix: ''
|
|
477
|
-
};
|
|
478
|
-
}
|
|
479
|
-
let split = (typeof nodePath === 'string' ? nodePath.split(path.delimiter) : Array.from(nodePath));
|
|
480
|
-
let result = {};
|
|
481
|
-
for (let i = 0; i < split.length; i++) {
|
|
482
|
-
const win32 = split[i].split('/').join('\\');
|
|
483
|
-
const posix = isWindows() ? split[i].split('\\').join('/').replace(/^([^:\\/]*):/, (_, $1) => `/mnt/${$1.toLowerCase()}`) : split[i];
|
|
484
|
-
result.win32 = result.win32 ? `${result.win32};${win32}` : win32;
|
|
485
|
-
result.posix = result.posix ? `${result.posix}:${posix}` : posix;
|
|
486
|
-
result[i] = { win32, posix };
|
|
487
|
-
}
|
|
488
|
-
return result;
|
|
489
|
-
}
|
|
490
|
-
module.exports = cmdShim;
|
|
460
|
+
`;
|
|
461
|
+
}
|
|
462
|
+
return pwsh;
|
|
463
|
+
}
|
|
464
|
+
/**
|
|
465
|
+
* Chmod just created shim and make it executable
|
|
466
|
+
*
|
|
467
|
+
* @param to Path to shim.
|
|
468
|
+
*/
|
|
469
|
+
function chmodShim(to, opts) {
|
|
470
|
+
return opts.fs_.chmod(to, 0o755);
|
|
471
|
+
}
|
|
472
|
+
function normalizePathEnvVar(nodePath) {
|
|
473
|
+
if (!nodePath || !nodePath.length) {
|
|
474
|
+
return {
|
|
475
|
+
win32: '',
|
|
476
|
+
posix: ''
|
|
477
|
+
};
|
|
478
|
+
}
|
|
479
|
+
let split = (typeof nodePath === 'string' ? nodePath.split(path.delimiter) : Array.from(nodePath));
|
|
480
|
+
let result = {};
|
|
481
|
+
for (let i = 0; i < split.length; i++) {
|
|
482
|
+
const win32 = split[i].split('/').join('\\');
|
|
483
|
+
const posix = isWindows() ? split[i].split('\\').join('/').replace(/^([^:\\/]*):/, (_, $1) => `/mnt/${$1.toLowerCase()}`) : split[i];
|
|
484
|
+
result.win32 = result.win32 ? `${result.win32};${win32}` : win32;
|
|
485
|
+
result.posix = result.posix ? `${result.posix}:${posix}` : posix;
|
|
486
|
+
result[i] = { win32, posix };
|
|
487
|
+
}
|
|
488
|
+
return result;
|
|
489
|
+
}
|
|
490
|
+
module.exports = cmdShim;
|
|
491
491
|
//# sourceMappingURL=index.js.map
|
package/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["src/index.ts"],"names":[],"mappings":"AAAA,YAAY,CAAA;AAuEZ,OAAO,CAAC,QAAQ,GAAG,eAAe,CAAA;AA4BlC,+BAA8B;AAE9B,6BAA6B;AAC7B,wCAAwC;AACxC,+CAA+C;AAC/C,MAAM,WAAW,GAAG,6CAA6C,CAAA;AACjE,MAAM,eAAe,GAAG;IACtB,wEAAwE;IACxE,cAAc,EAAE,IAAI;IACpB,aAAa,EAAE,SAAS,EAAE;IAC1B,EAAE,EAAE,OAAO,CAAC,IAAI,CAAC;CAClB,CAAA;AACD;;;GAGG;AACH,MAAM,qBAAqB,GAAG,IAAI,GAAG,CAAC;IACpC,CAAC,KAAK,EAAE,MAAM,CAAC;IACf,CAAC,MAAM,EAAE,MAAM,CAAC;IAChB,CAAC,MAAM,EAAE,MAAM,CAAC;IAChB,CAAC,MAAM,EAAE,KAAK,CAAC;IACf,CAAC,MAAM,EAAE,KAAK,CAAC;IACf,CAAC,MAAM,EAAE,MAAM,CAAC;IAChB,CAAC,KAAK,EAAE,IAAI,CAAC;CACd,CAAC,CAAA;AAEF,SAAS,aAAa,CAAE,IAAc;IACpC,MAAM,KAAK,GAAG,EAAC,GAAG,eAAe,EAAE,GAAG,IAAI,EAAoB,CAAA;IAC9D,MAAM,EAAE,GAAG,KAAK,CAAC,EAAE,CAAA;IACnB,KAAK,CAAC,GAAG,GAAG;QACV,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC,gBAAS,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,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