@notation/factory-cli 0.5.1 → 0.5.3
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/commands/repo.ts +10 -2
- package/package.json +2 -2
package/commands/repo.ts
CHANGED
|
@@ -2,7 +2,7 @@ import { existsSync, realpathSync } from "node:fs";
|
|
|
2
2
|
import { join } from "node:path";
|
|
3
3
|
import { createInterface } from "node:readline/promises";
|
|
4
4
|
import { pathToFileURL } from "node:url";
|
|
5
|
-
import { appSlug } from "@notation/factory-github/app";
|
|
5
|
+
import { appSlug, appVisibility } from "@notation/factory-github/app";
|
|
6
6
|
import { collectResourceGraph } from "@notation/resource";
|
|
7
7
|
import { loadConfig, openBrowser, type OutpostCliConfig, output } from "./shell.ts";
|
|
8
8
|
|
|
@@ -134,12 +134,20 @@ export const repoInstall = async ({ repo: given }: { repo?: string }) => {
|
|
|
134
134
|
`Set githubApps in .factory/config.ts to the ID of the hub's GitHub App for each connection, such as githubApps: { ${missing.map((name) => `${name}: 123456`).join(", ")} }. The App's ID is on its settings page, and \`factory infra up\` prints it when it creates the App.`,
|
|
135
135
|
);
|
|
136
136
|
}
|
|
137
|
-
const { id: repoId, owner } = await gh<{ id: number; owner: { id: number } }>(`repos/${repo}`);
|
|
137
|
+
const { id: repoId, owner } = await gh<{ id: number; owner: { id: number; login: string } }>(`repos/${repo}`);
|
|
138
138
|
|
|
139
139
|
const prompt = createInterface({ input: process.stdin, output: process.stdout });
|
|
140
|
+
// readline takes Ctrl+C from the process while it's open, and without this listener only pauses.
|
|
141
|
+
prompt.on("SIGINT", () => process.exit(130));
|
|
140
142
|
try {
|
|
141
143
|
for (const name of names) {
|
|
142
144
|
const slug = await appSlug(String(githubApps[name]));
|
|
145
|
+
const app = await appVisibility(slug);
|
|
146
|
+
if (!app.public && app.owner.toLowerCase() !== owner.login.toLowerCase()) {
|
|
147
|
+
throw new Error(
|
|
148
|
+
`The GitHub App ${slug} is private to ${app.owner}, so it can't be installed on ${repo}. Move the repo to ${app.owner}, or make the App public under Advanced on its settings page.`,
|
|
149
|
+
);
|
|
150
|
+
}
|
|
143
151
|
const url = `https://github.com/apps/${slug}/installations/new/permissions?suggested_target_id=${owner.id}&repository_ids[]=${repoId}`;
|
|
144
152
|
console.log(`Install the GitHub App ${slug} on ${repo}:\n ${url}`);
|
|
145
153
|
openBrowser(url);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@notation/factory-cli",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.3",
|
|
4
4
|
"author": "Daniel Grant",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -21,6 +21,6 @@
|
|
|
21
21
|
},
|
|
22
22
|
"dependencies": {
|
|
23
23
|
"@notation/resource": "0.28.1",
|
|
24
|
-
"@notation/factory-github": "0.5.
|
|
24
|
+
"@notation/factory-github": "0.5.3"
|
|
25
25
|
}
|
|
26
26
|
}
|