which-webstorm 3.2.2 → 4.0.0

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/.gitattributes ADDED
@@ -0,0 +1,6 @@
1
+ # In general, use LF for text
2
+ * text eol=lf
3
+
4
+ # Windows CMD does not like LF in batch files
5
+ *.bat text eol=crlf
6
+ *.cmd text eol=crlf
package/README.md CHANGED
@@ -2,14 +2,14 @@
2
2
 
3
3
  Finds WebStorm
4
4
 
5
- [![QA](https://github.com/oliversalzburg/which-webstorm/actions/workflows/qa.yml/badge.svg)](https://github.com/oliversalzburg/which-webstorm/actions/workflows/qa.yml)
5
+ [![QA](https://github.com/oliversalzburg/which-webstorm/actions/workflows/test.yml/badge.svg)](https://github.com/oliversalzburg/which-webstorm/actions/workflows/test.yml)
6
6
 
7
7
  ## Usage
8
8
 
9
9
  ### As a module
10
10
 
11
11
  ```js
12
- const whichWebstorm = require("which-webstorm");
12
+ import whichWebstorm from "which-webstorm";
13
13
  console.log(await whichWebstorm()); // prints path to WebStorm binary
14
14
  console.log(whichWebstorm.sync()); // prints path to WebStorm binary
15
15
  ```
package/bin/bin.js ADDED
@@ -0,0 +1,5 @@
1
+ #!/usr/bin/env node
2
+
3
+ import { WebStormLocator } from "../output/main.js";
4
+
5
+ new WebStormLocator().findWebstormAsync().then(console.log).catch(console.error);
package/bin/webstorm.js CHANGED
@@ -1,34 +1,32 @@
1
1
  #!/usr/bin/env node
2
2
 
3
- "use strict";
3
+ import { execa } from "execa";
4
+ import { statSync } from "node:fs";
5
+ import { resolve } from "node:path";
6
+ import { WebStormLocator } from "../output/main.js";
4
7
 
5
- const execa = require("execa");
6
- const fs = require("fs");
7
- const path = require("path");
8
- const whichWebstorm = require("..");
8
+ new WebStormLocator().findWebstormAsync().then(webstorm => {
9
+ const args = process.argv.splice(2);
9
10
 
10
- whichWebstorm().then((webstorm) => {
11
- const args = process.argv.splice(2);
11
+ if (args.length) {
12
+ return Promise.all(
13
+ args.map(arg => {
14
+ // Attempt to construct absolute path.
15
+ // This ensures that WebStorm doesn't try to resolve paths relative to
16
+ // the location where the webstorm binary is located.
17
+ const fullPath = resolve(arg);
18
+ if (statSync(fullPath)) {
19
+ arg = fullPath;
20
+ }
12
21
 
13
- if (args.length) {
14
- return Promise.all(
15
- args.map((arg) => {
16
- // Attempt to construct absolute path.
17
- // This ensures that WebStorm doesn't try to resolve paths relative to
18
- // the location where the webstorm binary is located.
19
- const fullPath = path.resolve(arg);
20
- if (fs.statSync(fullPath)) {
21
- arg = fullPath;
22
- }
22
+ return execa(webstorm, [arg], {
23
+ cwd: process.cwd(),
24
+ });
25
+ }),
26
+ );
27
+ }
23
28
 
24
- return execa(webstorm, [arg], {
25
- cwd: process.cwd(),
26
- });
27
- })
28
- );
29
- }
30
-
31
- return execa(webstorm, {
32
- cwd: process.cwd(),
33
- });
29
+ return execa(webstorm, {
30
+ cwd: process.cwd(),
31
+ });
34
32
  });
@@ -0,0 +1,7 @@
1
+ import { createRequire } from "node:module";
2
+ import path from "node:path";
3
+ import url from "node:url";
4
+ globalThis.require = createRequire(import.meta.url);
5
+ globalThis.__filename = url.fileURLToPath(import.meta.url);
6
+ globalThis.__dirname = path.dirname(__filename);
7
+ //# sourceMappingURL=cjs-shim.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cjs-shim.js","sourceRoot":"","sources":["../source/cjs-shim.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,GAAG,MAAM,UAAU,CAAC;AAE3B,UAAU,CAAC,OAAO,GAAG,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AACpD,UAAU,CAAC,UAAU,GAAG,GAAG,CAAC,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAC3D,UAAU,CAAC,SAAS,GAAG,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC"}