@elding/cli 0.9.2 → 0.9.3
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/dist/commands/proxy.js +12 -3
- package/dist/commands/run.js +10 -3
- package/package.json +1 -1
package/dist/commands/proxy.js
CHANGED
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
2
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
6
|
exports.proxy = proxy;
|
|
4
7
|
const child_process_1 = require("child_process");
|
|
8
|
+
const path_1 = __importDefault(require("path"));
|
|
5
9
|
const config_js_1 = require("../lib/config.js");
|
|
6
10
|
const api_js_1 = require("../lib/api.js");
|
|
7
11
|
const proxyServer_js_1 = require("../lib/proxyServer.js");
|
|
@@ -46,16 +50,21 @@ async function proxy(cmd, args, options = {}) {
|
|
|
46
50
|
console.log(chalk.dim("Logs cloud proxy désactivés (--no-report-logs)."));
|
|
47
51
|
else
|
|
48
52
|
console.log(chalk.dim("Métadonnées de requêtes envoyées au vault (jamais les valeurs). Couper avec --no-report-logs."));
|
|
53
|
+
// Résout les binaires locaux (next, vite...) comme le ferait npm, en
|
|
54
|
+
// cross-platform : path.delimiter = ";" sur Windows, ":" sur POSIX.
|
|
55
|
+
const localBin = path_1.default.join(process.cwd(), "node_modules", ".bin");
|
|
56
|
+
// Sur Windows, les binaires sont des shims `.cmd` : il faut un shell pour les
|
|
57
|
+
// exécuter (sinon `next` échoue en ENOENT). Sur POSIX, on respecte --shell.
|
|
58
|
+
const useShell = process.platform === "win32" ? true : !!options.shell;
|
|
49
59
|
const child = (0, child_process_1.spawn)(cmd, args, {
|
|
50
60
|
env: {
|
|
51
61
|
...process.env,
|
|
52
|
-
|
|
53
|
-
PATH: `${process.cwd()}/node_modules/.bin:${process.env.PATH ?? ""}`,
|
|
62
|
+
PATH: `${localBin}${path_1.default.delimiter}${process.env.PATH ?? ""}`,
|
|
54
63
|
ELDING_PROXY_URL: server.url,
|
|
55
64
|
ELDING_PROXY_TOKEN: server.token,
|
|
56
65
|
},
|
|
57
66
|
stdio: "inherit",
|
|
58
|
-
shell:
|
|
67
|
+
shell: useShell,
|
|
59
68
|
});
|
|
60
69
|
const shutdown = async () => {
|
|
61
70
|
server.close();
|
package/dist/commands/run.js
CHANGED
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
2
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
6
|
exports.run = run;
|
|
4
7
|
const child_process_1 = require("child_process");
|
|
8
|
+
const path_1 = __importDefault(require("path"));
|
|
5
9
|
const config_js_1 = require("../lib/config.js");
|
|
6
10
|
const api_js_1 = require("../lib/api.js");
|
|
7
11
|
const env_js_1 = require("../lib/env.js");
|
|
@@ -41,16 +45,19 @@ async function run(cmd, args, options = {}) {
|
|
|
41
45
|
if (rejected.length > 0) {
|
|
42
46
|
throw new Error(`Secrets refuses car leurs noms sont dangereux pour l'environnement: ${rejected.map((name) => (0, terminal_js_1.safeText)(name, 80)).join(", ")}`);
|
|
43
47
|
}
|
|
48
|
+
// Résout les binaires locaux (next, vite...) en cross-platform.
|
|
49
|
+
const localBin = path_1.default.join(process.cwd(), "node_modules", ".bin");
|
|
44
50
|
const env = {
|
|
45
51
|
...process.env,
|
|
46
|
-
|
|
47
|
-
PATH: `${process.cwd()}/node_modules/.bin:${process.env.PATH ?? ""}`,
|
|
52
|
+
PATH: `${localBin}${path_1.default.delimiter}${process.env.PATH ?? ""}`,
|
|
48
53
|
...safeSecrets,
|
|
49
54
|
};
|
|
55
|
+
// Sur Windows, les binaires locaux sont des shims `.cmd` : shell requis.
|
|
56
|
+
const useShell = process.platform === "win32" ? true : !!options.shell;
|
|
50
57
|
const result = (0, child_process_1.spawnSync)(cmd, args, {
|
|
51
58
|
env,
|
|
52
59
|
stdio: "inherit",
|
|
53
|
-
shell:
|
|
60
|
+
shell: useShell,
|
|
54
61
|
});
|
|
55
62
|
if (result.error) {
|
|
56
63
|
console.error(chalk.red(`Impossible de lancer la commande : ${result.error.message}`));
|