@zkochan/cmd-shim 5.2.1 → 5.3.1

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 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,52 @@
1
- # @zkochan/cmd-shim
2
-
3
- > Used in pnpm for command line application support
4
-
5
- <!--@shields('travis', 'appveyor', 'npm')-->
6
- [![Build Status](https://img.shields.io/travis/pnpm/cmd-shim/master.svg)](https://travis-ci.org/pnpm/cmd-shim) [![Build Status on Windows](https://img.shields.io/appveyor/ci/zkochan/cmd-shim-8ah3a/master.svg)](https://ci.appveyor.com/project/zkochan/cmd-shim-8ah3a/branch/master) [![npm version](https://img.shields.io/npm/v/@zkochan/cmd-shim.svg)](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
+ [![Build Status](https://img.shields.io/travis/pnpm/cmd-shim/master.svg)](https://travis-ci.org/pnpm/cmd-shim) [![Build Status on Windows](https://img.shields.io/appveyor/ci/zkochan/cmd-shim-8ah3a/master.svg)](https://ci.appveyor.com/project/zkochan/cmd-shim-8ah3a/branch/master) [![npm version](https://img.shields.io/npm/v/@zkochan/cmd-shim.svg)](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.prependToPath` - _String_ - prepends the passed path to PATH before executing the Node.js program.
39
+ - `opts.nodeExecPath` - _String_ - sets the path to the Node.js executable.
40
+ - `opts.createCmdFile` - _Boolean_ - is `true` on Windows by default. If true, creates a cmd file.
41
+ - `opts.createPwshFile` - _Boolean_ - is `true` by default. If true, creates a powershell file.
42
+ - `opts.progArgs` - String - optional arguments that will be prepend to any CLI arguments
43
+
44
+ ```javascript
45
+ const cmdShim = require('@zkochan/cmd-shim')
46
+ cmdShim(__dirname + '/cli.js', '/usr/bin/command-name', { preserveSymlinks: true })
47
+ .catch(err => console.error(err))
48
+ ```
49
+
50
+ ## License
51
+
52
+ [BSD-2-Clause](./LICENSE) © [Zoltan Kochan](http://kochan.io)
package/index.d.ts CHANGED
@@ -1,73 +1,74 @@
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
+ prependToPath?: string;
46
+ }
47
+ }
48
+ declare type Options = cmdShim.Options;
49
+ export = cmdShim;
50
+ /**
51
+ * Try to create shims.
52
+ *
53
+ * @param src Path to program (executable or script).
54
+ * @param to Path to shims.
55
+ * Don't add an extension if you will create multiple types of shims.
56
+ * @param opts Options.
57
+ * @throws If `src` is missing.
58
+ */
59
+ declare function cmdShim(src: string, to: string, opts?: Options): Promise<void>;
60
+ declare namespace cmdShim {
61
+ var ifExists: typeof cmdShimIfExists;
62
+ }
63
+ /**
64
+ * Try to create shims.
65
+ *
66
+ * Does nothing if `src` doesn't exist.
67
+ *
68
+ * @param src Path to program (executable or script).
69
+ * @param to Path to shims.
70
+ * Don't add an extension if you will create multiple types of shims.
71
+ * @param opts Options.
72
+ */
73
+ declare function cmdShimIfExists(src: string, to: string, opts?: Options): Promise<void>;
73
74
  //# sourceMappingURL=index.d.ts.map
package/index.d.ts.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["src/index.ts"],"names":[],"mappings":"AAWA,kBAAU,OAAO,CAAC;IAChB,UAAiB,OAAO;QACtB;;;;WAIG;QACH,cAAc,CAAC,EAAE,OAAO,CAAA;QAExB;;;;WAIG;QACH,aAAa,CAAC,EAAE,OAAO,CAAA;QAEvB;;;;WAIG;QACH,gBAAgB,CAAC,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