create-typescript-app 0.1.1 → 1.29.14
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/LICENSE.md +17 -5
- package/README.md +118 -0
- package/bin/index.js +4 -0
- package/lib/bin/index.d.ts +3 -0
- package/lib/bin/index.js +52 -0
- package/lib/bin/index.js.map +1 -0
- package/lib/bin/mode.d.ts +4 -0
- package/lib/bin/mode.js +43 -0
- package/lib/bin/mode.js.map +1 -0
- package/lib/create/createRerunSuggestion.d.ts +6 -0
- package/lib/create/createRerunSuggestion.js +17 -0
- package/lib/create/createRerunSuggestion.js.map +1 -0
- package/lib/create/createWithOptions.d.ts +9 -0
- package/lib/create/createWithOptions.js +62 -0
- package/lib/create/createWithOptions.js.map +1 -0
- package/lib/create/index.d.ts +3 -0
- package/lib/create/index.js +64 -0
- package/lib/create/index.js.map +1 -0
- package/lib/greet.d.ts +5 -0
- package/lib/greet.js +14 -0
- package/lib/greet.js.map +1 -0
- package/lib/index.d.ts +2 -0
- package/lib/index.js +3 -0
- package/lib/index.js.map +1 -0
- package/lib/initialize/index.d.ts +3 -0
- package/lib/initialize/index.js +32 -0
- package/lib/initialize/index.js.map +1 -0
- package/lib/initialize/initializeWithOptions.d.ts +7 -0
- package/lib/initialize/initializeWithOptions.js +60 -0
- package/lib/initialize/initializeWithOptions.js.map +1 -0
- package/lib/migrate/index.d.ts +3 -0
- package/lib/migrate/index.js +29 -0
- package/lib/migrate/index.js.map +1 -0
- package/lib/migrate/migrateWithOptions.d.ts +7 -0
- package/lib/migrate/migrateWithOptions.js +67 -0
- package/lib/migrate/migrateWithOptions.js.map +1 -0
- package/lib/shared/cli/lines.d.ts +5 -0
- package/lib/shared/cli/lines.js +17 -0
- package/lib/shared/cli/lines.js.map +1 -0
- package/lib/shared/cli/lowerFirst.d.ts +3 -0
- package/lib/shared/cli/lowerFirst.js +7 -0
- package/lib/shared/cli/lowerFirst.js.map +1 -0
- package/lib/shared/cli/outro.d.ts +7 -0
- package/lib/shared/cli/outro.js +21 -0
- package/lib/shared/cli/outro.js.map +1 -0
- package/lib/shared/cli/spinners.d.ts +6 -0
- package/lib/shared/cli/spinners.js +49 -0
- package/lib/shared/cli/spinners.js.map +1 -0
- package/lib/shared/cli/startLineWithDots.d.ts +3 -0
- package/lib/shared/cli/startLineWithDots.js +31 -0
- package/lib/shared/cli/startLineWithDots.js.map +1 -0
- package/lib/shared/doesRepositoryExist.d.ts +9 -0
- package/lib/shared/doesRepositoryExist.js +18 -0
- package/lib/shared/doesRepositoryExist.js.map +1 -0
- package/lib/shared/ensureGitRepository.d.ts +3 -0
- package/lib/shared/ensureGitRepository.js +12 -0
- package/lib/shared/ensureGitRepository.js.map +1 -0
- package/lib/shared/getGitHubUserAsAllContributor.d.ts +3 -0
- package/lib/shared/getGitHubUserAsAllContributor.js +31 -0
- package/lib/shared/getGitHubUserAsAllContributor.js.map +1 -0
- package/lib/shared/options/args.d.ts +85 -0
- package/lib/shared/options/args.js +33 -0
- package/lib/shared/options/args.js.map +1 -0
- package/lib/shared/options/augmentOptionsWithExcludes.d.ts +5 -0
- package/lib/shared/options/augmentOptionsWithExcludes.js +126 -0
- package/lib/shared/options/augmentOptionsWithExcludes.js.map +1 -0
- package/lib/shared/options/ensureRepositoryExists.d.ts +11 -0
- package/lib/shared/options/ensureRepositoryExists.js +58 -0
- package/lib/shared/options/ensureRepositoryExists.js.map +1 -0
- package/lib/shared/options/getOctokit.d.ts +5 -0
- package/lib/shared/options/getOctokit.js +17 -0
- package/lib/shared/options/getOctokit.js.map +1 -0
- package/lib/shared/options/getPrefillOrPromptedOption.d.ts +3 -0
- package/lib/shared/options/getPrefillOrPromptedOption.js +23 -0
- package/lib/shared/options/getPrefillOrPromptedOption.js.map +1 -0
- package/lib/shared/options/optionalDefault.d.ts +3 -0
- package/lib/shared/options/optionalDefault.js +13 -0
- package/lib/shared/options/optionalDefault.js.map +1 -0
- package/lib/shared/options/readGitAndNpmDefaults/index.d.ts +11 -0
- package/lib/shared/options/readGitAndNpmDefaults/index.js +36 -0
- package/lib/shared/options/readGitAndNpmDefaults/index.js.map +1 -0
- package/lib/shared/options/readGitAndNpmDefaults/parsePackageAuthor.d.ts +8 -0
- package/lib/shared/options/readGitAndNpmDefaults/parsePackageAuthor.js +14 -0
- package/lib/shared/options/readGitAndNpmDefaults/parsePackageAuthor.js.map +1 -0
- package/lib/shared/options/readGitAndNpmDefaults/readTitleFromReadme.d.ts +3 -0
- package/lib/shared/options/readGitAndNpmDefaults/readTitleFromReadme.js +8 -0
- package/lib/shared/options/readGitAndNpmDefaults/readTitleFromReadme.js.map +1 -0
- package/lib/shared/options/readOptions.d.ts +10 -0
- package/lib/shared/options/readOptions.js +83 -0
- package/lib/shared/options/readOptions.js.map +1 -0
- package/lib/shared/packages.d.ts +6 -0
- package/lib/shared/packages.js +20 -0
- package/lib/shared/packages.js.map +1 -0
- package/lib/shared/prompts.d.ts +4 -0
- package/lib/shared/prompts.js +16 -0
- package/lib/shared/prompts.js.map +1 -0
- package/lib/shared/readFileAsJson.d.ts +3 -0
- package/lib/shared/readFileAsJson.js +15 -0
- package/lib/shared/readFileAsJson.js.map +1 -0
- package/lib/shared/readFileSafe.d.ts +3 -0
- package/lib/shared/readFileSafe.js +12 -0
- package/lib/shared/readFileSafe.js.map +1 -0
- package/lib/shared/readFileSafeAsJson.d.ts +3 -0
- package/lib/shared/readFileSafeAsJson.js +8 -0
- package/lib/shared/readFileSafeAsJson.js.map +1 -0
- package/lib/shared/runOrRestore.d.ts +7 -0
- package/lib/shared/runOrRestore.js +41 -0
- package/lib/shared/runOrRestore.js.map +1 -0
- package/lib/shared/tryCatchAsync.d.ts +3 -0
- package/lib/shared/tryCatchAsync.js +11 -0
- package/lib/shared/tryCatchAsync.js.map +1 -0
- package/lib/shared/types.d.ts +54 -0
- package/lib/shared/types.js +1 -0
- package/lib/shared/types.js.map +1 -0
- package/lib/steps/addOwnerAsAllContributor.d.ts +3 -0
- package/lib/steps/addOwnerAsAllContributor.js +41 -0
- package/lib/steps/addOwnerAsAllContributor.js.map +1 -0
- package/lib/steps/addToolAllContributors.d.ts +3 -0
- package/lib/steps/addToolAllContributors.js +12 -0
- package/lib/steps/addToolAllContributors.js.map +1 -0
- package/lib/steps/clearChangelog.d.ts +3 -0
- package/lib/steps/clearChangelog.js +12 -0
- package/lib/steps/clearChangelog.js.map +1 -0
- package/lib/steps/clearUnnecessaryFiles.d.ts +3 -0
- package/lib/steps/clearUnnecessaryFiles.js +33 -0
- package/lib/steps/clearUnnecessaryFiles.js.map +1 -0
- package/lib/steps/detectExistingContributors.d.ts +3 -0
- package/lib/steps/detectExistingContributors.js +16 -0
- package/lib/steps/detectExistingContributors.js.map +1 -0
- package/lib/steps/finalizeDependencies.d.ts +5 -0
- package/lib/steps/finalizeDependencies.js +59 -0
- package/lib/steps/finalizeDependencies.js.map +1 -0
- package/lib/steps/initializeGitHubRepository/index.d.ts +6 -0
- package/lib/steps/initializeGitHubRepository/index.js +14 -0
- package/lib/steps/initializeGitHubRepository/index.js.map +1 -0
- package/lib/steps/initializeGitHubRepository/initializeBranchProtectionSettings.d.ts +6 -0
- package/lib/steps/initializeGitHubRepository/initializeBranchProtectionSettings.js +46 -0
- package/lib/steps/initializeGitHubRepository/initializeBranchProtectionSettings.js.map +1 -0
- package/lib/steps/initializeGitHubRepository/labels/getExistingEquivalentLabel.d.ts +3 -0
- package/lib/steps/initializeGitHubRepository/labels/getExistingEquivalentLabel.js +14 -0
- package/lib/steps/initializeGitHubRepository/labels/getExistingEquivalentLabel.js.map +1 -0
- package/lib/steps/initializeGitHubRepository/labels/initializeRepositoryLabels.d.ts +3 -0
- package/lib/steps/initializeGitHubRepository/labels/initializeRepositoryLabels.js +31 -0
- package/lib/steps/initializeGitHubRepository/labels/initializeRepositoryLabels.js.map +1 -0
- package/lib/steps/initializeGitHubRepository/labels/outcomeLabels.d.ts +7 -0
- package/lib/steps/initializeGitHubRepository/labels/outcomeLabels.js +86 -0
- package/lib/steps/initializeGitHubRepository/labels/outcomeLabels.js.map +1 -0
- package/lib/steps/initializeGitRemote.d.ts +6 -0
- package/lib/steps/initializeGitRemote.js +15 -0
- package/lib/steps/initializeGitRemote.js.map +1 -0
- package/lib/steps/initializeRepositorySettings.d.ts +7 -0
- package/lib/steps/initializeRepositorySettings.js +27 -0
- package/lib/steps/initializeRepositorySettings.js.map +1 -0
- package/lib/steps/removeSetupScripts.d.ts +3 -0
- package/lib/steps/removeSetupScripts.js +23 -0
- package/lib/steps/removeSetupScripts.js.map +1 -0
- package/lib/steps/resetGitTags.d.ts +3 -0
- package/lib/steps/resetGitTags.js +12 -0
- package/lib/steps/resetGitTags.js.map +1 -0
- package/lib/steps/runCommands.d.ts +3 -0
- package/lib/steps/runCommands.js +33 -0
- package/lib/steps/runCommands.js.map +1 -0
- package/lib/steps/uninstallPackages.d.ts +3 -0
- package/lib/steps/uninstallPackages.js +41 -0
- package/lib/steps/uninstallPackages.js.map +1 -0
- package/lib/steps/updateAllContributorsTable.d.ts +5 -0
- package/lib/steps/updateAllContributorsTable.js +27 -0
- package/lib/steps/updateAllContributorsTable.js.map +1 -0
- package/lib/steps/updateLocalFiles.d.ts +5 -0
- package/lib/steps/updateLocalFiles.js +58 -0
- package/lib/steps/updateLocalFiles.js.map +1 -0
- package/lib/steps/updateReadme.d.ts +4 -0
- package/lib/steps/updateReadme.js +17 -0
- package/lib/steps/updateReadme.js.map +1 -0
- package/lib/steps/writeReadme.d.ts +5 -0
- package/lib/steps/writeReadme.js +87 -0
- package/lib/steps/writeReadme.js.map +1 -0
- package/lib/steps/writing/creation/createESLintRC.d.ts +5 -0
- package/lib/steps/writing/creation/createESLintRC.js +163 -0
- package/lib/steps/writing/creation/createESLintRC.js.map +1 -0
- package/lib/steps/writing/creation/dotGitHub/actions.d.ts +7 -0
- package/lib/steps/writing/creation/dotGitHub/actions.js +29 -0
- package/lib/steps/writing/creation/dotGitHub/actions.js.map +1 -0
- package/lib/steps/writing/creation/dotGitHub/createDevelopment.d.ts +5 -0
- package/lib/steps/writing/creation/dotGitHub/createDevelopment.js +96 -0
- package/lib/steps/writing/creation/dotGitHub/createDevelopment.js.map +1 -0
- package/lib/steps/writing/creation/dotGitHub/createDotGitHubFiles.d.ts +14 -0
- package/lib/steps/writing/creation/dotGitHub/createDotGitHubFiles.js +282 -0
- package/lib/steps/writing/creation/dotGitHub/createDotGitHubFiles.js.map +1 -0
- package/lib/steps/writing/creation/dotGitHub/createWorkflowFile.d.ts +49 -0
- package/lib/steps/writing/creation/dotGitHub/createWorkflowFile.js +34 -0
- package/lib/steps/writing/creation/dotGitHub/createWorkflowFile.js.map +1 -0
- package/lib/steps/writing/creation/dotGitHub/index.d.ts +41 -0
- package/lib/steps/writing/creation/dotGitHub/index.js +16 -0
- package/lib/steps/writing/creation/dotGitHub/index.js.map +1 -0
- package/lib/steps/writing/creation/dotGitHub/issueTemplate.d.ts +10 -0
- package/lib/steps/writing/creation/dotGitHub/issueTemplate.js +202 -0
- package/lib/steps/writing/creation/dotGitHub/issueTemplate.js.map +1 -0
- package/lib/steps/writing/creation/dotGitHub/workflows.d.ts +20 -0
- package/lib/steps/writing/creation/dotGitHub/workflows.js +280 -0
- package/lib/steps/writing/creation/dotGitHub/workflows.js.map +1 -0
- package/lib/steps/writing/creation/dotHusky.d.ts +6 -0
- package/lib/steps/writing/creation/dotHusky.js +15 -0
- package/lib/steps/writing/creation/dotHusky.js.map +1 -0
- package/lib/steps/writing/creation/dotVSCode.d.ts +9 -0
- package/lib/steps/writing/creation/dotVSCode.js +55 -0
- package/lib/steps/writing/creation/dotVSCode.js.map +1 -0
- package/lib/steps/writing/creation/formatters/formatIgnoreFile.d.ts +3 -0
- package/lib/steps/writing/creation/formatters/formatIgnoreFile.js +7 -0
- package/lib/steps/writing/creation/formatters/formatIgnoreFile.js.map +1 -0
- package/lib/steps/writing/creation/formatters/formatJson.d.ts +3 -0
- package/lib/steps/writing/creation/formatters/formatJson.js +17 -0
- package/lib/steps/writing/creation/formatters/formatJson.js.map +1 -0
- package/lib/steps/writing/creation/formatters/formatTypeScript.d.ts +3 -0
- package/lib/steps/writing/creation/formatters/formatTypeScript.js +8 -0
- package/lib/steps/writing/creation/formatters/formatTypeScript.js.map +1 -0
- package/lib/steps/writing/creation/formatters/formatYaml.d.ts +3 -0
- package/lib/steps/writing/creation/formatters/formatYaml.js +23 -0
- package/lib/steps/writing/creation/formatters/formatYaml.js.map +1 -0
- package/lib/steps/writing/creation/index.d.ts +6 -0
- package/lib/steps/writing/creation/index.js +18 -0
- package/lib/steps/writing/creation/index.js.map +1 -0
- package/lib/steps/writing/creation/rootFiles.d.ts +25 -0
- package/lib/steps/writing/creation/rootFiles.js +202 -0
- package/lib/steps/writing/creation/rootFiles.js.map +1 -0
- package/lib/steps/writing/creation/src.d.ts +10 -0
- package/lib/steps/writing/creation/src.js +90 -0
- package/lib/steps/writing/creation/src.js.map +1 -0
- package/lib/steps/writing/creation/writeAllContributorsRC.d.ts +5 -0
- package/lib/steps/writing/creation/writeAllContributorsRC.js +25 -0
- package/lib/steps/writing/creation/writeAllContributorsRC.js.map +1 -0
- package/lib/steps/writing/creation/writePackageJson.d.ts +5 -0
- package/lib/steps/writing/creation/writePackageJson.js +98 -0
- package/lib/steps/writing/creation/writePackageJson.js.map +1 -0
- package/lib/steps/writing/types.d.ts +5 -0
- package/lib/steps/writing/types.js +1 -0
- package/lib/steps/writing/types.js.map +1 -0
- package/lib/steps/writing/writeStructure.d.ts +5 -0
- package/lib/steps/writing/writeStructure.js +11 -0
- package/lib/steps/writing/writeStructure.js.map +1 -0
- package/lib/steps/writing/writeStructureWorker.d.ts +5 -0
- package/lib/steps/writing/writeStructureWorker.js +47 -0
- package/lib/steps/writing/writeStructureWorker.js.map +1 -0
- package/lib/types.d.ts +7 -0
- package/lib/types.js +1 -0
- package/lib/types.js.map +1 -0
- package/package.json +112 -23
- package/.vscode/settings.json +0 -3
- package/dist/src/cli.d.ts +0 -0
- package/dist/src/cli.js +0 -2
- package/dist/src/cli.js.map +0 -1
- package/dist/src/index.d.ts +0 -1
- package/dist/src/index.js +0 -53
- package/dist/src/index.js.map +0 -1
- package/dist/template/src/cli.d.ts +0 -0
- package/dist/template/src/cli.js +0 -2
- package/dist/template/src/cli.js.map +0 -1
- package/dist/template/src/index.d.ts +0 -0
- package/dist/template/src/index.js +0 -2
- package/dist/template/src/index.js.map +0 -1
- package/src/cli.ts +0 -0
- package/src/index.ts +0 -56
- package/src/types.d.ts +0 -10
- package/template/.vscode/settings.json +0 -3
- package/template/README.md +0 -28
- package/template/package.json +0 -34
- package/template/src/cli.ts +0 -0
- package/template/src/index.ts +0 -0
- package/template/tsconfig.json +0 -15
- package/template/tslint.json +0 -48
- package/tsconfig.json +0 -15
- package/tslint.json +0 -48
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/shared/readFileSafe.ts"],"sourcesContent":["import fs from \"node:fs/promises\";\n\nexport async function readFileSafe(filePath: string, fallback: string) {\n\ttry {\n\t\treturn (await fs.readFile(filePath)).toString();\n\t} catch {\n\t\treturn fallback;\n\t}\n}\n"],"mappings":"AAAA,OAAO,QAAQ;AAEf,eAAsB,aAAa,UAAkB,UAAkB;AACtE,MAAI;AACH,YAAQ,MAAM,GAAG,SAAS,QAAQ,GAAG,SAAS;AAAA,EAC/C,QAAQ;AACP,WAAO;AAAA,EACR;AACD;","names":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/shared/readFileSafeAsJson.ts"],"sourcesContent":["import { readFileSafe } from \"./readFileSafe.js\";\n\nexport async function readFileSafeAsJson(filePath: string) {\n\treturn JSON.parse(await readFileSafe(filePath, \"null\")) as unknown;\n}\n"],"mappings":"AAAA,SAAS,oBAAoB;AAE7B,eAAsB,mBAAmB,UAAkB;AAC1D,SAAO,KAAK,MAAM,MAAM,aAAa,UAAU,MAAM,CAAC;AACvD;","names":[]}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import * as prompts from "@clack/prompts";
|
|
2
|
+
import chalk from "chalk";
|
|
3
|
+
import { $ } from "execa";
|
|
4
|
+
import { handlePromptCancel } from "./prompts.js";
|
|
5
|
+
async function runOrRestore({ run, skipRestore }) {
|
|
6
|
+
try {
|
|
7
|
+
await run();
|
|
8
|
+
return 0;
|
|
9
|
+
} catch (error) {
|
|
10
|
+
prompts.outro(
|
|
11
|
+
chalk.red`Looks like there was a problem. Correct it and try again? 😕`
|
|
12
|
+
);
|
|
13
|
+
console.log();
|
|
14
|
+
console.log(error);
|
|
15
|
+
if (skipRestore) {
|
|
16
|
+
console.log();
|
|
17
|
+
console.log(chalk.gray`Leaving changes to the local directory on disk.`);
|
|
18
|
+
console.log();
|
|
19
|
+
} else {
|
|
20
|
+
const shouldRestore = await prompts.confirm({
|
|
21
|
+
message: "Do you want to restore the repository to how it was?"
|
|
22
|
+
});
|
|
23
|
+
handlePromptCancel(shouldRestore);
|
|
24
|
+
if (shouldRestore) {
|
|
25
|
+
console.log();
|
|
26
|
+
console.log(
|
|
27
|
+
chalk.gray`Resetting repository using`,
|
|
28
|
+
chalk.reset`git restore .`
|
|
29
|
+
);
|
|
30
|
+
await $`git restore .`;
|
|
31
|
+
console.log("Repository is reset. Ready to try again?");
|
|
32
|
+
console.log();
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
return 1;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
export {
|
|
39
|
+
runOrRestore
|
|
40
|
+
};
|
|
41
|
+
//# sourceMappingURL=runOrRestore.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/shared/runOrRestore.ts"],"sourcesContent":["import * as prompts from \"@clack/prompts\";\nimport chalk from \"chalk\";\nimport { $ } from \"execa\";\n\nimport { handlePromptCancel } from \"./prompts.js\";\n\nexport interface RunOrRestoreOptions {\n\trun: () => Promise<void>;\n\tskipRestore: boolean | undefined;\n}\n\nexport async function runOrRestore({ run, skipRestore }: RunOrRestoreOptions) {\n\ttry {\n\t\tawait run();\n\t\treturn 0;\n\t} catch (error) {\n\t\tprompts.outro(\n\t\t\tchalk.red`Looks like there was a problem. Correct it and try again? 😕`,\n\t\t);\n\n\t\tconsole.log();\n\t\tconsole.log(error);\n\n\t\tif (skipRestore) {\n\t\t\tconsole.log();\n\t\t\tconsole.log(chalk.gray`Leaving changes to the local directory on disk.`);\n\t\t\tconsole.log();\n\t\t} else {\n\t\t\tconst shouldRestore = await prompts.confirm({\n\t\t\t\tmessage: \"Do you want to restore the repository to how it was?\",\n\t\t\t});\n\n\t\t\thandlePromptCancel(shouldRestore);\n\n\t\t\tif (shouldRestore) {\n\t\t\t\tconsole.log();\n\t\t\t\tconsole.log(\n\t\t\t\t\tchalk.gray`Resetting repository using`,\n\t\t\t\t\tchalk.reset`git restore .`,\n\t\t\t\t);\n\t\t\t\tawait $`git restore .`;\n\t\t\t\tconsole.log(\"Repository is reset. Ready to try again?\");\n\t\t\t\tconsole.log();\n\t\t\t}\n\t\t}\n\n\t\treturn 1;\n\t}\n}\n"],"mappings":"AAAA,YAAY,aAAa;AACzB,OAAO,WAAW;AAClB,SAAS,SAAS;AAElB,SAAS,0BAA0B;AAOnC,eAAsB,aAAa,EAAE,KAAK,YAAY,GAAwB;AAC7E,MAAI;AACH,UAAM,IAAI;AACV,WAAO;AAAA,EACR,SAAS,OAAO;AACf,YAAQ;AAAA,MACP,MAAM;AAAA,IACP;AAEA,YAAQ,IAAI;AACZ,YAAQ,IAAI,KAAK;AAEjB,QAAI,aAAa;AAChB,cAAQ,IAAI;AACZ,cAAQ,IAAI,MAAM,qDAAqD;AACvE,cAAQ,IAAI;AAAA,IACb,OAAO;AACN,YAAM,gBAAgB,MAAM,QAAQ,QAAQ;AAAA,QAC3C,SAAS;AAAA,MACV,CAAC;AAED,yBAAmB,aAAa;AAEhC,UAAI,eAAe;AAClB,gBAAQ,IAAI;AACZ,gBAAQ;AAAA,UACP,MAAM;AAAA,UACN,MAAM;AAAA,QACP;AACA,cAAM;AACN,gBAAQ,IAAI,0CAA0C;AACtD,gBAAQ,IAAI;AAAA,MACb;AAAA,IACD;AAEA,WAAO;AAAA,EACR;AACD;","names":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/shared/tryCatchAsync.ts"],"sourcesContent":["export async function tryCatchAsync<T>(get: () => Promise<T>) {\n\ttry {\n\t\treturn await get();\n\t} catch {\n\t\treturn undefined;\n\t}\n}\n"],"mappings":"AAAA,eAAsB,cAAiB,KAAuB;AAC7D,MAAI;AACH,WAAO,MAAM,IAAI;AAAA,EAClB,QAAQ;AACP,WAAO;AAAA,EACR;AACD;","names":[]}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
interface AllContributorContributor {
|
|
2
|
+
contributions: string[];
|
|
3
|
+
login: string;
|
|
4
|
+
}
|
|
5
|
+
interface AllContributorsData {
|
|
6
|
+
contributors: AllContributorContributor[];
|
|
7
|
+
}
|
|
8
|
+
interface PartialPackageData {
|
|
9
|
+
author?: {
|
|
10
|
+
email: string;
|
|
11
|
+
name: string;
|
|
12
|
+
} | string;
|
|
13
|
+
dependencies?: Record<string, string>;
|
|
14
|
+
description?: string;
|
|
15
|
+
devDependencies?: Record<string, string>;
|
|
16
|
+
email?: string;
|
|
17
|
+
name?: string;
|
|
18
|
+
repository?: {
|
|
19
|
+
type: string;
|
|
20
|
+
url: string;
|
|
21
|
+
} | string;
|
|
22
|
+
}
|
|
23
|
+
type InputBase = "everything" | "minimum" | "prompt";
|
|
24
|
+
interface Options {
|
|
25
|
+
author: string | undefined;
|
|
26
|
+
base: InputBase | undefined;
|
|
27
|
+
createRepository: boolean | undefined;
|
|
28
|
+
description: string;
|
|
29
|
+
email: string | undefined;
|
|
30
|
+
excludeCompliance: boolean | undefined;
|
|
31
|
+
excludeContributors: boolean | undefined;
|
|
32
|
+
excludeLintJson: boolean | undefined;
|
|
33
|
+
excludeLintKnip: boolean | undefined;
|
|
34
|
+
excludeLintMd: boolean | undefined;
|
|
35
|
+
excludeLintPackageJson: boolean | undefined;
|
|
36
|
+
excludeLintPackages: boolean | undefined;
|
|
37
|
+
excludeLintPerfectionist: boolean | undefined;
|
|
38
|
+
excludeLintSpelling: boolean | undefined;
|
|
39
|
+
excludeLintYml: boolean | undefined;
|
|
40
|
+
excludeReleases: boolean | undefined;
|
|
41
|
+
excludeRenovate: boolean | undefined;
|
|
42
|
+
excludeTests: boolean | undefined;
|
|
43
|
+
funding: string | undefined;
|
|
44
|
+
owner: string;
|
|
45
|
+
repository: string;
|
|
46
|
+
skipGitHubApi: boolean;
|
|
47
|
+
skipInstall: boolean | undefined;
|
|
48
|
+
skipRemoval: boolean | undefined;
|
|
49
|
+
skipRestore: boolean | undefined;
|
|
50
|
+
skipUninstall: boolean | undefined;
|
|
51
|
+
title: string;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
export { AllContributorContributor, AllContributorsData, InputBase, Options, PartialPackageData };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
//# sourceMappingURL=types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import fs from "node:fs/promises";
|
|
2
|
+
import prettier from "prettier";
|
|
3
|
+
import { getGitHubUserAsAllContributor } from "../shared/getGitHubUserAsAllContributor.js";
|
|
4
|
+
import { readFileAsJson } from "../shared/readFileAsJson.js";
|
|
5
|
+
async function addOwnerAsAllContributor(owner) {
|
|
6
|
+
const user = await getGitHubUserAsAllContributor(owner);
|
|
7
|
+
const existingContributors = await readFileAsJson(
|
|
8
|
+
"./.all-contributorsrc"
|
|
9
|
+
);
|
|
10
|
+
if (!isValidAllContributorsData(existingContributors)) {
|
|
11
|
+
throw new Error(
|
|
12
|
+
`Invalid .all-contributorsrc: ${JSON.stringify(existingContributors)}`
|
|
13
|
+
);
|
|
14
|
+
}
|
|
15
|
+
const contributors = existingContributors.contributors.filter(({ login }) => ["JoshuaKGoldberg", user].includes(login)).map(
|
|
16
|
+
(contributor) => contributor.login === "JoshuaKGoldberg" ? { ...contributor, contributions: ["tool"] } : contributor
|
|
17
|
+
);
|
|
18
|
+
if (!contributors.some((contributor) => contributor.login === user)) {
|
|
19
|
+
contributors.push({
|
|
20
|
+
contributions: ["tool"],
|
|
21
|
+
login: user
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
await fs.writeFile(
|
|
25
|
+
"./.all-contributorsrc",
|
|
26
|
+
await prettier.format(
|
|
27
|
+
JSON.stringify({
|
|
28
|
+
...existingContributors,
|
|
29
|
+
contributors
|
|
30
|
+
}),
|
|
31
|
+
{ parser: "json" }
|
|
32
|
+
)
|
|
33
|
+
);
|
|
34
|
+
}
|
|
35
|
+
function isValidAllContributorsData(value) {
|
|
36
|
+
return !!value && typeof value === "object" && "contributors" in value;
|
|
37
|
+
}
|
|
38
|
+
export {
|
|
39
|
+
addOwnerAsAllContributor
|
|
40
|
+
};
|
|
41
|
+
//# sourceMappingURL=addOwnerAsAllContributor.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/steps/addOwnerAsAllContributor.ts"],"sourcesContent":["import fs from \"node:fs/promises\";\nimport prettier from \"prettier\";\n\nimport { getGitHubUserAsAllContributor } from \"../shared/getGitHubUserAsAllContributor.js\";\nimport { readFileAsJson } from \"../shared/readFileAsJson.js\";\nimport { AllContributorsData } from \"../shared/types.js\";\n\nexport async function addOwnerAsAllContributor(owner: string) {\n\tconst user = await getGitHubUserAsAllContributor(owner);\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: contributor,\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 prettier.format(\n\t\t\tJSON.stringify({\n\t\t\t\t...existingContributors,\n\t\t\t\tcontributors,\n\t\t\t}),\n\t\t\t{ parser: \"json\" },\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,OAAO,QAAQ;AACf,OAAO,cAAc;AAErB,SAAS,qCAAqC;AAC9C,SAAS,sBAAsB;AAG/B,eAAsB,yBAAyB,OAAe;AAC7D,QAAM,OAAO,MAAM,8BAA8B,KAAK;AAEtD,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,EACJ;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,SAAS;AAAA,MACd,KAAK,UAAU;AAAA,QACd,GAAG;AAAA,QACH;AAAA,MACD,CAAC;AAAA,MACD,EAAE,QAAQ,OAAO;AAAA,IAClB;AAAA,EACD;AACD;AAEA,SAAS,2BACR,OAC+B;AAC/B,SAAO,CAAC,CAAC,SAAS,OAAO,UAAU,YAAY,kBAAkB;AAClE;","names":[]}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { $ } from "execa";
|
|
2
|
+
import { getGitHubUserAsAllContributor } from "../shared/getGitHubUserAsAllContributor.js";
|
|
3
|
+
async function addToolAllContributors(owner) {
|
|
4
|
+
const login = await getGitHubUserAsAllContributor(owner);
|
|
5
|
+
if (login !== "JoshuaKGoldberg") {
|
|
6
|
+
await $`npx -y all-contributors-cli add JoshuaKGoldberg tool`;
|
|
7
|
+
}
|
|
8
|
+
}
|
|
9
|
+
export {
|
|
10
|
+
addToolAllContributors
|
|
11
|
+
};
|
|
12
|
+
//# sourceMappingURL=addToolAllContributors.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/steps/addToolAllContributors.ts"],"sourcesContent":["import { $ } from \"execa\";\n\nimport { getGitHubUserAsAllContributor } from \"../shared/getGitHubUserAsAllContributor.js\";\n\nexport async function addToolAllContributors(owner: string) {\n\tconst login = await getGitHubUserAsAllContributor(owner);\n\n\tif (login !== \"JoshuaKGoldberg\") {\n\t\tawait $`npx -y all-contributors-cli add JoshuaKGoldberg tool`;\n\t}\n}\n"],"mappings":"AAAA,SAAS,SAAS;AAElB,SAAS,qCAAqC;AAE9C,eAAsB,uBAAuB,OAAe;AAC3D,QAAM,QAAQ,MAAM,8BAA8B,KAAK;AAEvD,MAAI,UAAU,mBAAmB;AAChC,UAAM;AAAA,EACP;AACD;","names":[]}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import fs from "node:fs/promises";
|
|
2
|
+
import prettier from "prettier";
|
|
3
|
+
async function clearChangelog() {
|
|
4
|
+
await fs.writeFile(
|
|
5
|
+
"./CHANGELOG.md",
|
|
6
|
+
await prettier.format(`# Changelog`, { parser: "markdown" })
|
|
7
|
+
);
|
|
8
|
+
}
|
|
9
|
+
export {
|
|
10
|
+
clearChangelog
|
|
11
|
+
};
|
|
12
|
+
//# sourceMappingURL=clearChangelog.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/steps/clearChangelog.ts"],"sourcesContent":["import fs from \"node:fs/promises\";\nimport prettier from \"prettier\";\n\nexport async function clearChangelog() {\n\tawait fs.writeFile(\n\t\t\"./CHANGELOG.md\",\n\t\tawait prettier.format(`# Changelog`, { parser: \"markdown\" }),\n\t);\n}\n"],"mappings":"AAAA,OAAO,QAAQ;AACf,OAAO,cAAc;AAErB,eAAsB,iBAAiB;AACtC,QAAM,GAAG;AAAA,IACR;AAAA,IACA,MAAM,SAAS,OAAO,eAAe,EAAE,QAAQ,WAAW,CAAC;AAAA,EAC5D;AACD;","names":[]}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import fs from "node:fs/promises";
|
|
2
|
+
const globPaths = [
|
|
3
|
+
...extensions(".babelrc", "cjs", "cts", "js", "json", "mjs"),
|
|
4
|
+
...extensions(".eslintrc", "js", "json", "yml"),
|
|
5
|
+
...extensions(".prettierrc", "json", "json5", "yaml", "yml"),
|
|
6
|
+
...extensions("babel.config", "cjs", "cts", "js", "json", "mjs"),
|
|
7
|
+
...extensions("jest.config", "cjs", "js", "json", "mjs", "ts"),
|
|
8
|
+
"./src/**/*.js",
|
|
9
|
+
".circleci/config.yml",
|
|
10
|
+
".babelrc",
|
|
11
|
+
".npmignore",
|
|
12
|
+
"CODE_OF_CONDUCT.md",
|
|
13
|
+
"CONTRIBUTING.md",
|
|
14
|
+
"codecov.yml",
|
|
15
|
+
"DEVELOPMENT.md",
|
|
16
|
+
"dist",
|
|
17
|
+
"lib",
|
|
18
|
+
"package-lock.json",
|
|
19
|
+
"travis.yml",
|
|
20
|
+
"yarn.lock"
|
|
21
|
+
];
|
|
22
|
+
function extensions(base, ...extensions2) {
|
|
23
|
+
return extensions2.map((extension) => [base, extension].join("."));
|
|
24
|
+
}
|
|
25
|
+
async function clearUnnecessaryFiles() {
|
|
26
|
+
for (const globPath of globPaths) {
|
|
27
|
+
await fs.rm(globPath, { force: true, recursive: true });
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
export {
|
|
31
|
+
clearUnnecessaryFiles
|
|
32
|
+
};
|
|
33
|
+
//# sourceMappingURL=clearUnnecessaryFiles.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/steps/clearUnnecessaryFiles.ts"],"sourcesContent":["import 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(\".prettierrc\", \"json\", \"json5\", \"yaml\", \"yml\"),\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\".babelrc\",\n\t\".npmignore\",\n\t\"CODE_OF_CONDUCT.md\",\n\t\"CONTRIBUTING.md\",\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\nfunction extensions(base: string, ...extensions: string[]) {\n\treturn extensions.map((extension) => [base, extension].join(\".\"));\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"],"mappings":"AAAA,OAAO,QAAQ;AAEf,MAAM,YAAY;AAAA,EACjB,GAAG,WAAW,YAAY,OAAO,OAAO,MAAM,QAAQ,KAAK;AAAA,EAC3D,GAAG,WAAW,aAAa,MAAM,QAAQ,KAAK;AAAA,EAC9C,GAAG,WAAW,eAAe,QAAQ,SAAS,QAAQ,KAAK;AAAA,EAC3D,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;AACD;AAEA,SAAS,WAAW,SAAiBA,aAAsB;AAC1D,SAAOA,YAAW,IAAI,CAAC,cAAc,CAAC,MAAM,SAAS,EAAE,KAAK,GAAG,CAAC;AACjE;AAEA,eAAsB,wBAAwB;AAC7C,aAAW,YAAY,WAAW;AACjC,UAAM,GAAG,GAAG,UAAU,EAAE,OAAO,MAAM,WAAW,KAAK,CAAC;AAAA,EACvD;AACD;","names":["extensions"]}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { getAllContributorsForRepository } from "all-contributors-for-repository";
|
|
2
|
+
import { $ } from "execa";
|
|
3
|
+
async function detectExistingContributors() {
|
|
4
|
+
const contributors = await getAllContributorsForRepository({
|
|
5
|
+
owner: "JoshuaKGoldberg",
|
|
6
|
+
repo: "create-typescript-app"
|
|
7
|
+
});
|
|
8
|
+
for (const [contributor, contributions] of Object.entries(contributors)) {
|
|
9
|
+
const contributionTypes = Object.keys(contributions).join(",");
|
|
10
|
+
await $`npx -y all-contributors-cli add ${contributor} ${contributionTypes}`;
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
export {
|
|
14
|
+
detectExistingContributors
|
|
15
|
+
};
|
|
16
|
+
//# sourceMappingURL=detectExistingContributors.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/steps/detectExistingContributors.ts"],"sourcesContent":["import { getAllContributorsForRepository } from \"all-contributors-for-repository\";\nimport { $ } from \"execa\";\n\nexport async function detectExistingContributors() {\n\tconst contributors = await getAllContributorsForRepository({\n\t\towner: \"JoshuaKGoldberg\",\n\t\trepo: \"create-typescript-app\",\n\t});\n\n\tfor (const [contributor, contributions] of Object.entries(contributors)) {\n\t\tconst contributionTypes = Object.keys(contributions).join(\",\");\n\t\tawait $`npx -y all-contributors-cli add ${contributor} ${contributionTypes}`;\n\t}\n}\n"],"mappings":"AAAA,SAAS,uCAAuC;AAChD,SAAS,SAAS;AAElB,eAAsB,6BAA6B;AAClD,QAAM,eAAe,MAAM,gCAAgC;AAAA,IAC1D,OAAO;AAAA,IACP,MAAM;AAAA,EACP,CAAC;AAED,aAAW,CAAC,aAAa,aAAa,KAAK,OAAO,QAAQ,YAAY,GAAG;AACxE,UAAM,oBAAoB,OAAO,KAAK,aAAa,EAAE,KAAK,GAAG;AAC7D,UAAM,oCAAoC,WAAW,IAAI,iBAAiB;AAAA,EAC3E;AACD;","names":[]}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { execaCommand } from "execa";
|
|
2
|
+
import { readPackageData, removeDependencies } from "../shared/packages.js";
|
|
3
|
+
async function finalizeDependencies(options) {
|
|
4
|
+
const devDependencies = [
|
|
5
|
+
"@types/eslint",
|
|
6
|
+
"@typescript-eslint/eslint-plugin",
|
|
7
|
+
"@typescript-eslint/parser",
|
|
8
|
+
"eslint",
|
|
9
|
+
"eslint-config-prettier",
|
|
10
|
+
"eslint-plugin-deprecation",
|
|
11
|
+
"eslint-plugin-eslint-comments",
|
|
12
|
+
"eslint-plugin-import",
|
|
13
|
+
"eslint-plugin-jsdoc",
|
|
14
|
+
"eslint-plugin-n",
|
|
15
|
+
"eslint-plugin-regexp",
|
|
16
|
+
"husky",
|
|
17
|
+
"lint-staged",
|
|
18
|
+
"prettier",
|
|
19
|
+
"prettier-plugin-curly",
|
|
20
|
+
"prettier-plugin-packagejson",
|
|
21
|
+
"tsup",
|
|
22
|
+
"typescript",
|
|
23
|
+
...options.excludeContributors ? [] : ["all-contributors-cli"],
|
|
24
|
+
...options.excludeLintJson ? [] : ["eslint-plugin-jsonc", "jsonc-eslint-parser"],
|
|
25
|
+
...options.excludeLintKnip ? [] : ["knip"],
|
|
26
|
+
...options.excludeLintMd ? [] : [
|
|
27
|
+
"eslint-plugin-markdown",
|
|
28
|
+
"markdownlint",
|
|
29
|
+
"markdownlint-cli",
|
|
30
|
+
"sentences-per-line"
|
|
31
|
+
],
|
|
32
|
+
...options.excludeLintPackageJson ? [] : ["npm-package-json-lint", "npm-package-json-lint-config-default"],
|
|
33
|
+
...options.excludeLintPerfectionist ? [] : ["eslint-plugin-perfectionist"],
|
|
34
|
+
...options.excludeLintSpelling ? [] : ["cspell"],
|
|
35
|
+
...options.excludeLintYml ? [] : ["eslint-plugin-yml", "yaml-eslint-parser"],
|
|
36
|
+
...options.excludeReleases ? [] : ["release-it", "should-semantic-release"],
|
|
37
|
+
...options.excludeTests ? [] : [
|
|
38
|
+
"@vitest/coverage-v8",
|
|
39
|
+
"console-fail-test",
|
|
40
|
+
"eslint-plugin-no-only-tests",
|
|
41
|
+
"eslint-plugin-vitest",
|
|
42
|
+
"vitest"
|
|
43
|
+
]
|
|
44
|
+
].filter(Boolean).sort().map((packageName) => `${packageName}@latest`).join(" ");
|
|
45
|
+
await execaCommand(`pnpm add ${devDependencies} -D`);
|
|
46
|
+
if (!options.excludeContributors) {
|
|
47
|
+
await execaCommand(`npx all-contributors-cli generate`);
|
|
48
|
+
await removeDependencies(
|
|
49
|
+
["all-contributors-cli", "all-contributors-for-repository"],
|
|
50
|
+
(await readPackageData()).devDependencies,
|
|
51
|
+
"-D"
|
|
52
|
+
);
|
|
53
|
+
}
|
|
54
|
+
await execaCommand("pnpm run format:write");
|
|
55
|
+
}
|
|
56
|
+
export {
|
|
57
|
+
finalizeDependencies
|
|
58
|
+
};
|
|
59
|
+
//# sourceMappingURL=finalizeDependencies.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/steps/finalizeDependencies.ts"],"sourcesContent":["import { execaCommand } from \"execa\";\n\nimport { readPackageData, removeDependencies } from \"../shared/packages.js\";\nimport { Options } from \"../shared/types.js\";\n\nexport async function finalizeDependencies(options: Options) {\n\tconst devDependencies = [\n\t\t\"@types/eslint\",\n\t\t\"@typescript-eslint/eslint-plugin\",\n\t\t\"@typescript-eslint/parser\",\n\t\t\"eslint\",\n\t\t\"eslint-config-prettier\",\n\t\t\"eslint-plugin-deprecation\",\n\t\t\"eslint-plugin-eslint-comments\",\n\t\t\"eslint-plugin-import\",\n\t\t\"eslint-plugin-jsdoc\",\n\t\t\"eslint-plugin-n\",\n\t\t\"eslint-plugin-regexp\",\n\t\t\"husky\",\n\t\t\"lint-staged\",\n\t\t\"prettier\",\n\t\t\"prettier-plugin-curly\",\n\t\t\"prettier-plugin-packagejson\",\n\t\t\"tsup\",\n\t\t\"typescript\",\n\t\t...(options.excludeContributors ? [] : [\"all-contributors-cli\"]),\n\t\t...(options.excludeLintJson\n\t\t\t? []\n\t\t\t: [\"eslint-plugin-jsonc\", \"jsonc-eslint-parser\"]),\n\t\t...(options.excludeLintKnip ? [] : [\"knip\"]),\n\t\t...(options.excludeLintMd\n\t\t\t? []\n\t\t\t: [\n\t\t\t\t\t\"eslint-plugin-markdown\",\n\t\t\t\t\t\"markdownlint\",\n\t\t\t\t\t\"markdownlint-cli\",\n\t\t\t\t\t\"sentences-per-line\",\n\t\t\t ]),\n\t\t...(options.excludeLintPackageJson\n\t\t\t? []\n\t\t\t: [\"npm-package-json-lint\", \"npm-package-json-lint-config-default\"]),\n\t\t...(options.excludeLintPerfectionist\n\t\t\t? []\n\t\t\t: [\"eslint-plugin-perfectionist\"]),\n\t\t...(options.excludeLintSpelling ? [] : [\"cspell\"]),\n\t\t...(options.excludeLintYml\n\t\t\t? []\n\t\t\t: [\"eslint-plugin-yml\", \"yaml-eslint-parser\"]),\n\t\t...(options.excludeReleases\n\t\t\t? []\n\t\t\t: [\"release-it\", \"should-semantic-release\"]),\n\t\t...(options.excludeTests\n\t\t\t? []\n\t\t\t: [\n\t\t\t\t\t\"@vitest/coverage-v8\",\n\t\t\t\t\t\"console-fail-test\",\n\t\t\t\t\t\"eslint-plugin-no-only-tests\",\n\t\t\t\t\t\"eslint-plugin-vitest\",\n\t\t\t\t\t\"vitest\",\n\t\t\t ]),\n\t]\n\t\t.filter(Boolean)\n\t\t.sort()\n\t\t.map((packageName) => `${packageName}@latest`)\n\t\t.join(\" \");\n\n\tawait execaCommand(`pnpm add ${devDependencies} -D`);\n\n\tif (!options.excludeContributors) {\n\t\tawait execaCommand(`npx all-contributors-cli generate`);\n\t\tawait removeDependencies(\n\t\t\t[\"all-contributors-cli\", \"all-contributors-for-repository\"],\n\t\t\t(await readPackageData()).devDependencies,\n\t\t\t\"-D\",\n\t\t);\n\t}\n\n\tawait execaCommand(\"pnpm run format:write\");\n}\n"],"mappings":"AAAA,SAAS,oBAAoB;AAE7B,SAAS,iBAAiB,0BAA0B;AAGpD,eAAsB,qBAAqB,SAAkB;AAC5D,QAAM,kBAAkB;AAAA,IACvB;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,GAAI,QAAQ,sBAAsB,CAAC,IAAI,CAAC,sBAAsB;AAAA,IAC9D,GAAI,QAAQ,kBACT,CAAC,IACD,CAAC,uBAAuB,qBAAqB;AAAA,IAChD,GAAI,QAAQ,kBAAkB,CAAC,IAAI,CAAC,MAAM;AAAA,IAC1C,GAAI,QAAQ,gBACT,CAAC,IACD;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IACA;AAAA,IACH,GAAI,QAAQ,yBACT,CAAC,IACD,CAAC,yBAAyB,sCAAsC;AAAA,IACnE,GAAI,QAAQ,2BACT,CAAC,IACD,CAAC,6BAA6B;AAAA,IACjC,GAAI,QAAQ,sBAAsB,CAAC,IAAI,CAAC,QAAQ;AAAA,IAChD,GAAI,QAAQ,iBACT,CAAC,IACD,CAAC,qBAAqB,oBAAoB;AAAA,IAC7C,GAAI,QAAQ,kBACT,CAAC,IACD,CAAC,cAAc,yBAAyB;AAAA,IAC3C,GAAI,QAAQ,eACT,CAAC,IACD;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IACA;AAAA,EACJ,EACE,OAAO,OAAO,EACd,KAAK,EACL,IAAI,CAAC,gBAAgB,GAAG,WAAW,SAAS,EAC5C,KAAK,GAAG;AAEV,QAAM,aAAa,YAAY,eAAe,KAAK;AAEnD,MAAI,CAAC,QAAQ,qBAAqB;AACjC,UAAM,aAAa,mCAAmC;AACtD,UAAM;AAAA,MACL,CAAC,wBAAwB,iCAAiC;AAAA,OACzD,MAAM,gBAAgB,GAAG;AAAA,MAC1B;AAAA,IACD;AAAA,EACD;AAEA,QAAM,aAAa,uBAAuB;AAC3C;","names":[]}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { initializeGitRemote } from "../initializeGitRemote.js";
|
|
2
|
+
import { initializeRepositorySettings } from "../initializeRepositorySettings.js";
|
|
3
|
+
import { initializeBranchProtectionSettings } from "./initializeBranchProtectionSettings.js";
|
|
4
|
+
import { initializeRepositoryLabels } from "./labels/initializeRepositoryLabels.js";
|
|
5
|
+
async function initializeGitHubRepository(octokit, options) {
|
|
6
|
+
await initializeGitRemote(options);
|
|
7
|
+
await initializeRepositorySettings(octokit, options);
|
|
8
|
+
await initializeBranchProtectionSettings(octokit, options);
|
|
9
|
+
await initializeRepositoryLabels();
|
|
10
|
+
}
|
|
11
|
+
export {
|
|
12
|
+
initializeGitHubRepository
|
|
13
|
+
};
|
|
14
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/steps/initializeGitHubRepository/index.ts"],"sourcesContent":["import { Octokit } from \"octokit\";\n\nimport { Options } from \"../../shared/types.js\";\nimport { initializeGitRemote } from \"../initializeGitRemote.js\";\nimport { initializeRepositorySettings } from \"../initializeRepositorySettings.js\";\nimport { initializeBranchProtectionSettings } from \"./initializeBranchProtectionSettings.js\";\nimport { initializeRepositoryLabels } from \"./labels/initializeRepositoryLabels.js\";\n\nexport async function initializeGitHubRepository(\n\toctokit: Octokit,\n\toptions: Options,\n) {\n\tawait initializeGitRemote(options);\n\tawait initializeRepositorySettings(octokit, options);\n\tawait initializeBranchProtectionSettings(octokit, options);\n\tawait initializeRepositoryLabels();\n}\n"],"mappings":"AAGA,SAAS,2BAA2B;AACpC,SAAS,oCAAoC;AAC7C,SAAS,0CAA0C;AACnD,SAAS,kCAAkC;AAE3C,eAAsB,2BACrB,SACA,SACC;AACD,QAAM,oBAAoB,OAAO;AACjC,QAAM,6BAA6B,SAAS,OAAO;AACnD,QAAM,mCAAmC,SAAS,OAAO;AACzD,QAAM,2BAA2B;AAClC;","names":[]}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { Octokit } from 'octokit';
|
|
2
|
+
import { Options } from '../../shared/types.js';
|
|
3
|
+
|
|
4
|
+
declare function initializeBranchProtectionSettings(octokit: Octokit, { owner, repository }: Pick<Options, "owner" | "repository">): Promise<false | undefined>;
|
|
5
|
+
|
|
6
|
+
export { initializeBranchProtectionSettings };
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
async function initializeBranchProtectionSettings(octokit, { owner, repository }) {
|
|
2
|
+
try {
|
|
3
|
+
await octokit.request(
|
|
4
|
+
`PUT /repos/${owner}/${repository}/branches/main/protection`,
|
|
5
|
+
{
|
|
6
|
+
allow_deletions: false,
|
|
7
|
+
allow_force_pushes: true,
|
|
8
|
+
allow_fork_pushes: false,
|
|
9
|
+
allow_fork_syncing: true,
|
|
10
|
+
block_creations: false,
|
|
11
|
+
branch: "main",
|
|
12
|
+
enforce_admins: false,
|
|
13
|
+
owner,
|
|
14
|
+
repo: repository,
|
|
15
|
+
required_conversation_resolution: true,
|
|
16
|
+
required_linear_history: false,
|
|
17
|
+
required_pull_request_reviews: null,
|
|
18
|
+
required_status_checks: {
|
|
19
|
+
checks: [
|
|
20
|
+
{ context: "build" },
|
|
21
|
+
{ context: "compliance" },
|
|
22
|
+
{ context: "lint" },
|
|
23
|
+
{ context: "lint_knip" },
|
|
24
|
+
{ context: "lint_markdown" },
|
|
25
|
+
{ context: "lint_package" },
|
|
26
|
+
{ context: "lint_packages" },
|
|
27
|
+
{ context: "lint_spelling" },
|
|
28
|
+
{ context: "prettier" },
|
|
29
|
+
{ context: "test" }
|
|
30
|
+
],
|
|
31
|
+
strict: false
|
|
32
|
+
},
|
|
33
|
+
restrictions: null
|
|
34
|
+
}
|
|
35
|
+
);
|
|
36
|
+
} catch (error) {
|
|
37
|
+
if (error.status === 403) {
|
|
38
|
+
return false;
|
|
39
|
+
}
|
|
40
|
+
throw error;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
export {
|
|
44
|
+
initializeBranchProtectionSettings
|
|
45
|
+
};
|
|
46
|
+
//# sourceMappingURL=initializeBranchProtectionSettings.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/steps/initializeGitHubRepository/initializeBranchProtectionSettings.ts"],"sourcesContent":["import { RequestError } from \"@octokit/request-error\";\nimport { Octokit } from \"octokit\";\n\nimport { Options } from \"../../shared/types.js\";\n\nexport async function initializeBranchProtectionSettings(\n\toctokit: Octokit,\n\t{ owner, repository }: Pick<Options, \"owner\" | \"repository\">,\n) {\n\ttry {\n\t\tawait octokit.request(\n\t\t\t`PUT /repos/${owner}/${repository}/branches/main/protection`,\n\t\t\t{\n\t\t\t\tallow_deletions: false,\n\t\t\t\tallow_force_pushes: true,\n\t\t\t\tallow_fork_pushes: false,\n\t\t\t\tallow_fork_syncing: true,\n\t\t\t\tblock_creations: false,\n\t\t\t\tbranch: \"main\",\n\t\t\t\tenforce_admins: false,\n\t\t\t\towner,\n\t\t\t\trepo: repository,\n\t\t\t\trequired_conversation_resolution: true,\n\t\t\t\trequired_linear_history: false,\n\t\t\t\trequired_pull_request_reviews: null,\n\t\t\t\trequired_status_checks: {\n\t\t\t\t\tchecks: [\n\t\t\t\t\t\t{ context: \"build\" },\n\t\t\t\t\t\t{ context: \"compliance\" },\n\t\t\t\t\t\t{ context: \"lint\" },\n\t\t\t\t\t\t{ context: \"lint_knip\" },\n\t\t\t\t\t\t{ context: \"lint_markdown\" },\n\t\t\t\t\t\t{ context: \"lint_package\" },\n\t\t\t\t\t\t{ context: \"lint_packages\" },\n\t\t\t\t\t\t{ context: \"lint_spelling\" },\n\t\t\t\t\t\t{ context: \"prettier\" },\n\t\t\t\t\t\t{ context: \"test\" },\n\t\t\t\t\t],\n\t\t\t\t\tstrict: false,\n\t\t\t\t},\n\t\t\t\trestrictions: null,\n\t\t\t},\n\t\t);\n\t} catch (error) {\n\t\tif ((error as RequestError).status === 403) {\n\t\t\treturn false;\n\t\t}\n\n\t\tthrow error;\n\t}\n}\n"],"mappings":"AAKA,eAAsB,mCACrB,SACA,EAAE,OAAO,WAAW,GACnB;AACD,MAAI;AACH,UAAM,QAAQ;AAAA,MACb,cAAc,KAAK,IAAI,UAAU;AAAA,MACjC;AAAA,QACC,iBAAiB;AAAA,QACjB,oBAAoB;AAAA,QACpB,mBAAmB;AAAA,QACnB,oBAAoB;AAAA,QACpB,iBAAiB;AAAA,QACjB,QAAQ;AAAA,QACR,gBAAgB;AAAA,QAChB;AAAA,QACA,MAAM;AAAA,QACN,kCAAkC;AAAA,QAClC,yBAAyB;AAAA,QACzB,+BAA+B;AAAA,QAC/B,wBAAwB;AAAA,UACvB,QAAQ;AAAA,YACP,EAAE,SAAS,QAAQ;AAAA,YACnB,EAAE,SAAS,aAAa;AAAA,YACxB,EAAE,SAAS,OAAO;AAAA,YAClB,EAAE,SAAS,YAAY;AAAA,YACvB,EAAE,SAAS,gBAAgB;AAAA,YAC3B,EAAE,SAAS,eAAe;AAAA,YAC1B,EAAE,SAAS,gBAAgB;AAAA,YAC3B,EAAE,SAAS,gBAAgB;AAAA,YAC3B,EAAE,SAAS,WAAW;AAAA,YACtB,EAAE,SAAS,OAAO;AAAA,UACnB;AAAA,UACA,QAAQ;AAAA,QACT;AAAA,QACA,cAAc;AAAA,MACf;AAAA,IACD;AAAA,EACD,SAAS,OAAO;AACf,QAAK,MAAuB,WAAW,KAAK;AAC3C,aAAO;AAAA,IACR;AAEA,UAAM;AAAA,EACP;AACD;","names":[]}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
const aliases = /* @__PURE__ */ new Map([
|
|
2
|
+
["enhancement", "type: feature"],
|
|
3
|
+
["help wanted", "status: accepting prs"]
|
|
4
|
+
]);
|
|
5
|
+
function getExistingEquivalentLabel(existingLabels, outcomeLabel) {
|
|
6
|
+
const outcomeTrimmed = outcomeLabel.replace(/\w+: (\w+)/, "$1");
|
|
7
|
+
return existingLabels.find((existingLabel) => {
|
|
8
|
+
return existingLabel === outcomeLabel || existingLabel === outcomeTrimmed || aliases.get(existingLabel) === outcomeLabel || existingLabel.replace(/\w+: (\w+)/, "$1") === outcomeLabel;
|
|
9
|
+
});
|
|
10
|
+
}
|
|
11
|
+
export {
|
|
12
|
+
getExistingEquivalentLabel
|
|
13
|
+
};
|
|
14
|
+
//# sourceMappingURL=getExistingEquivalentLabel.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../src/steps/initializeGitHubRepository/labels/getExistingEquivalentLabel.ts"],"sourcesContent":["const aliases = new Map([\n\t[\"enhancement\", \"type: feature\"],\n\t[\"help wanted\", \"status: accepting prs\"],\n]);\n\nexport function getExistingEquivalentLabel(\n\texistingLabels: string[],\n\toutcomeLabel: string,\n) {\n\tconst outcomeTrimmed = outcomeLabel.replace(/\\w+: (\\w+)/, \"$1\");\n\n\treturn existingLabels.find((existingLabel) => {\n\t\treturn (\n\t\t\texistingLabel === outcomeLabel ||\n\t\t\texistingLabel === outcomeTrimmed ||\n\t\t\taliases.get(existingLabel) === outcomeLabel ||\n\t\t\texistingLabel.replace(/\\w+: (\\w+)/, \"$1\") === outcomeLabel\n\t\t);\n\t});\n}\n"],"mappings":"AAAA,MAAM,UAAU,oBAAI,IAAI;AAAA,EACvB,CAAC,eAAe,eAAe;AAAA,EAC/B,CAAC,eAAe,uBAAuB;AACxC,CAAC;AAEM,SAAS,2BACf,gBACA,cACC;AACD,QAAM,iBAAiB,aAAa,QAAQ,cAAc,IAAI;AAE9D,SAAO,eAAe,KAAK,CAAC,kBAAkB;AAC7C,WACC,kBAAkB,gBAClB,kBAAkB,kBAClB,QAAQ,IAAI,aAAa,MAAM,gBAC/B,cAAc,QAAQ,cAAc,IAAI,MAAM;AAAA,EAEhD,CAAC;AACF;","names":[]}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { $ } from "execa";
|
|
2
|
+
import { getExistingEquivalentLabel } from "./getExistingEquivalentLabel.js";
|
|
3
|
+
import { outcomeLabels } from "./outcomeLabels.js";
|
|
4
|
+
async function initializeRepositoryLabels() {
|
|
5
|
+
const getLabelName = (label) => label.name;
|
|
6
|
+
const existingLabels = JSON.parse(
|
|
7
|
+
(await $`gh label list --json name`).stdout || "[]"
|
|
8
|
+
).map(getLabelName);
|
|
9
|
+
const allowedLabels = new Set(outcomeLabels.map(getLabelName));
|
|
10
|
+
for (const outcome of outcomeLabels) {
|
|
11
|
+
const existingEquivalent = getExistingEquivalentLabel(
|
|
12
|
+
existingLabels,
|
|
13
|
+
outcome.name
|
|
14
|
+
);
|
|
15
|
+
if (existingEquivalent) {
|
|
16
|
+
allowedLabels.add(existingEquivalent);
|
|
17
|
+
await $`gh label edit ${existingEquivalent} --color ${outcome.color} --description ${outcome.description} --name ${outcome.name}`;
|
|
18
|
+
} else {
|
|
19
|
+
await $`gh label create ${outcome.name} --color ${outcome.color} --description ${outcome.description}`;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
for (const existingLabel of existingLabels) {
|
|
23
|
+
if (!allowedLabels.has(existingLabel)) {
|
|
24
|
+
await $`gh label delete ${existingLabel} --yes`;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
export {
|
|
29
|
+
initializeRepositoryLabels
|
|
30
|
+
};
|
|
31
|
+
//# sourceMappingURL=initializeRepositoryLabels.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../src/steps/initializeGitHubRepository/labels/initializeRepositoryLabels.ts"],"sourcesContent":["import { $ } from \"execa\";\n\nimport { getExistingEquivalentLabel } from \"./getExistingEquivalentLabel.js\";\nimport { outcomeLabels } from \"./outcomeLabels.js\";\n\ninterface GhLabelData {\n\tname: string;\n}\n\nexport async function initializeRepositoryLabels() {\n\tconst getLabelName = (label: { name: string }) => label.name;\n\n\tconst existingLabels = (\n\t\tJSON.parse(\n\t\t\t(await $`gh label list --json name`).stdout || \"[]\",\n\t\t) as GhLabelData[]\n\t).map(getLabelName);\n\tconst allowedLabels = new Set(outcomeLabels.map(getLabelName));\n\n\tfor (const outcome of outcomeLabels) {\n\t\tconst existingEquivalent = getExistingEquivalentLabel(\n\t\t\texistingLabels,\n\t\t\toutcome.name,\n\t\t);\n\n\t\tif (existingEquivalent) {\n\t\t\tallowedLabels.add(existingEquivalent);\n\t\t\tawait $`gh label edit ${existingEquivalent} --color ${outcome.color} --description ${outcome.description} --name ${outcome.name}`;\n\t\t} else {\n\t\t\tawait $`gh label create ${outcome.name} --color ${outcome.color} --description ${outcome.description}`;\n\t\t}\n\t}\n\n\tfor (const existingLabel of existingLabels) {\n\t\tif (!allowedLabels.has(existingLabel)) {\n\t\t\tawait $`gh label delete ${existingLabel} --yes`;\n\t\t}\n\t}\n}\n"],"mappings":"AAAA,SAAS,SAAS;AAElB,SAAS,kCAAkC;AAC3C,SAAS,qBAAqB;AAM9B,eAAsB,6BAA6B;AAClD,QAAM,eAAe,CAAC,UAA4B,MAAM;AAExD,QAAM,iBACL,KAAK;AAAA,KACH,MAAM,8BAA8B,UAAU;AAAA,EAChD,EACC,IAAI,YAAY;AAClB,QAAM,gBAAgB,IAAI,IAAI,cAAc,IAAI,YAAY,CAAC;AAE7D,aAAW,WAAW,eAAe;AACpC,UAAM,qBAAqB;AAAA,MAC1B;AAAA,MACA,QAAQ;AAAA,IACT;AAEA,QAAI,oBAAoB;AACvB,oBAAc,IAAI,kBAAkB;AACpC,YAAM,kBAAkB,kBAAkB,YAAY,QAAQ,KAAK,kBAAkB,QAAQ,WAAW,WAAW,QAAQ,IAAI;AAAA,IAChI,OAAO;AACN,YAAM,oBAAoB,QAAQ,IAAI,YAAY,QAAQ,KAAK,kBAAkB,QAAQ,WAAW;AAAA,IACrG;AAAA,EACD;AAEA,aAAW,iBAAiB,gBAAgB;AAC3C,QAAI,CAAC,cAAc,IAAI,aAAa,GAAG;AACtC,YAAM,oBAAoB,aAAa;AAAA,IACxC;AAAA,EACD;AACD;","names":[]}
|