rust-just 1.36.0 → 1.37.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/lib/index.mjs CHANGED
@@ -1,7 +1,9 @@
1
1
  #!/usr/bin/env node
2
2
  import { execa } from 'execa';
3
- import { fileURLToPath } from 'url';
3
+ import { fileURLToPath } from 'node:url';
4
4
  import { platform, arch } from 'os';
5
+ import yargs from 'yargs/yargs';
6
+ import { hideBin } from 'yargs/helpers';
5
7
 
6
8
  var __defProp = Object.defineProperty;
7
9
  var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
@@ -25,14 +27,33 @@ async function getExePath() {
25
27
  }
26
28
  }
27
29
  __name(getExePath, "getExePath");
28
-
29
- // src/index.ts
30
+ function safeParse(jsonString) {
31
+ try {
32
+ return JSON.parse(jsonString);
33
+ } catch (e) {
34
+ console.error("Invalid JSON format in --options");
35
+ process.exit(1);
36
+ }
37
+ }
38
+ __name(safeParse, "safeParse");
30
39
  async function run() {
31
40
  const exePath = await getExePath();
32
- const args = process.argv.slice(2);
33
- const processResult = await execa(fileURLToPath(exePath), args, {
34
- stdio: "inherit"
35
- });
41
+ const argv = yargs(hideBin(process.argv)).option("execaoptions", {
42
+ type: "string",
43
+ description: "Execa options in JSON format"
44
+ }).parserConfiguration({
45
+ "unknown-options-as-args": true
46
+ }).help(false).version(false).parse();
47
+ const args = argv._;
48
+ let execaOptions = {
49
+ stdio: "inherit",
50
+ reject: false
51
+ };
52
+ if (argv.execaoptions) {
53
+ const userOptions = safeParse(argv.execaoptions);
54
+ execaOptions = { ...execaOptions, ...userOptions };
55
+ }
56
+ const processResult = await execa(fileURLToPath(exePath), args, execaOptions);
36
57
  process.exit(processResult.exitCode ?? 0);
37
58
  }
38
59
  __name(run, "run");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rust-just",
3
- "version": "1.36.0",
3
+ "version": "1.37.0",
4
4
  "description": "🤖 Just a command runner",
5
5
  "bin": "lib/index.mjs",
6
6
  "exports": {
@@ -16,7 +16,7 @@
16
16
  "lint": "eslint .",
17
17
  "lint:fix": "eslint . --fix",
18
18
  "build": "tsup",
19
- "dev": "yarn build && node lib/index.js"
19
+ "dev": "yarn build && node lib/index.mjs"
20
20
  },
21
21
  "repository": {
22
22
  "type": "git",
@@ -35,9 +35,10 @@
35
35
  "bugs": {
36
36
  "url": "https://github.com/casey/just/issues"
37
37
  },
38
- "homepage": "https://github.com/casey/just#readme",
38
+ "homepage": "https://github.com/gnpaone/rust-just/tree/master/npm#readme",
39
39
  "dependencies": {
40
- "execa": "^9.4.0"
40
+ "execa": "^9.4.1",
41
+ "yargs": "^17.7.2"
41
42
  },
42
43
  "devDependencies": {
43
44
  "@types/node": "^20.11.22",
@@ -48,13 +49,13 @@
48
49
  "typescript": "^5.3.3"
49
50
  },
50
51
  "optionalDependencies": {
51
- "rust-just-darwin-arm64": "1.36.0",
52
- "rust-just-darwin-x64": "1.36.0",
53
- "rust-just-linux-arm": "1.36.0",
54
- "rust-just-linux-arm64": "1.36.0",
55
- "rust-just-linux-x64": "1.36.0",
56
- "rust-just-windows-arm64": "1.36.0",
57
- "rust-just-windows-x64": "1.36.0"
52
+ "rust-just-darwin-arm64": "1.37.0",
53
+ "rust-just-darwin-x64": "1.37.0",
54
+ "rust-just-linux-arm": "1.37.0",
55
+ "rust-just-linux-arm64": "1.37.0",
56
+ "rust-just-linux-x64": "1.37.0",
57
+ "rust-just-windows-arm64": "1.37.0",
58
+ "rust-just-windows-x64": "1.37.0"
58
59
  },
59
60
  "eslintConfig": {
60
61
  "extends": [