@mushi-mushi/cli 0.17.0 → 0.17.2
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/README.md +30 -17
- package/dist/chunk-EEQI5AFX.js +6 -0
- package/dist/{chunk-NYPX5KXR.js → chunk-S4WQHEGH.js} +1 -0
- package/dist/detect.js +1 -1
- package/dist/index.js +2497 -2211
- package/dist/init.js +15 -14
- package/dist/version.js +1 -1
- package/package.json +1 -1
- package/dist/chunk-OTQQZKPK.js +0 -6
package/dist/init.js
CHANGED
|
@@ -5,10 +5,10 @@ import {
|
|
|
5
5
|
envVarsToWrite,
|
|
6
6
|
installCommand,
|
|
7
7
|
readPackageJson
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-S4WQHEGH.js";
|
|
9
9
|
import {
|
|
10
10
|
MUSHI_CLI_VERSION
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-EEQI5AFX.js";
|
|
12
12
|
|
|
13
13
|
// src/init.ts
|
|
14
14
|
import * as p from "@clack/prompts";
|
|
@@ -112,6 +112,13 @@ function tightenDirPermissions(path) {
|
|
|
112
112
|
// src/endpoint.ts
|
|
113
113
|
var TEST_REPORT_TIMEOUT_MS = 1e4;
|
|
114
114
|
var TEST_REPORT_FETCH_TIMEOUT_MS = TEST_REPORT_TIMEOUT_MS;
|
|
115
|
+
var CLOUD_API_ENDPOINT = "https://dxptnwrhwsqckaftyymj.supabase.co/functions/v1/api";
|
|
116
|
+
function resolveCloudEndpoint(explicit) {
|
|
117
|
+
if (explicit?.trim()) return explicit.trim();
|
|
118
|
+
const fromEnv = process.env.MUSHI_API_ENDPOINT?.trim();
|
|
119
|
+
if (fromEnv) return fromEnv;
|
|
120
|
+
return CLOUD_API_ENDPOINT;
|
|
121
|
+
}
|
|
115
122
|
function normalizeEndpoint(url) {
|
|
116
123
|
if (!url) {
|
|
117
124
|
throw new Error(
|
|
@@ -311,11 +318,12 @@ async function runInit(options = {}) {
|
|
|
311
318
|
} else {
|
|
312
319
|
p.log.info(`Skipped install. Run \`${installCommand(pm, packagesToInstall)}\` yourself.`);
|
|
313
320
|
}
|
|
321
|
+
const endpoint = resolveCloudEndpoint(options.endpoint);
|
|
314
322
|
writeEnvFile(cwd, credentials.apiKey, credentials.projectId, framework);
|
|
315
|
-
persistCliConfig(credentials.apiKey, credentials.projectId);
|
|
323
|
+
persistCliConfig(credentials.apiKey, credentials.projectId, endpoint);
|
|
316
324
|
const enableRewards = await maybeEnableRewards(options);
|
|
317
325
|
printNextSteps(framework, credentials.apiKey, credentials.projectId, enableRewards);
|
|
318
|
-
await maybeSendTestReport(credentials, options);
|
|
326
|
+
await maybeSendTestReport(credentials, { ...options, endpoint });
|
|
319
327
|
p.outro("Setup complete. Happy bug squashing \u{1F41B}");
|
|
320
328
|
}
|
|
321
329
|
function ensureInteractiveOrBailOut(options) {
|
|
@@ -489,9 +497,9 @@ function warnIfMissingFromGitignore(cwd, envFile) {
|
|
|
489
497
|
p.log.warn(`${envFile} is not in .gitignore \u2014 add it before committing.`);
|
|
490
498
|
}
|
|
491
499
|
}
|
|
492
|
-
function persistCliConfig(apiKey, projectId) {
|
|
500
|
+
function persistCliConfig(apiKey, projectId, endpoint) {
|
|
493
501
|
const existing = loadConfig();
|
|
494
|
-
saveConfig({ ...existing, apiKey, projectId });
|
|
502
|
+
saveConfig({ ...existing, apiKey, projectId, endpoint });
|
|
495
503
|
}
|
|
496
504
|
function printNextSteps(framework, apiKey, projectId, enableRewards = false) {
|
|
497
505
|
p.note(framework.snippet(apiKey, projectId), "Add this to your app:");
|
|
@@ -535,16 +543,9 @@ async function maybeSendTestReport(credentials, options) {
|
|
|
535
543
|
shouldSend = answer;
|
|
536
544
|
}
|
|
537
545
|
if (!shouldSend) return;
|
|
538
|
-
|
|
539
|
-
p.note(
|
|
540
|
-
"No endpoint configured \u2014 skipping test report.\nSet endpoint to your Supabase edge function URL, e.g. https://xyz.supabase.co/functions/v1/api",
|
|
541
|
-
"Skipped"
|
|
542
|
-
);
|
|
543
|
-
return;
|
|
544
|
-
}
|
|
546
|
+
const endpoint = normalizeEndpoint(resolveCloudEndpoint(options.endpoint));
|
|
545
547
|
const spinner2 = p.spinner();
|
|
546
548
|
spinner2.start("Sending test report\u2026");
|
|
547
|
-
const endpoint = normalizeEndpoint(options.endpoint);
|
|
548
549
|
const controller = new AbortController();
|
|
549
550
|
const timer = setTimeout(() => controller.abort(), TEST_REPORT_FETCH_TIMEOUT_MS);
|
|
550
551
|
try {
|
package/dist/version.js
CHANGED
package/package.json
CHANGED