@learnrudi/cli 1.10.10 → 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 +51 -14
- 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", env:
|
|
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", env:
|
|
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);
|
|
@@ -9250,7 +9250,7 @@ async function uninstallPackage(id) {
|
|
|
9250
9250
|
const npmPrefix = getNodeRuntimeRoot();
|
|
9251
9251
|
execSync11(`"${npmCmd}" uninstall -g ${manifest.npmPackage} --prefix "${npmPrefix}" --no-audit --no-fund`, {
|
|
9252
9252
|
stdio: "pipe",
|
|
9253
|
-
env:
|
|
9253
|
+
env: buildNodeToolEnv(npmCmd)
|
|
9254
9254
|
});
|
|
9255
9255
|
} catch (error) {
|
|
9256
9256
|
console.warn(`[Installer] Warning: Failed to uninstall ${manifest.npmPackage}: ${error.message}`);
|
|
@@ -9433,11 +9433,31 @@ async function installStackDependencies(stackPath, onProgress) {
|
|
|
9433
9433
|
const packageJsonPath = import_path6.default.join(nodePath, "package.json");
|
|
9434
9434
|
if (import_fs5.default.existsSync(packageJsonPath)) {
|
|
9435
9435
|
onProgress?.({ phase: "installing-deps", message: "Installing Node.js dependencies..." });
|
|
9436
|
+
let installedWithPnpm = false;
|
|
9436
9437
|
try {
|
|
9437
|
-
const
|
|
9438
|
-
|
|
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;
|
|
9439
9451
|
} catch (error) {
|
|
9440
|
-
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
|
+
}
|
|
9441
9461
|
}
|
|
9442
9462
|
}
|
|
9443
9463
|
}
|
|
@@ -9453,15 +9473,16 @@ async function installStackDependencies(stackPath, onProgress) {
|
|
|
9453
9473
|
}
|
|
9454
9474
|
}
|
|
9455
9475
|
}
|
|
9456
|
-
function
|
|
9457
|
-
|
|
9458
|
-
|
|
9476
|
+
function buildNodeToolEnv(toolCmd, extraEnv = {}) {
|
|
9477
|
+
const env = { ...process.env, ...extraEnv };
|
|
9478
|
+
if (!import_path6.default.isAbsolute(toolCmd)) {
|
|
9479
|
+
return env;
|
|
9459
9480
|
}
|
|
9460
|
-
const
|
|
9461
|
-
const basePath =
|
|
9481
|
+
const toolBinDir = import_path6.default.dirname(toolCmd);
|
|
9482
|
+
const basePath = env.PATH || "";
|
|
9462
9483
|
return {
|
|
9463
|
-
...
|
|
9464
|
-
PATH: [
|
|
9484
|
+
...env,
|
|
9485
|
+
PATH: [toolBinDir, basePath].join(import_path6.default.delimiter)
|
|
9465
9486
|
};
|
|
9466
9487
|
}
|
|
9467
9488
|
async function findNpmExecutable() {
|
|
@@ -9480,6 +9501,22 @@ async function findNpmExecutable() {
|
|
|
9480
9501
|
}
|
|
9481
9502
|
return "npm";
|
|
9482
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
|
+
}
|
|
9483
9520
|
async function findPythonExecutable() {
|
|
9484
9521
|
const isWindows = process.platform === "win32";
|
|
9485
9522
|
const arch = process.arch === "arm64" ? "arm64" : "x64";
|
|
@@ -40833,7 +40870,7 @@ async function cmdStudio(args, flags) {
|
|
|
40833
40870
|
}
|
|
40834
40871
|
|
|
40835
40872
|
// src/index.js
|
|
40836
|
-
var VERSION2 = true ? "1.10.
|
|
40873
|
+
var VERSION2 = true ? "1.10.11" : process.env.npm_package_version || "0.0.0";
|
|
40837
40874
|
async function main() {
|
|
40838
40875
|
const { command, args, flags } = parseArgs(process.argv.slice(2));
|
|
40839
40876
|
if (flags.version || flags.v) {
|