@learnrudi/cli 1.10.9 → 1.10.11
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/index.cjs +56 -7
- package/dist/packages-manifest.json +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -9002,12 +9002,12 @@ async function installSinglePackage(pkg, options = {}) {
|
|
|
9002
9002
|
const resourcesPath = process.env.RESOURCES_PATH;
|
|
9003
9003
|
const npmCmd = resourcesPath ? import_path6.default.join(resourcesPath, "bundled-runtimes", "node", "bin", "npm") : await findNpmExecutable();
|
|
9004
9004
|
if (!isAgentNpm && !import_fs5.default.existsSync(import_path6.default.join(installPath, "package.json"))) {
|
|
9005
|
-
execSync11(`"${npmCmd}" init -y`, { cwd: installPath, stdio: "pipe" });
|
|
9005
|
+
execSync11(`"${npmCmd}" init -y`, { cwd: installPath, stdio: "pipe", env: buildNodeToolEnv(npmCmd) });
|
|
9006
9006
|
}
|
|
9007
9007
|
const shouldIgnoreScripts = pkg.source?.type === "npm" && !allowScripts;
|
|
9008
9008
|
const installFlags = shouldIgnoreScripts ? "--ignore-scripts --no-audit --no-fund" : "--no-audit --no-fund";
|
|
9009
9009
|
const installCmd = isAgentNpm ? `install -g ${pkg.npmPackage} ${installFlags} --prefix "${npmInstallRoot}"` : `install ${pkg.npmPackage} ${installFlags}`;
|
|
9010
|
-
execSync11(`"${npmCmd}" ${installCmd}`, { cwd: installPath, stdio: "pipe" });
|
|
9010
|
+
execSync11(`"${npmCmd}" ${installCmd}`, { cwd: installPath, stdio: "pipe", env: buildNodeToolEnv(npmCmd) });
|
|
9011
9011
|
let bins = pkg.bins;
|
|
9012
9012
|
if (!bins || bins.length === 0) {
|
|
9013
9013
|
bins = discoverNpmBins(npmInstallRoot, pkg.npmPackage, npmScope);
|
|
@@ -9249,7 +9249,8 @@ async function uninstallPackage(id) {
|
|
|
9249
9249
|
const npmCmd = await findNpmExecutable();
|
|
9250
9250
|
const npmPrefix = getNodeRuntimeRoot();
|
|
9251
9251
|
execSync11(`"${npmCmd}" uninstall -g ${manifest.npmPackage} --prefix "${npmPrefix}" --no-audit --no-fund`, {
|
|
9252
|
-
stdio: "pipe"
|
|
9252
|
+
stdio: "pipe",
|
|
9253
|
+
env: buildNodeToolEnv(npmCmd)
|
|
9253
9254
|
});
|
|
9254
9255
|
} catch (error) {
|
|
9255
9256
|
console.warn(`[Installer] Warning: Failed to uninstall ${manifest.npmPackage}: ${error.message}`);
|
|
@@ -9432,11 +9433,31 @@ async function installStackDependencies(stackPath, onProgress) {
|
|
|
9432
9433
|
const packageJsonPath = import_path6.default.join(nodePath, "package.json");
|
|
9433
9434
|
if (import_fs5.default.existsSync(packageJsonPath)) {
|
|
9434
9435
|
onProgress?.({ phase: "installing-deps", message: "Installing Node.js dependencies..." });
|
|
9436
|
+
let installedWithPnpm = false;
|
|
9435
9437
|
try {
|
|
9436
|
-
const
|
|
9437
|
-
|
|
9438
|
+
const pnpmStore = import_path6.default.join(PATHS.cache, "pnpm");
|
|
9439
|
+
const corepackHome = import_path6.default.join(PATHS.cache, "corepack");
|
|
9440
|
+
const corepackCmd = await findCorepackExecutable();
|
|
9441
|
+
import_fs5.default.mkdirSync(pnpmStore, { recursive: true });
|
|
9442
|
+
import_fs5.default.mkdirSync(corepackHome, { recursive: true });
|
|
9443
|
+
const corepackEnv = buildNodeToolEnv(corepackCmd, { COREPACK_HOME: corepackHome });
|
|
9444
|
+
execSync11(`"${corepackCmd}" prepare pnpm@9 --activate`, { cwd: nodePath, stdio: "pipe", env: corepackEnv });
|
|
9445
|
+
execSync11(`"${corepackCmd}" pnpm install --store-dir "${pnpmStore}" --prefer-frozen-lockfile`, {
|
|
9446
|
+
cwd: nodePath,
|
|
9447
|
+
stdio: "pipe",
|
|
9448
|
+
env: corepackEnv
|
|
9449
|
+
});
|
|
9450
|
+
installedWithPnpm = true;
|
|
9438
9451
|
} catch (error) {
|
|
9439
|
-
console.warn(`Warning:
|
|
9452
|
+
console.warn(`Warning: pnpm install failed, falling back to npm: ${error.message}`);
|
|
9453
|
+
}
|
|
9454
|
+
if (!installedWithPnpm) {
|
|
9455
|
+
try {
|
|
9456
|
+
const npmCmd = await findNpmExecutable();
|
|
9457
|
+
execSync11(`"${npmCmd}" install`, { cwd: nodePath, stdio: "pipe", env: buildNodeToolEnv(npmCmd) });
|
|
9458
|
+
} catch (error) {
|
|
9459
|
+
console.warn(`Warning: Failed to install Node.js dependencies: ${error.message}`);
|
|
9460
|
+
}
|
|
9440
9461
|
}
|
|
9441
9462
|
}
|
|
9442
9463
|
}
|
|
@@ -9452,6 +9473,18 @@ async function installStackDependencies(stackPath, onProgress) {
|
|
|
9452
9473
|
}
|
|
9453
9474
|
}
|
|
9454
9475
|
}
|
|
9476
|
+
function buildNodeToolEnv(toolCmd, extraEnv = {}) {
|
|
9477
|
+
const env = { ...process.env, ...extraEnv };
|
|
9478
|
+
if (!import_path6.default.isAbsolute(toolCmd)) {
|
|
9479
|
+
return env;
|
|
9480
|
+
}
|
|
9481
|
+
const toolBinDir = import_path6.default.dirname(toolCmd);
|
|
9482
|
+
const basePath = env.PATH || "";
|
|
9483
|
+
return {
|
|
9484
|
+
...env,
|
|
9485
|
+
PATH: [toolBinDir, basePath].join(import_path6.default.delimiter)
|
|
9486
|
+
};
|
|
9487
|
+
}
|
|
9455
9488
|
async function findNpmExecutable() {
|
|
9456
9489
|
const isWindows = process.platform === "win32";
|
|
9457
9490
|
const arch = process.arch === "arm64" ? "arm64" : "x64";
|
|
@@ -9468,6 +9501,22 @@ async function findNpmExecutable() {
|
|
|
9468
9501
|
}
|
|
9469
9502
|
return "npm";
|
|
9470
9503
|
}
|
|
9504
|
+
async function findCorepackExecutable() {
|
|
9505
|
+
const isWindows = process.platform === "win32";
|
|
9506
|
+
const arch = process.arch === "arm64" ? "arm64" : "x64";
|
|
9507
|
+
const binDir = isWindows ? "" : "bin";
|
|
9508
|
+
const exe = isWindows ? "corepack.cmd" : "corepack";
|
|
9509
|
+
const bundledNodeBase = import_path6.default.join(PATHS.runtimes, "node");
|
|
9510
|
+
const archSpecificCorepack = import_path6.default.join(bundledNodeBase, arch, binDir, exe);
|
|
9511
|
+
if (import_fs5.default.existsSync(archSpecificCorepack)) {
|
|
9512
|
+
return archSpecificCorepack;
|
|
9513
|
+
}
|
|
9514
|
+
const flatCorepack = import_path6.default.join(bundledNodeBase, binDir, exe);
|
|
9515
|
+
if (import_fs5.default.existsSync(flatCorepack)) {
|
|
9516
|
+
return flatCorepack;
|
|
9517
|
+
}
|
|
9518
|
+
return "corepack";
|
|
9519
|
+
}
|
|
9471
9520
|
async function findPythonExecutable() {
|
|
9472
9521
|
const isWindows = process.platform === "win32";
|
|
9473
9522
|
const arch = process.arch === "arm64" ? "arm64" : "x64";
|
|
@@ -40821,7 +40870,7 @@ async function cmdStudio(args, flags) {
|
|
|
40821
40870
|
}
|
|
40822
40871
|
|
|
40823
40872
|
// src/index.js
|
|
40824
|
-
var VERSION2 = true ? "1.10.
|
|
40873
|
+
var VERSION2 = true ? "1.10.11" : process.env.npm_package_version || "0.0.0";
|
|
40825
40874
|
async function main() {
|
|
40826
40875
|
const { command, args, flags } = parseArgs(process.argv.slice(2));
|
|
40827
40876
|
if (flags.version || flags.v) {
|