ref0-git 0.2.0 → 0.4.0
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/app/apps/github/.dev.vars.example +2 -1
- package/app/apps/github/generated/git-rest.ts +191 -25
- package/app/apps/github/generated/routeTree.gen.ts +21 -0
- package/app/apps/github/package.json +1 -1
- package/app/apps/github/src/branches/branch-list.tsx +8 -4
- package/app/apps/github/src/branches/branches.ts +10 -5
- package/app/apps/github/src/camo/addresses.ts +120 -0
- package/app/apps/github/src/camo/client.ts +125 -0
- package/app/apps/github/src/camo/fetch.ts +201 -0
- package/app/apps/github/src/camo/lookup.ts +23 -0
- package/app/apps/github/src/camo/node.ts +50 -0
- package/app/apps/github/src/camo/proxy.ts +116 -0
- package/app/apps/github/src/camo/sign-images.ts +307 -0
- package/app/apps/github/src/camo/signing.ts +80 -0
- package/app/apps/github/src/clients/allowed.ts +111 -18
- package/app/apps/github/src/clients/clients.ts +76 -61
- package/app/apps/github/src/clients/transport.ts +13 -0
- package/app/apps/github/src/code/code-tree.tsx +3 -1
- package/app/apps/github/src/code/file-view.tsx +15 -6
- package/app/apps/github/src/code/files.ts +26 -19
- package/app/apps/github/src/code/go-to-file.tsx +2 -1
- package/app/apps/github/src/code/load.ts +41 -23
- package/app/apps/github/src/code/markdown-files.ts +13 -2
- package/app/apps/github/src/code/ref-pages.ts +14 -5
- package/app/apps/github/src/code/ref-switcher.tsx +4 -3
- package/app/apps/github/src/code/refs.ts +42 -8
- package/app/apps/github/src/code/repo-home.tsx +6 -2
- package/app/apps/github/src/code/repo.ts +12 -6
- package/app/apps/github/src/code/saved.ts +5 -3
- package/app/apps/github/src/code/trees.ts +11 -9
- package/app/apps/github/src/components/markdown/markdown.css +6 -0
- package/app/apps/github/src/components/markdown/markdown.tsx +95 -10
- package/app/apps/github/src/components/owner-card.tsx +3 -1
- package/app/apps/github/src/components/repos/your-repos.tsx +3 -1
- package/app/apps/github/src/components/shell/owner-repos.tsx +7 -12
- package/app/apps/github/src/components/shell/repo-switcher.tsx +10 -16
- package/app/apps/github/src/components/signin/device-card.tsx +9 -2
- package/app/apps/github/src/components/user-avatar.tsx +2 -1
- package/app/apps/github/src/context/context.ts +13 -0
- package/app/apps/github/src/diffs/blobs.ts +37 -14
- package/app/apps/github/src/diffs/diff-job.ts +53 -0
- package/app/apps/github/src/diffs/diff-worker.ts +6 -0
- package/app/apps/github/src/diffs/diffing.ts +136 -0
- package/app/apps/github/src/diffs/files.ts +4 -3
- package/app/apps/github/src/diffs/hunks.tsx +101 -53
- package/app/apps/github/src/diffs/patch.ts +20 -11
- package/app/apps/github/src/history/commit-diff.ts +10 -5
- package/app/apps/github/src/history/commit-list.tsx +3 -1
- package/app/apps/github/src/history/commit-page.tsx +4 -2
- package/app/apps/github/src/history/history.ts +12 -10
- package/app/apps/github/src/hooks/allowed.ts +9 -9
- package/app/apps/github/src/hooks/avatars.ts +3 -3
- package/app/apps/github/src/hooks/open-counts.ts +5 -4
- package/app/apps/github/src/hooks/profiles.ts +26 -12
- package/app/apps/github/src/hooks/repos.ts +78 -25
- package/app/apps/github/src/inbox/count.ts +30 -29
- package/app/apps/github/src/inbox/inbox-item.tsx +3 -1
- package/app/apps/github/src/inbox/inbox-page.tsx +5 -2
- package/app/apps/github/src/inbox/marks.ts +26 -15
- package/app/apps/github/src/inbox/release-tags.ts +7 -6
- package/app/apps/github/src/inbox/subjects.ts +5 -4
- package/app/apps/github/src/inbox/subscription-controls.tsx +14 -5
- package/app/apps/github/src/inbox/subscriptions.ts +95 -35
- package/app/apps/github/src/inbox/threads.ts +6 -6
- package/app/apps/github/src/issues/changes.ts +40 -16
- package/app/apps/github/src/issues/counts.ts +8 -5
- package/app/apps/github/src/issues/issue-list.tsx +20 -6
- package/app/apps/github/src/issues/issue-page.tsx +30 -14
- package/app/apps/github/src/issues/issues.ts +195 -46
- package/app/apps/github/src/issues/label-dialog.tsx +8 -11
- package/app/apps/github/src/issues/labels-page.tsx +35 -3
- package/app/apps/github/src/issues/milestone-dialog.tsx +197 -0
- package/app/apps/github/src/issues/milestones-page.tsx +269 -0
- package/app/apps/github/src/issues/new-issue.tsx +3 -1
- package/app/apps/github/src/issues/sidebar.tsx +8 -6
- package/app/apps/github/src/markdown/README.md +22 -17
- package/app/apps/github/src/markdown/context.ts +83 -10
- package/app/apps/github/src/markdown/images.ts +3 -2
- package/app/apps/github/src/markdown/lookup.ts +17 -11
- package/app/apps/github/src/markdown/page-budget.ts +50 -0
- package/app/apps/github/src/markdown/patches.ts +74 -32
- package/app/apps/github/src/markdown/query.ts +7 -2
- package/app/apps/github/src/markdown/remote.ts +106 -0
- package/app/apps/github/src/markdown/render.ts +101 -24
- package/app/apps/github/src/markdown/texts.ts +43 -0
- package/app/apps/github/src/markdown/words-module.d.ts +5 -0
- package/app/apps/github/src/markdown/words-plugin.ts +135 -0
- package/app/apps/github/src/names/repos.ts +1 -1
- package/app/apps/github/src/palette/palette.tsx +28 -10
- package/app/apps/github/src/palette/rows.tsx +93 -40
- package/app/apps/github/src/palette/server.ts +10 -7
- package/app/apps/github/src/palette/targets.ts +1 -0
- package/app/apps/github/src/policy.ts +137 -61
- package/app/apps/github/src/private-repos.ts +5 -5
- package/app/apps/github/src/pulls/compare-page.tsx +6 -3
- package/app/apps/github/src/pulls/files-tab.tsx +480 -214
- package/app/apps/github/src/pulls/held-summary.ts +178 -0
- package/app/apps/github/src/pulls/live.ts +6 -4
- package/app/apps/github/src/pulls/merge-box.tsx +17 -10
- package/app/apps/github/src/pulls/pull-list.tsx +6 -3
- package/app/apps/github/src/pulls/pull-page.tsx +19 -10
- package/app/apps/github/src/pulls/pull.ts +68 -40
- package/app/apps/github/src/pulls/pulls.ts +39 -22
- package/app/apps/github/src/pulls/review-drafts.ts +131 -0
- package/app/apps/github/src/pulls/review.ts +374 -99
- package/app/apps/github/src/pulls/threads.tsx +152 -0
- package/app/apps/github/src/queue/queue-page.tsx +15 -8
- package/app/apps/github/src/queue/queue.ts +35 -20
- package/app/apps/github/src/releases/latest-release.tsx +3 -1
- package/app/apps/github/src/releases/overview.tsx +4 -2
- package/app/apps/github/src/releases/release-form.tsx +8 -5
- package/app/apps/github/src/releases/release-list.tsx +8 -5
- package/app/apps/github/src/releases/release-view.tsx +1 -0
- package/app/apps/github/src/releases/releases.ts +33 -23
- package/app/apps/github/src/releases/tag-list.tsx +3 -1
- package/app/apps/github/src/router.tsx +5 -2
- package/app/apps/github/src/routes/$owner/$repo/_code/blob/$.tsx +7 -1
- package/app/apps/github/src/routes/$owner/$repo/_code/tree/$.tsx +6 -1
- package/app/apps/github/src/routes/$owner/$repo/_releases/releases/index.tsx +2 -1
- package/app/apps/github/src/routes/$owner/$repo/_releases/tags.tsx +1 -1
- package/app/apps/github/src/routes/$owner/$repo/branches.tsx +5 -1
- package/app/apps/github/src/routes/$owner/$repo/commit/$sha.tsx +1 -1
- package/app/apps/github/src/routes/$owner/$repo/commits/$.tsx +6 -1
- package/app/apps/github/src/routes/$owner/$repo/index.tsx +1 -1
- package/app/apps/github/src/routes/$owner/$repo/issues/$number.tsx +4 -2
- package/app/apps/github/src/routes/$owner/$repo/issues/index.tsx +2 -2
- package/app/apps/github/src/routes/$owner/$repo/issues/new.tsx +5 -2
- package/app/apps/github/src/routes/$owner/$repo/labels.tsx +2 -1
- package/app/apps/github/src/routes/$owner/$repo/milestones.tsx +36 -0
- package/app/apps/github/src/routes/$owner/$repo/pull/$number/route.tsx +4 -2
- package/app/apps/github/src/routes/$owner/$repo/pulls/index.tsx +2 -2
- package/app/apps/github/src/routes/$owner/$repo/queue.tsx +2 -1
- package/app/apps/github/src/routes/$owner/$repo/releases/edit/$.tsx +5 -2
- package/app/apps/github/src/routes/$owner/$repo/releases/new.tsx +2 -1
- package/app/apps/github/src/routes/$owner/$repo/releases/tag/$.tsx +4 -2
- package/app/apps/github/src/routes/$owner/$repo/route.tsx +9 -5
- package/app/apps/github/src/routes/$owner/$repo/settings/hooks/index.tsx +3 -1
- package/app/apps/github/src/routes/$owner/$repo/settings/index.tsx +3 -1
- package/app/apps/github/src/routes/-nav.tsx +10 -2
- package/app/apps/github/src/routes/-root-testing.ts +29 -6
- package/app/apps/github/src/routes/__root.tsx +9 -4
- package/app/apps/github/src/routes/index.tsx +3 -1
- package/app/apps/github/src/routes/orgs/$owner/route.tsx +4 -1
- package/app/apps/github/src/routes/orgs/$owner/settings.tsx +4 -1
- package/app/apps/github/src/seed/acme.ts +1 -1
- package/app/apps/github/src/seed/seed.ts +199 -120
- package/app/apps/github/src/server.ts +24 -15
- package/app/apps/github/src/settings/account-avatar.tsx +4 -1
- package/app/apps/github/src/settings/general-settings.tsx +3 -1
- package/app/apps/github/src/settings/general.ts +4 -4
- package/app/apps/github/src/settings/hook-form.tsx +3 -1
- package/app/apps/github/src/settings/hook-list.tsx +5 -2
- package/app/apps/github/src/settings/hooks.ts +7 -7
- package/app/apps/github/src/settings/org-settings.tsx +3 -1
- package/app/apps/github/src/settings/orgs.ts +21 -11
- package/app/apps/github/src/settings/settings-layout.tsx +3 -1
- package/app/apps/github/src/signin/approval.ts +4 -3
- package/app/apps/github/src/signin/auth.ts +9 -2
- package/app/apps/github/src/signin/device-code.ts +8 -3
- package/app/apps/github/src/signin/device-prompt.ts +28 -3
- package/app/apps/github/src/signin/revoke.ts +36 -0
- package/app/apps/github/tsconfig.json +4 -1
- package/app/apps/github/vite.config.ts +8 -0
- package/app/pnpm-workspace.yaml +9 -5
- package/app/tsconfig.base.json +1 -0
- package/dist/cli/child.mjs +1 -1
- package/dist/cli/credentials.mjs +4 -4
- package/dist/cli/documents.mjs +32 -22
- package/dist/cli/events.mjs +1 -1
- package/dist/cli/failure.mjs +20 -7
- package/dist/cli/folders.mjs +2 -2
- package/dist/cli/git-remote-ref0.mjs +47 -22
- package/dist/cli/git.mjs +26 -5
- package/dist/cli/helpers.mjs +168 -35
- package/dist/cli/hosts.mjs +3 -3
- package/dist/cli/output.mjs +2 -2
- package/dist/cli/prompt.mjs +1 -1
- package/dist/cli/queue.mjs +7 -7
- package/dist/cli/ref0-git.mjs +2 -2
- package/dist/cli/repos.mjs +35 -18
- package/dist/cli/resources.mjs +5 -5
- package/dist/cli/retry-after.mjs +8 -0
- package/dist/cli/setup.mjs +172 -66
- package/dist/cli/sign-in.mjs +65 -23
- package/dist/cli/sign-ins.mjs +70 -13
- package/dist/cli/sqlite.mjs +2 -2
- package/dist/cli/tokens.mjs +3 -3
- package/dist/cli/vendor.mjs +1 -1
- package/dist/init/app.mjs +18 -20
- package/dist/init/choices.mjs +1 -1
- package/dist/init/cloudflare.mjs +15 -19
- package/dist/init/create.mjs +4 -3
- package/dist/init/detect.mjs +4 -4
- package/dist/init/files.mjs +121 -9
- package/dist/init/frameworks.mjs +16 -0
- package/dist/init/git-module.mjs +22 -7
- package/dist/init/jsonc.mjs +9 -7
- package/dist/init/metadata.mjs +9 -3
- package/dist/init/mounts.mjs +13 -10
- package/dist/init/next.mjs +3 -5
- package/dist/init/node-app.mjs +3 -3
- package/dist/init/node.mjs +41 -42
- package/dist/init/nuxt.mjs +153 -27
- package/dist/init/stores.mjs +14 -9
- package/dist/init/sveltekit.mjs +4 -2
- package/dist/init/template.mjs +9 -6
- package/dist/init/templates.mjs +64 -48
- package/dist/init/vercel.mjs +37 -36
- package/dist/init/versions.mjs +3 -3
- package/package.json +6 -5
package/dist/cli/setup.mjs
CHANGED
|
@@ -3,6 +3,7 @@ import { appOutput, checkedManifest, copied, entered } from "../init/app.mjs";
|
|
|
3
3
|
import { nodeAppOutput, startOrigin } from "../init/node-app.mjs";
|
|
4
4
|
import { configParts, gitClasses, gitSecrets } from "../init/cloudflare.mjs";
|
|
5
5
|
import { platforms } from "../init/template.mjs";
|
|
6
|
+
import { pnpmManual, withPnpmOverrides, wroteOf } from "../init/files.mjs";
|
|
6
7
|
import { keepsData, mainOrigin, nodeNeeds, routed, routedFindings } from "../init/node.mjs";
|
|
7
8
|
import { detect } from "../init/detect.mjs";
|
|
8
9
|
import { outputOf as outputOf$1, secretFilesOf } from "../init/output.mjs";
|
|
@@ -14,9 +15,10 @@ import { svelteBodyLimit, svelteStart } from "../init/sveltekit.mjs";
|
|
|
14
15
|
import { variablesOf, vercelProblems } from "../init/vercel.mjs";
|
|
15
16
|
import { addedTo, plan } from "../init/plan.mjs";
|
|
16
17
|
import { dropInPrefixes } from "../init/routes.mjs";
|
|
17
|
-
import { appPackages, release } from "../init/metadata.mjs";
|
|
18
|
+
import { appPackages, peerPackages, release } from "../init/metadata.mjs";
|
|
19
|
+
import { catalogOf } from "../init/workspace.mjs";
|
|
18
20
|
import { doctorJson, initJson, verifyJson } from "./documents.mjs";
|
|
19
|
-
import { CliFailure,
|
|
21
|
+
import { CliFailure, cancelled, diskFailed, failure, leftBehind, refused, usageFailure } from "./failure.mjs";
|
|
20
22
|
import { chosenHost, hostFlag, remoteOf } from "./hosts.mjs";
|
|
21
23
|
import { runChild, stopMs } from "./child.mjs";
|
|
22
24
|
import { vendored } from "./vendor.mjs";
|
|
@@ -27,17 +29,17 @@ import { Sqlite } from "./sqlite.mjs";
|
|
|
27
29
|
import { CliModes, answer, cliDocument, field, nextDocument, printable, receipt, say, secrets, stderrText } from "./output.mjs";
|
|
28
30
|
import { select } from "./prompt.mjs";
|
|
29
31
|
import * as Effect from "effect/Effect";
|
|
32
|
+
import * as Exit from "effect/Exit";
|
|
30
33
|
import * as Redacted from "effect/Redacted";
|
|
31
34
|
import * as Stream from "effect/Stream";
|
|
32
35
|
import * as ChildProcess from "effect/process/ChildProcess";
|
|
33
36
|
import * as ChildProcessSpawner from "effect/process/ChildProcessSpawner";
|
|
34
|
-
import * as Exit from "effect/Exit";
|
|
35
37
|
import * as Option from "effect/Option";
|
|
36
38
|
import * as Command from "effect/cli/Command";
|
|
37
39
|
import * as Schema from "effect/Schema";
|
|
38
40
|
import * as Flag from "effect/cli/Flag";
|
|
39
41
|
import * as Argument from "effect/cli/Argument";
|
|
40
|
-
import {
|
|
42
|
+
import { shortTarget } from "@ref0/git";
|
|
41
43
|
import * as Clock from "effect/Clock";
|
|
42
44
|
import * as FileSystem from "effect/FileSystem";
|
|
43
45
|
import * as Path from "effect/Path";
|
|
@@ -54,7 +56,7 @@ const { process } = node;
|
|
|
54
56
|
* Whether `path` under `folder` goes through a link, at any part of it: `init` reads and writes
|
|
55
57
|
* only the folder's own files, so a supplied repo can't point one at a file outside it.
|
|
56
58
|
*/
|
|
57
|
-
const linked = Effect.fnUntraced(function* (folder, path) {
|
|
59
|
+
const linked = /* @__PURE__ */ Effect.fnUntraced(function* (folder, path) {
|
|
58
60
|
const fs = yield* FileSystem.FileSystem;
|
|
59
61
|
const parts = path.split("/");
|
|
60
62
|
for (const at of parts.keys()) {
|
|
@@ -76,11 +78,11 @@ const trackedSecrets = (folder, paths) => Effect.map(gitRun([
|
|
|
76
78
|
...paths
|
|
77
79
|
], { cwd: folder }), (listed) => listed.status === 0 ? listed.stdout.split("\0").filter((path) => path !== "") : []);
|
|
78
80
|
/** `folder`, as detection reads it from the disk, through `Folders`: a file through a link reads as missing. */
|
|
79
|
-
const viewOf = Effect.fnUntraced(function* (folder) {
|
|
81
|
+
const viewOf = /* @__PURE__ */ Effect.fnUntraced(function* (folder) {
|
|
80
82
|
return (yield* Folders).view(folder, process.env["npm_config_user_agent"]);
|
|
81
83
|
});
|
|
82
84
|
/** The folder a command names, from the current one, and the argv that names it again. */
|
|
83
|
-
const folderOf = Effect.fnUntraced(function* (dir) {
|
|
85
|
+
const folderOf = /* @__PURE__ */ Effect.fnUntraced(function* (dir) {
|
|
84
86
|
const path = yield* Path.Path;
|
|
85
87
|
const given = Option.getOrUndefined(dir);
|
|
86
88
|
return {
|
|
@@ -100,10 +102,33 @@ const madeSecret = () => {
|
|
|
100
102
|
secrets.hide(made);
|
|
101
103
|
return Redacted.make(made);
|
|
102
104
|
};
|
|
103
|
-
/**
|
|
104
|
-
|
|
105
|
+
/**
|
|
106
|
+
* Everything `init` writes for `choices` in `project`. Under pnpm, that's `pnpm-workspace.yaml`'s
|
|
107
|
+
* overrides too, since pnpm reads none from `package.json`: `--from-checkout`'s, or a release run
|
|
108
|
+
* moving the ones an earlier `--from-checkout` wrote, which `workspace`, the file now, holds. An
|
|
109
|
+
* `overrides` it can't merge into is a manual step instead.
|
|
110
|
+
*/
|
|
111
|
+
const outputOf = (choices, project, source, vendor, pnpm) => {
|
|
112
|
+
const output = choices.app === "ref0" && source.app !== void 0 ? (choices.platform === "node" ? nodeAppOutput : appOutput)(choices, project.name, source.app, madeSecret, vendor) : outputOf$1(choices, project, madeSecret, vendor);
|
|
113
|
+
if (pnpm === void 0) return output;
|
|
114
|
+
const manual = pnpmManual(pnpm.workspace, vendor);
|
|
115
|
+
if (manual !== void 0) return {
|
|
116
|
+
...output,
|
|
117
|
+
manual: [...output.manual, manual]
|
|
118
|
+
};
|
|
119
|
+
if (vendor === void 0 && withPnpmOverrides(pnpm.workspace, vendor) === (pnpm.workspace ?? "")) return output;
|
|
120
|
+
const workspace = {
|
|
121
|
+
path: "pnpm-workspace.yaml",
|
|
122
|
+
kind: "merge",
|
|
123
|
+
merge: (current) => withPnpmOverrides(current, vendor)
|
|
124
|
+
};
|
|
125
|
+
return {
|
|
126
|
+
...output,
|
|
127
|
+
files: [...output.files, workspace]
|
|
128
|
+
};
|
|
129
|
+
};
|
|
105
130
|
/** Each file under `folder`, by its path from it, that `keep` keeps, in the folders `init` enters. */
|
|
106
|
-
const filesUnder = Effect.fnUntraced(function* (folder, keep, under = "") {
|
|
131
|
+
const filesUnder = /* @__PURE__ */ Effect.fnUntraced(function* (folder, keep, under = "") {
|
|
107
132
|
const fs = yield* FileSystem.FileSystem;
|
|
108
133
|
const found = [];
|
|
109
134
|
for (const entry of yield* fs.readDirectory(`${folder}/${under}`)) {
|
|
@@ -136,14 +161,14 @@ const checkoutHolds = [
|
|
|
136
161
|
...vendorPacks.map((each) => `packages/${each.folder}/package.json`)
|
|
137
162
|
];
|
|
138
163
|
/** The files a checkout at `root` lacks, of what `init` takes from it. */
|
|
139
|
-
const lacking = Effect.fnUntraced(function* (root, packed) {
|
|
164
|
+
const lacking = /* @__PURE__ */ Effect.fnUntraced(function* (root, packed) {
|
|
140
165
|
const fs = yield* FileSystem.FileSystem;
|
|
141
166
|
const missing = [];
|
|
142
167
|
for (const path of checkoutHolds.filter((each) => !packed || !each.startsWith("packages/"))) if (!(yield* fs.exists(`${root}/${path}`).pipe(Effect.orElseSucceed(() => false)))) missing.push(path);
|
|
143
168
|
return missing;
|
|
144
169
|
});
|
|
145
170
|
/** The app's files from a checkout at `root`, or from the copy `ref0-git`'s pack carries there. */
|
|
146
|
-
const appSourceIn = Effect.fnUntraced(function* (root) {
|
|
171
|
+
const appSourceIn = /* @__PURE__ */ Effect.fnUntraced(function* (root) {
|
|
147
172
|
const fs = yield* FileSystem.FileSystem;
|
|
148
173
|
const app = `${root}/apps/github`;
|
|
149
174
|
const files = [];
|
|
@@ -163,19 +188,33 @@ const appSourceIn = Effect.fnUntraced(function* (root) {
|
|
|
163
188
|
* usage failure naming the file and what's wrong with it: a checkout `--from-checkout` names is
|
|
164
189
|
* the person's to fix.
|
|
165
190
|
*/
|
|
166
|
-
const checkedApp = Effect.fnUntraced(function* (root) {
|
|
191
|
+
const checkedApp = /* @__PURE__ */ Effect.fnUntraced(function* (root) {
|
|
167
192
|
const app = yield* appSourceIn(root);
|
|
168
193
|
return yield* checkedManifest(app.manifest).pipe(Effect.as(app), Effect.mapError((error) => usageFailure("invalid_manifest", `${printable(`${root}/apps/github/package.json`)} isn't a package.json init can read: ${printable(error.message)}`, "Fix it, then run init again")));
|
|
169
194
|
});
|
|
170
195
|
/**
|
|
196
|
+
* A usage failure when the checkout at `root` pins a peer of Git's packages, such as `effect`, at
|
|
197
|
+
* another version than this CLI writes beside them: its packages would take a peer the project
|
|
198
|
+
* doesn't install.
|
|
199
|
+
*/
|
|
200
|
+
const peersAgree = /* @__PURE__ */ Effect.fnUntraced(function* (root) {
|
|
201
|
+
const fs = yield* FileSystem.FileSystem;
|
|
202
|
+
const catalog = catalogOf(yield* fs.readFileString(`${root}/pnpm-workspace.yaml`));
|
|
203
|
+
const [apart] = Object.entries(peerPackages).filter(([name, version]) => catalog.get(name) !== version);
|
|
204
|
+
if (apart === void 0) return;
|
|
205
|
+
const [name, version] = apart;
|
|
206
|
+
return yield* Effect.fail(usageFailure("checkout_peers_apart", `${printable(root)} pins ${name} at ${printable(catalog.get(name) ?? "nothing")}, and this ref0-git writes ${version} beside Git's packages`, "Run init with the checkout's own ref0-git, as docs/start.md says"));
|
|
207
|
+
}, (reading, root) => Effect.catchTag(reading, "PlatformError", (error) => Effect.fail(diskFailed(`read ${printable(`${root}/pnpm-workspace.yaml`)}`)(error))));
|
|
208
|
+
/**
|
|
171
209
|
* The source `init` takes the app from: `--from-checkout`'s folder, or this checkout, or the copy
|
|
172
210
|
* of it in `app/` that `ref0-git`'s pack carries, whose packages are on npm.
|
|
173
211
|
*/
|
|
174
|
-
const sourceOf = Effect.fnUntraced(function* (fromCheckout, appChosen) {
|
|
212
|
+
const sourceOf = /* @__PURE__ */ Effect.fnUntraced(function* (fromCheckout, appChosen) {
|
|
175
213
|
if (fromCheckout !== void 0) {
|
|
176
214
|
const root = (yield* Path.Path).resolve(fromCheckout);
|
|
177
215
|
const missing = yield* lacking(root, false);
|
|
178
216
|
if (missing.length > 0) return yield* Effect.fail(usageFailure("not_a_checkout", `${printable(root)} isn't a ref-0/git checkout: it has no ${missing.join(", ")}`));
|
|
217
|
+
yield* peersAgree(root);
|
|
179
218
|
return {
|
|
180
219
|
app: appChosen ? yield* checkedApp(root) : void 0,
|
|
181
220
|
checkout: root
|
|
@@ -201,7 +240,7 @@ const sourceOf = Effect.fnUntraced(function* (fromCheckout, appChosen) {
|
|
|
201
240
|
*/
|
|
202
241
|
const published = /^(?:0|[1-9]\d*)\.(?:0|[1-9]\d*)\.(?:0|[1-9]\d*)(?:-(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*)?(?:\+[0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*)?$/u;
|
|
203
242
|
/** The tarball `pnpm pack --json` says it made: its package's name and version, and its file. */
|
|
204
|
-
const readPacked = Schema.decodeUnknownEffect(Schema.fromJsonString(Schema.Struct({
|
|
243
|
+
const readPacked = /* @__PURE__ */ Schema.decodeUnknownEffect(Schema.fromJsonString(Schema.Struct({
|
|
205
244
|
name: Schema.String,
|
|
206
245
|
version: Schema.String,
|
|
207
246
|
filename: Schema.String
|
|
@@ -215,12 +254,12 @@ const lastObject = (printed) => {
|
|
|
215
254
|
return at === -1 ? printed.slice(Math.max(0, printed.indexOf("{"))) : printed.slice(at + 1);
|
|
216
255
|
};
|
|
217
256
|
/** A package's manifest, as far as a dry run reads it: its version. */
|
|
218
|
-
const readVersion = Schema.decodeUnknownEffect(Schema.fromJsonString(Schema.Struct({ version: Schema.String })));
|
|
257
|
+
const readVersion = /* @__PURE__ */ Schema.decodeUnknownEffect(Schema.fromJsonString(Schema.Struct({ version: Schema.String })));
|
|
219
258
|
/**
|
|
220
259
|
* The tarballs a pack of `checkout` would make, from its own manifests' versions, named as `pnpm
|
|
221
260
|
* pack` names them: what a dry run, which packs nothing, says `init` would write.
|
|
222
261
|
*/
|
|
223
|
-
const plannedVendor = Effect.fnUntraced(function* (checkout) {
|
|
262
|
+
const plannedVendor = /* @__PURE__ */ Effect.fnUntraced(function* (checkout) {
|
|
224
263
|
const fs = yield* FileSystem.FileSystem;
|
|
225
264
|
const vendor = /* @__PURE__ */ new Map();
|
|
226
265
|
for (const each of vendorPacks) {
|
|
@@ -236,7 +275,7 @@ const plannedVendor = Effect.fnUntraced(function* (checkout) {
|
|
|
236
275
|
* name, version and file `pnpm pack --json` says, from the checkout's own manifest. A pack that
|
|
237
276
|
* fails, or names another package, is why it failed.
|
|
238
277
|
*/
|
|
239
|
-
const packedFrom = Effect.fnUntraced(function* (checkout) {
|
|
278
|
+
const packedFrom = /* @__PURE__ */ Effect.fnUntraced(function* (checkout) {
|
|
240
279
|
const fs = yield* FileSystem.FileSystem;
|
|
241
280
|
const folder = yield* fs.makeTempDirectory({ prefix: "ref0-git-vendor-" }).pipe(Effect.mapError(diskFailed("make a folder for the packs")));
|
|
242
281
|
return yield* packedInto(checkout, folder).pipe(Effect.onExit((exit) => Exit.isSuccess(exit) && exit.value.kind === "packed" ? Effect.void : fs.remove(folder, {
|
|
@@ -248,7 +287,7 @@ const packedFrom = Effect.fnUntraced(function* (checkout) {
|
|
|
248
287
|
* `pnpm pack` of `from` into `destination`, its output kept, not shown: its build prints each file
|
|
249
288
|
* it writes. Interrupted, it gets SIGINT, then SIGKILL past `stopMs`, as `runChild` stops its child.
|
|
250
289
|
*/
|
|
251
|
-
const packOnce = Effect.fnUntraced(function* (from, destination) {
|
|
290
|
+
const packOnce = /* @__PURE__ */ Effect.fnUntraced(function* (from, destination) {
|
|
252
291
|
const spawner = yield* ChildProcessSpawner.ChildProcessSpawner;
|
|
253
292
|
const printed = [];
|
|
254
293
|
const out = [];
|
|
@@ -285,7 +324,7 @@ const packOnce = Effect.fnUntraced(function* (from, destination) {
|
|
|
285
324
|
* their `exports` name it, never their `dist/`. Their lines print first, in `vendorPacks`' order,
|
|
286
325
|
* and the packs are read in that order once all have ended, so the first that failed is named.
|
|
287
326
|
*/
|
|
288
|
-
const packedInto = Effect.fnUntraced(function* (checkout, folder) {
|
|
327
|
+
const packedInto = /* @__PURE__ */ Effect.fnUntraced(function* (checkout, folder) {
|
|
289
328
|
const fs = yield* FileSystem.FileSystem;
|
|
290
329
|
const path = yield* Path.Path;
|
|
291
330
|
const vendor = /* @__PURE__ */ new Map();
|
|
@@ -336,7 +375,7 @@ const dirArgument = (says) => Argument.String("DIR").pipe(Argument.withDescripti
|
|
|
336
375
|
/** A command's argv after `ref0-git`, as it was run, for a next step that runs it again. */
|
|
337
376
|
const asRun = () => process.argv.slice(2);
|
|
338
377
|
/** `init`'s flags that take a value as the next argument. */
|
|
339
|
-
const valueFlags = new Set([
|
|
378
|
+
const valueFlags = /* @__PURE__ */ new Set([
|
|
340
379
|
"serve",
|
|
341
380
|
"platform",
|
|
342
381
|
"records",
|
|
@@ -400,7 +439,7 @@ const rowOf = (choice, settled, context) => {
|
|
|
400
439
|
* cancel waits until it ends, since it's uninterruptible: every file lands, or a failure names the
|
|
401
440
|
* one that stopped it and those written before.
|
|
402
441
|
*/
|
|
403
|
-
const written = Effect.fnUntraced(function* (folder, steps) {
|
|
442
|
+
const written = /* @__PURE__ */ Effect.fnUntraced(function* (folder, steps) {
|
|
404
443
|
const fs = yield* FileSystem.FileSystem;
|
|
405
444
|
const wrote = [];
|
|
406
445
|
for (const step of steps) {
|
|
@@ -420,7 +459,7 @@ const written = Effect.fnUntraced(function* (folder, steps) {
|
|
|
420
459
|
* The plan carried out: printed under `--dry-run`; refused whole when a file differs, so nothing
|
|
421
460
|
* changes; else written, installed, and said, with the next step `doctor`.
|
|
422
461
|
*/
|
|
423
|
-
const finish = Effect.fnUntraced(function* (flags, folder, project, settled, output, steps, packed, create) {
|
|
462
|
+
const finish = /* @__PURE__ */ Effect.fnUntraced(function* (flags, folder, project, settled, output, steps, packed, create) {
|
|
424
463
|
const mode = yield* CliModes;
|
|
425
464
|
const manager = Option.getOrElse(flags.packageManager, () => project.packageManager.value);
|
|
426
465
|
const doctorStep = {
|
|
@@ -430,7 +469,7 @@ const finish = Effect.fnUntraced(function* (flags, folder, project, settled, out
|
|
|
430
469
|
const differs = steps.filter((step) => step.action === "differs");
|
|
431
470
|
const changes = steps.filter((step) => step.text !== void 0 && step.action !== "unchanged");
|
|
432
471
|
const installed = yield* (yield* FileSystem.FileSystem).exists(`${folder.path}/node_modules/@ref0/git`).pipe(Effect.orElseSucceed(() => false));
|
|
433
|
-
const installing = flags.install && !flags.dryRun && (changes.some((step) => step.path === "package.json") || !installed);
|
|
472
|
+
const installing = flags.install && !flags.dryRun && !output.manual.some((step) => step.path === "pnpm-workspace.yaml") && (changes.some((step) => step.path === "package.json") || !installed);
|
|
434
473
|
const documentOf = (ran) => ({
|
|
435
474
|
folder: folder.path,
|
|
436
475
|
project: project.project,
|
|
@@ -525,7 +564,7 @@ const finish = Effect.fnUntraced(function* (flags, folder, project, settled, out
|
|
|
525
564
|
run: [asRun()]
|
|
526
565
|
});
|
|
527
566
|
const wrote = yield* written(folder.path, steps);
|
|
528
|
-
const kept = wrote
|
|
567
|
+
const kept = wroteOf(wrote, settled.app.value === "ref0");
|
|
529
568
|
const installStep = {
|
|
530
569
|
says: `Run \`${manager} install\` in ${printable(folder.path)}, then check it`,
|
|
531
570
|
run: [["doctor", ...folder.argv]]
|
|
@@ -577,7 +616,7 @@ const finish = Effect.fnUntraced(function* (flags, folder, project, settled, out
|
|
|
577
616
|
* one of them, which detection then takes; in a folder holding at most `.git`, the new app to
|
|
578
617
|
* make; anywhere else, refused.
|
|
579
618
|
*/
|
|
580
|
-
const framed = Effect.fnUntraced(function* (named, app, view) {
|
|
619
|
+
const framed = /* @__PURE__ */ Effect.fnUntraced(function* (named, app, view) {
|
|
581
620
|
if (named === void 0) return void 0;
|
|
582
621
|
if (Option.isSome(app)) return yield* usageFailure("app_choices_conflict", `--framework ${named} and ${app.value ? "--app" : "--no-app"} are one choice: pass one of them`);
|
|
583
622
|
const found = detectFrameworks(view);
|
|
@@ -608,7 +647,7 @@ const holdsAtMostGit = (named, entries) => {
|
|
|
608
647
|
* failed one, or one that left no `package.json` naming the framework, is `create_failed`, and
|
|
609
648
|
* what it left stays. Answers the folder as it left it.
|
|
610
649
|
*/
|
|
611
|
-
const createIn = Effect.fnUntraced(function* (folder, named, command) {
|
|
650
|
+
const createIn = /* @__PURE__ */ Effect.fnUntraced(function* (folder, named, command) {
|
|
612
651
|
const [program = "npx", ...args] = command.argv;
|
|
613
652
|
yield* (yield* FileSystem.FileSystem).makeDirectory(folder, { recursive: true }).pipe(Effect.mapError(diskFailed(`make ${printable(folder)}`)));
|
|
614
653
|
yield* holdsAtMostGit(named, (yield* viewOf(folder)).entries);
|
|
@@ -648,7 +687,7 @@ const createIn = Effect.fnUntraced(function* (folder, named, command) {
|
|
|
648
687
|
* The folder Git goes in, and its project: as found, or, for `--framework`, as its create command
|
|
649
688
|
* leaves it, run first, or under `--dry-run` as its template would.
|
|
650
689
|
*/
|
|
651
|
-
const madeFor = Effect.fnUntraced(function* (creating, flags, folder, view, project, chosen) {
|
|
690
|
+
const madeFor = /* @__PURE__ */ Effect.fnUntraced(function* (creating, flags, folder, view, project, chosen) {
|
|
652
691
|
if (creating === void 0) return {
|
|
653
692
|
view,
|
|
654
693
|
project,
|
|
@@ -716,7 +755,7 @@ const init = Command.make("init", {
|
|
|
716
755
|
yes: Flag.Boolean("yes").pipe(Flag.withDescription("Take the recommended answer for each choice the flags and the folder leave open"), Flag.withDefault(false)),
|
|
717
756
|
fromCheckout: Flag.String("from-checkout").pipe(Flag.withDescription("Take the app, Git's packages and ref0-git from a ref-0/git checkout, packed into vendor/, until they're on npm"), Flag.withMetavar("DIR"), Flag.optional),
|
|
718
757
|
dryRun: Flag.Boolean("dry-run").pipe(Flag.withDescription("Print the plan, each file and its action, and change nothing"), Flag.withDefault(false))
|
|
719
|
-
}, Effect.fnUntraced(function* (flags) {
|
|
758
|
+
}, /* @__PURE__ */ Effect.fnUntraced(function* (flags) {
|
|
720
759
|
const mode = yield* CliModes;
|
|
721
760
|
const fileSystem = yield* FileSystem.FileSystem;
|
|
722
761
|
const folder = yield* folderOf(flags.dir);
|
|
@@ -815,11 +854,12 @@ const init = Command.make("init", {
|
|
|
815
854
|
return yield* Effect.ensuring(Effect.gen(function* () {
|
|
816
855
|
const made = yield* madeFor(creating, flags, folder.path, view, placed, chosen);
|
|
817
856
|
const vendor = source.checkout === void 0 ? void 0 : packed?.vendor ?? (yield* plannedVendor(source.checkout));
|
|
818
|
-
const
|
|
857
|
+
const pnpm = Option.getOrElse(flags.packageManager, () => made.project.packageManager.value) === "pnpm" ? { workspace: made.view.read("pnpm-workspace.yaml") } : void 0;
|
|
858
|
+
const output = outputOf(chosen, made.project, source, vendor, pnpm);
|
|
819
859
|
const held = project.held === void 0 ? void 0 : outputOf({
|
|
820
860
|
...chosen,
|
|
821
861
|
...project.held
|
|
822
|
-
}, made.project, source, vendor);
|
|
862
|
+
}, made.project, source, vendor, pnpm);
|
|
823
863
|
const steps = plan(output.files, held?.files, made.view.read);
|
|
824
864
|
const links = [];
|
|
825
865
|
for (const step of steps) if (yield* linked(folder.path, step.path)) links.push(step.path);
|
|
@@ -840,19 +880,68 @@ const init = Command.make("init", {
|
|
|
840
880
|
})).pipe(Command.withDescription("Set up Git hosting in a folder: a new Worker, or Git added to an existing one (experimental)"));
|
|
841
881
|
/** The prefix every scratch repo of `--verify`'s is under, so a run that died leaves findable ones. */
|
|
842
882
|
const scratchPrefix = "ref0-git-verify/";
|
|
843
|
-
/** The scratch repos a host still has. */
|
|
844
|
-
const leftovers = (host, client) => Effect.tryPromise({
|
|
845
|
-
try: async () => {
|
|
846
|
-
const found = [];
|
|
847
|
-
for await (const repo of paginate(client.repos.list, { prefix: scratchPrefix })) found.push(printable(repo));
|
|
848
|
-
return found;
|
|
849
|
-
},
|
|
850
|
-
catch: () => failure("unreachable", `${host} didn't list its scratch repos`)
|
|
851
|
-
});
|
|
852
883
|
/** How long each of `--verify`'s calls to the host may take, so a host that stops can't hold it. */
|
|
853
884
|
const callMs = 3e4;
|
|
854
|
-
/**
|
|
855
|
-
const
|
|
885
|
+
/** How many scratch repos `--verify` names, from one page: past it, it says there are more. */
|
|
886
|
+
const leftoversShown = 50;
|
|
887
|
+
/**
|
|
888
|
+
* The scratch repos a host still has, from one page of `leftoversShown`, newest first, in
|
|
889
|
+
* `callMs`. Create order reads no deleted repo, where name order reads the one each passing run
|
|
890
|
+
* leaves, so a host that's run `--verify` often still names what's left. The check has passed by
|
|
891
|
+
* the time it lists them, so a listing that fails is said, not the run's failure.
|
|
892
|
+
*/
|
|
893
|
+
const leftovers = (host, client) => cutAnswer(host, (signal) => client.repos.list({
|
|
894
|
+
prefix: scratchPrefix,
|
|
895
|
+
order: "newest",
|
|
896
|
+
page: { limit: leftoversShown },
|
|
897
|
+
signal
|
|
898
|
+
})).pipe(Effect.match({
|
|
899
|
+
onSuccess: (page) => {
|
|
900
|
+
const names = page.items.map(printable);
|
|
901
|
+
return page.next === void 0 ? { leftovers: names } : {
|
|
902
|
+
leftovers: names,
|
|
903
|
+
more: true
|
|
904
|
+
};
|
|
905
|
+
},
|
|
906
|
+
onFailure: (failed) => ({ unlisted: {
|
|
907
|
+
reason: failed.reason,
|
|
908
|
+
message: printable(failed.headline)
|
|
909
|
+
} })
|
|
910
|
+
}));
|
|
911
|
+
/** The receipt's Leftovers row for `found`, and the step that lists them all when there are more. */
|
|
912
|
+
const leftoversRow = (host, found) => {
|
|
913
|
+
if ("unlisted" in found) return { says: `Not listed: ${found.unlisted.message}` };
|
|
914
|
+
if (found.more === void 0) return { says: found.leftovers.length === 0 ? "None" : found.leftovers.join(", ") };
|
|
915
|
+
return {
|
|
916
|
+
says: found.leftovers.length === 0 ? "None in the first page; more may remain" : `${found.leftovers.join(", ")}, and more`,
|
|
917
|
+
next: {
|
|
918
|
+
says: "List every scratch repo",
|
|
919
|
+
run: [[
|
|
920
|
+
"repos",
|
|
921
|
+
"list",
|
|
922
|
+
"--host",
|
|
923
|
+
host,
|
|
924
|
+
"--prefix",
|
|
925
|
+
scratchPrefix,
|
|
926
|
+
"--order",
|
|
927
|
+
"newest"
|
|
928
|
+
]]
|
|
929
|
+
}
|
|
930
|
+
};
|
|
931
|
+
};
|
|
932
|
+
/**
|
|
933
|
+
* The host's answer to `call`, given up after `callMs` on Effect's `Clock` as well as on the
|
|
934
|
+
* run's cancel, or its failure as the CLI's: a cut interrupts `tryPromise` (aborting `signal`) and
|
|
935
|
+
* fails `deadline_exceeded`, a refusal is the host's own, and any other failure `unreachable`, so
|
|
936
|
+
* every `--verify` call says a stalled host in the same words.
|
|
937
|
+
*/
|
|
938
|
+
const cutAnswer = (host, call) => Effect.tryPromise({
|
|
939
|
+
try: (signal) => call(signal),
|
|
940
|
+
catch: () => failure("unreachable", `Couldn't reach ${host}`)
|
|
941
|
+
}).pipe(Effect.timeoutOrElse({
|
|
942
|
+
duration: callMs,
|
|
943
|
+
orElse: () => Effect.fail(failure("deadline_exceeded", `${host} didn't answer in ${callMs / 1e3}s`))
|
|
944
|
+
}), Effect.flatMap((answer) => answer.kind === "error" ? Effect.fail(refused(answer.error, host)) : Effect.succeed(answer.value)));
|
|
856
945
|
/** A create's failures that don't say the host made nothing: no answer, or its own failure. */
|
|
857
946
|
const unsettled = /^(unreachable|unavailable|deadline_exceeded|internal|data_loss)$/;
|
|
858
947
|
/**
|
|
@@ -861,7 +950,7 @@ const unsettled = /^(unreachable|unavailable|deadline_exceeded|internal|data_los
|
|
|
861
950
|
* A create the host may still finish can't be undone, so a repo whose create didn't succeed, a
|
|
862
951
|
* token whose ID never came and a failed clean-up call are named as maybe left.
|
|
863
952
|
*/
|
|
864
|
-
const verify = Effect.fnUntraced(function* (hostOption) {
|
|
953
|
+
const verify = /* @__PURE__ */ Effect.fnUntraced(function* (hostOption) {
|
|
865
954
|
const { host, client, origin, endpoint } = yield* remoteOf(yield* chosenHost(hostOption));
|
|
866
955
|
const now = yield* Clock.currentTimeMillis;
|
|
867
956
|
const repo = `${scratchPrefix}${now.toString(36)}${(yield* Random.nextIntBetween(0, 1679616)).toString(36).padStart(4, "0")}`;
|
|
@@ -882,19 +971,19 @@ const verify = Effect.fnUntraced(function* (hostOption) {
|
|
|
882
971
|
}), (ran) => ran.status === 0 ? Effect.succeed(ran.stdout) : Effect.fail(failure("verify_git", `git ${args[0] ?? ""} failed against ${host}`)));
|
|
883
972
|
const work = Effect.gen(function* () {
|
|
884
973
|
made.repo = true;
|
|
885
|
-
const created = yield*
|
|
886
|
-
|
|
974
|
+
const created = yield* cutAnswer(host, (signal) => client.repos.create({
|
|
975
|
+
name: repo,
|
|
887
976
|
signal
|
|
888
|
-
}))
|
|
977
|
+
})).pipe(Effect.tapError((failed) => Effect.sync(() => made.repo = unsettled.test(failed.reason))));
|
|
889
978
|
made.created = true;
|
|
890
979
|
steps.push("Created");
|
|
891
980
|
made.tokenSent = true;
|
|
892
|
-
const token = yield*
|
|
981
|
+
const token = yield* cutAnswer(host, (signal) => client.tokens.create(repo, {
|
|
893
982
|
scope: "write",
|
|
894
983
|
subject: { id: "ref0-git-verify" },
|
|
895
984
|
expiresAt: now + 36e5,
|
|
896
985
|
signal
|
|
897
|
-
}))
|
|
986
|
+
})).pipe(Effect.tapError((failed) => Effect.sync(() => made.tokenSent = unsettled.test(failed.reason))));
|
|
898
987
|
made.token = token.id;
|
|
899
988
|
secrets.hide(token.secret);
|
|
900
989
|
const identity = {
|
|
@@ -953,7 +1042,7 @@ const verify = Effect.fnUntraced(function* (hostOption) {
|
|
|
953
1042
|
"rev-parse",
|
|
954
1043
|
"HEAD"
|
|
955
1044
|
])).trim();
|
|
956
|
-
const read = yield*
|
|
1045
|
+
const read = yield* cutAnswer(host, (signal) => client.refs.get(repo, {
|
|
957
1046
|
ref: target,
|
|
958
1047
|
signal
|
|
959
1048
|
}));
|
|
@@ -975,7 +1064,10 @@ const verify = Effect.fnUntraced(function* (hostOption) {
|
|
|
975
1064
|
steps.push("cloned");
|
|
976
1065
|
});
|
|
977
1066
|
/** Whether `call` removed `what` in time, or found it gone where `gone` says that's settled. */
|
|
978
|
-
const removed = (what, call, gone = true) => Effect.tryPromise(
|
|
1067
|
+
const removed = (what, call, gone = true) => Effect.tryPromise((signal) => call(signal)).pipe(Effect.map((done) => done.kind === "success" || gone && done.error.code === "NOT_FOUND"), Effect.timeoutOrElse({
|
|
1068
|
+
duration: callMs,
|
|
1069
|
+
orElse: () => Effect.succeed(false)
|
|
1070
|
+
}), Effect.orElseSucceed(() => false), Effect.tap((done) => done ? Effect.void : Effect.sync(() => left.push(what))));
|
|
979
1071
|
const cleanUpFailed = (headline) => failure("cleanup_failed", `${headline}, and may have left ${left.join(" and ")}`, {
|
|
980
1072
|
says: `Check ${host} for it: a later \`doctor --verify\` lists scratch repos under Leftovers`,
|
|
981
1073
|
run: []
|
|
@@ -995,15 +1087,28 @@ const verify = Effect.fnUntraced(function* (hostOption) {
|
|
|
995
1087
|
yield* work.pipe(Effect.ensuring(cleanUp), Effect.mapError((failed) => left.length === 0 ? failed : cleanUpFailed(failed.headline)));
|
|
996
1088
|
if (left.length > 0) return yield* cleanUpFailed(`${host} works end to end`);
|
|
997
1089
|
const found = yield* leftovers(host, client);
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1090
|
+
const row = leftoversRow(host, found);
|
|
1091
|
+
if ((yield* CliModes).json) {
|
|
1092
|
+
const document = {
|
|
1093
|
+
host,
|
|
1094
|
+
repo,
|
|
1095
|
+
steps,
|
|
1096
|
+
...found
|
|
1097
|
+
};
|
|
1098
|
+
return yield* row.next === void 0 ? cliDocument(verifyJson, document) : cliDocument(verifyJson, {
|
|
1099
|
+
...document,
|
|
1100
|
+
nextStep: nextDocument(row.next)
|
|
1101
|
+
});
|
|
1102
|
+
}
|
|
1103
|
+
const done = `${host} works end to end`;
|
|
1104
|
+
const fields = [["Scratch repo", `${repo}: ${steps.join(", ")}`], ["Leftovers", row.says]];
|
|
1105
|
+
yield* row.next === void 0 ? receipt({
|
|
1106
|
+
done,
|
|
1107
|
+
fields
|
|
1108
|
+
}) : receipt({
|
|
1109
|
+
done,
|
|
1110
|
+
fields,
|
|
1111
|
+
next: row.next
|
|
1007
1112
|
});
|
|
1008
1113
|
});
|
|
1009
1114
|
/**
|
|
@@ -1041,7 +1146,7 @@ const installedFinding = (project, disk) => ({
|
|
|
1041
1146
|
blocks: "running it"
|
|
1042
1147
|
});
|
|
1043
1148
|
/** `folder`'s `Disk`, for `chosen`: the app's local SQLite is read only where it keeps its records. */
|
|
1044
|
-
const diskOf = Effect.fnUntraced(function* (folder, project, chosen) {
|
|
1149
|
+
const diskOf = /* @__PURE__ */ Effect.fnUntraced(function* (folder, project, chosen) {
|
|
1045
1150
|
const fs = yield* FileSystem.FileSystem;
|
|
1046
1151
|
const sqlite = yield* Sqlite;
|
|
1047
1152
|
const { database } = platforms.node;
|
|
@@ -1153,12 +1258,12 @@ const nodeFindings = (view, project, chosen, disk, source) => {
|
|
|
1153
1258
|
const { sources } = disk;
|
|
1154
1259
|
const entry = sources.find((file) => {
|
|
1155
1260
|
const text = file === "git.ts" ? "" : view.read(`src/${file}`) ?? "";
|
|
1156
|
-
return /from ['"]\.\/git\.ts['"]/.test(text) && /\b(?:toNode(?:Handler|Middleware)|(?:serve|rest|git)\.fetch)\(/.test(text) && /\
|
|
1261
|
+
return /from ['"]\.\/git\.ts['"]/.test(text) && /\b(?:toNode(?:Handler|Middleware)|(?:serve|rest|git)\.fetch)\(/.test(text) && /\btoJobRunner\(/.test(text);
|
|
1157
1262
|
});
|
|
1158
1263
|
const framework = project.framework;
|
|
1159
1264
|
const starter = framework === void 0 ? void 0 : startersOf(framework);
|
|
1160
1265
|
const starts = starter?.file;
|
|
1161
|
-
const started = starts !== void 0 && /\
|
|
1266
|
+
const started = starts !== void 0 && /\btoJobRunner\(/.test(starts.text);
|
|
1162
1267
|
if (routed(project.framework)) return [
|
|
1163
1268
|
filesFinding(view, project, chosen, source),
|
|
1164
1269
|
...routedFindings(chosen, project, project.framework),
|
|
@@ -1201,7 +1306,7 @@ const nodeAppFindings = (view, project, chosen, disk, source) => {
|
|
|
1201
1306
|
const { database, entry: entryPath, jobs } = platforms.node;
|
|
1202
1307
|
const plugin = view.read(jobs) ?? "";
|
|
1203
1308
|
const entry = view.read(entryPath) ?? "";
|
|
1204
|
-
const runs = /\
|
|
1309
|
+
const runs = /\btoJobRunner\(/.test(plugin) && /from ['"]\.\/git\.ts['"]/.test(entry);
|
|
1205
1310
|
const files = disk.migrations;
|
|
1206
1311
|
const local = chosen.records === "sqlite";
|
|
1207
1312
|
const { migrated } = disk;
|
|
@@ -1270,8 +1375,9 @@ const vercelFindingsOf = (view, project, disk, chosen, source) => {
|
|
|
1270
1375
|
installedFinding(project, disk),
|
|
1271
1376
|
{
|
|
1272
1377
|
check: "Variables",
|
|
1273
|
-
ok:
|
|
1274
|
-
says: unset.length === 0 ? "Each variable .env.example lists is set in .env or .env.local: `vercel env pull` fills .env.local from Development, so see Production's with `vercel env ls production`" : `${unset.join(", ")} ${unset.length === 1 ? "isn't" : "aren't"} set in .env or .env.local, which \`vercel env pull\` fills from Development: set each for Production and Development, then pull again
|
|
1378
|
+
ok: unset.length === 0,
|
|
1379
|
+
says: unset.length === 0 ? "Each variable .env.example lists is set in .env or .env.local: `vercel env pull` fills .env.local from Development, so see Production's with `vercel env ls production`" : `${unset.join(", ")} ${unset.length === 1 ? "isn't" : "aren't"} set in .env or .env.local, which \`vercel env pull\` fills from Development: set each for Production and Development, then pull again`,
|
|
1380
|
+
blocks: "deploying: src/git.ts stops without them"
|
|
1275
1381
|
},
|
|
1276
1382
|
{
|
|
1277
1383
|
check: "Vercel plan",
|
|
@@ -1356,7 +1462,7 @@ const setupCommands = [init, Command.make("doctor", {
|
|
|
1356
1462
|
dir: dirArgument("The folder to check: the current one when left out"),
|
|
1357
1463
|
verify: Flag.Boolean("verify").pipe(Flag.withDescription("Instead of this folder's config, create, push, read, clone and delete a scratch repo on the host"), Flag.withDefault(false)),
|
|
1358
1464
|
host: hostFlag
|
|
1359
|
-
}, Effect.fnUntraced(function* ({ dir, verify: verifying, host }) {
|
|
1465
|
+
}, /* @__PURE__ */ Effect.fnUntraced(function* ({ dir, verify: verifying, host }) {
|
|
1360
1466
|
if (verifying) return yield* verify(host);
|
|
1361
1467
|
if (Option.isSome(host)) return yield* usageFailure("host_without_verify", "--host names the host --verify checks", {
|
|
1362
1468
|
says: "Check that host end to end",
|