create-typescript-app 1.31.0 → 1.33.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/README.md +35 -32
- package/lib/bin/index.js +4 -4
- package/lib/bin/index.js.map +1 -1
- package/lib/bin/promptForMode.d.ts +11 -0
- package/lib/bin/promptForMode.js +102 -0
- package/lib/bin/promptForMode.js.map +1 -0
- package/lib/create/createAndEnterGitDirectory.d.ts +3 -0
- package/lib/create/createAndEnterGitDirectory.js +19 -0
- package/lib/create/createAndEnterGitDirectory.js.map +1 -0
- package/lib/create/createRerunSuggestion.d.ts +1 -2
- package/lib/create/createRerunSuggestion.js +10 -4
- package/lib/create/createRerunSuggestion.js.map +1 -1
- package/lib/create/createWithOptions.d.ts +1 -0
- package/lib/create/createWithOptions.js +6 -9
- package/lib/create/createWithOptions.js.map +1 -1
- package/lib/create/index.d.ts +2 -3
- package/lib/create/index.js +14 -17
- package/lib/create/index.js.map +1 -1
- package/lib/initialize/index.d.ts +1 -2
- package/lib/initialize/index.js +5 -5
- package/lib/initialize/index.js.map +1 -1
- package/lib/initialize/initializeWithOptions.d.ts +1 -0
- package/lib/initialize/initializeWithOptions.js +4 -4
- package/lib/initialize/initializeWithOptions.js.map +1 -1
- package/lib/migrate/index.d.ts +1 -2
- package/lib/migrate/index.js +6 -3
- package/lib/migrate/index.js.map +1 -1
- package/lib/migrate/migrateWithOptions.d.ts +1 -0
- package/lib/migrate/migrateWithOptions.js +3 -3
- package/lib/migrate/migrateWithOptions.js.map +1 -1
- package/lib/shared/cli/outro.d.ts +4 -3
- package/lib/shared/cli/outro.js +2 -2
- package/lib/shared/cli/outro.js.map +1 -1
- package/lib/shared/generateNextSteps.d.ts +8 -0
- package/lib/shared/generateNextSteps.js +60 -0
- package/lib/shared/generateNextSteps.js.map +1 -0
- package/lib/shared/getGitHubUserAsAllContributor.d.ts +5 -1
- package/lib/shared/getGitHubUserAsAllContributor.js +11 -3
- package/lib/shared/getGitHubUserAsAllContributor.js.map +1 -1
- package/lib/shared/options/args.d.ts +21 -5
- package/lib/shared/options/args.js +7 -2
- package/lib/shared/options/args.js.map +1 -1
- package/lib/shared/options/augmentOptionsWithExcludes.d.ts +2 -0
- package/lib/shared/options/augmentOptionsWithExcludes.js +4 -4
- package/lib/shared/options/augmentOptionsWithExcludes.js.map +1 -1
- package/lib/shared/options/{readOptionDefaults → createOptionDefaults}/index.d.ts +6 -2
- package/lib/shared/options/{readOptionDefaults → createOptionDefaults}/index.js +3 -3
- package/lib/shared/options/createOptionDefaults/index.js.map +1 -0
- package/lib/shared/options/{readOptionDefaults → createOptionDefaults}/parsePackageAuthor.d.ts +2 -0
- package/lib/shared/options/createOptionDefaults/parsePackageAuthor.js.map +1 -0
- package/lib/shared/options/createOptionDefaults/readDefaultsFromReadme.js.map +1 -0
- package/lib/shared/options/ensureRepositoryExists.d.ts +3 -1
- package/lib/shared/options/ensureRepositoryExists.js +2 -1
- package/lib/shared/options/ensureRepositoryExists.js.map +1 -1
- package/lib/shared/options/getPrefillOrPromptedOption.d.ts +1 -1
- package/lib/shared/options/getPrefillOrPromptedOption.js +1 -4
- package/lib/shared/options/getPrefillOrPromptedOption.js.map +1 -1
- package/lib/shared/options/optionsSchema.d.ts +28 -8
- package/lib/shared/options/optionsSchema.js +7 -2
- package/lib/shared/options/optionsSchema.js.map +1 -1
- package/lib/shared/options/readOptions.d.ts +3 -2
- package/lib/shared/options/readOptions.js +15 -15
- package/lib/shared/options/readOptions.js.map +1 -1
- package/lib/shared/packages.d.ts +2 -0
- package/lib/shared/types.d.ts +41 -9
- package/lib/steps/addOwnerAsAllContributor.d.ts +5 -1
- package/lib/steps/addOwnerAsAllContributor.js +8 -3
- package/lib/steps/addOwnerAsAllContributor.js.map +1 -1
- package/lib/steps/addToolAllContributors.d.ts +5 -1
- package/lib/steps/addToolAllContributors.js +2 -2
- package/lib/steps/addToolAllContributors.js.map +1 -1
- package/lib/steps/detectExistingContributors.d.ts +2 -0
- package/lib/steps/finalizeDependencies.d.ts +2 -0
- package/lib/steps/finalizeDependencies.js +8 -4
- package/lib/steps/finalizeDependencies.js.map +1 -1
- package/lib/steps/initializeGitHubRepository/index.d.ts +2 -0
- package/lib/steps/initializeGitHubRepository/initializeBranchProtectionSettings.d.ts +2 -0
- package/lib/steps/initializeGitHubRepository/labels/outcomeLabels.js +5 -0
- package/lib/steps/initializeGitHubRepository/labels/outcomeLabels.js.map +1 -1
- package/lib/steps/initializeGitRemote.d.ts +2 -0
- package/lib/steps/initializeRepositorySettings.d.ts +2 -0
- package/lib/steps/uninstallPackages.d.ts +1 -1
- package/lib/steps/uninstallPackages.js +2 -2
- package/lib/steps/uninstallPackages.js.map +1 -1
- package/lib/steps/updateAllContributorsTable.d.ts +2 -0
- package/lib/steps/updateLocalFiles.d.ts +1 -2
- package/lib/steps/updateLocalFiles.js +3 -3
- package/lib/steps/updateLocalFiles.js.map +1 -1
- package/lib/steps/writeReadme/findIntroSectionClose.js +1 -1
- package/lib/steps/writeReadme/findIntroSectionClose.js.map +1 -1
- package/lib/steps/writeReadme/generateTopContent.d.ts +2 -0
- package/lib/steps/writeReadme/generateTopContent.js +17 -2
- package/lib/steps/writeReadme/generateTopContent.js.map +1 -1
- package/lib/steps/writeReadme/index.d.ts +2 -0
- package/lib/steps/writeReadme/index.js +1 -1
- package/lib/steps/writeReadme/index.js.map +1 -1
- package/lib/steps/writing/creation/createESLintRC.d.ts +2 -0
- package/lib/steps/writing/creation/createESLintRC.js +10 -1
- package/lib/steps/writing/creation/createESLintRC.js.map +1 -1
- package/lib/steps/writing/creation/dotGitHub/createDevelopment.d.ts +2 -0
- package/lib/steps/writing/creation/dotGitHub/createDevelopment.js +1 -1
- package/lib/steps/writing/creation/dotGitHub/createDevelopment.js.map +1 -1
- package/lib/steps/writing/creation/dotGitHub/createDotGitHubFiles.d.ts +2 -0
- package/lib/steps/writing/creation/dotGitHub/createDotGitHubFiles.js +7 -7
- package/lib/steps/writing/creation/dotGitHub/createDotGitHubFiles.js.map +1 -1
- package/lib/steps/writing/creation/dotGitHub/{workflows.d.ts → createWorkflows.d.ts} +2 -0
- package/lib/steps/writing/creation/dotGitHub/{workflows.js → createWorkflows.js} +9 -86
- package/lib/steps/writing/creation/dotGitHub/createWorkflows.js.map +1 -0
- package/lib/steps/writing/creation/dotGitHub/index.d.ts +2 -0
- package/lib/steps/writing/creation/dotGitHub/index.js +1 -1
- package/lib/steps/writing/creation/dotGitHub/index.js.map +1 -1
- package/lib/steps/writing/creation/dotGitHub/issueTemplate.d.ts +2 -0
- package/lib/steps/writing/creation/dotVSCode.d.ts +2 -0
- package/lib/steps/writing/creation/index.d.ts +1 -2
- package/lib/steps/writing/creation/index.js +2 -2
- package/lib/steps/writing/creation/index.js.map +1 -1
- package/lib/steps/writing/creation/rootFiles.d.ts +2 -0
- package/lib/steps/writing/creation/rootFiles.js +3 -2
- package/lib/steps/writing/creation/rootFiles.js.map +1 -1
- package/lib/steps/writing/creation/src.d.ts +2 -0
- package/lib/steps/writing/creation/writeAllContributorsRC.d.ts +2 -0
- package/lib/steps/writing/creation/writeAllContributorsRC.js +1 -1
- package/lib/steps/writing/creation/writeAllContributorsRC.js.map +1 -1
- package/lib/steps/writing/creation/writePackageJson.d.ts +2 -0
- package/lib/steps/writing/creation/writePackageJson.js +2 -1
- package/lib/steps/writing/creation/writePackageJson.js.map +1 -1
- package/lib/steps/writing/writeStructure.d.ts +1 -2
- package/lib/steps/writing/writeStructure.js +2 -2
- package/lib/steps/writing/writeStructure.js.map +1 -1
- package/package.json +5 -6
- package/lib/bin/mode.d.ts +0 -14
- package/lib/bin/mode.js +0 -50
- package/lib/bin/mode.js.map +0 -1
- package/lib/create/createAndEnterRepository.d.ts +0 -3
- package/lib/create/createAndEnterRepository.js +0 -15
- package/lib/create/createAndEnterRepository.js.map +0 -1
- package/lib/shared/options/readOptionDefaults/index.js.map +0 -1
- package/lib/shared/options/readOptionDefaults/parsePackageAuthor.js.map +0 -1
- package/lib/shared/options/readOptionDefaults/readDefaultsFromReadme.js.map +0 -1
- package/lib/steps/writing/creation/dotGitHub/workflows.js.map +0 -1
- /package/lib/shared/options/{readOptionDefaults → createOptionDefaults}/parsePackageAuthor.js +0 -0
- /package/lib/shared/options/{readOptionDefaults → createOptionDefaults}/readDefaultsFromReadme.d.ts +0 -0
- /package/lib/shared/options/{readOptionDefaults → createOptionDefaults}/readDefaultsFromReadme.js +0 -0
|
@@ -1,4 +1,8 @@
|
|
|
1
|
-
|
|
1
|
+
import { PromptedOptions } from '../../types.js';
|
|
2
|
+
import 'zod';
|
|
3
|
+
import '../../codes.js';
|
|
4
|
+
|
|
5
|
+
declare function createOptionDefaults(promptedOptions?: PromptedOptions): {
|
|
2
6
|
logo: () => Promise<string | undefined>;
|
|
3
7
|
title: () => Promise<string | undefined>;
|
|
4
8
|
author: () => Promise<string>;
|
|
@@ -12,4 +16,4 @@ declare function readOptionDefaults(): {
|
|
|
12
16
|
repository: () => Promise<string | undefined>;
|
|
13
17
|
};
|
|
14
18
|
|
|
15
|
-
export {
|
|
19
|
+
export { createOptionDefaults };
|
|
@@ -9,7 +9,7 @@ import { tryCatchAsync } from "../../tryCatchAsync.js";
|
|
|
9
9
|
import { tryCatchLazyValueAsync } from "../../tryCatchLazyValueAsync.js";
|
|
10
10
|
import { parsePackageAuthor } from "./parsePackageAuthor.js";
|
|
11
11
|
import { readDefaultsFromReadme } from "./readDefaultsFromReadme.js";
|
|
12
|
-
function
|
|
12
|
+
function createOptionDefaults(promptedOptions) {
|
|
13
13
|
const gitDefaults = tryCatchLazyValueAsync(
|
|
14
14
|
async () => gitUrlParse(await gitRemoteOriginUrl())
|
|
15
15
|
);
|
|
@@ -35,11 +35,11 @@ function readOptionDefaults() {
|
|
|
35
35
|
async () => (await fs.readFile(".github/FUNDING.yml")).toString().split(":")[1]?.trim()
|
|
36
36
|
),
|
|
37
37
|
owner: async () => (await gitDefaults())?.organization ?? (await packageAuthor()).author,
|
|
38
|
-
repository: async () => (await gitDefaults())?.name ?? (await packageData()).name,
|
|
38
|
+
repository: async () => promptedOptions?.repository ?? (await gitDefaults())?.name ?? (await packageData()).name,
|
|
39
39
|
...readDefaultsFromReadme()
|
|
40
40
|
};
|
|
41
41
|
}
|
|
42
42
|
export {
|
|
43
|
-
|
|
43
|
+
createOptionDefaults
|
|
44
44
|
};
|
|
45
45
|
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../src/shared/options/createOptionDefaults/index.ts"],"sourcesContent":["import { $ } from \"execa\";\nimport gitRemoteOriginUrl from \"git-remote-origin-url\";\nimport gitUrlParse from \"git-url-parse\";\nimport lazyValue from \"lazy-value\";\nimport fs from \"node:fs/promises\";\nimport npmUser from \"npm-user\";\n\nimport { readPackageData } from \"../../packages.js\";\nimport { tryCatchAsync } from \"../../tryCatchAsync.js\";\nimport { tryCatchLazyValueAsync } from \"../../tryCatchLazyValueAsync.js\";\nimport { PromptedOptions } from \"../../types.js\";\nimport { parsePackageAuthor } from \"./parsePackageAuthor.js\";\nimport { readDefaultsFromReadme } from \"./readDefaultsFromReadme.js\";\n\nexport function createOptionDefaults(promptedOptions?: PromptedOptions) {\n\tconst gitDefaults = tryCatchLazyValueAsync(async () =>\n\t\tgitUrlParse(await gitRemoteOriginUrl()),\n\t);\n\n\tconst npmDefaults = tryCatchLazyValueAsync(async () => {\n\t\tconst whoami = (await $`npm whoami`).stdout;\n\t\treturn whoami ? await npmUser(whoami) : undefined;\n\t});\n\n\tconst packageData = lazyValue(readPackageData);\n\tconst packageAuthor = lazyValue(async () =>\n\t\tparsePackageAuthor(await packageData()),\n\t);\n\n\treturn {\n\t\tauthor: async () => (await packageAuthor()).author ?? npmDefaults.name,\n\t\tdescription: async () => (await packageData()).description,\n\t\temail: async () => {\n\t\t\tconst gitEmail = await tryCatchAsync(\n\t\t\t\tasync () => (await $`git config --get user.email`).stdout,\n\t\t\t);\n\t\t\tconst npmEmail =\n\t\t\t\t(await npmDefaults())?.email ?? (await packageAuthor()).email;\n\n\t\t\t/* eslint-disable @typescript-eslint/no-non-null-assertion */\n\t\t\treturn gitEmail || npmEmail\n\t\t\t\t? { github: (gitEmail || npmEmail)!, npm: (npmEmail || gitEmail)! }\n\t\t\t\t: undefined;\n\t\t\t/* eslint-enable @typescript-eslint/no-non-null-assertion */\n\t\t},\n\t\tfunding: async () =>\n\t\t\tawait tryCatchAsync(\n\t\t\t\tasync () =>\n\t\t\t\t\t(await fs.readFile(\".github/FUNDING.yml\"))\n\t\t\t\t\t\t.toString()\n\t\t\t\t\t\t.split(\":\")[1]\n\t\t\t\t\t\t?.trim(),\n\t\t\t),\n\t\towner: async () =>\n\t\t\t(await gitDefaults())?.organization ?? (await packageAuthor()).author,\n\t\trepository: async () =>\n\t\t\tpromptedOptions?.repository ??\n\t\t\t(await gitDefaults())?.name ??\n\t\t\t(await packageData()).name,\n\t\t...readDefaultsFromReadme(),\n\t};\n}\n"],"mappings":"AAAA,SAAS,SAAS;AAClB,OAAO,wBAAwB;AAC/B,OAAO,iBAAiB;AACxB,OAAO,eAAe;AACtB,OAAO,QAAQ;AACf,OAAO,aAAa;AAEpB,SAAS,uBAAuB;AAChC,SAAS,qBAAqB;AAC9B,SAAS,8BAA8B;AAEvC,SAAS,0BAA0B;AACnC,SAAS,8BAA8B;AAEhC,SAAS,qBAAqB,iBAAmC;AACvE,QAAM,cAAc;AAAA,IAAuB,YAC1C,YAAY,MAAM,mBAAmB,CAAC;AAAA,EACvC;AAEA,QAAM,cAAc,uBAAuB,YAAY;AACtD,UAAM,UAAU,MAAM,eAAe;AACrC,WAAO,SAAS,MAAM,QAAQ,MAAM,IAAI;AAAA,EACzC,CAAC;AAED,QAAM,cAAc,UAAU,eAAe;AAC7C,QAAM,gBAAgB;AAAA,IAAU,YAC/B,mBAAmB,MAAM,YAAY,CAAC;AAAA,EACvC;AAEA,SAAO;AAAA,IACN,QAAQ,aAAa,MAAM,cAAc,GAAG,UAAU,YAAY;AAAA,IAClE,aAAa,aAAa,MAAM,YAAY,GAAG;AAAA,IAC/C,OAAO,YAAY;AAClB,YAAM,WAAW,MAAM;AAAA,QACtB,aAAa,MAAM,gCAAgC;AAAA,MACpD;AACA,YAAM,YACJ,MAAM,YAAY,IAAI,UAAU,MAAM,cAAc,GAAG;AAGzD,aAAO,YAAY,WAChB,EAAE,QAAS,YAAY,UAAY,KAAM,YAAY,SAAW,IAChE;AAAA,IAEJ;AAAA,IACA,SAAS,YACR,MAAM;AAAA,MACL,aACE,MAAM,GAAG,SAAS,qBAAqB,GACtC,SAAS,EACT,MAAM,GAAG,EAAE,CAAC,GACX,KAAK;AAAA,IACV;AAAA,IACD,OAAO,aACL,MAAM,YAAY,IAAI,iBAAiB,MAAM,cAAc,GAAG;AAAA,IAChE,YAAY,YACX,iBAAiB,eAChB,MAAM,YAAY,IAAI,SACtB,MAAM,YAAY,GAAG;AAAA,IACvB,GAAG,uBAAuB;AAAA,EAC3B;AACD;","names":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../src/shared/options/createOptionDefaults/parsePackageAuthor.ts"],"sourcesContent":["import { PartialPackageData } from \"../../types.js\";\n\nexport function parsePackageAuthor(packageData: PartialPackageData) {\n\tconst [packageAuthor, packageEmail] =\n\t\ttypeof packageData.author === \"string\"\n\t\t\t? [\n\t\t\t\t\tpackageData.author.split(\"<\")[0].trim(),\n\t\t\t\t\tpackageData.author.split(/<|>/)[1]?.trim(),\n\t\t\t ]\n\t\t\t: [packageData.author?.name, packageData.author?.email];\n\n\treturn {\n\t\tauthor: packageAuthor,\n\t\temail: packageEmail,\n\t};\n}\n"],"mappings":"AAEO,SAAS,mBAAmB,aAAiC;AACnE,QAAM,CAAC,eAAe,YAAY,IACjC,OAAO,YAAY,WAAW,WAC3B;AAAA,IACA,YAAY,OAAO,MAAM,GAAG,EAAE,CAAC,EAAE,KAAK;AAAA,IACtC,YAAY,OAAO,MAAM,KAAK,EAAE,CAAC,GAAG,KAAK;AAAA,EACzC,IACA,CAAC,YAAY,QAAQ,MAAM,YAAY,QAAQ,KAAK;AAExD,SAAO;AAAA,IACN,QAAQ;AAAA,IACR,OAAO;AAAA,EACR;AACD;","names":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../src/shared/options/createOptionDefaults/readDefaultsFromReadme.ts"],"sourcesContent":["import lazyValue from \"lazy-value\";\n\nimport { readFileSafe } from \"../../readFileSafe.js\";\n\nexport function readDefaultsFromReadme() {\n\tconst readme = lazyValue(async () => await readFileSafe(\"README.md\", \"\"));\n\n\tconst imageTag = lazyValue(\n\t\tasync () => (await readme()).match(/<img.+src.+\\/>/)?.[0],\n\t);\n\n\treturn {\n\t\tlogo: async () =>\n\t\t\t(await imageTag())\n\t\t\t\t?.match(/src\\s*=(.+)?\\/>/)?.[1]\n\t\t\t\t?.replaceAll(/^['\"]|['\"]$/g, \"\"),\n\t\ttitle: async () =>\n\t\t\t(await readme())\n\t\t\t\t.match(/^(?:# |<h1\\s+align=\"center\">)(.*?)(?:<\\/h1>)?$/i)?.[1]\n\t\t\t\t?.trim()\n\t\t\t\t?.replace(/<[^>]+(?:>|$)/g, \"\"),\n\t};\n}\n"],"mappings":"AAAA,OAAO,eAAe;AAEtB,SAAS,oBAAoB;AAEtB,SAAS,yBAAyB;AACxC,QAAM,SAAS,UAAU,YAAY,MAAM,aAAa,aAAa,EAAE,CAAC;AAExE,QAAM,WAAW;AAAA,IAChB,aAAa,MAAM,OAAO,GAAG,MAAM,gBAAgB,IAAI,CAAC;AAAA,EACzD;AAEA,SAAO;AAAA,IACN,MAAM,aACJ,MAAM,SAAS,IACb,MAAM,iBAAiB,IAAI,CAAC,GAC5B,WAAW,gBAAgB,EAAE;AAAA,IACjC,OAAO,aACL,MAAM,OAAO,GACZ,MAAM,iDAAiD,IAAI,CAAC,GAC3D,KAAK,GACL,QAAQ,kBAAkB,EAAE;AAAA,EACjC;AACD;","names":[]}
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import { Options } from '../types.js';
|
|
2
2
|
import { GitHub } from './getGitHub.js';
|
|
3
|
+
import 'zod';
|
|
4
|
+
import '../codes.js';
|
|
3
5
|
import 'octokit';
|
|
4
6
|
|
|
5
|
-
type EnsureRepositoryExistsOptions = Pick<Options, "
|
|
7
|
+
type EnsureRepositoryExistsOptions = Pick<Options, "mode" | "owner" | "repository">;
|
|
6
8
|
interface RepositoryExistsResult {
|
|
7
9
|
github: GitHub | undefined;
|
|
8
10
|
repository: string;
|
|
@@ -2,7 +2,8 @@ import * as prompts from "@clack/prompts";
|
|
|
2
2
|
import { doesRepositoryExist } from "../doesRepositoryExist.js";
|
|
3
3
|
import { filterPromptCancel } from "../prompts.js";
|
|
4
4
|
async function ensureRepositoryExists(github, options) {
|
|
5
|
-
let {
|
|
5
|
+
let { repository } = options;
|
|
6
|
+
let createRepository = options.mode === "create";
|
|
6
7
|
while (github) {
|
|
7
8
|
if (await doesRepositoryExist(github.octokit, options)) {
|
|
8
9
|
return { github, repository };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/shared/options/ensureRepositoryExists.ts"],"sourcesContent":["import * as prompts from \"@clack/prompts\";\n\nimport { doesRepositoryExist } from \"../doesRepositoryExist.js\";\nimport { filterPromptCancel } from \"../prompts.js\";\nimport { Options } from \"../types.js\";\nimport { GitHub } from \"./getGitHub.js\";\n\nexport type EnsureRepositoryExistsOptions = Pick<\n\tOptions,\n\t\"
|
|
1
|
+
{"version":3,"sources":["../../../src/shared/options/ensureRepositoryExists.ts"],"sourcesContent":["import * as prompts from \"@clack/prompts\";\n\nimport { doesRepositoryExist } from \"../doesRepositoryExist.js\";\nimport { filterPromptCancel } from \"../prompts.js\";\nimport { Options } from \"../types.js\";\nimport { GitHub } from \"./getGitHub.js\";\n\nexport type EnsureRepositoryExistsOptions = Pick<\n\tOptions,\n\t\"mode\" | \"owner\" | \"repository\"\n>;\n\nexport interface RepositoryExistsResult {\n\tgithub: GitHub | undefined;\n\trepository: string;\n}\n\nexport async function ensureRepositoryExists(\n\tgithub: GitHub | undefined,\n\toptions: EnsureRepositoryExistsOptions,\n): Promise<Partial<RepositoryExistsResult>> {\n\t// We'll only respect input options once before prompting for them\n\tlet { repository } = options;\n\tlet createRepository = options.mode === \"create\";\n\n\t// We'll continuously pester the user for a repository\n\t// until they bail, create a new one, or it exists.\n\twhile (github) {\n\t\tif (await doesRepositoryExist(github.octokit, options)) {\n\t\t\treturn { github, repository };\n\t\t}\n\n\t\tconst selection = createRepository\n\t\t\t? \"create\"\n\t\t\t: filterPromptCancel(\n\t\t\t\t\t(await prompts.select({\n\t\t\t\t\t\tmessage: `Repository ${options.repository} doesn't seem to exist under ${options.owner}. What would you like to do?`,\n\t\t\t\t\t\toptions: [\n\t\t\t\t\t\t\t{ label: \"Create a new repository\", value: \"create\" },\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tlabel: \"Switch to a different repository name\",\n\t\t\t\t\t\t\t\tvalue: \"different\",\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tlabel: \"Keep changes local\",\n\t\t\t\t\t\t\t\tvalue: \"local\",\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t{ label: \"Bail out and maybe try again later\", value: \"bail\" },\n\t\t\t\t\t\t],\n\t\t\t\t\t})) as \"bail\" | \"create\" | \"different\" | \"local\",\n\t\t\t );\n\n\t\tcreateRepository = false;\n\n\t\tswitch (selection) {\n\t\t\tcase undefined:\n\t\t\tcase \"bail\":\n\t\t\t\treturn {};\n\n\t\t\tcase \"create\":\n\t\t\t\tawait github.octokit.rest.repos.createUsingTemplate({\n\t\t\t\t\tname: repository,\n\t\t\t\t\towner: options.owner,\n\t\t\t\t\ttemplate_owner: \"JoshuaKGoldberg\",\n\t\t\t\t\ttemplate_repo: \"create-typescript-app\",\n\t\t\t\t});\n\t\t\t\treturn { github: github, repository };\n\n\t\t\tcase \"different\":\n\t\t\t\tconst newRepository = filterPromptCancel(\n\t\t\t\t\tawait prompts.text({\n\t\t\t\t\t\tmessage: `What would you like to call the repository?`,\n\t\t\t\t\t}),\n\t\t\t\t);\n\n\t\t\t\tif (!newRepository) {\n\t\t\t\t\treturn {};\n\t\t\t\t}\n\n\t\t\t\trepository = newRepository;\n\t\t\t\tbreak;\n\n\t\t\tcase \"local\":\n\t\t\t\tgithub = undefined;\n\t\t\t\tbreak;\n\t\t}\n\t}\n\n\treturn { github: github, repository };\n}\n"],"mappings":"AAAA,YAAY,aAAa;AAEzB,SAAS,2BAA2B;AACpC,SAAS,0BAA0B;AAcnC,eAAsB,uBACrB,QACA,SAC2C;AAE3C,MAAI,EAAE,WAAW,IAAI;AACrB,MAAI,mBAAmB,QAAQ,SAAS;AAIxC,SAAO,QAAQ;AACd,QAAI,MAAM,oBAAoB,OAAO,SAAS,OAAO,GAAG;AACvD,aAAO,EAAE,QAAQ,WAAW;AAAA,IAC7B;AAEA,UAAM,YAAY,mBACf,WACA;AAAA,MACC,MAAM,QAAQ,OAAO;AAAA,QACrB,SAAS,cAAc,QAAQ,UAAU,gCAAgC,QAAQ,KAAK;AAAA,QACtF,SAAS;AAAA,UACR,EAAE,OAAO,2BAA2B,OAAO,SAAS;AAAA,UACpD;AAAA,YACC,OAAO;AAAA,YACP,OAAO;AAAA,UACR;AAAA,UACA;AAAA,YACC,OAAO;AAAA,YACP,OAAO;AAAA,UACR;AAAA,UACA,EAAE,OAAO,sCAAsC,OAAO,OAAO;AAAA,QAC9D;AAAA,MACD,CAAC;AAAA,IACD;AAEH,uBAAmB;AAEnB,YAAQ,WAAW;AAAA,MAClB,KAAK;AAAA,MACL,KAAK;AACJ,eAAO,CAAC;AAAA,MAET,KAAK;AACJ,cAAM,OAAO,QAAQ,KAAK,MAAM,oBAAoB;AAAA,UACnD,MAAM;AAAA,UACN,OAAO,QAAQ;AAAA,UACf,gBAAgB;AAAA,UAChB,eAAe;AAAA,QAChB,CAAC;AACD,eAAO,EAAE,QAAgB,WAAW;AAAA,MAErC,KAAK;AACJ,cAAM,gBAAgB;AAAA,UACrB,MAAM,QAAQ,KAAK;AAAA,YAClB,SAAS;AAAA,UACV,CAAC;AAAA,QACF;AAEA,YAAI,CAAC,eAAe;AACnB,iBAAO,CAAC;AAAA,QACT;AAEA,qBAAa;AACb;AAAA,MAED,KAAK;AACJ,iBAAS;AACT;AAAA,IACF;AAAA,EACD;AAEA,SAAO,EAAE,QAAgB,WAAW;AACrC;","names":[]}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
declare function getPrefillOrPromptedOption(
|
|
1
|
+
declare function getPrefillOrPromptedOption(message: string, getPlaceholder?: () => Promise<string | undefined>): Promise<string | undefined>;
|
|
2
2
|
|
|
3
3
|
export { getPrefillOrPromptedOption };
|
|
@@ -1,9 +1,6 @@
|
|
|
1
1
|
import * as prompts from "@clack/prompts";
|
|
2
2
|
import { filterPromptCancel } from "../prompts.js";
|
|
3
|
-
async function getPrefillOrPromptedOption(
|
|
4
|
-
if (existingValue) {
|
|
5
|
-
return existingValue;
|
|
6
|
-
}
|
|
3
|
+
async function getPrefillOrPromptedOption(message, getPlaceholder) {
|
|
7
4
|
return filterPromptCancel(
|
|
8
5
|
await prompts.text({
|
|
9
6
|
message,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/shared/options/getPrefillOrPromptedOption.ts"],"sourcesContent":["import * as prompts from \"@clack/prompts\";\n\nimport { filterPromptCancel } from \"../prompts.js\";\n\nexport async function getPrefillOrPromptedOption(\n\
|
|
1
|
+
{"version":3,"sources":["../../../src/shared/options/getPrefillOrPromptedOption.ts"],"sourcesContent":["import * as prompts from \"@clack/prompts\";\n\nimport { filterPromptCancel } from \"../prompts.js\";\n\nexport async function getPrefillOrPromptedOption(\n\tmessage: string,\n\tgetPlaceholder?: () => Promise<string | undefined>,\n) {\n\treturn filterPromptCancel(\n\t\tawait prompts.text({\n\t\t\tmessage,\n\t\t\tplaceholder: await getPlaceholder?.(),\n\t\t\tvalidate: (val) => {\n\t\t\t\tif (val.length === 0) {\n\t\t\t\t\treturn \"Please enter a value.\";\n\t\t\t\t}\n\t\t\t},\n\t\t}),\n\t);\n}\n"],"mappings":"AAAA,YAAY,aAAa;AAEzB,SAAS,0BAA0B;AAEnC,eAAsB,2BACrB,SACA,gBACC;AACD,SAAO;AAAA,IACN,MAAM,QAAQ,KAAK;AAAA,MAClB;AAAA,MACA,aAAa,MAAM,iBAAiB;AAAA,MACpC,UAAU,CAAC,QAAQ;AAClB,YAAI,IAAI,WAAW,GAAG;AACrB,iBAAO;AAAA,QACR;AAAA,MACD;AAAA,IACD,CAAC;AAAA,EACF;AACD;","names":[]}
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
|
|
3
3
|
declare const optionsSchemaShape: {
|
|
4
|
+
access: z.ZodOptional<z.ZodUnion<[z.ZodLiteral<"public">, z.ZodLiteral<"restricted">]>>;
|
|
4
5
|
author: z.ZodOptional<z.ZodString>;
|
|
5
6
|
base: z.ZodOptional<z.ZodUnion<[z.ZodLiteral<"common">, z.ZodLiteral<"everything">, z.ZodLiteral<"minimum">, z.ZodLiteral<"prompt">]>>;
|
|
6
|
-
createRepository: z.ZodOptional<z.ZodBoolean>;
|
|
7
7
|
description: z.ZodOptional<z.ZodString>;
|
|
8
|
+
directory: z.ZodOptional<z.ZodString>;
|
|
8
9
|
email: z.ZodOptional<z.ZodObject<{
|
|
9
10
|
github: z.ZodString;
|
|
10
11
|
npm: z.ZodString;
|
|
@@ -15,8 +16,8 @@ declare const optionsSchemaShape: {
|
|
|
15
16
|
github: string;
|
|
16
17
|
npm: string;
|
|
17
18
|
}>>;
|
|
19
|
+
excludeAllContributors: z.ZodOptional<z.ZodBoolean>;
|
|
18
20
|
excludeCompliance: z.ZodOptional<z.ZodBoolean>;
|
|
19
|
-
excludeContributors: z.ZodOptional<z.ZodBoolean>;
|
|
20
21
|
excludeLintDeprecation: z.ZodOptional<z.ZodBoolean>;
|
|
21
22
|
excludeLintESLint: z.ZodOptional<z.ZodBoolean>;
|
|
22
23
|
excludeLintJSDoc: z.ZodOptional<z.ZodBoolean>;
|
|
@@ -35,10 +36,14 @@ declare const optionsSchemaShape: {
|
|
|
35
36
|
excludeRenovate: z.ZodOptional<z.ZodBoolean>;
|
|
36
37
|
excludeTests: z.ZodOptional<z.ZodBoolean>;
|
|
37
38
|
funding: z.ZodOptional<z.ZodString>;
|
|
39
|
+
keywords: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
38
40
|
logo: z.ZodOptional<z.ZodString>;
|
|
39
41
|
logoAlt: z.ZodOptional<z.ZodString>;
|
|
42
|
+
mode: z.ZodOptional<z.ZodUnion<[z.ZodLiteral<"create">, z.ZodLiteral<"initialize">, z.ZodLiteral<"migrate">]>>;
|
|
43
|
+
offline: z.ZodOptional<z.ZodBoolean>;
|
|
40
44
|
owner: z.ZodOptional<z.ZodString>;
|
|
41
45
|
repository: z.ZodOptional<z.ZodString>;
|
|
46
|
+
skipAllContributorsApi: z.ZodOptional<z.ZodBoolean>;
|
|
42
47
|
skipGitHubApi: z.ZodOptional<z.ZodBoolean>;
|
|
43
48
|
skipInstall: z.ZodOptional<z.ZodBoolean>;
|
|
44
49
|
skipRemoval: z.ZodOptional<z.ZodBoolean>;
|
|
@@ -47,10 +52,11 @@ declare const optionsSchemaShape: {
|
|
|
47
52
|
title: z.ZodOptional<z.ZodString>;
|
|
48
53
|
};
|
|
49
54
|
declare const optionsSchema: z.ZodObject<{
|
|
55
|
+
access: z.ZodOptional<z.ZodUnion<[z.ZodLiteral<"public">, z.ZodLiteral<"restricted">]>>;
|
|
50
56
|
author: z.ZodOptional<z.ZodString>;
|
|
51
57
|
base: z.ZodOptional<z.ZodUnion<[z.ZodLiteral<"common">, z.ZodLiteral<"everything">, z.ZodLiteral<"minimum">, z.ZodLiteral<"prompt">]>>;
|
|
52
|
-
createRepository: z.ZodOptional<z.ZodBoolean>;
|
|
53
58
|
description: z.ZodOptional<z.ZodString>;
|
|
59
|
+
directory: z.ZodOptional<z.ZodString>;
|
|
54
60
|
email: z.ZodOptional<z.ZodObject<{
|
|
55
61
|
github: z.ZodString;
|
|
56
62
|
npm: z.ZodString;
|
|
@@ -61,8 +67,8 @@ declare const optionsSchema: z.ZodObject<{
|
|
|
61
67
|
github: string;
|
|
62
68
|
npm: string;
|
|
63
69
|
}>>;
|
|
70
|
+
excludeAllContributors: z.ZodOptional<z.ZodBoolean>;
|
|
64
71
|
excludeCompliance: z.ZodOptional<z.ZodBoolean>;
|
|
65
|
-
excludeContributors: z.ZodOptional<z.ZodBoolean>;
|
|
66
72
|
excludeLintDeprecation: z.ZodOptional<z.ZodBoolean>;
|
|
67
73
|
excludeLintESLint: z.ZodOptional<z.ZodBoolean>;
|
|
68
74
|
excludeLintJSDoc: z.ZodOptional<z.ZodBoolean>;
|
|
@@ -81,10 +87,14 @@ declare const optionsSchema: z.ZodObject<{
|
|
|
81
87
|
excludeRenovate: z.ZodOptional<z.ZodBoolean>;
|
|
82
88
|
excludeTests: z.ZodOptional<z.ZodBoolean>;
|
|
83
89
|
funding: z.ZodOptional<z.ZodString>;
|
|
90
|
+
keywords: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
84
91
|
logo: z.ZodOptional<z.ZodString>;
|
|
85
92
|
logoAlt: z.ZodOptional<z.ZodString>;
|
|
93
|
+
mode: z.ZodOptional<z.ZodUnion<[z.ZodLiteral<"create">, z.ZodLiteral<"initialize">, z.ZodLiteral<"migrate">]>>;
|
|
94
|
+
offline: z.ZodOptional<z.ZodBoolean>;
|
|
86
95
|
owner: z.ZodOptional<z.ZodString>;
|
|
87
96
|
repository: z.ZodOptional<z.ZodString>;
|
|
97
|
+
skipAllContributorsApi: z.ZodOptional<z.ZodBoolean>;
|
|
88
98
|
skipGitHubApi: z.ZodOptional<z.ZodBoolean>;
|
|
89
99
|
skipInstall: z.ZodOptional<z.ZodBoolean>;
|
|
90
100
|
skipRemoval: z.ZodOptional<z.ZodBoolean>;
|
|
@@ -92,16 +102,17 @@ declare const optionsSchema: z.ZodObject<{
|
|
|
92
102
|
skipUninstall: z.ZodOptional<z.ZodBoolean>;
|
|
93
103
|
title: z.ZodOptional<z.ZodString>;
|
|
94
104
|
}, "strip", z.ZodTypeAny, {
|
|
105
|
+
access?: "public" | "restricted" | undefined;
|
|
95
106
|
author?: string | undefined;
|
|
96
107
|
base?: "common" | "everything" | "minimum" | "prompt" | undefined;
|
|
97
|
-
createRepository?: boolean | undefined;
|
|
98
108
|
description?: string | undefined;
|
|
109
|
+
directory?: string | undefined;
|
|
99
110
|
email?: {
|
|
100
111
|
github: string;
|
|
101
112
|
npm: string;
|
|
102
113
|
} | undefined;
|
|
114
|
+
excludeAllContributors?: boolean | undefined;
|
|
103
115
|
excludeCompliance?: boolean | undefined;
|
|
104
|
-
excludeContributors?: boolean | undefined;
|
|
105
116
|
excludeLintDeprecation?: boolean | undefined;
|
|
106
117
|
excludeLintESLint?: boolean | undefined;
|
|
107
118
|
excludeLintJSDoc?: boolean | undefined;
|
|
@@ -120,10 +131,14 @@ declare const optionsSchema: z.ZodObject<{
|
|
|
120
131
|
excludeRenovate?: boolean | undefined;
|
|
121
132
|
excludeTests?: boolean | undefined;
|
|
122
133
|
funding?: string | undefined;
|
|
134
|
+
keywords?: string[] | undefined;
|
|
123
135
|
logo?: string | undefined;
|
|
124
136
|
logoAlt?: string | undefined;
|
|
137
|
+
mode?: "create" | "initialize" | "migrate" | undefined;
|
|
138
|
+
offline?: boolean | undefined;
|
|
125
139
|
owner?: string | undefined;
|
|
126
140
|
repository?: string | undefined;
|
|
141
|
+
skipAllContributorsApi?: boolean | undefined;
|
|
127
142
|
skipGitHubApi?: boolean | undefined;
|
|
128
143
|
skipInstall?: boolean | undefined;
|
|
129
144
|
skipRemoval?: boolean | undefined;
|
|
@@ -131,16 +146,17 @@ declare const optionsSchema: z.ZodObject<{
|
|
|
131
146
|
skipUninstall?: boolean | undefined;
|
|
132
147
|
title?: string | undefined;
|
|
133
148
|
}, {
|
|
149
|
+
access?: "public" | "restricted" | undefined;
|
|
134
150
|
author?: string | undefined;
|
|
135
151
|
base?: "common" | "everything" | "minimum" | "prompt" | undefined;
|
|
136
|
-
createRepository?: boolean | undefined;
|
|
137
152
|
description?: string | undefined;
|
|
153
|
+
directory?: string | undefined;
|
|
138
154
|
email?: {
|
|
139
155
|
github: string;
|
|
140
156
|
npm: string;
|
|
141
157
|
} | undefined;
|
|
158
|
+
excludeAllContributors?: boolean | undefined;
|
|
142
159
|
excludeCompliance?: boolean | undefined;
|
|
143
|
-
excludeContributors?: boolean | undefined;
|
|
144
160
|
excludeLintDeprecation?: boolean | undefined;
|
|
145
161
|
excludeLintESLint?: boolean | undefined;
|
|
146
162
|
excludeLintJSDoc?: boolean | undefined;
|
|
@@ -159,10 +175,14 @@ declare const optionsSchema: z.ZodObject<{
|
|
|
159
175
|
excludeRenovate?: boolean | undefined;
|
|
160
176
|
excludeTests?: boolean | undefined;
|
|
161
177
|
funding?: string | undefined;
|
|
178
|
+
keywords?: string[] | undefined;
|
|
162
179
|
logo?: string | undefined;
|
|
163
180
|
logoAlt?: string | undefined;
|
|
181
|
+
mode?: "create" | "initialize" | "migrate" | undefined;
|
|
182
|
+
offline?: boolean | undefined;
|
|
164
183
|
owner?: string | undefined;
|
|
165
184
|
repository?: string | undefined;
|
|
185
|
+
skipAllContributorsApi?: boolean | undefined;
|
|
166
186
|
skipGitHubApi?: boolean | undefined;
|
|
167
187
|
skipInstall?: boolean | undefined;
|
|
168
188
|
skipRemoval?: boolean | undefined;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
const optionsSchemaShape = {
|
|
3
|
+
access: z.union([z.literal("public"), z.literal("restricted")]).optional(),
|
|
3
4
|
author: z.string().optional(),
|
|
4
5
|
base: z.union([
|
|
5
6
|
z.literal("common"),
|
|
@@ -7,14 +8,14 @@ const optionsSchemaShape = {
|
|
|
7
8
|
z.literal("minimum"),
|
|
8
9
|
z.literal("prompt")
|
|
9
10
|
]).optional(),
|
|
10
|
-
createRepository: z.boolean().optional(),
|
|
11
11
|
description: z.string().optional(),
|
|
12
|
+
directory: z.string().optional(),
|
|
12
13
|
email: z.object({
|
|
13
14
|
github: z.string().email(),
|
|
14
15
|
npm: z.string().email()
|
|
15
16
|
}).optional(),
|
|
17
|
+
excludeAllContributors: z.boolean().optional(),
|
|
16
18
|
excludeCompliance: z.boolean().optional(),
|
|
17
|
-
excludeContributors: z.boolean().optional(),
|
|
18
19
|
excludeLintDeprecation: z.boolean().optional(),
|
|
19
20
|
excludeLintESLint: z.boolean().optional(),
|
|
20
21
|
excludeLintJSDoc: z.boolean().optional(),
|
|
@@ -33,10 +34,14 @@ const optionsSchemaShape = {
|
|
|
33
34
|
excludeRenovate: z.boolean().optional(),
|
|
34
35
|
excludeTests: z.boolean().optional(),
|
|
35
36
|
funding: z.string().optional(),
|
|
37
|
+
keywords: z.array(z.string()).optional(),
|
|
36
38
|
logo: z.string().optional(),
|
|
37
39
|
logoAlt: z.string().optional(),
|
|
40
|
+
mode: z.union([z.literal("create"), z.literal("initialize"), z.literal("migrate")]).optional(),
|
|
41
|
+
offline: z.boolean().optional(),
|
|
38
42
|
owner: z.string().optional(),
|
|
39
43
|
repository: z.string().optional(),
|
|
44
|
+
skipAllContributorsApi: z.boolean().optional(),
|
|
40
45
|
skipGitHubApi: z.boolean().optional(),
|
|
41
46
|
skipInstall: z.boolean().optional(),
|
|
42
47
|
skipRemoval: z.boolean().optional(),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/shared/options/optionsSchema.ts"],"sourcesContent":["import { z } from \"zod\";\n\nexport const optionsSchemaShape = {\n\tauthor: z.string().optional(),\n\tbase: z\n\t\t.union([\n\t\t\tz.literal(\"common\"),\n\t\t\tz.literal(\"everything\"),\n\t\t\tz.literal(\"minimum\"),\n\t\t\tz.literal(\"prompt\"),\n\t\t])\n\t\t.optional(),\n\
|
|
1
|
+
{"version":3,"sources":["../../../src/shared/options/optionsSchema.ts"],"sourcesContent":["import { z } from \"zod\";\n\nexport const optionsSchemaShape = {\n\taccess: z.union([z.literal(\"public\"), z.literal(\"restricted\")]).optional(),\n\tauthor: z.string().optional(),\n\tbase: z\n\t\t.union([\n\t\t\tz.literal(\"common\"),\n\t\t\tz.literal(\"everything\"),\n\t\t\tz.literal(\"minimum\"),\n\t\t\tz.literal(\"prompt\"),\n\t\t])\n\t\t.optional(),\n\tdescription: z.string().optional(),\n\tdirectory: z.string().optional(),\n\temail: z\n\t\t.object({\n\t\t\tgithub: z.string().email(),\n\t\t\tnpm: z.string().email(),\n\t\t})\n\t\t.optional(),\n\texcludeAllContributors: z.boolean().optional(),\n\texcludeCompliance: z.boolean().optional(),\n\texcludeLintDeprecation: z.boolean().optional(),\n\texcludeLintESLint: z.boolean().optional(),\n\texcludeLintJSDoc: z.boolean().optional(),\n\texcludeLintJson: z.boolean().optional(),\n\texcludeLintKnip: z.boolean().optional(),\n\texcludeLintMd: z.boolean().optional(),\n\texcludeLintPackageJson: z.boolean().optional(),\n\texcludeLintPackages: z.boolean().optional(),\n\texcludeLintPerfectionist: z.boolean().optional(),\n\texcludeLintRegex: z.boolean().optional(),\n\texcludeLintSpelling: z.boolean().optional(),\n\texcludeLintStrict: z.boolean().optional(),\n\texcludeLintStylistic: z.boolean().optional(),\n\texcludeLintYml: z.boolean().optional(),\n\texcludeReleases: z.boolean().optional(),\n\texcludeRenovate: z.boolean().optional(),\n\texcludeTests: z.boolean().optional(),\n\tfunding: z.string().optional(),\n\tkeywords: z.array(z.string()).optional(),\n\tlogo: z.string().optional(),\n\tlogoAlt: z.string().optional(),\n\tmode: z\n\t\t.union([z.literal(\"create\"), z.literal(\"initialize\"), z.literal(\"migrate\")])\n\t\t.optional(),\n\toffline: z.boolean().optional(),\n\towner: z.string().optional(),\n\trepository: z.string().optional(),\n\tskipAllContributorsApi: z.boolean().optional(),\n\tskipGitHubApi: z.boolean().optional(),\n\tskipInstall: z.boolean().optional(),\n\tskipRemoval: z.boolean().optional(),\n\tskipRestore: z.boolean().optional(),\n\tskipUninstall: z.boolean().optional(),\n\ttitle: z.string().optional(),\n};\n\nexport const optionsSchema = z.object(optionsSchemaShape);\n"],"mappings":"AAAA,SAAS,SAAS;AAEX,MAAM,qBAAqB;AAAA,EACjC,QAAQ,EAAE,MAAM,CAAC,EAAE,QAAQ,QAAQ,GAAG,EAAE,QAAQ,YAAY,CAAC,CAAC,EAAE,SAAS;AAAA,EACzE,QAAQ,EAAE,OAAO,EAAE,SAAS;AAAA,EAC5B,MAAM,EACJ,MAAM;AAAA,IACN,EAAE,QAAQ,QAAQ;AAAA,IAClB,EAAE,QAAQ,YAAY;AAAA,IACtB,EAAE,QAAQ,SAAS;AAAA,IACnB,EAAE,QAAQ,QAAQ;AAAA,EACnB,CAAC,EACA,SAAS;AAAA,EACX,aAAa,EAAE,OAAO,EAAE,SAAS;AAAA,EACjC,WAAW,EAAE,OAAO,EAAE,SAAS;AAAA,EAC/B,OAAO,EACL,OAAO;AAAA,IACP,QAAQ,EAAE,OAAO,EAAE,MAAM;AAAA,IACzB,KAAK,EAAE,OAAO,EAAE,MAAM;AAAA,EACvB,CAAC,EACA,SAAS;AAAA,EACX,wBAAwB,EAAE,QAAQ,EAAE,SAAS;AAAA,EAC7C,mBAAmB,EAAE,QAAQ,EAAE,SAAS;AAAA,EACxC,wBAAwB,EAAE,QAAQ,EAAE,SAAS;AAAA,EAC7C,mBAAmB,EAAE,QAAQ,EAAE,SAAS;AAAA,EACxC,kBAAkB,EAAE,QAAQ,EAAE,SAAS;AAAA,EACvC,iBAAiB,EAAE,QAAQ,EAAE,SAAS;AAAA,EACtC,iBAAiB,EAAE,QAAQ,EAAE,SAAS;AAAA,EACtC,eAAe,EAAE,QAAQ,EAAE,SAAS;AAAA,EACpC,wBAAwB,EAAE,QAAQ,EAAE,SAAS;AAAA,EAC7C,qBAAqB,EAAE,QAAQ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;","names":[]}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
-
import { Options } from '../types.js';
|
|
2
|
+
import { Options, Mode, PromptedOptions } from '../types.js';
|
|
3
3
|
import { GitHub } from './getGitHub.js';
|
|
4
|
+
import '../codes.js';
|
|
4
5
|
import 'octokit';
|
|
5
6
|
|
|
6
7
|
interface GitHubAndOptions {
|
|
@@ -16,6 +17,6 @@ interface OptionsParseSuccess extends GitHubAndOptions {
|
|
|
16
17
|
cancelled: false;
|
|
17
18
|
}
|
|
18
19
|
type OptionsParseResult = OptionsParseCancelled | OptionsParseSuccess;
|
|
19
|
-
declare function readOptions(args: string[]): Promise<OptionsParseResult>;
|
|
20
|
+
declare function readOptions(args: string[], mode: Mode, promptedOptions?: PromptedOptions): Promise<OptionsParseResult>;
|
|
20
21
|
|
|
21
22
|
export { GitHubAndOptions, OptionsParseCancelled, OptionsParseResult, OptionsParseSuccess, readOptions };
|
|
@@ -3,14 +3,14 @@ import { titleCase } from "title-case";
|
|
|
3
3
|
import { withSpinner } from "../cli/spinners.js";
|
|
4
4
|
import { allArgOptions } from "./args.js";
|
|
5
5
|
import { augmentOptionsWithExcludes } from "./augmentOptionsWithExcludes.js";
|
|
6
|
+
import { createOptionDefaults } from "./createOptionDefaults/index.js";
|
|
6
7
|
import { detectEmailRedundancy } from "./detectEmailRedundancy.js";
|
|
7
8
|
import { ensureRepositoryExists } from "./ensureRepositoryExists.js";
|
|
8
9
|
import { getGitHub } from "./getGitHub.js";
|
|
9
10
|
import { getPrefillOrPromptedOption } from "./getPrefillOrPromptedOption.js";
|
|
10
11
|
import { optionsSchema } from "./optionsSchema.js";
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
const defaults = readOptionDefaults();
|
|
12
|
+
async function readOptions(args, mode, promptedOptions = {}) {
|
|
13
|
+
const defaults = createOptionDefaults(promptedOptions);
|
|
14
14
|
const { values } = parseArgs({
|
|
15
15
|
args,
|
|
16
16
|
options: allArgOptions,
|
|
@@ -18,16 +18,17 @@ async function readOptions(args) {
|
|
|
18
18
|
tokens: true
|
|
19
19
|
});
|
|
20
20
|
const mappedOptions = {
|
|
21
|
+
access: values.access,
|
|
21
22
|
author: values.author,
|
|
22
23
|
base: values.base,
|
|
23
|
-
createRepository: values["create-repository"],
|
|
24
24
|
description: values.description,
|
|
25
|
+
directory: values.directory,
|
|
25
26
|
email: values.email ?? values["email-github"] ?? values["email-npm"] ? {
|
|
26
27
|
github: values.email ?? values["email-github"],
|
|
27
28
|
npm: values.email ?? values["email-npm"]
|
|
28
29
|
} : void 0,
|
|
30
|
+
excludeAllContributors: values["exclude-all-contributors"],
|
|
29
31
|
excludeCompliance: values["exclude-compliance"],
|
|
30
|
-
excludeContributors: values["exclude-contributors"],
|
|
31
32
|
excludeLintDeprecation: values["exclude-lint-deprecation"],
|
|
32
33
|
excludeLintESLint: values["exclude-lint-eslint"],
|
|
33
34
|
excludeLintJSDoc: values["exclude-lint-jsdoc"],
|
|
@@ -45,9 +46,11 @@ async function readOptions(args) {
|
|
|
45
46
|
excludeRenovate: values["exclude-renovate"],
|
|
46
47
|
excludeTests: values["unit-tests"],
|
|
47
48
|
funding: values.funding,
|
|
49
|
+
offline: values.offline,
|
|
48
50
|
owner: values.owner,
|
|
49
51
|
repository: values.repository,
|
|
50
|
-
|
|
52
|
+
skipAllContributorsApi: values["skip-all-contributors-api"] ?? values.offline,
|
|
53
|
+
skipGitHubApi: values["skip-github-api"] ?? values.offline,
|
|
51
54
|
skipInstall: values["skip-install"],
|
|
52
55
|
skipRemoval: values["skip-removal"],
|
|
53
56
|
skipRestore: values["skip-restore"],
|
|
@@ -72,7 +75,6 @@ async function readOptions(args) {
|
|
|
72
75
|
}
|
|
73
76
|
const options = optionsParseResult.data;
|
|
74
77
|
options.owner ??= await getPrefillOrPromptedOption(
|
|
75
|
-
options.owner,
|
|
76
78
|
"What organization or user will the repository be under?",
|
|
77
79
|
defaults.owner
|
|
78
80
|
);
|
|
@@ -83,7 +85,6 @@ async function readOptions(args) {
|
|
|
83
85
|
};
|
|
84
86
|
}
|
|
85
87
|
options.repository ??= await getPrefillOrPromptedOption(
|
|
86
|
-
options.repository,
|
|
87
88
|
"What will the kebab-case name of the repository be?",
|
|
88
89
|
defaults.repository
|
|
89
90
|
);
|
|
@@ -94,9 +95,9 @@ async function readOptions(args) {
|
|
|
94
95
|
};
|
|
95
96
|
}
|
|
96
97
|
const { github, repository } = await ensureRepositoryExists(
|
|
97
|
-
|
|
98
|
+
options.skipGitHubApi ? void 0 : await withSpinner("Checking GitHub authentication", getGitHub),
|
|
98
99
|
{
|
|
99
|
-
|
|
100
|
+
mode,
|
|
100
101
|
owner: options.owner,
|
|
101
102
|
repository: options.repository
|
|
102
103
|
}
|
|
@@ -105,7 +106,6 @@ async function readOptions(args) {
|
|
|
105
106
|
return { cancelled: true, options };
|
|
106
107
|
}
|
|
107
108
|
options.description ??= await getPrefillOrPromptedOption(
|
|
108
|
-
options.description,
|
|
109
109
|
"How would you describe the new package?",
|
|
110
110
|
async () => await defaults.description() ?? "A very lovely package. Hooray!"
|
|
111
111
|
);
|
|
@@ -113,7 +113,6 @@ async function readOptions(args) {
|
|
|
113
113
|
return { cancelled: true, options };
|
|
114
114
|
}
|
|
115
115
|
options.title ??= await getPrefillOrPromptedOption(
|
|
116
|
-
options.title,
|
|
117
116
|
"What will the Title Case title of the repository be?",
|
|
118
117
|
async () => await defaults.title() ?? titleCase(repository).replaceAll("-", " ")
|
|
119
118
|
);
|
|
@@ -122,8 +121,7 @@ async function readOptions(args) {
|
|
|
122
121
|
}
|
|
123
122
|
let logo;
|
|
124
123
|
if (options.logo) {
|
|
125
|
-
const alt = await getPrefillOrPromptedOption(
|
|
126
|
-
options.logoAlt,
|
|
124
|
+
const alt = options.logoAlt ?? await getPrefillOrPromptedOption(
|
|
127
125
|
"What is the alt text (non-visual description) of the logo?"
|
|
128
126
|
);
|
|
129
127
|
if (!alt) {
|
|
@@ -132,7 +130,6 @@ async function readOptions(args) {
|
|
|
132
130
|
logo = { alt, src: options.logo };
|
|
133
131
|
}
|
|
134
132
|
const email = options.email ?? await defaults.email() ?? await getPrefillOrPromptedOption(
|
|
135
|
-
void 0,
|
|
136
133
|
"What email should be used in package.json and .md files?"
|
|
137
134
|
);
|
|
138
135
|
if (!email) {
|
|
@@ -140,11 +137,14 @@ async function readOptions(args) {
|
|
|
140
137
|
}
|
|
141
138
|
const augmentedOptions = await augmentOptionsWithExcludes({
|
|
142
139
|
...options,
|
|
140
|
+
access: options.access ?? "public",
|
|
143
141
|
author: options.author ?? await defaults.owner(),
|
|
144
142
|
description: options.description,
|
|
143
|
+
directory: options.directory ?? promptedOptions.directory ?? options.repository,
|
|
145
144
|
email: typeof email === "string" ? { github: email, npm: email } : email,
|
|
146
145
|
funding: options.funding ?? await defaults.funding(),
|
|
147
146
|
logo,
|
|
147
|
+
mode,
|
|
148
148
|
owner: options.owner,
|
|
149
149
|
repository,
|
|
150
150
|
title: options.title
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/shared/options/readOptions.ts"],"sourcesContent":["import { parseArgs } from \"node:util\";\nimport { titleCase } from \"title-case\";\nimport { z } from \"zod\";\n\nimport { withSpinner } from \"../cli/spinners.js\";\nimport { Options, OptionsLogo } from \"../types.js\";\nimport { allArgOptions } from \"./args.js\";\nimport { augmentOptionsWithExcludes } from \"./augmentOptionsWithExcludes.js\";\nimport { detectEmailRedundancy } from \"./detectEmailRedundancy.js\";\nimport { ensureRepositoryExists } from \"./ensureRepositoryExists.js\";\nimport { GitHub, getGitHub } from \"./getGitHub.js\";\nimport { getPrefillOrPromptedOption } from \"./getPrefillOrPromptedOption.js\";\nimport { optionsSchema } from \"./optionsSchema.js\";\nimport { readOptionDefaults } from \"./readOptionDefaults/index.js\";\n\nexport interface GitHubAndOptions {\n\tgithub: GitHub | undefined;\n\toptions: Options;\n}\n\nexport interface OptionsParseCancelled {\n\tcancelled: true;\n\terror?: string | z.ZodError<object>;\n\toptions: object;\n}\n\nexport interface OptionsParseSuccess extends GitHubAndOptions {\n\tcancelled: false;\n}\n\nexport type OptionsParseResult = OptionsParseCancelled | OptionsParseSuccess;\n\nexport async function readOptions(args: string[]): Promise<OptionsParseResult> {\n\tconst defaults = readOptionDefaults();\n\tconst { values } = parseArgs({\n\t\targs,\n\t\toptions: allArgOptions,\n\t\tstrict: false,\n\t\ttokens: true,\n\t});\n\n\tconst mappedOptions = {\n\t\tauthor: values.author,\n\t\tbase: values.base,\n\t\tcreateRepository: values[\"create-repository\"],\n\t\tdescription: values.description,\n\t\temail:\n\t\t\tvalues.email ?? values[\"email-github\"] ?? values[\"email-npm\"]\n\t\t\t\t? {\n\t\t\t\t\t\tgithub: values.email ?? values[\"email-github\"],\n\t\t\t\t\t\tnpm: values.email ?? values[\"email-npm\"],\n\t\t\t\t }\n\t\t\t\t: undefined,\n\t\texcludeCompliance: values[\"exclude-compliance\"],\n\t\texcludeContributors: values[\"exclude-contributors\"],\n\t\texcludeLintDeprecation: values[\"exclude-lint-deprecation\"],\n\t\texcludeLintESLint: values[\"exclude-lint-eslint\"],\n\t\texcludeLintJSDoc: values[\"exclude-lint-jsdoc\"],\n\t\texcludeLintJson: values[\"exclude-lint-json\"],\n\t\texcludeLintKnip: values[\"exclude-lint-knip\"],\n\t\texcludeLintMd: values[\"exclude-lint-md\"],\n\t\texcludeLintPackageJson: values[\"exclude-lint-package-json\"],\n\t\texcludeLintPackages: values[\"exclude-lint-packages\"],\n\t\texcludeLintPerfectionist: values[\"exclude-lint-perfectionist\"],\n\t\texcludeLintRegex: values[\"exclude-lint-regex\"],\n\t\texcludeLintSpelling: values[\"exclude-lint-spelling\"],\n\t\texcludeLintStrict: values[\"exclude-lint-strict\"],\n\t\texcludeLintYml: values[\"exclude-lint-yml\"],\n\t\texcludeReleases: values[\"exclude-releases\"],\n\t\texcludeRenovate: values[\"exclude-renovate\"],\n\t\texcludeTests: values[\"unit-tests\"],\n\t\tfunding: values.funding,\n\t\towner: values.owner,\n\t\trepository: values.repository,\n\t\tskipGitHubApi: values[\"skip-github-api\"],\n\t\tskipInstall: values[\"skip-install\"],\n\t\tskipRemoval: values[\"skip-removal\"],\n\t\tskipRestore: values[\"skip-restore\"],\n\t\tskipUninstall: values[\"skip-uninstall\"],\n\t\ttitle: values.title,\n\t};\n\n\tconst emailError = detectEmailRedundancy(values);\n\tif (emailError) {\n\t\treturn {\n\t\t\tcancelled: true,\n\t\t\terror: emailError,\n\t\t\toptions: mappedOptions,\n\t\t};\n\t}\n\n\tconst optionsParseResult = optionsSchema.safeParse(mappedOptions);\n\n\tif (!optionsParseResult.success) {\n\t\treturn {\n\t\t\tcancelled: true,\n\t\t\terror: optionsParseResult.error,\n\t\t\toptions: mappedOptions,\n\t\t};\n\t}\n\n\tconst options = optionsParseResult.data;\n\n\toptions.owner ??= await getPrefillOrPromptedOption(\n\t\toptions.owner,\n\t\t\"What organization or user will the repository be under?\",\n\t\tdefaults.owner,\n\t);\n\tif (!options.owner) {\n\t\treturn {\n\t\t\tcancelled: true,\n\t\t\toptions,\n\t\t};\n\t}\n\n\toptions.repository ??= await getPrefillOrPromptedOption(\n\t\toptions.repository,\n\t\t\"What will the kebab-case name of the repository be?\",\n\t\tdefaults.repository,\n\t);\n\tif (!options.repository) {\n\t\treturn {\n\t\t\tcancelled: true,\n\t\t\toptions,\n\t\t};\n\t}\n\n\tconst { github, repository } = await ensureRepositoryExists(\n\t\tvalues[\"skip-github-api\"]\n\t\t\t? undefined\n\t\t\t: await withSpinner(\"Checking GitHub authentication\", getGitHub),\n\t\t{\n\t\t\tcreateRepository: options.createRepository,\n\t\t\towner: options.owner,\n\t\t\trepository: options.repository,\n\t\t},\n\t);\n\tif (!repository) {\n\t\treturn { cancelled: true, options };\n\t}\n\n\toptions.description ??= await getPrefillOrPromptedOption(\n\t\toptions.description,\n\t\t\"How would you describe the new package?\",\n\t\tasync () =>\n\t\t\t(await defaults.description()) ?? \"A very lovely package. Hooray!\",\n\t);\n\tif (!options.description) {\n\t\treturn { cancelled: true, options };\n\t}\n\n\toptions.title ??= await getPrefillOrPromptedOption(\n\t\toptions.title,\n\t\t\"What will the Title Case title of the repository be?\",\n\t\tasync () =>\n\t\t\t(await defaults.title()) ?? titleCase(repository).replaceAll(\"-\", \" \"),\n\t);\n\tif (!options.title) {\n\t\treturn { cancelled: true, options };\n\t}\n\n\tlet logo: OptionsLogo | undefined;\n\n\tif (options.logo) {\n\t\tconst alt = await getPrefillOrPromptedOption(\n\t\t\toptions.logoAlt,\n\t\t\t\"What is the alt text (non-visual description) of the logo?\",\n\t\t);\n\t\tif (!alt) {\n\t\t\treturn { cancelled: true, options };\n\t\t}\n\n\t\tlogo = { alt, src: options.logo };\n\t}\n\n\tconst email =\n\t\toptions.email ??\n\t\t(await defaults.email()) ??\n\t\t(await getPrefillOrPromptedOption(\n\t\t\tundefined,\n\t\t\t\"What email should be used in package.json and .md files?\",\n\t\t));\n\tif (!email) {\n\t\treturn { cancelled: true, options };\n\t}\n\n\tconst augmentedOptions = await augmentOptionsWithExcludes({\n\t\t...options,\n\t\tauthor: options.author ?? (await defaults.owner()),\n\t\tdescription: options.description,\n\t\temail: typeof email === \"string\" ? { github: email, npm: email } : email,\n\t\tfunding: options.funding ?? (await defaults.funding()),\n\t\tlogo,\n\t\towner: options.owner,\n\t\trepository,\n\t\ttitle: options.title,\n\t});\n\n\tif (!augmentedOptions) {\n\t\treturn {\n\t\t\tcancelled: true,\n\t\t\toptions,\n\t\t};\n\t}\n\n\treturn {\n\t\tcancelled: false,\n\t\tgithub,\n\t\toptions: augmentedOptions,\n\t};\n}\n"],"mappings":"AAAA,SAAS,iBAAiB;AAC1B,SAAS,iBAAiB;AAG1B,SAAS,mBAAmB;AAE5B,SAAS,qBAAqB;AAC9B,SAAS,kCAAkC;AAC3C,SAAS,6BAA6B;AACtC,SAAS,8BAA8B;AACvC,SAAiB,iBAAiB;AAClC,SAAS,kCAAkC;AAC3C,SAAS,qBAAqB;AAC9B,SAAS,0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ions.ts"],"sourcesContent":["import { parseArgs } from \"node:util\";\nimport { titleCase } from \"title-case\";\nimport { z } from \"zod\";\n\nimport { withSpinner } from \"../cli/spinners.js\";\nimport { Mode, PromptedOptions } from \"../types.js\";\nimport { Options, OptionsLogo } from \"../types.js\";\nimport { allArgOptions } from \"./args.js\";\nimport { augmentOptionsWithExcludes } from \"./augmentOptionsWithExcludes.js\";\nimport { createOptionDefaults } from \"./createOptionDefaults/index.js\";\nimport { detectEmailRedundancy } from \"./detectEmailRedundancy.js\";\nimport { ensureRepositoryExists } from \"./ensureRepositoryExists.js\";\nimport { GitHub, getGitHub } from \"./getGitHub.js\";\nimport { getPrefillOrPromptedOption } from \"./getPrefillOrPromptedOption.js\";\nimport { optionsSchema } from \"./optionsSchema.js\";\n\nexport interface GitHubAndOptions {\n\tgithub: GitHub | undefined;\n\toptions: Options;\n}\n\nexport interface OptionsParseCancelled {\n\tcancelled: true;\n\terror?: string | z.ZodError<object>;\n\toptions: object;\n}\n\nexport interface OptionsParseSuccess extends GitHubAndOptions {\n\tcancelled: false;\n}\n\nexport type OptionsParseResult = OptionsParseCancelled | OptionsParseSuccess;\n\nexport async function readOptions(\n\targs: string[],\n\tmode: Mode,\n\tpromptedOptions: PromptedOptions = {},\n): Promise<OptionsParseResult> {\n\tconst defaults = createOptionDefaults(promptedOptions);\n\tconst { values } = parseArgs({\n\t\targs,\n\t\toptions: allArgOptions,\n\t\tstrict: false,\n\t\ttokens: true,\n\t});\n\n\tconst mappedOptions = {\n\t\taccess: values.access,\n\t\tauthor: values.author,\n\t\tbase: values.base,\n\t\tdescription: values.description,\n\t\tdirectory: values.directory,\n\t\temail:\n\t\t\tvalues.email ?? values[\"email-github\"] ?? values[\"email-npm\"]\n\t\t\t\t? {\n\t\t\t\t\t\tgithub: values.email ?? values[\"email-github\"],\n\t\t\t\t\t\tnpm: values.email ?? values[\"email-npm\"],\n\t\t\t\t }\n\t\t\t\t: undefined,\n\t\texcludeAllContributors: values[\"exclude-all-contributors\"],\n\t\texcludeCompliance: values[\"exclude-compliance\"],\n\t\texcludeLintDeprecation: values[\"exclude-lint-deprecation\"],\n\t\texcludeLintESLint: values[\"exclude-lint-eslint\"],\n\t\texcludeLintJSDoc: values[\"exclude-lint-jsdoc\"],\n\t\texcludeLintJson: values[\"exclude-lint-json\"],\n\t\texcludeLintKnip: values[\"exclude-lint-knip\"],\n\t\texcludeLintMd: values[\"exclude-lint-md\"],\n\t\texcludeLintPackageJson: values[\"exclude-lint-package-json\"],\n\t\texcludeLintPackages: values[\"exclude-lint-packages\"],\n\t\texcludeLintPerfectionist: values[\"exclude-lint-perfectionist\"],\n\t\texcludeLintRegex: values[\"exclude-lint-regex\"],\n\t\texcludeLintSpelling: values[\"exclude-lint-spelling\"],\n\t\texcludeLintStrict: values[\"exclude-lint-strict\"],\n\t\texcludeLintYml: values[\"exclude-lint-yml\"],\n\t\texcludeReleases: values[\"exclude-releases\"],\n\t\texcludeRenovate: values[\"exclude-renovate\"],\n\t\texcludeTests: values[\"unit-tests\"],\n\t\tfunding: values.funding,\n\t\toffline: values.offline,\n\t\towner: values.owner,\n\t\trepository: values.repository,\n\t\tskipAllContributorsApi:\n\t\t\tvalues[\"skip-all-contributors-api\"] ?? values.offline,\n\t\tskipGitHubApi: values[\"skip-github-api\"] ?? values.offline,\n\t\tskipInstall: values[\"skip-install\"],\n\t\tskipRemoval: values[\"skip-removal\"],\n\t\tskipRestore: values[\"skip-restore\"],\n\t\tskipUninstall: values[\"skip-uninstall\"],\n\t\ttitle: values.title,\n\t};\n\n\tconst emailError = detectEmailRedundancy(values);\n\tif (emailError) {\n\t\treturn {\n\t\t\tcancelled: true,\n\t\t\terror: emailError,\n\t\t\toptions: mappedOptions,\n\t\t};\n\t}\n\n\tconst optionsParseResult = optionsSchema.safeParse(mappedOptions);\n\n\tif (!optionsParseResult.success) {\n\t\treturn {\n\t\t\tcancelled: true,\n\t\t\terror: optionsParseResult.error,\n\t\t\toptions: mappedOptions,\n\t\t};\n\t}\n\n\tconst options = optionsParseResult.data;\n\n\toptions.owner ??= await getPrefillOrPromptedOption(\n\t\t\"What organization or user will the repository be under?\",\n\t\tdefaults.owner,\n\t);\n\tif (!options.owner) {\n\t\treturn {\n\t\t\tcancelled: true,\n\t\t\toptions,\n\t\t};\n\t}\n\n\toptions.repository ??= await getPrefillOrPromptedOption(\n\t\t\"What will the kebab-case name of the repository be?\",\n\t\tdefaults.repository,\n\t);\n\tif (!options.repository) {\n\t\treturn {\n\t\t\tcancelled: true,\n\t\t\toptions,\n\t\t};\n\t}\n\n\tconst { github, repository } = await ensureRepositoryExists(\n\t\toptions.skipGitHubApi\n\t\t\t? undefined\n\t\t\t: await withSpinner(\"Checking GitHub authentication\", getGitHub),\n\t\t{\n\t\t\tmode,\n\t\t\towner: options.owner,\n\t\t\trepository: options.repository,\n\t\t},\n\t);\n\tif (!repository) {\n\t\treturn { cancelled: true, options };\n\t}\n\n\toptions.description ??= await getPrefillOrPromptedOption(\n\t\t\"How would you describe the new package?\",\n\t\tasync () =>\n\t\t\t(await defaults.description()) ?? \"A very lovely package. Hooray!\",\n\t);\n\tif (!options.description) {\n\t\treturn { cancelled: true, options };\n\t}\n\n\toptions.title ??= await getPrefillOrPromptedOption(\n\t\t\"What will the Title Case title of the repository be?\",\n\t\tasync () =>\n\t\t\t(await defaults.title()) ?? titleCase(repository).replaceAll(\"-\", \" \"),\n\t);\n\tif (!options.title) {\n\t\treturn { cancelled: true, options };\n\t}\n\n\tlet logo: OptionsLogo | undefined;\n\n\tif (options.logo) {\n\t\tconst alt =\n\t\t\toptions.logoAlt ??\n\t\t\t(await getPrefillOrPromptedOption(\n\t\t\t\t\"What is the alt text (non-visual description) of the logo?\",\n\t\t\t));\n\t\tif (!alt) {\n\t\t\treturn { cancelled: true, options };\n\t\t}\n\n\t\tlogo = { alt, src: options.logo };\n\t}\n\n\tconst email =\n\t\toptions.email ??\n\t\t(await defaults.email()) ??\n\t\t(await getPrefillOrPromptedOption(\n\t\t\t\"What email should be used in package.json and .md files?\",\n\t\t));\n\tif (!email) {\n\t\treturn { cancelled: true, options };\n\t}\n\n\tconst augmentedOptions = await augmentOptionsWithExcludes({\n\t\t...options,\n\t\taccess: options.access ?? \"public\",\n\t\tauthor: options.author ?? (await defaults.owner()),\n\t\tdescription: options.description,\n\t\tdirectory:\n\t\t\toptions.directory ?? promptedOptions.directory ?? options.repository,\n\t\temail: typeof email === \"string\" ? { github: email, npm: email } : email,\n\t\tfunding: options.funding ?? (await defaults.funding()),\n\t\tlogo,\n\t\tmode,\n\t\towner: options.owner,\n\t\trepository,\n\t\ttitle: options.title,\n\t});\n\n\tif (!augmentedOptions) {\n\t\treturn {\n\t\t\tcancelled: true,\n\t\t\toptions,\n\t\t};\n\t}\n\n\treturn {\n\t\tcancelled: false,\n\t\tgithub,\n\t\toptions: augmentedOptions,\n\t};\n}\n"],"mappings":"AAAA,SAAS,iBAAiB;AAC1B,SAAS,iBAAiB;AAG1B,SAAS,mBAAmB;AAG5B,SAAS,qBAAqB;AAC9B,SAAS,kCAAkC;AAC3C,SAAS,4BAA4B;AACrC,SAAS,6BAA6B;AACtC,SAAS,8BAA8B;AACvC,SAAiB,iBAAiB;AAClC,SAAS,kCAAkC;AAC3C,SAAS,qBAAqB;AAmB9B,eAAsB,YACrB,MACA,MACA,kBAAmC,CAAC,GACN;AAC9B,QAAM,WAAW,qBAAqB,eAAe;AACrD,QAAM,EAAE,OAAO,IAAI,UAAU;AAAA,IAC5B;AAAA,IACA,SAAS;AAAA,IACT,QAAQ;AAAA,IACR,QAAQ;AAAA,EACT,CAAC;AAED,QAAM,gBAAgB;AAAA,IACrB,QAAQ,OAAO;AAAA,IACf,QAAQ,OAAO;AAAA,IACf,MAAM,OAAO;AAAA,IACb,aAAa,OAAO;AAAA,IACpB,WAAW,OAAO;AAAA,IAClB,OACC,OAAO,SAAS,OAAO,cAAc,KAAK,OAAO,WAAW,IACzD;AAAA,MACA,QAAQ,OAAO,SAAS,OAAO,cAAc;AAAA,MAC7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;AAAA,IACnC;AAEA,WAAO,EAAE,KAAK,KAAK,QAAQ,KAAK;AAAA,EACjC;AAEA,QAAM,QACL,QAAQ,SACP,MAAM,SAAS,MAAM,KACrB,MAAM;AAAA,IACN;AAAA,EACD;AACD,MAAI,CAAC,OAAO;AACX,WAAO,EAAE,WAAW,MAAM,QAAQ;AAAA,EACnC;AAEA,QAAM,mBAAmB,MAAM,2BAA2B;AAAA,IACzD,GAAG;AAAA,IACH,QAAQ,QAAQ,UAAU;AAAA,IAC1B,QAAQ,QAAQ,UAAW,MAAM,SAAS,MAAM;AAAA,IAChD,aAAa,QAAQ;AAAA,IACrB,WACC,QAAQ,aAAa,gBAAgB,aAAa,QAAQ;AAAA,IAC3D,OAAO,OAAO,UAAU,WAAW,EAAE,QAAQ,OAAO,KAAK,MAAM,IAAI;AAAA,IACnE,SAAS,QAAQ,WAAY,MAAM,SAAS,QAAQ;AAAA,IACpD;AAAA,IACA;AAAA,IACA,OAAO,QAAQ;AAAA,IACf;AAAA,IACA,OAAO,QAAQ;AAAA,EAChB,CAAC;AAED,MAAI,CAAC,kBAAkB;AACtB,WAAO;AAAA,MACN,WAAW;AAAA,MACX;AAAA,IACD;AAAA,EACD;AAEA,SAAO;AAAA,IACN,WAAW;AAAA,IACX;AAAA,IACA,SAAS;AAAA,EACV;AACD;","names":[]}
|
package/lib/shared/packages.d.ts
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import { PartialPackageData } from './types.js';
|
|
2
|
+
import 'zod';
|
|
3
|
+
import './codes.js';
|
|
2
4
|
|
|
3
5
|
declare function readPackageData(): Promise<PartialPackageData>;
|
|
4
6
|
declare function removeDependencies(packageNames: string[], existing?: Record<string, string>, flags?: string): Promise<void>;
|
package/lib/shared/types.d.ts
CHANGED
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { StatusCode } from './codes.js';
|
|
3
|
+
|
|
1
4
|
interface AllContributorContributor {
|
|
2
5
|
contributions: string[];
|
|
3
6
|
login: string;
|
|
@@ -20,23 +23,28 @@ interface PartialPackageData {
|
|
|
20
23
|
url: string;
|
|
21
24
|
} | string;
|
|
22
25
|
}
|
|
23
|
-
type
|
|
24
|
-
|
|
25
|
-
alt: string;
|
|
26
|
-
src: string;
|
|
27
|
-
}
|
|
26
|
+
type OptionsAccess = "public" | "restricted";
|
|
27
|
+
type OptionsBase = "common" | "everything" | "minimum" | "prompt";
|
|
28
28
|
interface OptionsEmail {
|
|
29
29
|
github: string;
|
|
30
30
|
npm: string;
|
|
31
31
|
}
|
|
32
|
+
interface OptionsLogo {
|
|
33
|
+
alt: string;
|
|
34
|
+
src: string;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* All runtime options that may (or must) be specified for setup.
|
|
38
|
+
*/
|
|
32
39
|
interface Options {
|
|
40
|
+
access: OptionsAccess;
|
|
33
41
|
author?: string;
|
|
34
|
-
base?:
|
|
35
|
-
createRepository?: boolean;
|
|
42
|
+
base?: OptionsBase;
|
|
36
43
|
description: string;
|
|
44
|
+
directory: string;
|
|
37
45
|
email: OptionsEmail;
|
|
46
|
+
excludeAllContributors?: boolean;
|
|
38
47
|
excludeCompliance?: boolean;
|
|
39
|
-
excludeContributors?: boolean;
|
|
40
48
|
excludeLintDeprecation?: boolean;
|
|
41
49
|
excludeLintESLint?: boolean;
|
|
42
50
|
excludeLintJSDoc?: boolean;
|
|
@@ -55,9 +63,13 @@ interface Options {
|
|
|
55
63
|
excludeRenovate?: boolean;
|
|
56
64
|
excludeTests?: boolean;
|
|
57
65
|
funding?: string;
|
|
66
|
+
keywords?: string[];
|
|
58
67
|
logo: OptionsLogo | undefined;
|
|
68
|
+
mode: Mode;
|
|
69
|
+
offline?: boolean;
|
|
59
70
|
owner: string;
|
|
60
71
|
repository: string;
|
|
72
|
+
skipAllContributorsApi?: boolean;
|
|
61
73
|
skipGitHubApi?: boolean;
|
|
62
74
|
skipInstall?: boolean;
|
|
63
75
|
skipRemoval?: boolean;
|
|
@@ -65,5 +77,25 @@ interface Options {
|
|
|
65
77
|
skipUninstall?: boolean;
|
|
66
78
|
title: string;
|
|
67
79
|
}
|
|
80
|
+
/**
|
|
81
|
+
* Options that might be suggested by how the user is running setup.
|
|
82
|
+
*/
|
|
83
|
+
interface PromptedOptions {
|
|
84
|
+
/**
|
|
85
|
+
* Directory for the repository, if it may differ from the repository name.
|
|
86
|
+
*/
|
|
87
|
+
directory?: string;
|
|
88
|
+
/**
|
|
89
|
+
* Repository name, if it may differ from the current directory.
|
|
90
|
+
*/
|
|
91
|
+
repository?: string;
|
|
92
|
+
}
|
|
93
|
+
interface ModeResult {
|
|
94
|
+
code: StatusCode;
|
|
95
|
+
error?: string | z.ZodError<object>;
|
|
96
|
+
options: Partial<Options>;
|
|
97
|
+
}
|
|
98
|
+
type ModeRunner = (args: string[], promptedOptions?: PromptedOptions) => Promise<ModeResult>;
|
|
99
|
+
type Mode = "create" | "initialize" | "migrate";
|
|
68
100
|
|
|
69
|
-
export { AllContributorContributor, AllContributorsData,
|
|
101
|
+
export { AllContributorContributor, AllContributorsData, Mode, ModeResult, ModeRunner, Options, OptionsAccess, OptionsBase, OptionsEmail, OptionsLogo, PartialPackageData, PromptedOptions };
|
|
@@ -1,3 +1,7 @@
|
|
|
1
|
-
|
|
1
|
+
import { Options } from '../shared/types.js';
|
|
2
|
+
import 'zod';
|
|
3
|
+
import '../shared/codes.js';
|
|
4
|
+
|
|
5
|
+
declare function addOwnerAsAllContributor(options: Pick<Options, "offline" | "owner">): Promise<void>;
|
|
2
6
|
|
|
3
7
|
export { addOwnerAsAllContributor };
|