pinme 2.0.7 → 2.0.8-beta.1
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.js +46 -47
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -5978,7 +5978,7 @@ var import_chalk26 = __toESM(require("chalk"));
|
|
|
5978
5978
|
var import_figlet5 = __toESM(require("figlet"));
|
|
5979
5979
|
|
|
5980
5980
|
// package.json
|
|
5981
|
-
var version = "2.0.
|
|
5981
|
+
var version = "2.0.8-beta.1";
|
|
5982
5982
|
|
|
5983
5983
|
// bin/upload.ts
|
|
5984
5984
|
var import_path7 = __toESM(require("path"));
|
|
@@ -9067,6 +9067,16 @@ var import_os5 = __toESM(require("os"));
|
|
|
9067
9067
|
var import_path11 = __toESM(require("path"));
|
|
9068
9068
|
var import_chalk19 = __toESM(require("chalk"));
|
|
9069
9069
|
var import_child_process3 = require("child_process");
|
|
9070
|
+
var DependencyInstallError = class extends Error {
|
|
9071
|
+
command;
|
|
9072
|
+
constructor(command, cause) {
|
|
9073
|
+
const reason = cause instanceof Error ? cause.message : String(cause);
|
|
9074
|
+
super(`${command} failed: ${reason}`);
|
|
9075
|
+
this.name = "DependencyInstallError";
|
|
9076
|
+
this.command = command;
|
|
9077
|
+
this.cause = cause;
|
|
9078
|
+
}
|
|
9079
|
+
};
|
|
9070
9080
|
function makeTempCacheDir() {
|
|
9071
9081
|
return import_fs_extra5.default.mkdtempSync(import_path11.default.join(import_os5.default.tmpdir(), "pinme-npm-cache-"));
|
|
9072
9082
|
}
|
|
@@ -9076,9 +9086,18 @@ function getNpmCommand() {
|
|
|
9076
9086
|
}
|
|
9077
9087
|
return "npm";
|
|
9078
9088
|
}
|
|
9079
|
-
function
|
|
9089
|
+
function hasPackageLock(cwd) {
|
|
9090
|
+
return import_fs_extra5.default.existsSync(import_path11.default.join(cwd, "package-lock.json"));
|
|
9091
|
+
}
|
|
9092
|
+
function getInstallScript(cwd) {
|
|
9093
|
+
return hasPackageLock(cwd) ? "ci" : "install";
|
|
9094
|
+
}
|
|
9095
|
+
function formatInstallCommand(script) {
|
|
9096
|
+
return `npm ${script} --cache <isolated npm cache> --no-audit --no-fund`;
|
|
9097
|
+
}
|
|
9098
|
+
function runInstall(cwd, cacheDir, script) {
|
|
9080
9099
|
const npm = getNpmCommand();
|
|
9081
|
-
const result = (0, import_child_process3.spawnSync)(npm, [
|
|
9100
|
+
const result = (0, import_child_process3.spawnSync)(npm, [script, "--cache", cacheDir, "--no-audit", "--no-fund"], {
|
|
9082
9101
|
cwd,
|
|
9083
9102
|
stdio: "inherit",
|
|
9084
9103
|
shell: true,
|
|
@@ -9093,10 +9112,12 @@ function runInstall(cwd, cacheDir) {
|
|
|
9093
9112
|
throw result.error;
|
|
9094
9113
|
}
|
|
9095
9114
|
if (result.status !== 0) {
|
|
9096
|
-
throw new Error(`npm
|
|
9115
|
+
throw new Error(`npm ${script} failed with exit code ${result.status}`);
|
|
9097
9116
|
}
|
|
9098
9117
|
}
|
|
9099
9118
|
function installProjectDependencies(cwd) {
|
|
9119
|
+
const script = getInstallScript(cwd);
|
|
9120
|
+
const command = formatInstallCommand(script);
|
|
9100
9121
|
let lastError;
|
|
9101
9122
|
for (let attempt = 1; attempt <= 2; attempt += 1) {
|
|
9102
9123
|
const cacheDir = makeTempCacheDir();
|
|
@@ -9104,7 +9125,10 @@ function installProjectDependencies(cwd) {
|
|
|
9104
9125
|
if (attempt > 1) {
|
|
9105
9126
|
console.log(import_chalk19.default.yellow(" Retrying dependency install with a fresh npm cache..."));
|
|
9106
9127
|
}
|
|
9107
|
-
|
|
9128
|
+
if (attempt === 1 && script === "ci") {
|
|
9129
|
+
console.log(import_chalk19.default.gray(" package-lock.json found; using npm ci for a reproducible install."));
|
|
9130
|
+
}
|
|
9131
|
+
runInstall(cwd, cacheDir, script);
|
|
9108
9132
|
return;
|
|
9109
9133
|
} catch (error) {
|
|
9110
9134
|
lastError = error;
|
|
@@ -9112,7 +9136,7 @@ function installProjectDependencies(cwd) {
|
|
|
9112
9136
|
import_fs_extra5.default.removeSync(cacheDir);
|
|
9113
9137
|
}
|
|
9114
9138
|
}
|
|
9115
|
-
throw lastError;
|
|
9139
|
+
throw new DependencyInstallError(command, lastError);
|
|
9116
9140
|
}
|
|
9117
9141
|
|
|
9118
9142
|
// bin/create.ts
|
|
@@ -9388,40 +9412,28 @@ Directory "${projectName}" already exists.`));
|
|
|
9388
9412
|
console.log(import_chalk20.default.green(" Project dependencies installed"));
|
|
9389
9413
|
} catch (error) {
|
|
9390
9414
|
const errorMsg = error.message || "";
|
|
9415
|
+
const installCommand = error instanceof DependencyInstallError ? error.command : "npm ci/npm install --cache <isolated npm cache> --no-audit --no-fund";
|
|
9391
9416
|
if (errorMsg.includes("EACCES") || errorMsg.includes("EPERM") || errorMsg.includes("permission denied")) {
|
|
9392
|
-
throw createCommandError("project dependency install",
|
|
9393
|
-
"Permission error detected.
|
|
9394
|
-
"",
|
|
9395
|
-
"Option 1: Fix npm permissions (Recommended)",
|
|
9396
|
-
" mkdir -p ~/.npm-global",
|
|
9397
|
-
" npm config set prefix ~/.npm-global",
|
|
9398
|
-
" Then add ~/.npm-global/bin to your PATH in ~/.bashrc or ~/.zshrc",
|
|
9399
|
-
"",
|
|
9400
|
-
"Option 2: Use npx to avoid global installs",
|
|
9401
|
-
" npx npm install",
|
|
9402
|
-
"",
|
|
9403
|
-
"Option 3: Check if you have write permissions",
|
|
9417
|
+
throw createCommandError("project dependency install", installCommand, error, [
|
|
9418
|
+
"Permission error detected. Pinme already retries with an isolated npm cache.",
|
|
9419
|
+
"Check whether the project directory is writable:",
|
|
9404
9420
|
" ls -la " + targetDir,
|
|
9405
|
-
""
|
|
9406
|
-
"For more help: https://docs.npmjs.com/resolving-eacces-permissions-errors-when-installing-packages-globally"
|
|
9421
|
+
"If npm still reports a root-owned cache, set `npm_config_cache` to a user-writable directory and retry."
|
|
9407
9422
|
]);
|
|
9408
9423
|
}
|
|
9409
9424
|
if (errorMsg.includes("ENOTFOUND") || errorMsg.includes("ETIMEDOUT") || errorMsg.includes("network")) {
|
|
9410
|
-
throw createCommandError("project dependency install",
|
|
9425
|
+
throw createCommandError("project dependency install", installCommand, error, [
|
|
9411
9426
|
"Network error detected. Please check:",
|
|
9412
9427
|
" 1. Internet connection is available",
|
|
9413
9428
|
" 2. npm registry is accessible (https://registry.npmjs.org)",
|
|
9414
9429
|
" 3. Try using a mirror: npm config set registry https://registry.npmmirror.com"
|
|
9415
9430
|
]);
|
|
9416
9431
|
}
|
|
9417
|
-
throw createCommandError("project dependency install",
|
|
9432
|
+
throw createCommandError("project dependency install", installCommand, error, [
|
|
9418
9433
|
"Dependency installation failed.",
|
|
9419
9434
|
"Check network connectivity and npm registry availability.",
|
|
9420
9435
|
"Inspect the generated workspace `package.json` files for dependency conflicts.",
|
|
9421
|
-
""
|
|
9422
|
-
"If this is a permission issue, try:",
|
|
9423
|
-
" sudo chown -R $(whoami) ~/.npm",
|
|
9424
|
-
" sudo chown -R $(whoami) " + targetDir + "/node_modules"
|
|
9436
|
+
"If `package-lock.json` is stale, update it intentionally with `npm install` before retrying."
|
|
9425
9437
|
]);
|
|
9426
9438
|
}
|
|
9427
9439
|
console.log(import_chalk20.default.blue("\n5. Building backend worker..."));
|
|
@@ -9646,40 +9658,27 @@ function installDependencies() {
|
|
|
9646
9658
|
console.log(import_chalk21.default.green("Project dependencies installed"));
|
|
9647
9659
|
} catch (error) {
|
|
9648
9660
|
const errorMsg = error.message || "";
|
|
9661
|
+
const installCommand = error instanceof DependencyInstallError ? error.command : "npm ci/npm install --cache <isolated npm cache> --no-audit --no-fund";
|
|
9649
9662
|
if (errorMsg.includes("EACCES") || errorMsg.includes("EPERM") || errorMsg.includes("permission denied")) {
|
|
9650
|
-
throw createCommandError("project dependency install",
|
|
9651
|
-
"Permission error detected.
|
|
9652
|
-
"",
|
|
9653
|
-
"Option 1: Fix npm permissions (Recommended)",
|
|
9654
|
-
" mkdir -p ~/.npm-global",
|
|
9655
|
-
" npm config set prefix ~/.npm-global",
|
|
9656
|
-
" Then add ~/.npm-global/bin to your PATH in ~/.bashrc or ~/.zshrc",
|
|
9657
|
-
"",
|
|
9658
|
-
"Option 2: Use npx to avoid global installs",
|
|
9659
|
-
" npx npm install",
|
|
9660
|
-
"",
|
|
9661
|
-
"Option 3: Check if you have write permissions",
|
|
9663
|
+
throw createCommandError("project dependency install", installCommand, error, [
|
|
9664
|
+
"Permission error detected. Pinme already retries with an isolated npm cache.",
|
|
9665
|
+
"Check whether the project directory is writable:",
|
|
9662
9666
|
" ls -la " + PROJECT_DIR2,
|
|
9663
|
-
""
|
|
9664
|
-
"For more help: https://docs.npmjs.com/resolving-eacces-permissions-errors-when-installing-packages-globally"
|
|
9667
|
+
"If npm still reports a root-owned cache, set `npm_config_cache` to a user-writable directory and retry."
|
|
9665
9668
|
]);
|
|
9666
9669
|
}
|
|
9667
9670
|
if (errorMsg.includes("ENOTFOUND") || errorMsg.includes("ETIMEDOUT") || errorMsg.includes("network")) {
|
|
9668
|
-
throw createCommandError("project dependency install",
|
|
9671
|
+
throw createCommandError("project dependency install", installCommand, error, [
|
|
9669
9672
|
"Network error detected. Please check:",
|
|
9670
9673
|
" 1. Internet connection is available",
|
|
9671
9674
|
" 2. npm registry is accessible (https://registry.npmjs.org)",
|
|
9672
9675
|
" 3. Try using a mirror: npm config set registry https://registry.npmmirror.com"
|
|
9673
9676
|
]);
|
|
9674
9677
|
}
|
|
9675
|
-
throw createCommandError("project dependency install",
|
|
9678
|
+
throw createCommandError("project dependency install", installCommand, error, [
|
|
9676
9679
|
"Dependency installation failed.",
|
|
9677
9680
|
"Check network connectivity and npm registry availability.",
|
|
9678
|
-
"If `package-lock.json` is stale
|
|
9679
|
-
"",
|
|
9680
|
-
"If this is a permission issue, try:",
|
|
9681
|
-
" sudo chown -R $(whoami) ~/.npm",
|
|
9682
|
-
" sudo chown -R $(whoami) " + PROJECT_DIR2 + "/node_modules"
|
|
9681
|
+
"If `package-lock.json` is stale, update it intentionally with `npm install` before retrying."
|
|
9683
9682
|
]);
|
|
9684
9683
|
}
|
|
9685
9684
|
}
|