betterstart-cli 0.0.48 → 0.0.50
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/cli.js +48 -10
- package/dist/cli.js.map +1 -1
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -21840,7 +21840,7 @@ ${validationErrors.map((error) => ` - ${error}`).join("\n")}`
|
|
|
21840
21840
|
}
|
|
21841
21841
|
|
|
21842
21842
|
// adapters/next/commands/init.ts
|
|
21843
|
-
import { execFileSync as execFileSync5, spawn as
|
|
21843
|
+
import { execFileSync as execFileSync5, spawn as spawn5 } from "child_process";
|
|
21844
21844
|
import fs39 from "fs";
|
|
21845
21845
|
import path50 from "path";
|
|
21846
21846
|
import * as p18 from "@clack/prompts";
|
|
@@ -24620,6 +24620,7 @@ function readBlobTokenFromDotenv(filePath) {
|
|
|
24620
24620
|
}
|
|
24621
24621
|
|
|
24622
24622
|
// adapters/next/init/vercel/deploy.ts
|
|
24623
|
+
import { spawn as spawn4 } from "child_process";
|
|
24623
24624
|
import fs36 from "fs";
|
|
24624
24625
|
import path47 from "path";
|
|
24625
24626
|
import { stripVTControlCharacters as stripVTControlCharacters3 } from "util";
|
|
@@ -24672,12 +24673,14 @@ async function syncVercelProductionEnv(runner, cwd, env) {
|
|
|
24672
24673
|
var LOCAL_PROTOCOL_PATTERN = /^(workspace|link|file|portal):/;
|
|
24673
24674
|
var ADMIN_CONFIG_IMPORT_PATTERN = /^import\s+\{[^}]*\bdefineConfig\b[^}]*\}\s+from\s+['"]betterstart-cli['"];?[^\S\n]*$/m;
|
|
24674
24675
|
var ADMIN_CONFIG_IMPORT_SHIM = "const defineConfig = <T>(config: T): T => config";
|
|
24675
|
-
function guardProjectForDeploy(cwd) {
|
|
24676
|
+
async function guardProjectForDeploy(cwd, refreshLockfile = runPnpmLockfileOnly) {
|
|
24676
24677
|
const restores = [];
|
|
24677
|
-
const localSpecDeps = guardPackageJson(cwd, restores);
|
|
24678
|
+
const { localSpecDeps, removedCliDep } = guardPackageJson(cwd, restores);
|
|
24678
24679
|
guardAdminConfig(cwd, restores);
|
|
24680
|
+
const lockfile = removedCliDep ? await guardPnpmLockfile(cwd, restores, refreshLockfile) : "not-needed";
|
|
24679
24681
|
return {
|
|
24680
24682
|
localSpecDeps,
|
|
24683
|
+
lockfile,
|
|
24681
24684
|
restore() {
|
|
24682
24685
|
for (const restoreFile2 of restores) {
|
|
24683
24686
|
try {
|
|
@@ -24691,14 +24694,14 @@ function guardProjectForDeploy(cwd) {
|
|
|
24691
24694
|
function guardPackageJson(cwd, restores) {
|
|
24692
24695
|
const packageJsonPath = path47.join(cwd, "package.json");
|
|
24693
24696
|
if (!fs36.existsSync(packageJsonPath)) {
|
|
24694
|
-
return [];
|
|
24697
|
+
return { localSpecDeps: [], removedCliDep: false };
|
|
24695
24698
|
}
|
|
24696
24699
|
const original = fs36.readFileSync(packageJsonPath, "utf-8");
|
|
24697
24700
|
let parsed;
|
|
24698
24701
|
try {
|
|
24699
24702
|
parsed = JSON.parse(original);
|
|
24700
24703
|
} catch {
|
|
24701
|
-
return [];
|
|
24704
|
+
return { localSpecDeps: [], removedCliDep: false };
|
|
24702
24705
|
}
|
|
24703
24706
|
const localSpecDeps = [];
|
|
24704
24707
|
let removed = false;
|
|
@@ -24721,7 +24724,34 @@ function guardPackageJson(cwd, restores) {
|
|
|
24721
24724
|
`, "utf-8");
|
|
24722
24725
|
restores.push(() => fs36.writeFileSync(packageJsonPath, original, "utf-8"));
|
|
24723
24726
|
}
|
|
24724
|
-
return localSpecDeps;
|
|
24727
|
+
return { localSpecDeps, removedCliDep: removed };
|
|
24728
|
+
}
|
|
24729
|
+
async function guardPnpmLockfile(cwd, restores, refreshLockfile) {
|
|
24730
|
+
const lockfilePath = path47.join(cwd, "pnpm-lock.yaml");
|
|
24731
|
+
if (!fs36.existsSync(lockfilePath)) {
|
|
24732
|
+
return "not-needed";
|
|
24733
|
+
}
|
|
24734
|
+
const original = fs36.readFileSync(lockfilePath, "utf-8");
|
|
24735
|
+
restores.push(() => fs36.writeFileSync(lockfilePath, original, "utf-8"));
|
|
24736
|
+
return await refreshLockfile(cwd) ? "updated" : "failed";
|
|
24737
|
+
}
|
|
24738
|
+
var LOCKFILE_REFRESH_TIMEOUT_MS = 12e4;
|
|
24739
|
+
function runPnpmLockfileOnly(cwd) {
|
|
24740
|
+
return new Promise((resolve) => {
|
|
24741
|
+
const child = spawn4("pnpm", ["install", "--lockfile-only"], { cwd, stdio: "ignore" });
|
|
24742
|
+
const timer = setTimeout(() => {
|
|
24743
|
+
child.kill("SIGKILL");
|
|
24744
|
+
resolve(false);
|
|
24745
|
+
}, LOCKFILE_REFRESH_TIMEOUT_MS);
|
|
24746
|
+
child.on("close", (code) => {
|
|
24747
|
+
clearTimeout(timer);
|
|
24748
|
+
resolve(code === 0);
|
|
24749
|
+
});
|
|
24750
|
+
child.on("error", () => {
|
|
24751
|
+
clearTimeout(timer);
|
|
24752
|
+
resolve(false);
|
|
24753
|
+
});
|
|
24754
|
+
});
|
|
24725
24755
|
}
|
|
24726
24756
|
function guardAdminConfig(cwd, restores) {
|
|
24727
24757
|
const adminConfigPath = path47.join(cwd, "admin.config.ts");
|
|
@@ -24992,7 +25022,15 @@ async function runVercelDeployFlow(options) {
|
|
|
24992
25022
|
);
|
|
24993
25023
|
}
|
|
24994
25024
|
ensureVercelJsonFramework(options.cwd);
|
|
24995
|
-
const
|
|
25025
|
+
const guardSpinner = spinner2();
|
|
25026
|
+
guardSpinner.start("Preparing the project for deploy");
|
|
25027
|
+
const packageGuard = await guardProjectForDeploy(options.cwd);
|
|
25028
|
+
guardSpinner.clear();
|
|
25029
|
+
if (packageGuard.lockfile === "failed") {
|
|
25030
|
+
p17.log.warn(
|
|
25031
|
+
"Could not refresh pnpm-lock.yaml after removing betterstart-cli \u2014 the remote install may fail."
|
|
25032
|
+
);
|
|
25033
|
+
}
|
|
24996
25034
|
for (const dep of packageGuard.localSpecDeps) {
|
|
24997
25035
|
p17.log.warn(
|
|
24998
25036
|
`Dependency ${pc6.cyan(dep)} uses a local spec that cannot install on Vercel \u2014 the remote build may fail.`
|
|
@@ -26401,7 +26439,7 @@ function runSeedScript(cwd, adminDir, authBasePath, envOverrides) {
|
|
|
26401
26439
|
};
|
|
26402
26440
|
return new Promise((resolve) => {
|
|
26403
26441
|
const tsxBin = path50.join(cwd, "node_modules", ".bin", "tsx");
|
|
26404
|
-
const child =
|
|
26442
|
+
const child = spawn5(tsxBin, [seedPath], {
|
|
26405
26443
|
cwd,
|
|
26406
26444
|
stdio: "pipe",
|
|
26407
26445
|
env: {
|
|
@@ -26505,7 +26543,7 @@ ${stderr}`;
|
|
|
26505
26543
|
}
|
|
26506
26544
|
function runQuietCommand(bin, args, options) {
|
|
26507
26545
|
return new Promise((resolve) => {
|
|
26508
|
-
const child =
|
|
26546
|
+
const child = spawn5(bin, args, {
|
|
26509
26547
|
cwd: options.cwd,
|
|
26510
26548
|
stdio: "pipe",
|
|
26511
26549
|
env: {
|
|
@@ -26645,7 +26683,7 @@ function pipeManagedDevServerStream(stream, target, state) {
|
|
|
26645
26683
|
function startManagedDevServer(cwd, devCmd, adminLoginUrl, adminCredentials) {
|
|
26646
26684
|
return new Promise((resolve, reject) => {
|
|
26647
26685
|
const [bin, ...args] = devCmd.split(" ");
|
|
26648
|
-
const child =
|
|
26686
|
+
const child = spawn5(bin, args, {
|
|
26649
26687
|
cwd,
|
|
26650
26688
|
stdio: ["inherit", "pipe", "pipe"]
|
|
26651
26689
|
});
|