@devdogsuga/devtools 0.1.26 → 0.1.27
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 +72 -11
- package/bin/devtools.mjs +4 -4
- package/dist/cli-CZKkNHK5.js +6619 -0
- package/dist/failure-log-BBPGejQv.js +256 -0
- package/dist/launch.js +267 -281
- package/dist/local-env-D8HC2JK_.js +351 -0
- package/dist/local-env-DrBCXqD8.js +2 -0
- package/dist/menu-CQBsQRgH.js +1684 -0
- package/dist/peer-redirect-hooks.js +15 -0
- package/dist/peers-RBplwovA.js +229 -0
- package/dist/root-C2OmZDwD.js +94 -0
- package/dist/stack-Bx-55oi_.js +2 -0
- package/dist/stack-BynCgRVS.js +181 -0
- package/dist/supabase-project-0knM0mqd.js +426 -0
- package/dist/telemetry-C4foD8MD.js +249 -0
- package/dist/telemetry.js +2 -148
- package/package.json +10 -29
- package/bin/devtools-ci-bare.mjs +0 -48
- package/bin/devtools-ci.mjs +0 -31
- package/dist/args.d.ts +0 -26
- package/dist/args.js +0 -78
- package/dist/bws/bw.d.ts +0 -18
- package/dist/bws/bw.js +0 -70
- package/dist/bws/client.d.ts +0 -43
- package/dist/bws/client.js +0 -363
- package/dist/bws/environments.d.ts +0 -96
- package/dist/bws/environments.js +0 -111
- package/dist/bws/pace.d.ts +0 -25
- package/dist/bws/pace.js +0 -43
- package/dist/bws/retry.d.ts +0 -12
- package/dist/bws/retry.js +0 -39
- package/dist/bws/store.d.ts +0 -1
- package/dist/bws/store.js +0 -32
- package/dist/bws/token.d.ts +0 -31
- package/dist/bws/token.js +0 -88
- package/dist/bws/vault.d.ts +0 -29
- package/dist/bws/vault.js +0 -200
- package/dist/catalog.d.ts +0 -57
- package/dist/catalog.js +0 -57
- package/dist/cf/build.d.ts +0 -13
- package/dist/cf/build.js +0 -65
- package/dist/cf/commands.d.ts +0 -1
- package/dist/cf/commands.js +0 -172
- package/dist/cf/local-env.d.ts +0 -58
- package/dist/cf/local-env.js +0 -177
- package/dist/ci.d.ts +0 -1
- package/dist/ci.js +0 -328
- package/dist/cli.d.ts +0 -11
- package/dist/cli.js +0 -1094
- package/dist/commands.d.ts +0 -261
- package/dist/commands.js +0 -1318
- package/dist/completions.d.ts +0 -4
- package/dist/completions.js +0 -110
- package/dist/cron/commands.d.ts +0 -47
- package/dist/cron/commands.js +0 -372
- package/dist/cron/discovery.d.ts +0 -55
- package/dist/cron/discovery.js +0 -85
- package/dist/cron/schema.d.ts +0 -45
- package/dist/cron/schema.js +0 -35
- package/dist/db/config-push.d.ts +0 -8
- package/dist/db/config-push.js +0 -11
- package/dist/db/connection.d.ts +0 -79
- package/dist/db/connection.js +0 -114
- package/dist/db/exec.d.ts +0 -1
- package/dist/db/exec.js +0 -11
- package/dist/db/generate-types.d.ts +0 -1
- package/dist/db/generate-types.js +0 -4
- package/dist/db/generated-env.d.ts +0 -69
- package/dist/db/generated-env.js +0 -113
- package/dist/db/introspect.d.ts +0 -1
- package/dist/db/introspect.js +0 -122
- package/dist/db/local-env.d.ts +0 -65
- package/dist/db/local-env.js +0 -23
- package/dist/db/new-migration.d.ts +0 -8
- package/dist/db/new-migration.js +0 -69
- package/dist/db/pooler.d.ts +0 -23
- package/dist/db/pooler.js +0 -55
- package/dist/db/run.d.ts +0 -68
- package/dist/db/run.js +0 -156
- package/dist/db/seed-buckets.d.ts +0 -2
- package/dist/db/seed-buckets.js +0 -4
- package/dist/db/seed-production.d.ts +0 -8
- package/dist/db/seed-production.js +0 -79
- package/dist/db/seed-roles.d.ts +0 -7
- package/dist/db/seed-roles.js +0 -33
- package/dist/db/session-refresh.d.ts +0 -43
- package/dist/db/session-refresh.js +0 -40
- package/dist/deploy/migrations.d.ts +0 -20
- package/dist/deploy/migrations.js +0 -68
- package/dist/deploy/orphans.d.ts +0 -20
- package/dist/deploy/orphans.js +0 -177
- package/dist/deploy/preflight.d.ts +0 -53
- package/dist/deploy/preflight.js +0 -189
- package/dist/deploy/report.d.ts +0 -26
- package/dist/deploy/report.js +0 -70
- package/dist/deploy/require-planner.d.ts +0 -2
- package/dist/deploy/require-planner.js +0 -60
- package/dist/deploy/require-token.d.ts +0 -15
- package/dist/deploy/require-token.js +0 -78
- package/dist/deploy/secrets-file.d.ts +0 -17
- package/dist/deploy/secrets-file.js +0 -166
- package/dist/deploy/write-env.d.ts +0 -40
- package/dist/deploy/write-env.js +0 -395
- package/dist/docs/index-pages.d.ts +0 -38
- package/dist/docs/index-pages.js +0 -186
- package/dist/emails/commands.d.ts +0 -15
- package/dist/emails/commands.js +0 -130
- package/dist/emails/email-types.d.ts +0 -13
- package/dist/emails/email-types.js +0 -1
- package/dist/emails/fixtures.d.ts +0 -20
- package/dist/emails/fixtures.js +0 -20
- package/dist/env/audit.d.ts +0 -206
- package/dist/env/audit.js +0 -436
- package/dist/env/cloudflare.d.ts +0 -21
- package/dist/env/cloudflare.js +0 -61
- package/dist/env/commands.d.ts +0 -99
- package/dist/env/commands.js +0 -613
- package/dist/env/discovery.d.ts +0 -15
- package/dist/env/discovery.js +0 -239
- package/dist/env/document.d.ts +0 -119
- package/dist/env/document.js +0 -323
- package/dist/env/example.d.ts +0 -68
- package/dist/env/example.js +0 -605
- package/dist/env/selection.d.ts +0 -105
- package/dist/env/selection.js +0 -228
- package/dist/env-entry.d.ts +0 -49
- package/dist/env-entry.js +0 -204
- package/dist/environment-doctor.d.ts +0 -45
- package/dist/environment-doctor.js +0 -429
- package/dist/environment.d.ts +0 -92
- package/dist/environment.js +0 -185
- package/dist/fingerprint.d.ts +0 -10
- package/dist/fingerprint.js +0 -18
- package/dist/gen/campus-map.d.ts +0 -1
- package/dist/gen/campus-map.js +0 -473
- package/dist/gen/commands.d.ts +0 -1
- package/dist/gen/commands.js +0 -25
- package/dist/gen/hypno.d.ts +0 -1
- package/dist/gen/hypno.js +0 -134
- package/dist/gh/client.d.ts +0 -80
- package/dist/gh/client.js +0 -259
- package/dist/gh/environments.d.ts +0 -83
- package/dist/gh/environments.js +0 -178
- package/dist/gh/rulesets/actors.d.ts +0 -14
- package/dist/gh/rulesets/actors.js +0 -69
- package/dist/gh/rulesets/api.d.ts +0 -15
- package/dist/gh/rulesets/api.js +0 -104
- package/dist/gh/rulesets/commands.d.ts +0 -3
- package/dist/gh/rulesets/commands.js +0 -203
- package/dist/gh/rulesets/desired.d.ts +0 -112
- package/dist/gh/rulesets/desired.js +0 -271
- package/dist/gh/rulesets/diff.d.ts +0 -65
- package/dist/gh/rulesets/diff.js +0 -170
- package/dist/gh/rulesets/types.d.ts +0 -76
- package/dist/gh/rulesets/types.js +0 -13
- package/dist/gh/settings/api.d.ts +0 -40
- package/dist/gh/settings/api.js +0 -180
- package/dist/gh/settings/commands.d.ts +0 -1
- package/dist/gh/settings/commands.js +0 -254
- package/dist/gh/settings/desired.d.ts +0 -53
- package/dist/gh/settings/desired.js +0 -43
- package/dist/gh/settings/diff.d.ts +0 -57
- package/dist/gh/settings/diff.js +0 -161
- package/dist/gh/settings/types.d.ts +0 -92
- package/dist/gh/settings/types.js +0 -11
- package/dist/gh/settings/workflows.d.ts +0 -41
- package/dist/gh/settings/workflows.js +0 -128
- package/dist/grantRoot.d.ts +0 -42
- package/dist/grantRoot.js +0 -89
- package/dist/help.d.ts +0 -18
- package/dist/help.js +0 -169
- package/dist/images/commands.d.ts +0 -32
- package/dist/images/commands.js +0 -231
- package/dist/images/events.d.ts +0 -47
- package/dist/images/events.js +0 -116
- package/dist/images/graphics.d.ts +0 -70
- package/dist/images/graphics.js +0 -234
- package/dist/images/open-graph-types.d.ts +0 -75
- package/dist/images/open-graph-types.js +0 -1
- package/dist/images/prompts.d.ts +0 -34
- package/dist/images/prompts.js +0 -100
- package/dist/images/render.d.ts +0 -21
- package/dist/images/render.js +0 -61
- package/dist/images/select.d.ts +0 -64
- package/dist/images/select.js +0 -96
- package/dist/instance.d.ts +0 -69
- package/dist/instance.js +0 -102
- package/dist/invocation.d.ts +0 -49
- package/dist/invocation.js +0 -78
- package/dist/launch-ci.d.ts +0 -1
- package/dist/launch-ci.js +0 -90
- package/dist/launch.d.ts +0 -18
- package/dist/menu.d.ts +0 -43
- package/dist/menu.js +0 -300
- package/dist/moderation.d.ts +0 -70
- package/dist/moderation.js +0 -128
- package/dist/oauth/browser.d.ts +0 -1
- package/dist/oauth/browser.js +0 -13
- package/dist/oauth/config.d.ts +0 -24
- package/dist/oauth/config.js +0 -24
- package/dist/oauth/connect-url.d.ts +0 -17
- package/dist/oauth/connect-url.js +0 -23
- package/dist/oauth/db.d.ts +0 -37
- package/dist/oauth/db.js +0 -108
- package/dist/oauth/device.d.ts +0 -93
- package/dist/oauth/device.js +0 -198
- package/dist/oauth/discovery.d.ts +0 -28
- package/dist/oauth/discovery.js +0 -54
- package/dist/oauth/env-file.d.ts +0 -6
- package/dist/oauth/env-file.js +0 -35
- package/dist/oauth/exchange.d.ts +0 -43
- package/dist/oauth/exchange.js +0 -93
- package/dist/oauth/label.d.ts +0 -1
- package/dist/oauth/label.js +0 -25
- package/dist/oauth/loopback.d.ts +0 -52
- package/dist/oauth/loopback.js +0 -168
- package/dist/oauth/pkce.d.ts +0 -6
- package/dist/oauth/pkce.js +0 -34
- package/dist/oauth/target.d.ts +0 -54
- package/dist/oauth/target.js +0 -102
- package/dist/oauth/transport.d.ts +0 -41
- package/dist/oauth/transport.js +0 -32
- package/dist/oauth/wizard.d.ts +0 -40
- package/dist/oauth/wizard.js +0 -578
- package/dist/persona.d.ts +0 -18
- package/dist/persona.js +0 -221
- package/dist/pick.d.ts +0 -6
- package/dist/pick.js +0 -64
- package/dist/pipes.d.ts +0 -1
- package/dist/pipes.js +0 -25
- package/dist/planner/checks.d.ts +0 -26
- package/dist/planner/checks.js +0 -104
- package/dist/planner/commands.d.ts +0 -10
- package/dist/planner/commands.js +0 -367
- package/dist/planner/db.d.ts +0 -15
- package/dist/planner/db.js +0 -33
- package/dist/planner/role.d.ts +0 -33
- package/dist/planner/role.js +0 -68
- package/dist/repo/peer-redirect-hooks.d.ts +0 -16
- package/dist/repo/peer-redirect-hooks.js +0 -10
- package/dist/repo/peer-redirect.d.ts +0 -4
- package/dist/repo/peer-redirect.js +0 -26
- package/dist/repo/peers.d.ts +0 -39
- package/dist/repo/peers.js +0 -139
- package/dist/repo/resolve.d.ts +0 -41
- package/dist/repo/resolve.js +0 -152
- package/dist/repo/root.d.ts +0 -23
- package/dist/repo/root.js +0 -91
- package/dist/repo/source.d.ts +0 -14
- package/dist/repo/source.js +0 -54
- package/dist/repo/supabase-project.d.ts +0 -60
- package/dist/repo/supabase-project.js +0 -124
- package/dist/repo/tsx-loader.d.ts +0 -6
- package/dist/repo/tsx-loader.js +0 -41
- package/dist/run/pick.d.ts +0 -90
- package/dist/run/pick.js +0 -664
- package/dist/setup.d.ts +0 -1
- package/dist/setup.js +0 -280
- package/dist/stack.d.ts +0 -48
- package/dist/stack.js +0 -403
- package/dist/telemetry.d.ts +0 -59
- package/dist/tier.d.ts +0 -40
- package/dist/tier.js +0 -96
- package/dist/ui.d.ts +0 -40
- package/dist/ui.js +0 -71
- package/dist/version.d.ts +0 -7
- package/dist/version.js +0 -17
- package/dist/workers.d.ts +0 -5
- package/dist/workers.js +0 -33
- package/dist/workflows/commands.d.ts +0 -54
- package/dist/workflows/commands.js +0 -763
package/dist/setup.js
DELETED
|
@@ -1,280 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* One-command onboarding, the first thing a new contributor runs.
|
|
3
|
-
*
|
|
4
|
-
* Hosted Supabase (a student's own free-tier project) is the DEFAULT path:
|
|
5
|
-
* pick app(s) -> hosted or local -> prerequisite checks -> for hosted, a
|
|
6
|
-
* short wizard collects the project's URL and keys, validates the DB_URL,
|
|
7
|
-
* writes `.env`, runs the migrations, and chains straight into `devtools
|
|
8
|
-
* oauth` against that same project. Local keeps today's `db start` flow
|
|
9
|
-
* unchanged.
|
|
10
|
-
*
|
|
11
|
-
* Was `scripts/setup.ts` at the repo root, resolving paths from
|
|
12
|
-
* `process.cwd()`, so it only worked when invoked from the root. Same class of
|
|
13
|
-
* bug that made the Supabase CLI look for `supabase_db_platform`. It resolves
|
|
14
|
-
* from `findRepoRoot()` now and works from anywhere.
|
|
15
|
-
*/
|
|
16
|
-
import { existsSync, readFileSync, writeFileSync } from "node:fs";
|
|
17
|
-
import { execFileSync } from "node:child_process";
|
|
18
|
-
import { join } from "node:path";
|
|
19
|
-
import { confirm, log, note, password, select, spinner, text, } from "@clack/prompts";
|
|
20
|
-
import { loadRegistry } from "./env/discovery.js";
|
|
21
|
-
import { renderInit, resolveSections } from "./env/example.js";
|
|
22
|
-
import { discoverRepoRoot } from "./repo/root.js";
|
|
23
|
-
import { EnvDocument } from "./env/document.js";
|
|
24
|
-
import { dbPush } from "./db/run.js";
|
|
25
|
-
import { validateSessionPoolerUrl } from "./db/pooler.js";
|
|
26
|
-
import { runOAuthSetup } from "./oauth/wizard.js";
|
|
27
|
-
import { runEnvironmentDoctor } from "./environment-doctor.js";
|
|
28
|
-
import { unwrap } from "./ui.js";
|
|
29
|
-
function has(cmd, args = ["--version"]) {
|
|
30
|
-
try {
|
|
31
|
-
return execFileSync(cmd, args, {
|
|
32
|
-
stdio: ["ignore", "pipe", "ignore"],
|
|
33
|
-
encoding: "utf8",
|
|
34
|
-
}).trim();
|
|
35
|
-
}
|
|
36
|
-
catch {
|
|
37
|
-
return null;
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
/** Reads `packageManager` out of a checkout's root `package.json`, when one
|
|
41
|
-
* is reachable — for the "does the installed pnpm match the pin" line. */
|
|
42
|
-
function readPnpmPin(repoRoot) {
|
|
43
|
-
if (!repoRoot)
|
|
44
|
-
return null;
|
|
45
|
-
try {
|
|
46
|
-
const pkg = JSON.parse(readFileSync(join(repoRoot, "package.json"), "utf8"));
|
|
47
|
-
return pkg.packageManager?.replace(/^pnpm@/, "").split("+")[0] ?? null;
|
|
48
|
-
}
|
|
49
|
-
catch {
|
|
50
|
-
return null;
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
export async function runSetup() {
|
|
54
|
-
const checks = [];
|
|
55
|
-
// ── Prerequisites ──────────────────────────────────────────────────────────
|
|
56
|
-
//
|
|
57
|
-
// Optional tools report as information rather than warnings. A contributor
|
|
58
|
-
// without Flutter is not misconfigured; they are just not working on the
|
|
59
|
-
// Flutter app, and saying otherwise trains people to ignore the output.
|
|
60
|
-
const node = process.versions.node;
|
|
61
|
-
// The floor is 22.12, not the .nvmrc pin (24): pnpm 11 needs node:sqlite,
|
|
62
|
-
// which appeared in 22.5 and went LTS-stable at 22.12. CI's first-ever run
|
|
63
|
-
// failed on exactly this, with Node 20 from the old pin.
|
|
64
|
-
const [major = 0, minor = 0] = node.split(".").map(Number);
|
|
65
|
-
checks.push(major > 22 || (major === 22 && minor >= 12)
|
|
66
|
-
? `OK Node ${node}`
|
|
67
|
-
: `WARN Node ${node} — this repo needs >= 22.12 for pnpm 11 (see .nvmrc)`);
|
|
68
|
-
// Never corepack — this repo does not use it. Node via fnm, then `npm
|
|
69
|
-
// install -g pnpm`; pnpm self-switches to the pinned version on its first
|
|
70
|
-
// run here (pmOnFail=download).
|
|
71
|
-
const pnpmVersion = has("pnpm");
|
|
72
|
-
const repoRootForPin = discoverRepoRoot();
|
|
73
|
-
const pin = readPnpmPin(repoRootForPin);
|
|
74
|
-
if (!pnpmVersion) {
|
|
75
|
-
checks.push("WARN pnpm not found — run `npm install -g pnpm` (never `corepack enable`)");
|
|
76
|
-
}
|
|
77
|
-
else if (pin && pnpmVersion !== pin) {
|
|
78
|
-
checks.push(`WARN pnpm ${pnpmVersion} — this repo is pinned to ${pin}; any pnpm command here self-switches`);
|
|
79
|
-
}
|
|
80
|
-
else {
|
|
81
|
-
checks.push(`OK pnpm ${pnpmVersion}`);
|
|
82
|
-
}
|
|
83
|
-
checks.push(has("flutter", ["--version"])
|
|
84
|
-
? "OK Flutter installed (study-group-finder buildable)"
|
|
85
|
-
: "INFO Flutter not installed — only needed for apps/study-group-finder");
|
|
86
|
-
// ── No repo yet? ───────────────────────────────────────────────────────────
|
|
87
|
-
//
|
|
88
|
-
// `discoverRepoRoot()` (the non-throwing lookup — see `repo/root.ts`)
|
|
89
|
-
// rather than `findRepoRoot()`: per the carve-out plan's §5,
|
|
90
|
-
// `pnpm dlx @devdogsuga/devtools setup` is meant to work PRE-CLONE, run
|
|
91
|
-
// from wherever a contributor happens to be before they have a checkout
|
|
92
|
-
// at all. The prerequisite checks above need no repo either way; only the
|
|
93
|
-
// `.env`-seeding half below does, so that's the only part skipped here.
|
|
94
|
-
const repoRoot = discoverRepoRoot();
|
|
95
|
-
if (repoRoot === null) {
|
|
96
|
-
note(checks.join("\n"), "Prerequisites");
|
|
97
|
-
note([
|
|
98
|
-
"No DevDogsUGA checkout found in this directory or its parents.",
|
|
99
|
-
"",
|
|
100
|
-
"1. git clone https://github.com/DevDogsUGA/DevDogsUGA.git",
|
|
101
|
-
"2. cd DevDogsUGA && pnpm install",
|
|
102
|
-
"3. pnpm devtools setup — run again from inside the clone to seed .env",
|
|
103
|
-
].join("\n"), "Next steps");
|
|
104
|
-
return;
|
|
105
|
-
}
|
|
106
|
-
note(checks.join("\n"), "Prerequisites");
|
|
107
|
-
// ── Env ────────────────────────────────────────────────────────────────────
|
|
108
|
-
const env = join(repoRoot, ".env");
|
|
109
|
-
let chosenApps = null;
|
|
110
|
-
if (existsSync(env)) {
|
|
111
|
-
log.info("OK .env already exists (left untouched)");
|
|
112
|
-
}
|
|
113
|
-
else {
|
|
114
|
-
await loadRegistry();
|
|
115
|
-
const sections = await resolveSections();
|
|
116
|
-
if (sections) {
|
|
117
|
-
const order = [
|
|
118
|
-
"schedule-builder",
|
|
119
|
-
"study-group-finder",
|
|
120
|
-
"platform",
|
|
121
|
-
"sandbox",
|
|
122
|
-
];
|
|
123
|
-
chosenApps = order.filter((app) => sections.has(app));
|
|
124
|
-
}
|
|
125
|
-
writeFileSync(env, renderInit("development", new Date().toISOString().slice(0, 10), sections), { flag: "wx" });
|
|
126
|
-
log.success("Created .env (same as `pnpm devtools env init`)");
|
|
127
|
-
log.info(".env starts blank. Supabase on this machine fills the connection block " +
|
|
128
|
-
"for you; only a hosted project needs values typed in.");
|
|
129
|
-
}
|
|
130
|
-
// ── Local or hosted? ────────────────────────────────────────────────────────
|
|
131
|
-
const target = unwrap(await select({
|
|
132
|
-
message: "Which Supabase should this checkout use?",
|
|
133
|
-
options: [
|
|
134
|
-
{
|
|
135
|
-
value: "hosted",
|
|
136
|
-
label: "Hosted (your own free-tier project)",
|
|
137
|
-
hint: "recommended — set one up at supabase.com in a couple of minutes",
|
|
138
|
-
},
|
|
139
|
-
{
|
|
140
|
-
value: "local",
|
|
141
|
-
label: "Local (Docker)",
|
|
142
|
-
hint: "needs Docker Desktop, or Docker Engine in WSL2",
|
|
143
|
-
},
|
|
144
|
-
],
|
|
145
|
-
initialValue: "hosted",
|
|
146
|
-
}));
|
|
147
|
-
if (target === "hosted") {
|
|
148
|
-
await runHostedWizard(repoRoot);
|
|
149
|
-
// A read-only check of what just happened.
|
|
150
|
-
await runEnvironmentDoctor({ app: chosenApps?.[0] });
|
|
151
|
-
}
|
|
152
|
-
else {
|
|
153
|
-
// .env stays blank until `db start`, so checking now would only report
|
|
154
|
-
// the expected gap. Point at doctor instead.
|
|
155
|
-
printLocalNextSteps(chosenApps);
|
|
156
|
-
log.info("After `pnpm devtools db start`, run `pnpm devtools doctor` to check your setup.");
|
|
157
|
-
}
|
|
158
|
-
}
|
|
159
|
-
function printLocalNextSteps(chosenApps) {
|
|
160
|
-
const startSteps = chosenApps && chosenApps.length > 0
|
|
161
|
-
? chosenApps.map((app) => app === "study-group-finder"
|
|
162
|
-
? ` pnpm dev --filter study-group-finder (Flutter — needs the SDK)`
|
|
163
|
-
: ` pnpm dev --filter ${app}`)
|
|
164
|
-
: [" pnpm dev — then pick your app from the list"];
|
|
165
|
-
note([
|
|
166
|
-
"1. Run `pnpm devtools` again and choose:",
|
|
167
|
-
" Database → start — boots the local Docker stack and writes",
|
|
168
|
-
" .env.generated (no credentials needed)",
|
|
169
|
-
"",
|
|
170
|
-
'2. Choose Workspace → oauth to configure "Sign in with DevDogs"',
|
|
171
|
-
" after the local database is running. Every app signs in through",
|
|
172
|
-
" platform's OAuth server, so this step is shared no matter which",
|
|
173
|
-
" project you are building.",
|
|
174
|
-
"",
|
|
175
|
-
"3. Start the project you picked:",
|
|
176
|
-
...startSteps,
|
|
177
|
-
...(chosenApps?.includes("schedule-builder")
|
|
178
|
-
? [
|
|
179
|
-
"",
|
|
180
|
-
" schedule-builder starts with an empty catalog. Populate it by",
|
|
181
|
-
" triggering the registrar scrape workflow (starts vinext dev for you):",
|
|
182
|
-
" pnpm devtools workflows run --app schedule-builder --tier development",
|
|
183
|
-
]
|
|
184
|
-
: []),
|
|
185
|
-
].join("\n"), "Next steps");
|
|
186
|
-
}
|
|
187
|
-
/**
|
|
188
|
-
* The hosted onboarding wizard: create a project on supabase.com by hand
|
|
189
|
-
* (this only asks for what comes out of it), then API URL, publishable key,
|
|
190
|
-
* secret key, and the Session pooler DB_URL — validated before anything is
|
|
191
|
-
* written. Non-clobbering: an already-filled key is left alone unless the
|
|
192
|
-
* contributor confirms overwriting it.
|
|
193
|
-
*/
|
|
194
|
-
async function runHostedWizard(repoRoot) {
|
|
195
|
-
note([
|
|
196
|
-
"1. Create a free project at https://supabase.com/dashboard",
|
|
197
|
-
"2. Project Settings → API: copy the Project URL, the publishable key,",
|
|
198
|
-
" and the secret key.",
|
|
199
|
-
"3. Project Settings → Database → Connection string → Session pooler:",
|
|
200
|
-
" copy that string (port 5432, not 6543).",
|
|
201
|
-
].join("\n"), "Create a hosted Supabase project");
|
|
202
|
-
const envPath = join(repoRoot, ".env");
|
|
203
|
-
const existing = existsSync(envPath) ? readFileSync(envPath, "utf8") : "";
|
|
204
|
-
const doc = EnvDocument.parse(existing);
|
|
205
|
-
const apiUrl = await promptEnvValue(doc, "API_URL", "Project URL", "https://<ref>.supabase.co");
|
|
206
|
-
const publishableKey = await promptEnvValue(doc, "PUBLISHABLE_KEY", "Publishable key", "sb_publishable_...");
|
|
207
|
-
const secretKey = await promptSecretValue(doc, "SECRET_KEY", "Secret key");
|
|
208
|
-
let dbUrl;
|
|
209
|
-
for (;;) {
|
|
210
|
-
const candidate = await promptSecretValue(doc, "DB_URL", "Session pooler DB_URL");
|
|
211
|
-
const validation = validateSessionPoolerUrl(candidate);
|
|
212
|
-
if (validation.ok) {
|
|
213
|
-
dbUrl = candidate;
|
|
214
|
-
break;
|
|
215
|
-
}
|
|
216
|
-
log.error(validation.message ?? "That DB_URL is not usable.");
|
|
217
|
-
if (validation.faqId) {
|
|
218
|
-
log.info(`https://devdogsuga.org/docs/platform/getting-started/troubleshooting#${validation.faqId}`);
|
|
219
|
-
}
|
|
220
|
-
doc.set("DB_URL", ""); // clear so the next loop iteration re-prompts
|
|
221
|
-
}
|
|
222
|
-
doc.set("API_URL", apiUrl);
|
|
223
|
-
doc.set("PUBLISHABLE_KEY", publishableKey);
|
|
224
|
-
doc.set("SECRET_KEY", secretKey);
|
|
225
|
-
doc.set("DB_URL", dbUrl);
|
|
226
|
-
writeFileSync(envPath, doc.toString());
|
|
227
|
-
log.success("Wrote .env");
|
|
228
|
-
const s = spinner();
|
|
229
|
-
s.start("Running migrations against your project");
|
|
230
|
-
const code = await dbPush(dbUrl, { yes: true });
|
|
231
|
-
if (code === 0) {
|
|
232
|
-
s.stop("Migrations applied");
|
|
233
|
-
}
|
|
234
|
-
else {
|
|
235
|
-
s.stop("Migrations failed — see the Supabase CLI output above");
|
|
236
|
-
log.warn("Fix the problem above, then re-run `pnpm devtools setup` (your .env answers are kept), or run `pnpm devtools db migrate` and `pnpm devtools oauth` yourself.");
|
|
237
|
-
process.exitCode = 1;
|
|
238
|
-
return;
|
|
239
|
-
}
|
|
240
|
-
log.info('Now configuring "Sign in with DevDogs" against the same project.');
|
|
241
|
-
const hostedTarget = {
|
|
242
|
-
kind: "hosted",
|
|
243
|
-
apiUrl,
|
|
244
|
-
serviceRoleKey: secretKey,
|
|
245
|
-
};
|
|
246
|
-
await runOAuthSetup(undefined, undefined, undefined, hostedTarget);
|
|
247
|
-
// runOAuthSetup already printed the dashboard redirect-URL step.
|
|
248
|
-
note("pnpm dev --filter <your app>", "Then run your app");
|
|
249
|
-
}
|
|
250
|
-
async function promptEnvValue(doc, key, label, placeholder) {
|
|
251
|
-
const current = doc.get(key);
|
|
252
|
-
if (current) {
|
|
253
|
-
const overwrite = unwrap(await confirm({
|
|
254
|
-
message: `${label} is already set in .env. Overwrite it?`,
|
|
255
|
-
initialValue: false,
|
|
256
|
-
}));
|
|
257
|
-
if (!overwrite)
|
|
258
|
-
return current;
|
|
259
|
-
}
|
|
260
|
-
return unwrap(await text({
|
|
261
|
-
message: label,
|
|
262
|
-
placeholder,
|
|
263
|
-
validate: (v) => (v?.trim() ? undefined : "Required"),
|
|
264
|
-
})).trim();
|
|
265
|
-
}
|
|
266
|
-
async function promptSecretValue(doc, key, label) {
|
|
267
|
-
const current = doc.get(key);
|
|
268
|
-
if (current) {
|
|
269
|
-
const overwrite = unwrap(await confirm({
|
|
270
|
-
message: `${label} is already set in .env. Overwrite it?`,
|
|
271
|
-
initialValue: false,
|
|
272
|
-
}));
|
|
273
|
-
if (!overwrite)
|
|
274
|
-
return current;
|
|
275
|
-
}
|
|
276
|
-
return unwrap(await password({
|
|
277
|
-
message: label,
|
|
278
|
-
validate: (v) => (v?.trim() ? undefined : "Required"),
|
|
279
|
-
})).trim();
|
|
280
|
-
}
|
package/dist/stack.d.ts
DELETED
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
import { type DbConnection } from "./db/connection.js";
|
|
2
|
-
import { originReachable } from "./cron/commands.js";
|
|
3
|
-
export declare const STACK_COMMANDS: readonly ["start", "stop", "restart", "status", "migrate", "reset"];
|
|
4
|
-
export type StackCommand = (typeof STACK_COMMANDS)[number];
|
|
5
|
-
/**
|
|
6
|
-
* `db connect [<project-ref>]` — run `supabase link` for whoever drives the
|
|
7
|
-
* bare supabase CLI by hand. Nothing in devtools reads what it writes any
|
|
8
|
-
* more (see `db/connection.ts`'s header); it survives as a convenience, not
|
|
9
|
-
* a dependency.
|
|
10
|
-
*/
|
|
11
|
-
export declare function connectRemoteProject(ref?: string): Promise<number>;
|
|
12
|
-
/** Injectable so a test can fake "server up" / "server down" and inspect the
|
|
13
|
-
* request `reconcileConfigAfterReset` sends, without a real dev server or a
|
|
14
|
-
* `vi.stubGlobal` on `fetch`. Defaults to the real network. */
|
|
15
|
-
export interface ReconcileConfigDeps {
|
|
16
|
-
reachable: typeof originReachable;
|
|
17
|
-
fetch: typeof globalThis.fetch;
|
|
18
|
-
}
|
|
19
|
-
/**
|
|
20
|
-
* Best-effort trigger for `GET /cron/config-reconcile` against the local
|
|
21
|
-
* platform dev server, so `db reset` leaves meetings and workshops seeded
|
|
22
|
-
* whenever that server happens to already be up -- the common case for a
|
|
23
|
-
* repeat reset during development, rather than a first clone. No
|
|
24
|
-
* `CRON_SECRET` is sent because the route itself skips auth outside a
|
|
25
|
-
* deployed `DEPLOY_ENV` (see that route's header); this is exactly the
|
|
26
|
-
* unauthenticated local request `cron run` would send.
|
|
27
|
-
*
|
|
28
|
-
* When nothing answers yet -- most likely a first-time reset, before anyone
|
|
29
|
-
* has run `pnpm --filter platform dev` -- this reports that instead of
|
|
30
|
-
* silently leaving the tables empty, and names the manual step: start the
|
|
31
|
-
* server, then either re-run this reset or fire the shared fifteen-minute
|
|
32
|
-
* cron slot directly with `pnpm devtools cron run`.
|
|
33
|
-
*/
|
|
34
|
-
export declare function reconcileConfigAfterReset(deps?: ReconcileConfigDeps): Promise<string[]>;
|
|
35
|
-
/**
|
|
36
|
-
* Runs a stack command, returning its exit code and anything to report.
|
|
37
|
-
*
|
|
38
|
-
* `connection` is present exactly when the command writes the database
|
|
39
|
-
* (`migrate`, `reset`) — the caller (`cli.ts`'s `runStack`) resolves it,
|
|
40
|
-
* because resolving means possibly refusing with a printed reason, and the
|
|
41
|
-
* lifecycle commands must keep working with no resolvable database at all
|
|
42
|
-
* (that is what `db start` is FOR). `status` receives whatever resolved,
|
|
43
|
-
* or `null`, and degrades to machine facts.
|
|
44
|
-
*/
|
|
45
|
-
export declare function runStackCommand(command: StackCommand, connection: DbConnection | null): Promise<{
|
|
46
|
-
code: number;
|
|
47
|
-
lines: string[];
|
|
48
|
-
}>;
|