Skip to content

Commit 8e5aee2

Browse files
feat: remove --create-repository option
1 parent 001882b commit 8e5aee2

18 files changed

+25
-82
lines changed

docs/Options.md

+2-3
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ These required options determine how the creation script will set up and scaffol
1717
- `common`: Important additions to the minimum starters such as releases and tests.
1818
- `everything`: The most thorough tooling imaginable: sorting, spellchecking, and more!
1919
- `prompt`: Fine-grained control over which tooling pieces to use
20-
- `--create-repository` _(boolean)_: Whether to create a corresponding repository on github.com (if it doesn't yet exist)
2120
- `--mode`: Whether to:
2221
- `create` a new repository in a child directory
2322
- `initialize` a freshly repository in the current directory
@@ -26,7 +25,7 @@ These required options determine how the creation script will set up and scaffol
2625
For example, scaffolding a full new repository under the current directory and also linking it to a new repository on github.com:
2726

2827
```shell
29-
npx create-typescript-app --base everything --create-repository --mode create
28+
npx create-typescript-app --base everything --mode create
3029
```
3130

3231
See [Tooling.md](./Tooling.md) for details on the tooling pieces and which bases they're included in.
@@ -43,7 +42,7 @@ These required options determine the options that will be substituted into the t
4342
For example, pre-populating all core required options and also creating a new repository:
4443

4544
```shell
46-
npx create-typescript-app --create-repository --base everything --mode create --repository testing-repository --title "Testing Title" --owner TestingOwner --description "Test Description"
45+
npx create-typescript-app --base everything --mode create --repository testing-repository --title "Testing Title" --owner TestingOwner --description "Test Description"
4746
```
4847

4948
That script will run completely autonomously, no prompted inputs required. ✨

src/create/createRerunSuggestion.test.ts

+3-4
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ const options = {
77
access: "public",
88
author: "TestAuthor",
99
base: "everything",
10-
createRepository: true,
1110
description: "Test description.",
1211
directory: ".",
1312
email: {
@@ -47,7 +46,7 @@ describe("createRerunSuggestion", () => {
4746
const actual = createRerunSuggestion(options);
4847

4948
expect(actual).toMatchInlineSnapshot(
50-
'"npx create-typescript-app --mode create --base everything --access public --author TestAuthor --create-repository true --description \\"Test description.\\" --directory . --email-github [email protected] --email-npm [email protected] --exclude-all-contributors true --exclude-compliance true --exclude-lint-jsdoc true --exclude-lint-json true --exclude-lint-knip true --exclude-lint-package-json true --exclude-lint-perfectionist true --keywords \\"abc def ghi jkl mno pqr\\" --mode create --owner TestOwner --repository test-repository --skip-github-api true --skip-install true --skip-removal true --title \\"Test Title\\""',
49+
'"npx create-typescript-app --mode create --base everything --access public --author TestAuthor --description \\"Test description.\\" --directory . --email-github [email protected] --email-npm [email protected] --exclude-all-contributors true --exclude-compliance true --exclude-lint-jsdoc true --exclude-lint-json true --exclude-lint-knip true --exclude-lint-package-json true --exclude-lint-perfectionist true --keywords \\"abc def ghi jkl mno pqr\\" --mode create --owner TestOwner --repository test-repository --skip-github-api true --skip-install true --skip-removal true --title \\"Test Title\\""',
5150
);
5251
});
5352

@@ -62,7 +61,7 @@ describe("createRerunSuggestion", () => {
6261
});
6362

6463
expect(actual).toMatchInlineSnapshot(
65-
'"npx create-typescript-app --mode initialize --base everything --access public --author TestAuthor --create-repository true --description \\"Test description.\\" --directory . --email-github [email protected] --email-npm [email protected] --exclude-all-contributors true --exclude-compliance true --exclude-lint-jsdoc true --exclude-lint-json true --exclude-lint-knip true --exclude-lint-package-json true --exclude-lint-perfectionist true --keywords \\"abc def ghi jkl mno pqr\\" --logo test/src.png --logo-alt \\"Test alt.\\" --mode initialize --owner TestOwner --repository test-repository --skip-github-api true --skip-install true --skip-removal true --title \\"Test Title\\""',
64+
'"npx create-typescript-app --mode initialize --base everything --access public --author TestAuthor --description \\"Test description.\\" --directory . --email-github [email protected] --email-npm [email protected] --exclude-all-contributors true --exclude-compliance true --exclude-lint-jsdoc true --exclude-lint-json true --exclude-lint-knip true --exclude-lint-package-json true --exclude-lint-perfectionist true --keywords \\"abc def ghi jkl mno pqr\\" --logo test/src.png --logo-alt \\"Test alt.\\" --mode initialize --owner TestOwner --repository test-repository --skip-github-api true --skip-install true --skip-removal true --title \\"Test Title\\""',
6665
);
6766
});
6867

@@ -76,7 +75,7 @@ describe("createRerunSuggestion", () => {
7675
});
7776

7877
expect(actual).toMatchInlineSnapshot(
79-
'"npx create-typescript-app --mode initialize --base everything --access public --author TestAuthor --create-repository true --description \\"Test description.\\" --directory . --email-github [email protected] --email-npm [email protected] --exclude-all-contributors true --exclude-compliance true --exclude-lint-jsdoc true --exclude-lint-json true --exclude-lint-knip true --exclude-lint-md true --exclude-lint-package-json true --exclude-lint-perfectionist true --exclude-lint-spelling true --keywords \\"abc def ghi jkl mno pqr\\" --mode initialize --owner TestOwner --repository test-repository --skip-github-api true --skip-install true --skip-removal true --title \\"Test Title\\""',
78+
'"npx create-typescript-app --mode initialize --base everything --access public --author TestAuthor --description \\"Test description.\\" --directory . --email-github [email protected] --email-npm [email protected] --exclude-all-contributors true --exclude-compliance true --exclude-lint-jsdoc true --exclude-lint-json true --exclude-lint-knip true --exclude-lint-md true --exclude-lint-package-json true --exclude-lint-perfectionist true --exclude-lint-spelling true --keywords \\"abc def ghi jkl mno pqr\\" --mode initialize --owner TestOwner --repository test-repository --skip-github-api true --skip-install true --skip-removal true --title \\"Test Title\\""',
8079
);
8180
});
8281
});

src/create/createWithOptions.ts

+1-8
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import * as prompts from "@clack/prompts";
21
import { $ } from "execa";
32

43
import { withSpinner, withSpinners } from "../shared/cli/spinners.js";
@@ -46,13 +45,7 @@ export async function createWithOptions({ github, options }: GitHubAndOptions) {
4645
]);
4746

4847
const sendToGitHub =
49-
github &&
50-
(await doesRepositoryExist(github.octokit, options)) &&
51-
(options.createRepository ??
52-
(await prompts.confirm({
53-
message:
54-
"Would you like to push the template's tooling up to the repository on GitHub?",
55-
})) === true);
48+
github && (await doesRepositoryExist(github.octokit, options));
5649

5750
if (sendToGitHub) {
5851
await withSpinner("Initializing GitHub repository", async () => {

src/shared/options/args.ts

-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ export const allArgOptions = {
44
access: { type: "string" },
55
author: { type: "string" },
66
base: { type: "string" },
7-
"create-repository": { type: "boolean" },
87
description: { type: "string" },
98
directory: { type: "string" },
109
email: { type: "string" },

src/shared/options/augmentOptionsWithExcludes.test.ts

-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ const optionsBase = {
77
access: "public",
88
author: undefined,
99
base: "everything",
10-
createRepository: undefined,
1110
description: "",
1211
directory: ".",
1312
email: {

src/shared/options/ensureRepositoryExists.test.ts

-29
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@ const createMockOctokit = () =>
3838
describe("ensureRepositoryExists", () => {
3939
it("returns the repository when octokit is undefined", async () => {
4040
const actual = await ensureRepositoryExists(undefined, {
41-
createRepository: false,
4241
owner,
4342
repository,
4443
});
@@ -52,7 +51,6 @@ describe("ensureRepositoryExists", () => {
5251
const actual = await ensureRepositoryExists(
5352
{ auth, octokit },
5453
{
55-
createRepository: false,
5654
owner,
5755
repository,
5856
},
@@ -61,29 +59,6 @@ describe("ensureRepositoryExists", () => {
6159
expect(actual).toEqual({ github: { auth, octokit }, repository });
6260
});
6361

64-
it("creates a new repository when createRepository is true and the repository does not exist", async () => {
65-
const octokit = createMockOctokit();
66-
67-
mockDoesRepositoryExist.mockResolvedValue(false);
68-
69-
const actual = await ensureRepositoryExists(
70-
{ auth, octokit },
71-
{
72-
createRepository: true,
73-
owner,
74-
repository,
75-
},
76-
);
77-
78-
expect(actual).toEqual({ github: { auth, octokit }, repository });
79-
expect(octokit.rest.repos.createUsingTemplate).toHaveBeenCalledWith({
80-
name: repository,
81-
owner,
82-
template_owner: "JoshuaKGoldberg",
83-
template_repo: "create-typescript-app",
84-
});
85-
});
86-
8762
it("creates a new repository when the prompt is 'create' and the repository does not exist", async () => {
8863
const octokit = createMockOctokit();
8964

@@ -93,7 +68,6 @@ describe("ensureRepositoryExists", () => {
9368
const actual = await ensureRepositoryExists(
9469
{ auth, octokit },
9570
{
96-
createRepository: false,
9771
owner,
9872
repository,
9973
},
@@ -121,7 +95,6 @@ describe("ensureRepositoryExists", () => {
12195
const actual = await ensureRepositoryExists(
12296
{ auth, octokit },
12397
{
124-
createRepository: false,
12598
owner,
12699
repository,
127100
},
@@ -147,7 +120,6 @@ describe("ensureRepositoryExists", () => {
147120
const actual = await ensureRepositoryExists(
148121
{ auth, octokit },
149122
{
150-
createRepository: false,
151123
owner,
152124
repository,
153125
},
@@ -174,7 +146,6 @@ describe("ensureRepositoryExists", () => {
174146
const actual = await ensureRepositoryExists(
175147
{ auth, octokit },
176148
{
177-
createRepository: false,
178149
owner,
179150
repository,
180151
},

src/shared/options/ensureRepositoryExists.ts

+19-24
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import { GitHub } from "./getGitHub.js";
77

88
export type EnsureRepositoryExistsOptions = Pick<
99
Options,
10-
"createRepository" | "owner" | "repository"
10+
"owner" | "repository"
1111
>;
1212

1313
export interface RepositoryExistsResult {
@@ -19,8 +19,7 @@ export async function ensureRepositoryExists(
1919
github: GitHub | undefined,
2020
options: EnsureRepositoryExistsOptions,
2121
): Promise<Partial<RepositoryExistsResult>> {
22-
// We'll only respect input options once before prompting for them
23-
let { createRepository, repository } = options;
22+
let { repository } = options;
2423

2524
// We'll continuously pester the user for a repository
2625
// until they bail, create a new one, or it exists.
@@ -29,27 +28,23 @@ export async function ensureRepositoryExists(
2928
return { github, repository };
3029
}
3130

32-
const selection = createRepository
33-
? "create"
34-
: filterPromptCancel(
35-
(await prompts.select({
36-
message: `Repository ${options.repository} doesn't seem to exist under ${options.owner}. What would you like to do?`,
37-
options: [
38-
{ label: "Create a new repository", value: "create" },
39-
{
40-
label: "Switch to a different repository name",
41-
value: "different",
42-
},
43-
{
44-
label: "Keep changes local",
45-
value: "local",
46-
},
47-
{ label: "Bail out and maybe try again later", value: "bail" },
48-
],
49-
})) as "bail" | "create" | "different" | "local",
50-
);
51-
52-
createRepository = false;
31+
const selection = filterPromptCancel(
32+
(await prompts.select({
33+
message: `Repository ${options.repository} doesn't seem to exist under ${options.owner}. What would you like to do?`,
34+
options: [
35+
{ label: "Create a new repository", value: "create" },
36+
{
37+
label: "Switch to a different repository name",
38+
value: "different",
39+
},
40+
{
41+
label: "Keep changes local",
42+
value: "local",
43+
},
44+
{ label: "Bail out and maybe try again later", value: "bail" },
45+
],
46+
})) as "bail" | "create" | "different" | "local",
47+
);
5348

5449
switch (selection) {
5550
case undefined:

src/shared/options/optionsSchema.ts

-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ export const optionsSchemaShape = {
1111
z.literal("prompt"),
1212
])
1313
.optional(),
14-
createRepository: z.boolean().optional(),
1514
description: z.string().optional(),
1615
directory: z.string().optional(),
1716
email: z

src/shared/options/readOptions.test.ts

-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ const emptyOptions = {
99
access: undefined,
1010
author: undefined,
1111
base: undefined,
12-
createRepository: undefined,
1312
description: undefined,
1413
directory: undefined,
1514
email: undefined,

src/shared/options/readOptions.ts

-2
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,6 @@ export async function readOptions(
4848
access: values.access,
4949
author: values.author,
5050
base: values.base,
51-
createRepository: values["create-repository"],
5251
description: values.description,
5352
directory: values.directory,
5453
email:
@@ -138,7 +137,6 @@ export async function readOptions(
138137
? undefined
139138
: await withSpinner("Checking GitHub authentication", getGitHub),
140139
{
141-
createRepository: options.createRepository,
142140
owner: options.owner,
143141
repository: options.repository,
144142
},

src/shared/types.ts

-1
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,6 @@ export interface Options {
4242
access: OptionsAccess;
4343
author?: string;
4444
base?: OptionsBase;
45-
createRepository?: boolean;
4645
description: string;
4746
directory: string;
4847
email: OptionsEmail;

src/steps/finalizeDependencies.test.ts

-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ const options = {
2020
access: "public",
2121
author: undefined,
2222
base: "everything",
23-
createRepository: undefined,
2423
description: "Stub description.",
2524
directory: ".",
2625
email: {

src/steps/updateLocalFiles.test.ts

-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ const options = {
2323
access: "public",
2424
author: undefined,
2525
base: "everything",
26-
createRepository: undefined,
2726
description: "Stub description.",
2827
directory: ".",
2928
email: {

src/steps/writeReadme/generateTopContent.test.ts

-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ const optionsBase = {
77
access: "public",
88
author: undefined,
99
base: undefined,
10-
createRepository: undefined,
1110
description: "",
1211
directory: ".",
1312
email: {

src/steps/writeReadme/index.test.ts

-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ const options = {
2727
access: "public",
2828
author: "Test Author",
2929
base: "everything",
30-
createRepository: false,
3130
description: "Test description.",
3231
directory: ".",
3332
email: {

src/steps/writing/creation/createESLintRC.test.ts

-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ function fakeOptions(getExcludeValue: (exclusionName: string) => boolean) {
88
access: "public",
99
author: "TestAuthor",
1010
base: "everything",
11-
createRepository: true,
1211
description: "Test description.",
1312
directory: ".",
1413
email: {

src/steps/writing/creation/dotGitHub/createDevelopment.test.ts

-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ const options = {
77
access: "public",
88
author: "Test Author",
99
base: "everything",
10-
createRepository: false,
1110
description: "Test description.",
1211
directory: ".",
1312
email: {

src/steps/writing/creation/writePackageJson.test.ts

-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ const options = {
1515
access: "public",
1616
author: "test-author",
1717
base: "everything",
18-
createRepository: undefined,
1918
description: "Test description.",
2019
directory: ".",
2120
email: {

0 commit comments

Comments
 (0)