betterstart-cli 0.0.44 → 0.0.45
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 +61 -16
- package/dist/cli.js.map +1 -1
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -24892,8 +24892,8 @@ var INTERACTIVE_PROVISION_TIMEOUT_MS2 = 6e5;
|
|
|
24892
24892
|
var RESOURCE_CONNECT_TIMEOUT_MS = 6e4;
|
|
24893
24893
|
var NEON_FREE_PLAN_ID = "free_v3";
|
|
24894
24894
|
async function provisionNeonInteractive(runner, cwd, options) {
|
|
24895
|
-
const
|
|
24896
|
-
|
|
24895
|
+
const provisionSpinner = spinner2();
|
|
24896
|
+
provisionSpinner.start("Creating your Neon database");
|
|
24897
24897
|
const quiet = await runVercel(runner, neonAddArgs(options), {
|
|
24898
24898
|
cwd,
|
|
24899
24899
|
mode: "capture",
|
|
@@ -24901,25 +24901,72 @@ async function provisionNeonInteractive(runner, cwd, options) {
|
|
|
24901
24901
|
env: options.env
|
|
24902
24902
|
});
|
|
24903
24903
|
if (quiet.success) {
|
|
24904
|
-
|
|
24904
|
+
provisionSpinner.clear();
|
|
24905
24905
|
return readNeonProvisionInfo(quiet.stdout);
|
|
24906
24906
|
}
|
|
24907
|
-
|
|
24908
|
-
p16.log.info(
|
|
24909
|
-
`Create your Neon database in the Vercel prompts below ${pc5.dim(
|
|
24910
|
-
"(the Free plan is recommended)."
|
|
24911
|
-
)}`
|
|
24912
|
-
);
|
|
24907
|
+
let promptsShown = false;
|
|
24913
24908
|
const add = await runVercel(runner, connectedNeonAddArgs(options), {
|
|
24914
24909
|
cwd,
|
|
24915
|
-
mode: "
|
|
24910
|
+
mode: "stream",
|
|
24916
24911
|
timeoutMs: INTERACTIVE_PROVISION_TIMEOUT_MS2,
|
|
24917
|
-
env: options.env
|
|
24912
|
+
env: options.env,
|
|
24913
|
+
streamLineFilter: (line) => {
|
|
24914
|
+
if (!showNeonSetupLine(line)) return false;
|
|
24915
|
+
if (!promptsShown) {
|
|
24916
|
+
promptsShown = true;
|
|
24917
|
+
provisionSpinner.clear();
|
|
24918
|
+
p16.log.info(
|
|
24919
|
+
`Finish the Neon database setup in the Vercel prompts below ${pc5.dim(
|
|
24920
|
+
"(the Free plan is recommended)."
|
|
24921
|
+
)}`
|
|
24922
|
+
);
|
|
24923
|
+
}
|
|
24924
|
+
return true;
|
|
24925
|
+
}
|
|
24918
24926
|
});
|
|
24927
|
+
if (!promptsShown) provisionSpinner.clear();
|
|
24919
24928
|
if (!add.success) {
|
|
24920
|
-
|
|
24929
|
+
const combined = `${add.stdout}
|
|
24930
|
+
${add.stderr}`.trim();
|
|
24931
|
+
return {
|
|
24932
|
+
failure: add.timedOut ? "timeout" : "provision-failed",
|
|
24933
|
+
// Lines the user already saw are not repeated as detail.
|
|
24934
|
+
detail: promptsShown ? void 0 : combined || void 0
|
|
24935
|
+
};
|
|
24921
24936
|
}
|
|
24922
|
-
|
|
24937
|
+
const info = readNeonFallbackInfo(`${add.stdout}
|
|
24938
|
+
${add.stderr}`);
|
|
24939
|
+
if (promptsShown) info.usedTerminalFallback = true;
|
|
24940
|
+
return info;
|
|
24941
|
+
}
|
|
24942
|
+
var NEON_SETUP_NOISE = [
|
|
24943
|
+
/^$/,
|
|
24944
|
+
/^Vercel CLI \d/,
|
|
24945
|
+
/^>? ?Installing .+ under /,
|
|
24946
|
+
/^Provisioning resource/,
|
|
24947
|
+
/^Retrieving project/,
|
|
24948
|
+
/^>? ?Success!/,
|
|
24949
|
+
/^>? ?Guide: Run/,
|
|
24950
|
+
/^>? ?Dashboard: https:\/\//,
|
|
24951
|
+
/successfully connected to/i,
|
|
24952
|
+
/^>? ?Overwriting existing \.env/,
|
|
24953
|
+
/^>? ?Downloading/,
|
|
24954
|
+
/^Changes:/,
|
|
24955
|
+
/^\+ [A-Z][A-Z0-9_]*/,
|
|
24956
|
+
/^[✓√] +(Updated|Created)/
|
|
24957
|
+
];
|
|
24958
|
+
function showNeonSetupLine(line) {
|
|
24959
|
+
return !NEON_SETUP_NOISE.some((pattern) => pattern.test(line));
|
|
24960
|
+
}
|
|
24961
|
+
function readNeonFallbackInfo(output) {
|
|
24962
|
+
const info = {};
|
|
24963
|
+
const provisioned = output.match(/successfully provisioned: (\S+)/i)?.[1];
|
|
24964
|
+
if (provisioned) info.resourceName = provisioned;
|
|
24965
|
+
const dashboard = output.match(/Dashboard: (https:\/\/\S+)/i)?.[1];
|
|
24966
|
+
if (dashboard) info.dashboardUrl = dashboard;
|
|
24967
|
+
if (/failed to connect/i.test(output)) info.connectedToProject = false;
|
|
24968
|
+
else if (/successfully connected to/i.test(output)) info.connectedToProject = true;
|
|
24969
|
+
return info;
|
|
24923
24970
|
}
|
|
24924
24971
|
async function provisionNeon(runner, cwd, options) {
|
|
24925
24972
|
const provisionSpinner = spinner2();
|
|
@@ -25005,9 +25052,7 @@ function neonAddArgs(options) {
|
|
|
25005
25052
|
];
|
|
25006
25053
|
}
|
|
25007
25054
|
function connectedNeonAddArgs(options) {
|
|
25008
|
-
|
|
25009
|
-
if (options.plan) addArgs.push("--plan", options.plan);
|
|
25010
|
-
return addArgs;
|
|
25055
|
+
return ["integration", "add", "neon", "--plan", options.plan ?? NEON_FREE_PLAN_ID];
|
|
25011
25056
|
}
|
|
25012
25057
|
|
|
25013
25058
|
// adapters/next/init/vercel/flow.ts
|