Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion bin/setup-github
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,9 @@ const main = async () => {
process.stdout.write("main pushed\n")
}
} else {
gh(["repo", "create", REPO, "--public", "--description", description, "--source", ROOT, "--remote", "origin", "--push"])
// --push would send the branch checked out, which on a feature branch becomes the default and takes the ruleset.
gh(["repo", "create", REPO, "--public", "--description", description, "--source", ROOT, "--remote", "origin"])
git("push", "-q", "-u", "origin", "main")
process.stdout.write(`${REPO} created and main pushed\n`)
}
gh(["repo", "edit", REPO, "--delete-branch-on-merge"])
Expand Down
8 changes: 8 additions & 0 deletions changes/fix-setup-github-pushes-main.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
### Fixed

- **`bin/setup-github` pushes `main`, whatever branch is checked out.** It created the repository with
`gh repo create --push`, which sends the current branch: run from a feature branch, that branch became the default
and took main's ruleset, and `main` was not on GitHub.
- **A CRM CLI made from a config lists people and companies live when their entity names a `search`.**
`scripts/from-config.ts` wrote `LIVE` with users only, so a CLI with a people search had to mount `people list` and
`organizations list` by hand.
16 changes: 11 additions & 5 deletions kit/seeds/config/scripts/from-config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,14 @@ if (functions.length)
)
const verify = cli.auth.preset === "none" ? undefined : cli.auth.verify
// A value the config leaves out is a bare `undefined`, so a command that still reads it fails typecheck, not a run.
const live = (): string[] => {
const source = cli.source as { entities?: Record<string, { search?: unknown }>; users?: unknown } | undefined
return [
...(["person", "organization"] as const).filter((kind) => source?.entities?.[kind]?.search !== undefined),
...(source?.users ? ["user"] : []),
]
}

const constant = (name: string, type: string, value: unknown) =>
value === undefined
? `export const ${name} = undefined`
Expand Down Expand Up @@ -76,12 +84,10 @@ const text = formatted(
"export const HOOK_OPTIONS: { hooks?: CrmManifestHooks } = {}",
]),
"",
// What a CRM reads live: its users, when the source names a call for them.
// What a CRM reads live: people and companies whose entity names a search, and its users when the source names a
// call for them.
...(cli.category === "crm"
? [
`export const LIVE: readonly "user"[] = ${cli.source && "users" in cli.source && cli.source.users ? '["user"]' : "[]"}`,
"",
]
? [`export const LIVE: readonly ("person" | "organization" | "user")[] = ${JSON.stringify(live())}`, ""]
: []),
].join("\n"),
)
Expand Down
2 changes: 1 addition & 1 deletion kit/seeds/config/src/commands/crm.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ export const crmCommands = (): Command[] => {
app: IDENTITY,
open,
leads: SOURCE.kinds.includes("lead"),
// People and companies have no live list in a manifest source yet; its users do.
// People and companies whose entity names a search, and the users when the source names a call for them.
live: LIVE,
})
return [...holder.commands]
Expand Down
Loading