create-typescript-app 1.75.0 → 1.76.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/lib/bin/help.js +35 -35
- package/lib/bin/help.js.map +1 -1
- package/lib/bin/promptForMode.js +6 -6
- package/lib/bin/promptForMode.js.map +1 -1
- package/lib/shared/cli/spinners.d.ts +1 -1
- package/lib/shared/cli/spinners.js.map +1 -1
- package/lib/shared/options/args.d.ts +39 -13
- package/lib/shared/options/args.js +5 -0
- package/lib/shared/options/args.js.map +1 -1
- package/lib/shared/options/augmentOptionsWithExcludes.js +2 -2
- package/lib/shared/options/augmentOptionsWithExcludes.js.map +1 -1
- package/lib/shared/options/ensureRepositoryExists.js +1 -1
- package/lib/shared/options/ensureRepositoryExists.js.map +1 -1
- package/lib/shared/options/exclusionKeys.d.ts +1 -1
- package/lib/shared/options/exclusionKeys.js +6 -0
- package/lib/shared/options/exclusionKeys.js.map +1 -1
- package/lib/shared/options/optionsSchema.d.ts +6 -2
- package/lib/shared/options/optionsSchema.js +1 -0
- package/lib/shared/options/optionsSchema.js.map +1 -1
- package/lib/shared/options/readOptions.d.ts +1 -1
- package/lib/shared/options/readOptions.js +1 -0
- package/lib/shared/options/readOptions.js.map +1 -1
- package/lib/shared/types.d.ts +25 -24
- package/lib/steps/addOwnerAsAllContributor.js +2 -2
- package/lib/steps/addOwnerAsAllContributor.js.map +1 -1
- package/lib/steps/clearUnnecessaryFiles.js +3 -3
- package/lib/steps/clearUnnecessaryFiles.js.map +1 -1
- package/lib/steps/populateCSpellDictionary.js +7 -7
- package/lib/steps/populateCSpellDictionary.js.map +1 -1
- package/lib/steps/updateReadme.d.ts +1 -1
- package/lib/steps/updateReadme.js +1 -1
- package/lib/steps/updateReadme.js.map +1 -1
- package/lib/steps/writeReadme/index.js +19 -19
- package/lib/steps/writeReadme/index.js.map +1 -1
- package/lib/steps/writing/creation/createDotGitignore.js +3 -3
- package/lib/steps/writing/creation/createDotGitignore.js.map +1 -1
- package/lib/steps/writing/creation/createESLintConfig.js +21 -43
- package/lib/steps/writing/creation/createESLintConfig.js.map +1 -1
- package/lib/steps/writing/creation/dotGitHub/createDevelopment/index.js +27 -26
- package/lib/steps/writing/creation/dotGitHub/createDevelopment/index.js.map +1 -1
- package/lib/steps/writing/creation/dotGitHub/createMultiWorkflowFile.d.ts +8 -8
- package/lib/steps/writing/creation/dotGitHub/createMultiWorkflowFile.js.map +1 -1
- package/lib/steps/writing/creation/dotGitHub/createSoloWorkflowFile.d.ts +16 -16
- package/lib/steps/writing/creation/dotGitHub/createSoloWorkflowFile.js.map +1 -1
- package/lib/steps/writing/creation/rootFiles.js +6 -6
- package/lib/steps/writing/creation/rootFiles.js.map +1 -1
- package/package.json +48 -48
|
@@ -36,6 +36,7 @@ declare const optionsSchemaShape: {
|
|
|
36
36
|
excludeLintYml: z.ZodOptional<z.ZodBoolean>;
|
|
37
37
|
excludeReleases: z.ZodOptional<z.ZodBoolean>;
|
|
38
38
|
excludeRenovate: z.ZodOptional<z.ZodBoolean>;
|
|
39
|
+
excludeTemplatedBy: z.ZodOptional<z.ZodBoolean>;
|
|
39
40
|
excludeTests: z.ZodOptional<z.ZodBoolean>;
|
|
40
41
|
funding: z.ZodOptional<z.ZodString>;
|
|
41
42
|
guide: z.ZodOptional<z.ZodString>;
|
|
@@ -92,6 +93,7 @@ declare const optionsSchema: z.ZodObject<{
|
|
|
92
93
|
excludeLintYml: z.ZodOptional<z.ZodBoolean>;
|
|
93
94
|
excludeReleases: z.ZodOptional<z.ZodBoolean>;
|
|
94
95
|
excludeRenovate: z.ZodOptional<z.ZodBoolean>;
|
|
96
|
+
excludeTemplatedBy: z.ZodOptional<z.ZodBoolean>;
|
|
95
97
|
excludeTests: z.ZodOptional<z.ZodBoolean>;
|
|
96
98
|
funding: z.ZodOptional<z.ZodString>;
|
|
97
99
|
guide: z.ZodOptional<z.ZodString>;
|
|
@@ -112,13 +114,13 @@ declare const optionsSchema: z.ZodObject<{
|
|
|
112
114
|
skipUninstall: z.ZodOptional<z.ZodBoolean>;
|
|
113
115
|
title: z.ZodOptional<z.ZodString>;
|
|
114
116
|
}, "strip", z.ZodTypeAny, {
|
|
115
|
-
description?: string | undefined;
|
|
116
117
|
offline?: boolean | undefined;
|
|
117
118
|
access?: "public" | "restricted" | undefined;
|
|
118
119
|
author?: string | undefined;
|
|
119
120
|
auto?: boolean | undefined;
|
|
120
121
|
base?: "common" | "everything" | "minimal" | "prompt" | undefined;
|
|
121
122
|
bin?: string | undefined;
|
|
123
|
+
description?: string | undefined;
|
|
122
124
|
directory?: string | undefined;
|
|
123
125
|
email?: {
|
|
124
126
|
github: string;
|
|
@@ -150,6 +152,7 @@ declare const optionsSchema: z.ZodObject<{
|
|
|
150
152
|
excludeLintYml?: boolean | undefined;
|
|
151
153
|
excludeReleases?: boolean | undefined;
|
|
152
154
|
excludeRenovate?: boolean | undefined;
|
|
155
|
+
excludeTemplatedBy?: boolean | undefined;
|
|
153
156
|
excludeTests?: boolean | undefined;
|
|
154
157
|
preserveGeneratedFrom?: boolean | undefined;
|
|
155
158
|
skipAllContributorsApi?: boolean | undefined;
|
|
@@ -161,13 +164,13 @@ declare const optionsSchema: z.ZodObject<{
|
|
|
161
164
|
guideTitle?: string | undefined;
|
|
162
165
|
logoAlt?: string | undefined;
|
|
163
166
|
}, {
|
|
164
|
-
description?: string | undefined;
|
|
165
167
|
offline?: boolean | undefined;
|
|
166
168
|
access?: "public" | "restricted" | undefined;
|
|
167
169
|
author?: string | undefined;
|
|
168
170
|
auto?: boolean | undefined;
|
|
169
171
|
base?: "common" | "everything" | "minimal" | "prompt" | undefined;
|
|
170
172
|
bin?: string | undefined;
|
|
173
|
+
description?: string | undefined;
|
|
171
174
|
directory?: string | undefined;
|
|
172
175
|
email?: {
|
|
173
176
|
github: string;
|
|
@@ -199,6 +202,7 @@ declare const optionsSchema: z.ZodObject<{
|
|
|
199
202
|
excludeLintYml?: boolean | undefined;
|
|
200
203
|
excludeReleases?: boolean | undefined;
|
|
201
204
|
excludeRenovate?: boolean | undefined;
|
|
205
|
+
excludeTemplatedBy?: boolean | undefined;
|
|
202
206
|
excludeTests?: boolean | undefined;
|
|
203
207
|
preserveGeneratedFrom?: boolean | undefined;
|
|
204
208
|
skipAllContributorsApi?: boolean | undefined;
|
|
@@ -34,6 +34,7 @@ const optionsSchemaShape = {
|
|
|
34
34
|
excludeLintYml: z.boolean().optional(),
|
|
35
35
|
excludeReleases: z.boolean().optional(),
|
|
36
36
|
excludeRenovate: z.boolean().optional(),
|
|
37
|
+
excludeTemplatedBy: z.boolean().optional(),
|
|
37
38
|
excludeTests: z.boolean().optional(),
|
|
38
39
|
funding: z.string().optional(),
|
|
39
40
|
guide: z.string().url().optional(),
|
|
@@ -1 +1 @@
|
|
|
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\tauto: z.boolean().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(\"minimal\"),\n\t\t\tz.literal(\"prompt\"),\n\t\t])\n\t\t.optional(),\n\tbin: z.string().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\texcludeBuild: z.boolean().optional(),\n\texcludeCompliance: 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\tguide: z.string().url().optional(),\n\tguideTitle: 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\tpreserveGeneratedFrom: z.boolean().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,EAAE,QAAQ,EAAE,SAAS;AAAA,EAC3B,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,KAAK,EAAE,OAAO,EAAE,SAAS;AAAA,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A,EAChC,UAAU,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,SAAS;AAAA,EACvC,MAAM,EAAE,OAAO,EAAE,SAAS;AAAA,EAC1B,SAAS,EAAE,OAAO,EAAE,SAAS;AAAA,EAC7B,MAAM,EACJ,MAAM,CAAC,EAAE,QAAQ,QAAQ,GAAG,EAAE,QAAQ,YAAY,GAAG,EAAE,QAAQ,SAAS,CAAC,CAAC,EAC1E,SAAS;AAAA,EACX,SAAS,EAAE,QAAQ,EAAE,SAAS;AAAA,EAC9B,OAAO,EAAE,OAAO,EAAE,SAAS;AAAA,EAC3B,uBAAuB,EAAE,QAAQ,EAAE,SAAS;AAAA,EAC5C,YAAY,EAAE,OAAO,EAAE,SAAS;AAAA,EAChC,wBAAwB,EAAE,QAAQ,EAAE,SAAS;AAAA,EAC7C,eAAe,EAAE,QAAQ,EAAE,SAAS;AAAA,EACpC,aAAa,EAAE,QAAQ,EAAE,SAAS;AAAA,EAClC,aAAa,EAAE,QAAQ,EAAE,SAAS;AAAA,EAClC,aAAa,EAAE,QAAQ,EAAE,SAAS;AAAA,EAClC,eAAe,EAAE,QAAQ,EAAE,SAAS;AAAA,EACpC,OAAO,EAAE,OAAO,EAAE,SAAS;AAC5B;AAEO,MAAM,gBAAgB,EAAE,OAAO,kBAAkB;","names":[]}
|
|
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\tauto: z.boolean().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(\"minimal\"),\n\t\t\tz.literal(\"prompt\"),\n\t\t])\n\t\t.optional(),\n\tbin: z.string().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\texcludeBuild: z.boolean().optional(),\n\texcludeCompliance: 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\texcludeTemplatedBy: z.boolean().optional(),\n\texcludeTests: z.boolean().optional(),\n\tfunding: z.string().optional(),\n\tguide: z.string().url().optional(),\n\tguideTitle: 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\tpreserveGeneratedFrom: z.boolean().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,Q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13,10 @@ interface OptionsParseCancelled {
|
|
|
13
13
|
error?: string | z.ZodError<object>;
|
|
14
14
|
options: object;
|
|
15
15
|
}
|
|
16
|
+
type OptionsParseResult = OptionsParseCancelled | OptionsParseSuccess;
|
|
16
17
|
interface OptionsParseSuccess extends GitHubAndOptions {
|
|
17
18
|
cancelled: false;
|
|
18
19
|
}
|
|
19
|
-
type OptionsParseResult = OptionsParseCancelled | OptionsParseSuccess;
|
|
20
20
|
declare function readOptions(args: string[], mode: Mode, promptedOptions?: PromptedOptions): Promise<OptionsParseResult>;
|
|
21
21
|
|
|
22
22
|
export { type GitHubAndOptions, type OptionsParseCancelled, type OptionsParseResult, type OptionsParseSuccess, readOptions };
|
|
@@ -50,6 +50,7 @@ async function readOptions(args, mode, promptedOptions = {}) {
|
|
|
50
50
|
excludeLintYml: values["exclude-lint-yml"],
|
|
51
51
|
excludeReleases: values["exclude-releases"],
|
|
52
52
|
excludeRenovate: values["exclude-renovate"],
|
|
53
|
+
excludeTemplatedBy: values["exclude-templated-by"],
|
|
53
54
|
excludeTests: values["unit-tests"],
|
|
54
55
|
funding: values.funding,
|
|
55
56
|
guide: values.guide,
|
|
@@ -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 { Mode, OptionsGuide, 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 { getBase } from \"./getBase.js\";\nimport { getGitHub, GitHub } from \"./getGitHub.js\";\nimport { getPrefillOrPromptedOption } from \"./getPrefillOrPromptedOption.js\";\nimport { logInferredOptions } from \"./logInferredOptions.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\tif (mode === \"migrate\" && !values.base) {\n\t\tvalues.base = await getBase();\n\t}\n\n\tconst mappedOptions = {\n\t\taccess: values.access,\n\t\tauthor: values.author,\n\t\tauto: !!values.auto,\n\t\tbase: values.base,\n\t\tbin: values.bin,\n\t\tdescription: values.description,\n\t\tdirectory: values.directory,\n\t\temail:\n\t\t\t(values.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\t}\n\t\t\t\t: undefined,\n\t\texcludeAllContributors: values[\"exclude-all-contributors\"],\n\t\texcludeCompliance: values[\"exclude-compliance\"],\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\tguide: values.guide,\n\t\tguideTitle: values[\"guide-title\"],\n\t\tlogo: values.logo,\n\t\tlogoAlt: values[\"logo-alt\"],\n\t\toffline: values.offline,\n\t\towner: values.owner,\n\t\tpreserveGeneratedFrom:\n\t\t\tvalues[\"preserve-generated-from\"] ?? values.owner === \"JoshuaKGoldberg\",\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\tconst ownerOption = await getPrefillOrPromptedOption({\n\t\tauto: !!mappedOptions.auto,\n\t\tgetDefaultValue: defaults.owner,\n\t\tmessage: \"What organization or user will the repository be under?\",\n\t\tname: \"owner\",\n\t\tprovided: options.owner,\n\t});\n\n\toptions.owner ??= ownerOption.value;\n\n\tif (!options.owner) {\n\t\treturn {\n\t\t\tcancelled: true,\n\t\t\terror: ownerOption.error,\n\t\t\toptions,\n\t\t};\n\t}\n\n\tconst repositoryOption = await getPrefillOrPromptedOption({\n\t\tauto: !!mappedOptions.auto,\n\t\tgetDefaultValue: defaults.repository,\n\t\tmessage: \"What will the kebab-case name of the repository be?\",\n\t\tname: \"repository\",\n\t\tprovided: options.repository,\n\t});\n\n\toptions.repository ??= repositoryOption.value;\n\n\tif (!options.repository) {\n\t\treturn {\n\t\t\tcancelled: true,\n\t\t\terror: repositoryOption.error,\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\n\tif (!repository) {\n\t\treturn { cancelled: true, error: repositoryOption.error, options };\n\t}\n\n\tconst descriptionOption = await getPrefillOrPromptedOption({\n\t\tauto: !!mappedOptions.auto,\n\t\tgetDefaultValue: async () =>\n\t\t\t(await defaults.description()) ?? \"A very lovely package. Hooray!\",\n\t\tmessage: \"How would you describe the new package?\",\n\t\tname: \"description\",\n\t\tprovided: options.description,\n\t});\n\n\toptions.description ??= descriptionOption.value;\n\n\tif (!options.description) {\n\t\treturn { cancelled: true, error: descriptionOption.error, options };\n\t}\n\n\tconst titleOption = await getPrefillOrPromptedOption({\n\t\tauto: !!mappedOptions.auto,\n\t\tgetDefaultValue: async () =>\n\t\t\t(await defaults.title()) ?? titleCase(repository).replaceAll(\"-\", \" \"),\n\t\tmessage: \"What will the Title Case title of the repository be?\",\n\t\tname: \"title\",\n\t\tprovided: options.title,\n\t});\n\n\toptions.title ??= titleOption.value;\n\n\tif (!options.title) {\n\t\treturn { cancelled: true, error: titleOption.error, options };\n\t}\n\n\tlet guide: OptionsGuide | undefined;\n\n\tif (options.guide) {\n\t\tif (options.guideTitle) {\n\t\t\tguide = { href: options.guide, title: options.guideTitle };\n\t\t} else {\n\t\t\tconst titleOption = await getPrefillOrPromptedOption({\n\t\t\t\tauto: !!mappedOptions.auto,\n\t\t\t\tmessage: \"What is the title text for the guide?\",\n\t\t\t\tname: \"getPrefillOrPromptedOption\",\n\t\t\t});\n\n\t\t\tif (!titleOption.value) {\n\t\t\t\treturn { cancelled: true, error: titleOption.error, options };\n\t\t\t}\n\n\t\t\tguide = { href: options.guide, title: titleOption.value };\n\t\t}\n\t}\n\n\tlet logo: OptionsLogo | undefined;\n\n\tif (options.logo) {\n\t\tif (options.logoAlt) {\n\t\t\tlogo = { alt: options.logoAlt, src: options.logo };\n\t\t} else {\n\t\t\tconst logoAltOption = await getPrefillOrPromptedOption({\n\t\t\t\tauto: !!mappedOptions.auto,\n\t\t\t\tmessage: \"What is the alt text (non-visual description) of the logo?\",\n\t\t\t\tname: \"getPrefillOrPromptedOption\",\n\t\t\t});\n\n\t\t\tif (!logoAltOption.value) {\n\t\t\t\treturn { cancelled: true, error: logoAltOption.error, options };\n\t\t\t}\n\n\t\t\tlogo = { alt: logoAltOption.value, src: options.logo };\n\t\t}\n\t}\n\n\tlet email = options.email ?? (await defaults.email());\n\n\tif (!email) {\n\t\tconst emailOption = await getPrefillOrPromptedOption({\n\t\t\tauto: !!mappedOptions.auto,\n\t\t\tmessage: \"What email should be used in package.json and .md files?\",\n\t\t\tname: \"email\",\n\t\t});\n\n\t\tif (!emailOption.value) {\n\t\t\treturn { cancelled: true, error: emailOption.error, options };\n\t\t}\n\n\t\temail = { github: emailOption.value, npm: emailOption.value };\n\t}\n\n\tconst augmentedOptions = await augmentOptionsWithExcludes({\n\t\t...options,\n\t\taccess: options.access ?? \"public\",\n\t\tauthor:\n\t\t\toptions.author ?? (await defaults.author()) ?? (await defaults.owner()),\n\t\tbin: options.bin ?? (await defaults.bin()),\n\t\tdescription: options.description,\n\t\tdirectory:\n\t\t\toptions.directory ?? promptedOptions.directory ?? options.repository,\n\t\temail,\n\t\tfunding: options.funding ?? (await defaults.funding()),\n\t\tguide: guide ?? (await defaults.guide()),\n\t\tlogo: logo ?? (await defaults.logo()),\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\tif (options.auto) {\n\t\tlogInferredOptions(augmentedOptions);\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,SAAS,eAAe;AACxB,SAAS,iBAAyB;AAClC,SAAS,kCAAkC;AAC3C,SAAS,0BAA0B;AACnC,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,MAAI,SAAS,aAAa,CAAC,OAAO,MAAM;AACvC,WAAO,OAAO,MAAM,QAAQ;AAAA,EAC7B;AAEA,QAAM,gBAAgB;AAAA,IACrB,QAAQ,OAAO;AAAA,IACf,QAAQ,OAAO;AAAA,IACf,MAAM,CAAC,CAAC,OAAO;AAAA,IACf,MAAM,OAAO;AAAA,IACb,KAAK,OAAO;AAAA,IACZ,aAAa,OAAO;AAAA,IACpB,WAAW,OAAO;AAAA,IAClB,OACE,OAAO,SAAS,OAAO,cAAc,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ED,MAAI,CAAC,kBAAkB;AACtB,WAAO;AAAA,MACN,WAAW;AAAA,MACX;AAAA,IACD;AAAA,EACD;AAEA,MAAI,QAAQ,MAAM;AACjB,uBAAmB,gBAAgB;AAAA,EACpC;AAEA,SAAO;AAAA,IACN,WAAW;AAAA,IACX;AAAA,IACA,SAAS;AAAA,EACV;AACD;","names":["titleOption"]}
|
|
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 { Mode, OptionsGuide, 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 { getBase } from \"./getBase.js\";\nimport { getGitHub, GitHub } from \"./getGitHub.js\";\nimport { getPrefillOrPromptedOption } from \"./getPrefillOrPromptedOption.js\";\nimport { logInferredOptions } from \"./logInferredOptions.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 type OptionsParseResult = OptionsParseCancelled | OptionsParseSuccess;\n\nexport interface OptionsParseSuccess extends GitHubAndOptions {\n\tcancelled: false;\n}\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\tif (mode === \"migrate\" && !values.base) {\n\t\tvalues.base = await getBase();\n\t}\n\n\tconst mappedOptions = {\n\t\taccess: values.access,\n\t\tauthor: values.author,\n\t\tauto: !!values.auto,\n\t\tbase: values.base,\n\t\tbin: values.bin,\n\t\tdescription: values.description,\n\t\tdirectory: values.directory,\n\t\temail:\n\t\t\t(values.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\t}\n\t\t\t\t: undefined,\n\t\texcludeAllContributors: values[\"exclude-all-contributors\"],\n\t\texcludeCompliance: values[\"exclude-compliance\"],\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\texcludeTemplatedBy: values[\"exclude-templated-by\"],\n\t\texcludeTests: values[\"unit-tests\"],\n\t\tfunding: values.funding,\n\t\tguide: values.guide,\n\t\tguideTitle: values[\"guide-title\"],\n\t\tlogo: values.logo,\n\t\tlogoAlt: values[\"logo-alt\"],\n\t\toffline: values.offline,\n\t\towner: values.owner,\n\t\tpreserveGeneratedFrom:\n\t\t\tvalues[\"preserve-generated-from\"] ?? values.owner === \"JoshuaKGoldberg\",\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\tconst ownerOption = await getPrefillOrPromptedOption({\n\t\tauto: !!mappedOptions.auto,\n\t\tgetDefaultValue: defaults.owner,\n\t\tmessage: \"What organization or user will the repository be under?\",\n\t\tname: \"owner\",\n\t\tprovided: options.owner,\n\t});\n\n\toptions.owner ??= ownerOption.value;\n\n\tif (!options.owner) {\n\t\treturn {\n\t\t\tcancelled: true,\n\t\t\terror: ownerOption.error,\n\t\t\toptions,\n\t\t};\n\t}\n\n\tconst repositoryOption = await getPrefillOrPromptedOption({\n\t\tauto: !!mappedOptions.auto,\n\t\tgetDefaultValue: defaults.repository,\n\t\tmessage: \"What will the kebab-case name of the repository be?\",\n\t\tname: \"repository\",\n\t\tprovided: options.repository,\n\t});\n\n\toptions.repository ??= repositoryOption.value;\n\n\tif (!options.repository) {\n\t\treturn {\n\t\t\tcancelled: true,\n\t\t\terror: repositoryOption.error,\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\n\tif (!repository) {\n\t\treturn { cancelled: true, error: repositoryOption.error, options };\n\t}\n\n\tconst descriptionOption = await getPrefillOrPromptedOption({\n\t\tauto: !!mappedOptions.auto,\n\t\tgetDefaultValue: async () =>\n\t\t\t(await defaults.description()) ?? \"A very lovely package. Hooray!\",\n\t\tmessage: \"How would you describe the new package?\",\n\t\tname: \"description\",\n\t\tprovided: options.description,\n\t});\n\n\toptions.description ??= descriptionOption.value;\n\n\tif (!options.description) {\n\t\treturn { cancelled: true, error: descriptionOption.error, options };\n\t}\n\n\tconst titleOption = await getPrefillOrPromptedOption({\n\t\tauto: !!mappedOptions.auto,\n\t\tgetDefaultValue: async () =>\n\t\t\t(await defaults.title()) ?? titleCase(repository).replaceAll(\"-\", \" \"),\n\t\tmessage: \"What will the Title Case title of the repository be?\",\n\t\tname: \"title\",\n\t\tprovided: options.title,\n\t});\n\n\toptions.title ??= titleOption.value;\n\n\tif (!options.title) {\n\t\treturn { cancelled: true, error: titleOption.error, options };\n\t}\n\n\tlet guide: OptionsGuide | undefined;\n\n\tif (options.guide) {\n\t\tif (options.guideTitle) {\n\t\t\tguide = { href: options.guide, title: options.guideTitle };\n\t\t} else {\n\t\t\tconst titleOption = await getPrefillOrPromptedOption({\n\t\t\t\tauto: !!mappedOptions.auto,\n\t\t\t\tmessage: \"What is the title text for the guide?\",\n\t\t\t\tname: \"getPrefillOrPromptedOption\",\n\t\t\t});\n\n\t\t\tif (!titleOption.value) {\n\t\t\t\treturn { cancelled: true, error: titleOption.error, options };\n\t\t\t}\n\n\t\t\tguide = { href: options.guide, title: titleOption.value };\n\t\t}\n\t}\n\n\tlet logo: OptionsLogo | undefined;\n\n\tif (options.logo) {\n\t\tif (options.logoAlt) {\n\t\t\tlogo = { alt: options.logoAlt, src: options.logo };\n\t\t} else {\n\t\t\tconst logoAltOption = await getPrefillOrPromptedOption({\n\t\t\t\tauto: !!mappedOptions.auto,\n\t\t\t\tmessage: \"What is the alt text (non-visual description) of the logo?\",\n\t\t\t\tname: \"getPrefillOrPromptedOption\",\n\t\t\t});\n\n\t\t\tif (!logoAltOption.value) {\n\t\t\t\treturn { cancelled: true, error: logoAltOption.error, options };\n\t\t\t}\n\n\t\t\tlogo = { alt: logoAltOption.value, src: options.logo };\n\t\t}\n\t}\n\n\tlet email = options.email ?? (await defaults.email());\n\n\tif (!email) {\n\t\tconst emailOption = await getPrefillOrPromptedOption({\n\t\t\tauto: !!mappedOptions.auto,\n\t\t\tmessage: \"What email should be used in package.json and .md files?\",\n\t\t\tname: \"email\",\n\t\t});\n\n\t\tif (!emailOption.value) {\n\t\t\treturn { cancelled: true, error: emailOption.error, options };\n\t\t}\n\n\t\temail = { github: emailOption.value, npm: emailOption.value };\n\t}\n\n\tconst augmentedOptions = await augmentOptionsWithExcludes({\n\t\t...options,\n\t\taccess: options.access ?? \"public\",\n\t\tauthor:\n\t\t\toptions.author ?? (await defaults.author()) ?? (await defaults.owner()),\n\t\tbin: options.bin ?? (await defaults.bin()),\n\t\tdescription: options.description,\n\t\tdirectory:\n\t\t\toptions.directory ?? promptedOptions.directory ?? options.repository,\n\t\temail,\n\t\tfunding: options.funding ?? (await defaults.funding()),\n\t\tguide: guide ?? (await defaults.guide()),\n\t\tlogo: logo ?? (await defaults.logo()),\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\tif (options.auto) {\n\t\tlogInferredOptions(augmentedOptions);\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,i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cAAc,MAAM,2BAA2B;AAAA,MACpD,MAAM,CAAC,CAAC,cAAc;AAAA,MACtB,SAAS;AAAA,MACT,MAAM;AAAA,IACP,CAAC;AAED,QAAI,CAAC,YAAY,OAAO;AACvB,aAAO,EAAE,WAAW,MAAM,OAAO,YAAY,OAAO,QAAQ;AAAA,IAC7D;AAEA,YAAQ,EAAE,QAAQ,YAAY,OAAO,KAAK,YAAY,MAAM;AAAA,EAC7D;AAEA,QAAM,mBAAmB,MAAM,2BAA2B;AAAA,IACzD,GAAG;AAAA,IACH,QAAQ,QAAQ,UAAU;AAAA,IAC1B,QACC,QAAQ,UAAW,MAAM,SAAS,OAAO,KAAO,MAAM,SAAS,MAAM;AAAA,IACtE,KAAK,QAAQ,OAAQ,MAAM,SAAS,IAAI;AAAA,IACxC,aAAa,QAAQ;AAAA,IACrB,WACC,QAAQ,aAAa,gBAAgB,aAAa,QAAQ;AAAA,IAC3D;AAAA,IACA,SAAS,QAAQ,WAAY,MAAM,SAAS,QAAQ;AAAA,IACpD,OAAO,SAAU,MAAM,SAAS,MAAM;AAAA,IACtC,MAAM,QAAS,MAAM,SAAS,KAAK;AAAA,IACnC;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,MAAI,QAAQ,MAAM;AACjB,uBAAmB,gBAAgB;AAAA,EACpC;AAEA,SAAO;AAAA,IACN,WAAW;AAAA,IACX;AAAA,IACA,SAAS;AAAA,EACV;AACD;","names":["titleOption"]}
|
package/lib/shared/types.d.ts
CHANGED
|
@@ -8,23 +8,6 @@ interface AllContributorContributor {
|
|
|
8
8
|
interface AllContributorsData {
|
|
9
9
|
contributors: AllContributorContributor[];
|
|
10
10
|
}
|
|
11
|
-
interface PartialPackageData {
|
|
12
|
-
author?: {
|
|
13
|
-
email: string;
|
|
14
|
-
name: string;
|
|
15
|
-
} | string;
|
|
16
|
-
bin?: string;
|
|
17
|
-
dependencies?: Record<string, string>;
|
|
18
|
-
description?: string;
|
|
19
|
-
devDependencies?: Record<string, string>;
|
|
20
|
-
email?: string;
|
|
21
|
-
name?: string;
|
|
22
|
-
repository?: {
|
|
23
|
-
type: string;
|
|
24
|
-
url: string;
|
|
25
|
-
} | string;
|
|
26
|
-
scripts?: Record<string, string>;
|
|
27
|
-
}
|
|
28
11
|
type OptionsAccess = "public" | "restricted";
|
|
29
12
|
type OptionsBase = "common" | "everything" | "minimal" | "prompt";
|
|
30
13
|
interface OptionsEmail {
|
|
@@ -39,6 +22,23 @@ interface OptionsLogo {
|
|
|
39
22
|
alt: string;
|
|
40
23
|
src: string;
|
|
41
24
|
}
|
|
25
|
+
interface PartialPackageData {
|
|
26
|
+
author?: string | {
|
|
27
|
+
email: string;
|
|
28
|
+
name: string;
|
|
29
|
+
};
|
|
30
|
+
bin?: string;
|
|
31
|
+
dependencies?: Record<string, string>;
|
|
32
|
+
description?: string;
|
|
33
|
+
devDependencies?: Record<string, string>;
|
|
34
|
+
email?: string;
|
|
35
|
+
name?: string;
|
|
36
|
+
repository?: string | {
|
|
37
|
+
type: string;
|
|
38
|
+
url: string;
|
|
39
|
+
};
|
|
40
|
+
scripts?: Record<string, string>;
|
|
41
|
+
}
|
|
42
42
|
/**
|
|
43
43
|
* All runtime options that may (or must) be specified for setup.
|
|
44
44
|
*/
|
|
@@ -68,6 +68,7 @@ interface Options {
|
|
|
68
68
|
excludeLintYml?: boolean;
|
|
69
69
|
excludeReleases?: boolean;
|
|
70
70
|
excludeRenovate?: boolean;
|
|
71
|
+
excludeTemplatedBy?: boolean;
|
|
71
72
|
excludeTests?: boolean;
|
|
72
73
|
funding?: string;
|
|
73
74
|
guide?: OptionsGuide;
|
|
@@ -89,6 +90,13 @@ interface Options {
|
|
|
89
90
|
/**
|
|
90
91
|
* Options that might be suggested by how the user is running setup.
|
|
91
92
|
*/
|
|
93
|
+
type Mode = "create" | "initialize" | "migrate";
|
|
94
|
+
interface ModeResult {
|
|
95
|
+
code: StatusCode;
|
|
96
|
+
error?: string | z.ZodError<object>;
|
|
97
|
+
options: Partial<Options>;
|
|
98
|
+
}
|
|
99
|
+
type ModeRunner = (args: string[], promptedOptions?: PromptedOptions) => Promise<ModeResult>;
|
|
92
100
|
interface PromptedOptions {
|
|
93
101
|
/**
|
|
94
102
|
* Directory for the repository, if it may differ from the repository name.
|
|
@@ -99,12 +107,5 @@ interface PromptedOptions {
|
|
|
99
107
|
*/
|
|
100
108
|
repository?: string;
|
|
101
109
|
}
|
|
102
|
-
interface ModeResult {
|
|
103
|
-
code: StatusCode;
|
|
104
|
-
error?: string | z.ZodError<object>;
|
|
105
|
-
options: Partial<Options>;
|
|
106
|
-
}
|
|
107
|
-
type ModeRunner = (args: string[], promptedOptions?: PromptedOptions) => Promise<ModeResult>;
|
|
108
|
-
type Mode = "create" | "initialize" | "migrate";
|
|
109
110
|
|
|
110
111
|
export type { AllContributorContributor, AllContributorsData, Mode, ModeResult, ModeRunner, Options, OptionsAccess, OptionsBase, OptionsEmail, OptionsGuide, OptionsLogo, PartialPackageData, PromptedOptions };
|
|
@@ -16,8 +16,8 @@ async function addOwnerAsAllContributor(octokit, options) {
|
|
|
16
16
|
(contributor) => contributor.login === "JoshuaKGoldberg" ? { ...contributor, contributions: ["tool"] } : {
|
|
17
17
|
...contributor,
|
|
18
18
|
contributions: Array.from(
|
|
19
|
-
/* @__PURE__ */ new Set([...contributor.contributions
|
|
20
|
-
)
|
|
19
|
+
/* @__PURE__ */ new Set(["tool", ...contributor.contributions])
|
|
20
|
+
).sort()
|
|
21
21
|
}
|
|
22
22
|
);
|
|
23
23
|
if (!contributors.some((contributor) => contributor.login === user)) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/steps/addOwnerAsAllContributor.ts"],"sourcesContent":["import * as fs from \"node:fs/promises\";\nimport { Octokit } from \"octokit\";\n\nimport { getGitHubUserAsAllContributor } from \"../shared/getGitHubUserAsAllContributor.js\";\nimport { readFileAsJson } from \"../shared/readFileAsJson.js\";\nimport { AllContributorsData, Options } from \"../shared/types.js\";\nimport { formatJson } from \"./writing/creation/formatters/formatJson.js\";\n\nexport async function addOwnerAsAllContributor(\n\toctokit: Octokit | undefined,\n\toptions: Pick<Options, \"offline\" | \"owner\">,\n) {\n\tconst user = await getGitHubUserAsAllContributor(octokit, options);\n\n\tconst existingContributors = (await readFileAsJson(\n\t\t\"./.all-contributorsrc\",\n\t)) as AllContributorsData;\n\tif (!isValidAllContributorsData(existingContributors)) {\n\t\tthrow new Error(\n\t\t\t`Invalid .all-contributorsrc: ${JSON.stringify(existingContributors)}`,\n\t\t);\n\t}\n\n\tconst contributors = existingContributors.contributors\n\t\t.filter(({ login }) => [\"JoshuaKGoldberg\", user].includes(login))\n\t\t.map((contributor) =>\n\t\t\tcontributor.login === \"JoshuaKGoldberg\"\n\t\t\t\t? { ...contributor, contributions: [\"tool\"] }\n\t\t\t\t: {\n\t\t\t\t\t\t...contributor,\n\t\t\t\t\t\tcontributions: Array.from(\n\t\t\t\t\t\t\tnew Set([
|
|
1
|
+
{"version":3,"sources":["../../src/steps/addOwnerAsAllContributor.ts"],"sourcesContent":["import * as fs from \"node:fs/promises\";\nimport { Octokit } from \"octokit\";\n\nimport { getGitHubUserAsAllContributor } from \"../shared/getGitHubUserAsAllContributor.js\";\nimport { readFileAsJson } from \"../shared/readFileAsJson.js\";\nimport { AllContributorsData, Options } from \"../shared/types.js\";\nimport { formatJson } from \"./writing/creation/formatters/formatJson.js\";\n\nexport async function addOwnerAsAllContributor(\n\toctokit: Octokit | undefined,\n\toptions: Pick<Options, \"offline\" | \"owner\">,\n) {\n\tconst user = await getGitHubUserAsAllContributor(octokit, options);\n\n\tconst existingContributors = (await readFileAsJson(\n\t\t\"./.all-contributorsrc\",\n\t)) as AllContributorsData;\n\tif (!isValidAllContributorsData(existingContributors)) {\n\t\tthrow new Error(\n\t\t\t`Invalid .all-contributorsrc: ${JSON.stringify(existingContributors)}`,\n\t\t);\n\t}\n\n\tconst contributors = existingContributors.contributors\n\t\t.filter(({ login }) => [\"JoshuaKGoldberg\", user].includes(login))\n\t\t.map((contributor) =>\n\t\t\tcontributor.login === \"JoshuaKGoldberg\"\n\t\t\t\t? { ...contributor, contributions: [\"tool\"] }\n\t\t\t\t: {\n\t\t\t\t\t\t...contributor,\n\t\t\t\t\t\tcontributions: Array.from(\n\t\t\t\t\t\t\tnew Set([\"tool\", ...contributor.contributions]),\n\t\t\t\t\t\t).sort(),\n\t\t\t\t\t},\n\t\t);\n\n\tif (!contributors.some((contributor) => contributor.login === user)) {\n\t\tcontributors.push({\n\t\t\tcontributions: [\"tool\"],\n\t\t\tlogin: user,\n\t\t});\n\t}\n\n\tawait fs.writeFile(\n\t\t\"./.all-contributorsrc\",\n\t\tawait formatJson({\n\t\t\t...existingContributors,\n\t\t\tcontributors,\n\t\t}),\n\t);\n}\n\nfunction isValidAllContributorsData(\n\tvalue: unknown,\n): value is AllContributorsData {\n\treturn !!value && typeof value === \"object\" && \"contributors\" in value;\n}\n"],"mappings":"AAAA,YAAY,QAAQ;AAGpB,SAAS,qCAAqC;AAC9C,SAAS,sBAAsB;AAE/B,SAAS,kBAAkB;AAE3B,eAAsB,yBACrB,SACA,SACC;AACD,QAAM,OAAO,MAAM,8BAA8B,SAAS,OAAO;AAEjE,QAAM,uBAAwB,MAAM;AAAA,IACnC;AAAA,EACD;AACA,MAAI,CAAC,2BAA2B,oBAAoB,GAAG;AACtD,UAAM,IAAI;AAAA,MACT,gCAAgC,KAAK,UAAU,oBAAoB,CAAC;AAAA,IACrE;AAAA,EACD;AAEA,QAAM,eAAe,qBAAqB,aACxC,OAAO,CAAC,EAAE,MAAM,MAAM,CAAC,mBAAmB,IAAI,EAAE,SAAS,KAAK,CAAC,EAC/D;AAAA,IAAI,CAAC,gBACL,YAAY,UAAU,oBACnB,EAAE,GAAG,aAAa,eAAe,CAAC,MAAM,EAAE,IAC1C;AAAA,MACA,GAAG;AAAA,MACH,eAAe,MAAM;AAAA,QACpB,oBAAI,IAAI,CAAC,QAAQ,GAAG,YAAY,aAAa,CAAC;AAAA,MAC/C,EAAE,KAAK;AAAA,IACR;AAAA,EACH;AAED,MAAI,CAAC,aAAa,KAAK,CAAC,gBAAgB,YAAY,UAAU,IAAI,GAAG;AACpE,iBAAa,KAAK;AAAA,MACjB,eAAe,CAAC,MAAM;AAAA,MACtB,OAAO;AAAA,IACR,CAAC;AAAA,EACF;AAEA,QAAM,GAAG;AAAA,IACR;AAAA,IACA,MAAM,WAAW;AAAA,MAChB,GAAG;AAAA,MACH;AAAA,IACD,CAAC;AAAA,EACF;AACD;AAEA,SAAS,2BACR,OAC+B;AAC/B,SAAO,CAAC,CAAC,SAAS,OAAO,UAAU,YAAY,kBAAkB;AAClE;","names":[]}
|
|
@@ -25,14 +25,14 @@ const globPaths = [
|
|
|
25
25
|
"travis.yml",
|
|
26
26
|
"yarn.lock"
|
|
27
27
|
];
|
|
28
|
-
function extensions(base, ...extensions2) {
|
|
29
|
-
return extensions2.map((extension) => [base, extension].join("."));
|
|
30
|
-
}
|
|
31
28
|
async function clearUnnecessaryFiles() {
|
|
32
29
|
for (const globPath of globPaths) {
|
|
33
30
|
await fs.rm(globPath, { force: true, recursive: true });
|
|
34
31
|
}
|
|
35
32
|
}
|
|
33
|
+
function extensions(base, ...extensions2) {
|
|
34
|
+
return extensions2.map((extension) => [base, extension].join("."));
|
|
35
|
+
}
|
|
36
36
|
export {
|
|
37
37
|
clearUnnecessaryFiles
|
|
38
38
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/steps/clearUnnecessaryFiles.ts"],"sourcesContent":["import * as fs from \"node:fs/promises\";\n\nconst globPaths = [\n\t...extensions(\".babelrc\", \"cjs\", \"cts\", \"js\", \"json\", \"mjs\"),\n\t...extensions(\".eslintrc\", \"js\", \"json\", \"yml\"),\n\t...extensions(\".mocha\", \"cjs\", \"js\", \"json\", \"jsonc\", \"yaml\", \"yml\"),\n\t...extensions(\".prettierrc\", \"json\", \"json5\", \"yaml\", \"yml\"),\n\t...extensions(\"prettier.config\", \"js\", \"mjs\", \"cjs\"),\n\t...extensions(\"babel.config\", \"cjs\", \"cts\", \"js\", \"json\", \"mjs\"),\n\t...extensions(\"jest.config\", \"cjs\", \"js\", \"json\", \"mjs\", \"ts\"),\n\t\"./src/**/*.js\",\n\t\".circleci/config.yml\",\n\t\".github/codecov.yml\",\n\t\".babelrc\",\n\t\".npmignore\",\n\t\".eslintignore\",\n\t\".eslintrc\",\n\t\"CODE_OF_CONDUCT.md\",\n\t\"CONTRIBUTING.md\",\n\t\".npmpackagejsonlintrc.json\",\n\t\"codecov.yml\",\n\t\"DEVELOPMENT.md\",\n\t\"dist\",\n\t\"lib\",\n\t\"package-lock.json\",\n\t\"travis.yml\",\n\t\"yarn.lock\",\n];\n\
|
|
1
|
+
{"version":3,"sources":["../../src/steps/clearUnnecessaryFiles.ts"],"sourcesContent":["import * as fs from \"node:fs/promises\";\n\nconst globPaths = [\n\t...extensions(\".babelrc\", \"cjs\", \"cts\", \"js\", \"json\", \"mjs\"),\n\t...extensions(\".eslintrc\", \"js\", \"json\", \"yml\"),\n\t...extensions(\".mocha\", \"cjs\", \"js\", \"json\", \"jsonc\", \"yaml\", \"yml\"),\n\t...extensions(\".prettierrc\", \"json\", \"json5\", \"yaml\", \"yml\"),\n\t...extensions(\"prettier.config\", \"js\", \"mjs\", \"cjs\"),\n\t...extensions(\"babel.config\", \"cjs\", \"cts\", \"js\", \"json\", \"mjs\"),\n\t...extensions(\"jest.config\", \"cjs\", \"js\", \"json\", \"mjs\", \"ts\"),\n\t\"./src/**/*.js\",\n\t\".circleci/config.yml\",\n\t\".github/codecov.yml\",\n\t\".babelrc\",\n\t\".npmignore\",\n\t\".eslintignore\",\n\t\".eslintrc\",\n\t\"CODE_OF_CONDUCT.md\",\n\t\"CONTRIBUTING.md\",\n\t\".npmpackagejsonlintrc.json\",\n\t\"codecov.yml\",\n\t\"DEVELOPMENT.md\",\n\t\"dist\",\n\t\"lib\",\n\t\"package-lock.json\",\n\t\"travis.yml\",\n\t\"yarn.lock\",\n];\n\nexport async function clearUnnecessaryFiles() {\n\tfor (const globPath of globPaths) {\n\t\tawait fs.rm(globPath, { force: true, recursive: true });\n\t}\n}\n\nfunction extensions(base: string, ...extensions: string[]) {\n\treturn extensions.map((extension) => [base, extension].join(\".\"));\n}\n"],"mappings":"AAAA,YAAY,QAAQ;AAEpB,MAAM,YAAY;AAAA,EACjB,GAAG,WAAW,YAAY,OAAO,OAAO,MAAM,QAAQ,KAAK;AAAA,EAC3D,GAAG,WAAW,aAAa,MAAM,QAAQ,KAAK;AAAA,EAC9C,GAAG,WAAW,UAAU,OAAO,MAAM,QAAQ,SAAS,QAAQ,KAAK;AAAA,EACnE,GAAG,WAAW,eAAe,QAAQ,SAAS,QAAQ,KAAK;AAAA,EAC3D,GAAG,WAAW,mBAAmB,MAAM,OAAO,KAAK;AAAA,EACnD,GAAG,WAAW,gBAAgB,OAAO,OAAO,MAAM,QAAQ,KAAK;AAAA,EAC/D,GAAG,WAAW,eAAe,OAAO,MAAM,QAAQ,OAAO,IAAI;AAAA,EAC7D;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACD;AAEA,eAAsB,wBAAwB;AAC7C,aAAW,YAAY,WAAW;AACjC,UAAM,GAAG,GAAG,UAAU,EAAE,OAAO,MAAM,WAAW,KAAK,CAAC;AAAA,EACvD;AACD;AAEA,SAAS,WAAW,SAAiBA,aAAsB;AAC1D,SAAOA,YAAW,IAAI,CAAC,cAAc,CAAC,MAAM,SAAS,EAAE,KAAK,GAAG,CAAC;AACjE;","names":["extensions"]}
|
|
@@ -2,13 +2,6 @@ import { $ } from "execa";
|
|
|
2
2
|
import * as fs from "node:fs/promises";
|
|
3
3
|
import { readFileAsJson } from "../shared/readFileAsJson.js";
|
|
4
4
|
import { formatJson } from "./writing/creation/formatters/formatJson.js";
|
|
5
|
-
async function getStdout() {
|
|
6
|
-
try {
|
|
7
|
-
return await $`pnpm run lint:spelling`;
|
|
8
|
-
} catch (error) {
|
|
9
|
-
return error;
|
|
10
|
-
}
|
|
11
|
-
}
|
|
12
5
|
async function populateCSpellDictionary() {
|
|
13
6
|
const { stdout } = await getStdout();
|
|
14
7
|
const unknownWords = new Set(
|
|
@@ -30,6 +23,13 @@ async function populateCSpellDictionary() {
|
|
|
30
23
|
})
|
|
31
24
|
);
|
|
32
25
|
}
|
|
26
|
+
async function getStdout() {
|
|
27
|
+
try {
|
|
28
|
+
return await $`pnpm run lint:spelling`;
|
|
29
|
+
} catch (error) {
|
|
30
|
+
return error;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
33
|
export {
|
|
34
34
|
populateCSpellDictionary
|
|
35
35
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/steps/populateCSpellDictionary.ts"],"sourcesContent":["import { $ } from \"execa\";\nimport * as fs from \"node:fs/promises\";\n\nimport { readFileAsJson } from \"../shared/readFileAsJson.js\";\nimport { formatJson } from \"./writing/creation/formatters/formatJson.js\";\n\
|
|
1
|
+
{"version":3,"sources":["../../src/steps/populateCSpellDictionary.ts"],"sourcesContent":["import { $ } from \"execa\";\nimport * as fs from \"node:fs/promises\";\n\nimport { readFileAsJson } from \"../shared/readFileAsJson.js\";\nimport { formatJson } from \"./writing/creation/formatters/formatJson.js\";\n\nexport async function populateCSpellDictionary() {\n\tconst { stdout } = await getStdout();\n\tconst unknownWords = new Set(\n\t\tArray.from(stdout.matchAll(/Unknown word \\((.+)\\)/g)).map(\n\t\t\t([, matched]) => matched,\n\t\t),\n\t);\n\n\tconst existing = (await readFileAsJson(\"cspell.json\")) as Partial<\n\t\ttypeof import(\"../../cspell.json\")\n\t>;\n\n\tconst allWords = [...(existing.words ?? []), ...unknownWords];\n\tconst allWordsUnique = new Set(allWords);\n\n\tawait fs.writeFile(\n\t\t\"cspell.json\",\n\t\tawait formatJson({\n\t\t\t...existing,\n\t\t\twords: allWords\n\t\t\t\t.filter((word) => {\n\t\t\t\t\tconst wordLowerCase = word.toLowerCase();\n\t\t\t\t\treturn word === wordLowerCase || !allWordsUnique.has(wordLowerCase);\n\t\t\t\t})\n\t\t\t\t.sort((a, b) => a.toLowerCase().localeCompare(b.toLowerCase())),\n\t\t}),\n\t);\n}\n\nasync function getStdout() {\n\ttry {\n\t\treturn await $`pnpm run lint:spelling`;\n\t} catch (error) {\n\t\treturn error as { stdout: string };\n\t}\n}\n"],"mappings":"AAAA,SAAS,SAAS;AAClB,YAAY,QAAQ;AAEpB,SAAS,sBAAsB;AAC/B,SAAS,kBAAkB;AAE3B,eAAsB,2BAA2B;AAChD,QAAM,EAAE,OAAO,IAAI,MAAM,UAAU;AACnC,QAAM,eAAe,IAAI;AAAA,IACxB,MAAM,KAAK,OAAO,SAAS,wBAAwB,CAAC,EAAE;AAAA,MACrD,CAAC,CAAC,EAAE,OAAO,MAAM;AAAA,IAClB;AAAA,EACD;AAEA,QAAM,WAAY,MAAM,eAAe,aAAa;AAIpD,QAAM,WAAW,CAAC,GAAI,SAAS,SAAS,CAAC,GAAI,GAAG,YAAY;AAC5D,QAAM,iBAAiB,IAAI,IAAI,QAAQ;AAEvC,QAAM,GAAG;AAAA,IACR;AAAA,IACA,MAAM,WAAW;AAAA,MAChB,GAAG;AAAA,MACH,OAAO,SACL,OAAO,CAAC,SAAS;AACjB,cAAM,gBAAgB,KAAK,YAAY;AACvC,eAAO,SAAS,iBAAiB,CAAC,eAAe,IAAI,aAAa;AAAA,MACnE,CAAC,EACA,KAAK,CAAC,GAAG,MAAM,EAAE,YAAY,EAAE,cAAc,EAAE,YAAY,CAAC,CAAC;AAAA,IAChE,CAAC;AAAA,EACF;AACD;AAEA,eAAe,YAAY;AAC1B,MAAI;AACH,WAAO,MAAM;AAAA,EACd,SAAS,OAAO;AACf,WAAO;AAAA,EACR;AACD;","names":[]}
|
|
@@ -5,6 +5,6 @@ import '../shared/codes.js';
|
|
|
5
5
|
declare const endOfReadmeTemplateLine = "> \uD83D\uDC99 This package was templated with [`create-typescript-app`](https://github.com/JoshuaKGoldberg/create-typescript-app).";
|
|
6
6
|
declare const endOfReadmeNotice: string;
|
|
7
7
|
declare const endOfReadmeMatcher: RegExp;
|
|
8
|
-
declare function updateReadme(options: Pick<Options, "owner">): Promise<void>;
|
|
8
|
+
declare function updateReadme(options: Pick<Options, "excludeTemplatedBy" | "owner">): Promise<void>;
|
|
9
9
|
|
|
10
10
|
export { endOfReadmeMatcher, endOfReadmeNotice, endOfReadmeTemplateLine, updateReadme };
|
|
@@ -13,7 +13,7 @@ const endOfReadmeMatcher = /💙.+(?:based|built|templated).+(?:from|using|on|wi
|
|
|
13
13
|
async function updateReadme(options) {
|
|
14
14
|
let contents = await readFileSafe("./README.md", "");
|
|
15
15
|
contents = contents.replaceAll("JoshuaKGoldberg", options.owner);
|
|
16
|
-
if (!endOfReadmeMatcher.test(contents)) {
|
|
16
|
+
if (!options.excludeTemplatedBy && !endOfReadmeMatcher.test(contents)) {
|
|
17
17
|
contents += endOfReadmeNotice;
|
|
18
18
|
}
|
|
19
19
|
await fs.writeFile("./README.md", contents);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/steps/updateReadme.ts"],"sourcesContent":["import * as fs from \"node:fs/promises\";\nimport { EOL } from \"node:os\";\n\nimport { readFileSafe } from \"../shared/readFileSafe.js\";\nimport { Options } from \"../shared/types.js\";\n\nexport const endOfReadmeTemplateLine = `> 💙 This package was templated with [\\`create-typescript-app\\`](https://github.com/JoshuaKGoldberg/create-typescript-app).`;\n\nexport const endOfReadmeNotice = [\n\t``,\n\t`<!-- You can remove this notice if you don't want it 🙂 no worries! -->`,\n\t``,\n\tendOfReadmeTemplateLine,\n\t``,\n].join(EOL);\n\nexport const endOfReadmeMatcher =\n\t/💙.+(?:based|built|templated).+(?:from|using|on|with).+create-typescript-app/;\n\nexport async function updateReadme(
|
|
1
|
+
{"version":3,"sources":["../../src/steps/updateReadme.ts"],"sourcesContent":["import * as fs from \"node:fs/promises\";\nimport { EOL } from \"node:os\";\n\nimport { readFileSafe } from \"../shared/readFileSafe.js\";\nimport { Options } from \"../shared/types.js\";\n\nexport const endOfReadmeTemplateLine = `> 💙 This package was templated with [\\`create-typescript-app\\`](https://github.com/JoshuaKGoldberg/create-typescript-app).`;\n\nexport const endOfReadmeNotice = [\n\t``,\n\t`<!-- You can remove this notice if you don't want it 🙂 no worries! -->`,\n\t``,\n\tendOfReadmeTemplateLine,\n\t``,\n].join(EOL);\n\nexport const endOfReadmeMatcher =\n\t/💙.+(?:based|built|templated).+(?:from|using|on|with).+create-typescript-app/;\n\nexport async function updateReadme(\n\toptions: Pick<Options, \"excludeTemplatedBy\" | \"owner\">,\n) {\n\tlet contents = await readFileSafe(\"./README.md\", \"\");\n\n\tcontents = contents.replaceAll(\"JoshuaKGoldberg\", options.owner);\n\n\tif (!options.excludeTemplatedBy && !endOfReadmeMatcher.test(contents)) {\n\t\tcontents += endOfReadmeNotice;\n\t}\n\n\tawait fs.writeFile(\"./README.md\", contents);\n}\n"],"mappings":"AAAA,YAAY,QAAQ;AACpB,SAAS,WAAW;AAEpB,SAAS,oBAAoB;AAGtB,MAAM,0BAA0B;AAEhC,MAAM,oBAAoB;AAAA,EAChC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACD,EAAE,KAAK,GAAG;AAEH,MAAM,qBACZ;AAED,eAAsB,aACrB,SACC;AACD,MAAI,WAAW,MAAM,aAAa,eAAe,EAAE;AAEnD,aAAW,SAAS,WAAW,mBAAmB,QAAQ,KAAK;AAE/D,MAAI,CAAC,QAAQ,sBAAsB,CAAC,mBAAmB,KAAK,QAAQ,GAAG;AACtE,gBAAY;AAAA,EACb;AAEA,QAAM,GAAG,UAAU,eAAe,QAAQ;AAC3C;","names":[]}
|
|
@@ -5,25 +5,6 @@ import { findExistingBadges } from "./findExistingBadges.js";
|
|
|
5
5
|
import { findIntroSectionClose } from "./findIntroSectionClose.js";
|
|
6
6
|
import { generateTopContent } from "./generateTopContent.js";
|
|
7
7
|
const contributorsIndicator = `<!-- ALL-CONTRIBUTORS-LIST:START - Do not remove or modify this section -->`;
|
|
8
|
-
function generateAllContributorsContent(options) {
|
|
9
|
-
return [
|
|
10
|
-
`## Contributors`,
|
|
11
|
-
``,
|
|
12
|
-
`<!-- spellchecker: disable -->`,
|
|
13
|
-
contributorsIndicator,
|
|
14
|
-
`<!-- prettier-ignore-start -->`,
|
|
15
|
-
!options.excludeLintMd && `<!-- markdownlint-disable -->`,
|
|
16
|
-
`<table>`,
|
|
17
|
-
`<!-- (this will be filled in by all-contributors) -->`,
|
|
18
|
-
`</table>`,
|
|
19
|
-
``,
|
|
20
|
-
!options.excludeLintMd && `<!-- markdownlint-restore -->`,
|
|
21
|
-
`<!-- prettier-ignore-end -->`,
|
|
22
|
-
``,
|
|
23
|
-
`<!-- ALL-CONTRIBUTORS-LIST:END -->`,
|
|
24
|
-
`<!-- spellchecker: enable -->`
|
|
25
|
-
].filter(Boolean).join("\n");
|
|
26
|
-
}
|
|
27
8
|
async function writeReadme(options) {
|
|
28
9
|
const allContributorsContent = !options.excludeAllContributors && generateAllContributorsContent(options);
|
|
29
10
|
let contents = await readFileSafe("README.md", "");
|
|
@@ -51,6 +32,25 @@ async function writeReadme(options) {
|
|
|
51
32
|
}
|
|
52
33
|
await fs.writeFile("README.md", contents);
|
|
53
34
|
}
|
|
35
|
+
function generateAllContributorsContent(options) {
|
|
36
|
+
return [
|
|
37
|
+
`## Contributors`,
|
|
38
|
+
``,
|
|
39
|
+
`<!-- spellchecker: disable -->`,
|
|
40
|
+
contributorsIndicator,
|
|
41
|
+
`<!-- prettier-ignore-start -->`,
|
|
42
|
+
!options.excludeLintMd && `<!-- markdownlint-disable -->`,
|
|
43
|
+
`<table>`,
|
|
44
|
+
`<!-- (this will be filled in by all-contributors) -->`,
|
|
45
|
+
`</table>`,
|
|
46
|
+
``,
|
|
47
|
+
!options.excludeLintMd && `<!-- markdownlint-restore -->`,
|
|
48
|
+
`<!-- prettier-ignore-end -->`,
|
|
49
|
+
``,
|
|
50
|
+
`<!-- ALL-CONTRIBUTORS-LIST:END -->`,
|
|
51
|
+
`<!-- spellchecker: enable -->`
|
|
52
|
+
].filter(Boolean).join("\n");
|
|
53
|
+
}
|
|
54
54
|
export {
|
|
55
55
|
writeReadme
|
|
56
56
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/steps/writeReadme/index.ts"],"sourcesContent":["import * as fs from \"node:fs/promises\";\n\nimport { readFileSafe } from \"../../shared/readFileSafe.js\";\nimport { Options } from \"../../shared/types.js\";\nimport { endOfReadmeMatcher, endOfReadmeNotice } from \"../updateReadme.js\";\nimport { findExistingBadges } from \"./findExistingBadges.js\";\nimport { findIntroSectionClose } from \"./findIntroSectionClose.js\";\nimport { generateTopContent } from \"./generateTopContent.js\";\n\nconst contributorsIndicator = `<!-- ALL-CONTRIBUTORS-LIST:START - Do not remove or modify this section -->`;\n\
|
|
1
|
+
{"version":3,"sources":["../../../src/steps/writeReadme/index.ts"],"sourcesContent":["import * as fs from \"node:fs/promises\";\n\nimport { readFileSafe } from \"../../shared/readFileSafe.js\";\nimport { Options } from \"../../shared/types.js\";\nimport { endOfReadmeMatcher, endOfReadmeNotice } from \"../updateReadme.js\";\nimport { findExistingBadges } from \"./findExistingBadges.js\";\nimport { findIntroSectionClose } from \"./findIntroSectionClose.js\";\nimport { generateTopContent } from \"./generateTopContent.js\";\n\nconst contributorsIndicator = `<!-- ALL-CONTRIBUTORS-LIST:START - Do not remove or modify this section -->`;\n\nexport async function writeReadme(options: Options) {\n\tconst allContributorsContent =\n\t\t!options.excludeAllContributors && generateAllContributorsContent(options);\n\tlet contents = await readFileSafe(\"README.md\", \"\");\n\tif (!contents) {\n\t\tawait fs.writeFile(\n\t\t\t\"README.md\",\n\t\t\t[\n\t\t\t\tgenerateTopContent(options, []),\n\t\t\t\tallContributorsContent,\n\t\t\t\tendOfReadmeNotice.slice(1),\n\t\t\t]\n\t\t\t\t.filter(Boolean)\n\t\t\t\t.join(\"\\n\\n\"),\n\t\t);\n\t\treturn;\n\t}\n\n\tconst endOfIntroSection = findIntroSectionClose(contents);\n\n\tcontents = [\n\t\tgenerateTopContent(options, findExistingBadges(contents)),\n\t\tcontents.slice(endOfIntroSection),\n\t]\n\t\t.join(\"\")\n\t\t.replace(/\\[!\\[.+\\]\\(.+\\)\\]\\(.+\\)/g, \"\")\n\t\t.replace(/!\\[.+\\]\\(.+\\)/g, \"\")\n\t\t.replaceAll(\"\\r\", \"\")\n\t\t.replaceAll(\"\\n\\n\\n\", \"\\n\\n\");\n\n\tif (allContributorsContent && !contents.includes(contributorsIndicator)) {\n\t\tcontents = [contents, allContributorsContent].join(\"\\n\\n\");\n\t}\n\n\tif (!endOfReadmeMatcher.test(contents)) {\n\t\tcontents = [contents, endOfReadmeNotice].join(\"\\n\");\n\t}\n\n\tawait fs.writeFile(\"README.md\", contents);\n}\n\nfunction generateAllContributorsContent(options: Options) {\n\treturn [\n\t\t`## Contributors`,\n\t\t``,\n\t\t`<!-- spellchecker: disable -->`,\n\t\tcontributorsIndicator,\n\t\t`<!-- prettier-ignore-start -->`,\n\t\t!options.excludeLintMd && `<!-- markdownlint-disable -->`,\n\t\t`<table>`,\n\t\t`<!-- (this will be filled in by all-contributors) -->`,\n\t\t`</table>`,\n\t\t``,\n\t\t!options.excludeLintMd && `<!-- markdownlint-restore -->`,\n\t\t`<!-- prettier-ignore-end -->`,\n\t\t``,\n\t\t`<!-- ALL-CONTRIBUTORS-LIST:END -->`,\n\t\t`<!-- spellchecker: enable -->`,\n\t]\n\t\t.filter(Boolean)\n\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AA,IACA,CAAC,QAAQ,iBAAiB;AAAA,IAC1B;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACD,EACE,OAAO,OAAO,EACd,KAAK,IAAI;AACZ;","names":[]}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { formatIgnoreFile } from "./formatters/formatIgnoreFile.js";
|
|
2
2
|
function createDotGitignore(options) {
|
|
3
3
|
return formatIgnoreFile([
|
|
4
|
-
...options.excludeTests ? [] : ["coverage
|
|
5
|
-
"lib
|
|
6
|
-
"node_modules
|
|
4
|
+
...options.excludeTests ? [] : ["/coverage"],
|
|
5
|
+
"/lib",
|
|
6
|
+
"/node_modules"
|
|
7
7
|
]);
|
|
8
8
|
}
|
|
9
9
|
export {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/steps/writing/creation/createDotGitignore.ts"],"sourcesContent":["import { Options } from \"../../../shared/types.js\";\nimport { formatIgnoreFile } from \"./formatters/formatIgnoreFile.js\";\n\nexport function createDotGitignore(options: Pick<Options, \"excludeTests\">) {\n\treturn formatIgnoreFile([\n\t\t...(options.excludeTests ? [] : [\"coverage
|
|
1
|
+
{"version":3,"sources":["../../../../src/steps/writing/creation/createDotGitignore.ts"],"sourcesContent":["import { Options } from \"../../../shared/types.js\";\nimport { formatIgnoreFile } from \"./formatters/formatIgnoreFile.js\";\n\nexport function createDotGitignore(options: Pick<Options, \"excludeTests\">) {\n\treturn formatIgnoreFile([\n\t\t...(options.excludeTests ? [] : [\"/coverage\"]),\n\t\t\"/lib\",\n\t\t\"/node_modules\",\n\t]);\n}\n"],"mappings":"AACA,SAAS,wBAAwB;AAE1B,SAAS,mBAAmB,SAAwC;AAC1E,SAAO,iBAAiB;AAAA,IACvB,GAAI,QAAQ,eAAe,CAAC,IAAI,CAAC,WAAW;AAAA,IAC5C;AAAA,IACA;AAAA,EACD,CAAC;AACF;","names":[]}
|
|
@@ -2,8 +2,8 @@ import { formatTypeScript } from "./formatters/formatTypeScript.js";
|
|
|
2
2
|
async function createESLintConfig(options) {
|
|
3
3
|
const tseslintBase = options.excludeLintStrict ? "recommended" : "strict";
|
|
4
4
|
const imports = [
|
|
5
|
-
`import eslint from "@eslint/js";`,
|
|
6
5
|
!options.excludeLintESLint && `import comments from "@eslint-community/eslint-plugin-eslint-comments/configs";`,
|
|
6
|
+
`import eslint from "@eslint/js";`,
|
|
7
7
|
!options.excludeTests && `import vitest from "@vitest/eslint-plugin";`,
|
|
8
8
|
!options.excludeLintJSDoc && `import jsdoc from "eslint-plugin-jsdoc";`,
|
|
9
9
|
!options.excludeLintJson && `import jsonc from "eslint-plugin-jsonc";`,
|
|
@@ -17,19 +17,23 @@ async function createESLintConfig(options) {
|
|
|
17
17
|
].filter(Boolean);
|
|
18
18
|
const elements = [
|
|
19
19
|
`eslint.configs.recommended,`,
|
|
20
|
-
!options.excludeLintJson && ` ...jsonc.configs["flat/recommended-with-json"],`,
|
|
21
|
-
!options.excludeLintMd && ` ...markdown.configs.recommended,`,
|
|
22
|
-
!options.excludeLintYml && ` ...yml.configs["flat/recommended"],`,
|
|
23
|
-
!options.excludeLintYml && ` ...yml.configs["flat/prettier"],`,
|
|
24
20
|
!options.excludeLintESLint && ` comments.recommended,`,
|
|
25
21
|
!options.excludeLintJSDoc && ` jsdoc.configs["flat/contents-typescript-error"],
|
|
26
|
-
|
|
27
|
-
|
|
22
|
+
jsdoc.configs["flat/logical-typescript-error"],
|
|
23
|
+
jsdoc.configs["flat/stylistic-typescript-error"],`,
|
|
24
|
+
!options.excludeLintJson && ` jsonc.configs["flat/recommended-with-json"],`,
|
|
25
|
+
!options.excludeLintMd && ` markdown.configs.recommended,`,
|
|
28
26
|
` n.configs["flat/recommended"],`,
|
|
29
27
|
!options.excludeLintPackageJson && ` packageJson,`,
|
|
30
28
|
!options.excludeLintPerfectionist && ` perfectionist.configs["recommended-natural"],`,
|
|
31
29
|
!options.excludeLintRegex && ` regexp.configs["flat/recommended"],`
|
|
32
30
|
].filter(Boolean);
|
|
31
|
+
const ignores = [
|
|
32
|
+
...options.excludeTests ? [] : ["**/*.snap", "coverage"],
|
|
33
|
+
"lib",
|
|
34
|
+
"node_modules",
|
|
35
|
+
"pnpm-lock.yaml"
|
|
36
|
+
].map((ignore) => JSON.stringify(ignore)).sort();
|
|
33
37
|
const rules = !options.excludeLintStylistic && `{
|
|
34
38
|
// Stylistic concerns that don't interfere with Prettier
|
|
35
39
|
"logical-assignment-operators": [
|
|
@@ -44,42 +48,23 @@ async function createESLintConfig(options) {
|
|
|
44
48
|
return await formatTypeScript(`${imports.join("\n")}
|
|
45
49
|
|
|
46
50
|
export default tseslint.config(
|
|
47
|
-
{
|
|
48
|
-
|
|
49
|
-
"coverage*",`}
|
|
50
|
-
"lib",
|
|
51
|
-
"node_modules",
|
|
52
|
-
"pnpm-lock.yaml",${options.excludeTests ? "" : `
|
|
53
|
-
"**/*.snap",`}
|
|
54
|
-
],
|
|
55
|
-
},
|
|
56
|
-
{
|
|
57
|
-
linterOptions: {
|
|
58
|
-
reportUnusedDisableDirectives: "error",
|
|
59
|
-
},
|
|
60
|
-
},
|
|
51
|
+
{ ignores: [${ignores.join(", ")}], },
|
|
52
|
+
{ linterOptions: { reportUnusedDisableDirectives: "error" } },
|
|
61
53
|
${elements.join("\n")}
|
|
62
54
|
{
|
|
63
55
|
extends: ${options.excludeLintStylistic ? `tseslint.configs.${tseslintBase}TypeChecked` : `[
|
|
64
|
-
|
|
65
|
-
|
|
56
|
+
tseslint.configs.${tseslintBase}TypeChecked,
|
|
57
|
+
tseslint.configs.stylisticTypeChecked,
|
|
66
58
|
]`},
|
|
67
59
|
files: ["**/*.js", "**/*.ts"],
|
|
68
60
|
languageOptions: {
|
|
69
61
|
parserOptions: {
|
|
70
|
-
projectService: {
|
|
71
|
-
allowDefaultProject: ["*.config.*s"],
|
|
72
|
-
},
|
|
62
|
+
projectService: { allowDefaultProject: ["*.config.*s"] },
|
|
73
63
|
tsconfigRootDir: import.meta.dirname
|
|
74
64
|
},
|
|
75
65
|
},${rules ? `
|
|
76
66
|
rules: ${rules},` : ""}${options.excludeLintPerfectionist ? "" : `
|
|
77
|
-
settings: {
|
|
78
|
-
perfectionist: {
|
|
79
|
-
partitionByComment: true,
|
|
80
|
-
type: "natural",
|
|
81
|
-
},
|
|
82
|
-
},`}
|
|
67
|
+
settings: { perfectionist: { partitionByComment: true, type: "natural" } },`}
|
|
83
68
|
},
|
|
84
69
|
{
|
|
85
70
|
extends: [tseslint.configs.disableTypeChecked],
|
|
@@ -92,31 +77,24 @@ export default tseslint.config(
|
|
|
92
77
|
},
|
|
93
78
|
},${options.excludeTests ? "" : `
|
|
94
79
|
{
|
|
95
|
-
files: ["**/*.test.*"],
|
|
96
80
|
extends: [vitest.configs.recommended],
|
|
81
|
+
files: ["**/*.test.*"],
|
|
97
82
|
rules: {
|
|
98
|
-
// These on-by-default rules aren't useful in test files.
|
|
99
83
|
"@typescript-eslint/no-unsafe-assignment": "off",
|
|
100
|
-
"@typescript-eslint/no-unsafe-call": "off",
|
|
101
84
|
},
|
|
102
85
|
},`}${options.excludeLintYml ? "" : `
|
|
103
86
|
{
|
|
87
|
+
extends: [yml.configs["flat/recommended"], yml.configs["flat/prettier"]],
|
|
104
88
|
files: ["**/*.{yml,yaml}"],
|
|
105
89
|
rules: {
|
|
106
90
|
"yml/file-extension": ["error", { extension: "yml" }],
|
|
107
91
|
"yml/sort-keys": [
|
|
108
92
|
"error",
|
|
109
|
-
{
|
|
110
|
-
order: { type: "asc" },
|
|
111
|
-
pathPattern: "^.*$",
|
|
112
|
-
},
|
|
93
|
+
{ order: { type: "asc" }, pathPattern: "^.*$" },
|
|
113
94
|
],
|
|
114
95
|
"yml/sort-sequence-values": [
|
|
115
96
|
"error",
|
|
116
|
-
{
|
|
117
|
-
order: { type: "asc" },
|
|
118
|
-
pathPattern: "^.*$",
|
|
119
|
-
},
|
|
97
|
+
{ order: { type: "asc" }, pathPattern: "^.*$" },
|
|
120
98
|
],
|
|
121
99
|
},
|
|
122
100
|
},`}
|