create-typescript-app 1.52.7 → 1.54.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +10 -8
- package/lib/create/createWithOptions.js +10 -9
- package/lib/create/createWithOptions.js.map +1 -1
- package/lib/initialize/initializeWithOptions.js +3 -8
- package/lib/initialize/initializeWithOptions.js.map +1 -1
- package/lib/migrate/migrateWithOptions.js +7 -9
- package/lib/migrate/migrateWithOptions.js.map +1 -1
- package/lib/shared/createCleanupCommands.d.ts +7 -0
- package/lib/shared/{createCleanUpFilesCommands.js → createCleanupCommands.js} +5 -5
- package/lib/shared/createCleanupCommands.js.map +1 -0
- package/lib/shared/options/createOptionDefaults/index.js +1 -1
- package/lib/shared/options/createOptionDefaults/index.js.map +1 -1
- package/lib/shared/readFileSafe.js +1 -1
- package/lib/shared/readFileSafe.js.map +1 -1
- package/lib/steps/addOwnerAsAllContributor.js +6 -9
- package/lib/steps/addOwnerAsAllContributor.js.map +1 -1
- package/lib/steps/clearChangelog.js +1 -1
- package/lib/steps/clearChangelog.js.map +1 -1
- package/lib/steps/clearUnnecessaryFiles.js +2 -1
- package/lib/steps/clearUnnecessaryFiles.js.map +1 -1
- package/lib/steps/initializeGitHubRepository/labels/outcomeLabels.js +1 -1
- package/lib/steps/initializeGitHubRepository/labels/outcomeLabels.js.map +1 -1
- package/lib/steps/populateCSpellDictionary.d.ts +3 -0
- package/lib/steps/populateCSpellDictionary.js +36 -0
- package/lib/steps/populateCSpellDictionary.js.map +1 -0
- package/lib/steps/removeSetupScripts.js +1 -1
- package/lib/steps/removeSetupScripts.js.map +1 -1
- package/lib/steps/runCleanup.d.ts +7 -0
- package/lib/steps/{runCommands.js → runCleanup.js} +8 -4
- package/lib/steps/runCleanup.js.map +1 -0
- package/lib/steps/uninstallPackages.js +1 -0
- package/lib/steps/uninstallPackages.js.map +1 -1
- package/lib/steps/updateAllContributorsTable.js +9 -12
- package/lib/steps/updateAllContributorsTable.js.map +1 -1
- package/lib/steps/updateLocalFiles.js +31 -19
- package/lib/steps/updateLocalFiles.js.map +1 -1
- package/lib/steps/updateReadme.js +1 -1
- package/lib/steps/updateReadme.js.map +1 -1
- package/lib/steps/writeReadme/index.js +1 -1
- package/lib/steps/writeReadme/index.js.map +1 -1
- package/lib/steps/writing/creation/dotGitHub/actions.js +1 -1
- package/lib/steps/writing/creation/dotGitHub/actions.js.map +1 -1
- package/lib/steps/writing/creation/dotGitHub/createDevelopment/index.d.ts +7 -0
- package/lib/steps/writing/creation/dotGitHub/{createDevelopment.js → createDevelopment/index.js} +79 -60
- package/lib/steps/writing/creation/dotGitHub/createDevelopment/index.js.map +1 -0
- package/lib/steps/writing/creation/dotGitHub/createDevelopment/splitIntoSections.d.ts +3 -0
- package/lib/steps/writing/creation/dotGitHub/createDevelopment/splitIntoSections.js +24 -0
- package/lib/steps/writing/creation/dotGitHub/createDevelopment/splitIntoSections.js.map +1 -0
- package/lib/steps/writing/creation/dotGitHub/createDotGitHubFiles.js +2 -2
- package/lib/steps/writing/creation/dotGitHub/createDotGitHubFiles.js.map +1 -1
- package/lib/steps/writing/creation/dotGitHub/createWorkflows.js +1 -1
- package/lib/steps/writing/creation/dotGitHub/createWorkflows.js.map +1 -1
- package/lib/steps/writing/creation/dotVSCode.d.ts +1 -0
- package/lib/steps/writing/creation/dotVSCode.js +35 -12
- package/lib/steps/writing/creation/dotVSCode.js.map +1 -1
- package/lib/steps/writing/creation/formatters/formatJson.js +2 -1
- package/lib/steps/writing/creation/formatters/formatJson.js.map +1 -1
- package/lib/steps/writing/creation/rootFiles.d.ts +1 -1
- package/lib/steps/writing/creation/rootFiles.js +3 -23
- package/lib/steps/writing/creation/rootFiles.js.map +1 -1
- package/lib/steps/writing/creation/writePackageJson.js +1 -1
- package/lib/steps/writing/creation/writePackageJson.js.map +1 -1
- package/package.json +6 -5
- package/lib/shared/createCleanUpFilesCommands.d.ts +0 -7
- package/lib/shared/createCleanUpFilesCommands.js.map +0 -1
- package/lib/steps/runCommands.d.ts +0 -3
- package/lib/steps/runCommands.js.map +0 -1
- package/lib/steps/writing/creation/dotGitHub/createDevelopment.d.ts +0 -7
- package/lib/steps/writing/creation/dotGitHub/createDevelopment.js.map +0 -1
|
@@ -1,10 +1,14 @@
|
|
|
1
1
|
import chalk from "chalk";
|
|
2
2
|
import { execaCommand } from "execa";
|
|
3
|
+
import { rimraf } from "rimraf";
|
|
3
4
|
import { logLine } from "../shared/cli/lines.js";
|
|
4
5
|
import { withSpinner } from "../shared/cli/spinners.js";
|
|
5
|
-
async function
|
|
6
|
+
async function runCleanup(commands, mode) {
|
|
6
7
|
const failed = [];
|
|
7
|
-
await withSpinner(
|
|
8
|
+
await withSpinner("Cleaning up files", async () => {
|
|
9
|
+
if (mode === "migrate") {
|
|
10
|
+
await rimraf("coverage*");
|
|
11
|
+
}
|
|
8
12
|
for (const command of commands) {
|
|
9
13
|
try {
|
|
10
14
|
await execaCommand(command);
|
|
@@ -28,6 +32,6 @@ async function runCommands(label, commands) {
|
|
|
28
32
|
}
|
|
29
33
|
}
|
|
30
34
|
export {
|
|
31
|
-
|
|
35
|
+
runCleanup
|
|
32
36
|
};
|
|
33
|
-
//# sourceMappingURL=
|
|
37
|
+
//# sourceMappingURL=runCleanup.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/steps/runCleanup.ts"],"sourcesContent":["import chalk from \"chalk\";\nimport { execaCommand } from \"execa\";\nimport { rimraf } from \"rimraf\";\n\nimport { logLine } from \"../shared/cli/lines.js\";\nimport { withSpinner } from \"../shared/cli/spinners.js\";\nimport { Mode } from \"../shared/types.js\";\n\nexport async function runCleanup(commands: string[], mode: Mode) {\n\tconst failed: string[] = [];\n\n\tawait withSpinner(\"Cleaning up files\", async () => {\n\t\tif (mode === \"migrate\") {\n\t\t\t// Coverage folders can slow down format and lint times something awful.\n\t\t\t// https://github.com/JoshuaKGoldberg/create-typescript-app/issues/1221\n\t\t\tawait rimraf(\"coverage*\");\n\t\t}\n\n\t\tfor (const command of commands) {\n\t\t\ttry {\n\t\t\t\tawait execaCommand(command);\n\t\t\t} catch {\n\t\t\t\tfailed.push(command);\n\t\t\t}\n\t\t}\n\t});\n\n\tif (!failed.length) {\n\t\treturn;\n\t}\n\n\tlogLine();\n\n\tfor (const command of failed) {\n\t\tlogLine(\n\t\t\t[\n\t\t\t\tchalk.yellow(`🟡 Running \\``),\n\t\t\t\tchalk.yellowBright(command),\n\t\t\t\tchalk.yellow(`\\` failed. You should run it and fix its complaints.`),\n\t\t\t].join(\"\"),\n\t\t);\n\t}\n}\n"],"mappings":"AAAA,OAAO,WAAW;AAClB,SAAS,oBAAoB;AAC7B,SAAS,cAAc;AAEvB,SAAS,eAAe;AACxB,SAAS,mBAAmB;AAG5B,eAAsB,WAAW,UAAoB,MAAY;AAChE,QAAM,SAAmB,CAAC;AAE1B,QAAM,YAAY,qBAAqB,YAAY;AAClD,QAAI,SAAS,WAAW;AAGvB,YAAM,OAAO,WAAW;AAAA,IACzB;AAEA,eAAW,WAAW,UAAU;AAC/B,UAAI;AACH,cAAM,aAAa,OAAO;AAAA,MAC3B,QAAQ;AACP,eAAO,KAAK,OAAO;AAAA,MACpB;AAAA,IACD;AAAA,EACD,CAAC;AAED,MAAI,CAAC,OAAO,QAAQ;AACnB;AAAA,EACD;AAEA,UAAQ;AAER,aAAW,WAAW,QAAQ;AAC7B;AAAA,MACC;AAAA,QACC,MAAM,OAAO,sBAAe;AAAA,QAC5B,MAAM,aAAa,OAAO;AAAA,QAC1B,MAAM,OAAO,sDAAsD;AAAA,MACpE,EAAE,KAAK,EAAE;AAAA,IACV;AAAA,EACD;AACD;","names":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/steps/uninstallPackages.ts"],"sourcesContent":["import { $ } from \"execa\";\n\nimport { readPackageData, removeDependencies } from \"../shared/packages.js\";\n\nexport async function uninstallPackages(offline: boolean | undefined) {\n\tconst packageData = await readPackageData();\n\n\tawait removeDependencies(\n\t\t[\n\t\t\t\"@clack/prompts\",\n\t\t\t\"all-contributors-for-repository\",\n\t\t\t\"chalk\",\n\t\t\t\"execa\",\n\t\t\t\"git-remote-origin-url\",\n\t\t\t\"git-url-parse\",\n\t\t\t\"lazy-value\",\n\t\t\t\"js-yaml\",\n\t\t\t\"npm-user\",\n\t\t\t\"parse-author\",\n\t\t\t\"octokit\",\n\t\t\t\"prettier\",\n\t\t\t\"replace-in-file\",\n\t\t\t\"title-case\",\n\t\t\t\"zod\",\n\t\t\t\"zod-validation-error\",\n\t\t],\n\t\tpackageData.dependencies,\n\t);\n\n\tawait removeDependencies(\n\t\t[\n\t\t\t\"@octokit/request-error\",\n\t\t\t\"@types/git-url-parse\",\n\t\t\t\"@types/js-yaml\",\n\t\t\t\"@types/parse-author\",\n\t\t\t\"@types/prettier\",\n\t\t\t\"all-contributors-cli\",\n\t\t\t\"c8\",\n\t\t\t\"eslint-config-prettier\",\n\t\t\t\"globby\",\n\t\t\t\"tsx\",\n\t\t],\n\t\tpackageData.devDependencies,\n\t\t\"-D\",\n\t);\n\n\tawait $`pnpm add prettier -D${offline ? \" --offline\" : \"\"}`;\n}\n"],"mappings":"AAAA,SAAS,SAAS;AAElB,SAAS,iBAAiB,0BAA0B;AAEpD,eAAsB,kBAAkB,SAA8B;AACrE,QAAM,cAAc,MAAM,gBAAgB;AAE1C,QAAM;AAAA,IACL;AAAA,MACC;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IACD;AAAA,IACA,YAAY;AAAA,EACb;AAEA,QAAM;AAAA,IACL;AAAA,MACC;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IACD;AAAA,IACA,YAAY;AAAA,IACZ;AAAA,EACD;AAEA,QAAM,wBAAwB,UAAU,eAAe,EAAE;AAC1D;","names":[]}
|
|
1
|
+
{"version":3,"sources":["../../src/steps/uninstallPackages.ts"],"sourcesContent":["import { $ } from \"execa\";\n\nimport { readPackageData, removeDependencies } from \"../shared/packages.js\";\n\nexport async function uninstallPackages(offline: boolean | undefined) {\n\tconst packageData = await readPackageData();\n\n\tawait removeDependencies(\n\t\t[\n\t\t\t\"@clack/prompts\",\n\t\t\t\"all-contributors-for-repository\",\n\t\t\t\"chalk\",\n\t\t\t\"execa\",\n\t\t\t\"git-remote-origin-url\",\n\t\t\t\"git-url-parse\",\n\t\t\t\"lazy-value\",\n\t\t\t\"js-yaml\",\n\t\t\t\"npm-user\",\n\t\t\t\"parse-author\",\n\t\t\t\"octokit\",\n\t\t\t\"prettier\",\n\t\t\t\"replace-in-file\",\n\t\t\t\"title-case\",\n\t\t\t\"zod\",\n\t\t\t\"zod-validation-error\",\n\t\t],\n\t\tpackageData.dependencies,\n\t);\n\n\tawait removeDependencies(\n\t\t[\n\t\t\t\"@octokit/request-error\",\n\t\t\t\"@types/git-url-parse\",\n\t\t\t\"@types/js-yaml\",\n\t\t\t\"@types/parse-author\",\n\t\t\t\"@types/prettier\",\n\t\t\t\"all-contributors-cli\",\n\t\t\t\"c8\",\n\t\t\t\"eslint-config-prettier\",\n\t\t\t\"globby\",\n\t\t\t\"rimraf\",\n\t\t\t\"tsx\",\n\t\t],\n\t\tpackageData.devDependencies,\n\t\t\"-D\",\n\t);\n\n\tawait $`pnpm add prettier -D${offline ? \" --offline\" : \"\"}`;\n}\n"],"mappings":"AAAA,SAAS,SAAS;AAElB,SAAS,iBAAiB,0BAA0B;AAEpD,eAAsB,kBAAkB,SAA8B;AACrE,QAAM,cAAc,MAAM,gBAAgB;AAE1C,QAAM;AAAA,IACL;AAAA,MACC;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IACD;AAAA,IACA,YAAY;AAAA,EACb;AAEA,QAAM;AAAA,IACL;AAAA,MACC;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IACD;AAAA,IACA,YAAY;AAAA,IACZ;AAAA,EACD;AAEA,QAAM,wBAAwB,UAAU,eAAe,EAAE;AAC1D;","names":[]}
|
|
@@ -1,23 +1,20 @@
|
|
|
1
1
|
import { $ } from "execa";
|
|
2
|
-
import fs from "node:fs/promises";
|
|
3
|
-
import prettier from "prettier";
|
|
2
|
+
import * as fs from "node:fs/promises";
|
|
4
3
|
import { readFileSafeAsJson } from "../shared/readFileSafeAsJson.js";
|
|
4
|
+
import { formatJson } from "./writing/creation/formatters/formatJson.js";
|
|
5
5
|
async function updateAllContributorsTable({
|
|
6
6
|
owner,
|
|
7
7
|
repository
|
|
8
8
|
}) {
|
|
9
9
|
await fs.writeFile(
|
|
10
10
|
".all-contributorsrc",
|
|
11
|
-
await
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
}),
|
|
19
|
-
{ parser: "json" }
|
|
20
|
-
)
|
|
11
|
+
await formatJson({
|
|
12
|
+
...await readFileSafeAsJson(
|
|
13
|
+
".all-contributorsrc"
|
|
14
|
+
),
|
|
15
|
+
projectName: repository,
|
|
16
|
+
projectOwner: owner
|
|
17
|
+
})
|
|
21
18
|
);
|
|
22
19
|
await $`npx -y all-contributors-cli generate`;
|
|
23
20
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/steps/updateAllContributorsTable.ts"],"sourcesContent":["import { $ } from \"execa\";\nimport fs from \"node:fs/promises\";\
|
|
1
|
+
{"version":3,"sources":["../../src/steps/updateAllContributorsTable.ts"],"sourcesContent":["import { $ } from \"execa\";\nimport * as fs from \"node:fs/promises\";\n\nimport { readFileSafeAsJson } from \"../shared/readFileSafeAsJson.js\";\nimport { AllContributorsData, Options } from \"../shared/types.js\";\nimport { formatJson } from \"./writing/creation/formatters/formatJson.js\";\n\nexport async function updateAllContributorsTable({\n\towner,\n\trepository,\n}: Pick<Options, \"owner\" | \"repository\">) {\n\tawait fs.writeFile(\n\t\t\".all-contributorsrc\",\n\t\tawait formatJson({\n\t\t\t...((await readFileSafeAsJson(\n\t\t\t\t\".all-contributorsrc\",\n\t\t\t)) as AllContributorsData),\n\t\t\tprojectName: repository,\n\t\t\tprojectOwner: owner,\n\t\t}),\n\t);\n\n\tawait $`npx -y all-contributors-cli generate`;\n}\n"],"mappings":"AAAA,SAAS,SAAS;AAClB,YAAY,QAAQ;AAEpB,SAAS,0BAA0B;AAEnC,SAAS,kBAAkB;AAE3B,eAAsB,2BAA2B;AAAA,EAChD;AAAA,EACA;AACD,GAA0C;AACzC,QAAM,GAAG;AAAA,IACR;AAAA,IACA,MAAM,WAAW;AAAA,MAChB,GAAK,MAAM;AAAA,QACV;AAAA,MACD;AAAA,MACA,aAAa;AAAA,MACb,cAAc;AAAA,IACf,CAAC;AAAA,EACF;AAEA,QAAM;AACP;","names":[]}
|
|
@@ -11,27 +11,39 @@ async function updateLocalFiles(options) {
|
|
|
11
11
|
[/create-typescript-app/g, options.repository],
|
|
12
12
|
[/\/\*\n.+\*\/\n\n/gs, ``, ".eslintrc.cjs"],
|
|
13
13
|
[/"author": ".+"/g, `"author": "${options.author}"`, "./package.json"],
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
14
|
+
...options.mode === "migrate" ? [] : [
|
|
15
|
+
// Only creating a new repository should remove these parts.
|
|
16
|
+
// Existing ones might coincidentally have them too.
|
|
17
|
+
[/"test:create": ".+\n/g, ``, "./package.json"],
|
|
18
|
+
[/"test:initialize": ".*/g, ``, "./package.json"],
|
|
19
|
+
[/"initialize": ".*/g, ``, "./package.json"],
|
|
20
|
+
[/"test:migrate": ".+\n/g, ``, "./package.json"],
|
|
21
|
+
[
|
|
22
|
+
/## Getting Started.*## Development/gs,
|
|
23
|
+
`## Development`,
|
|
24
|
+
"./README.md"
|
|
25
|
+
],
|
|
26
|
+
[/\n## Setup Scripts.*$/gs, "", "./.github/DEVELOPMENT.md"],
|
|
27
|
+
[` "src/initialize/index.ts",
|
|
21
28
|
`, ``, "./knip.jsonc"],
|
|
22
|
-
|
|
29
|
+
[` "src/migrate/index.ts",
|
|
23
30
|
`, ``, "./knip.jsonc"],
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
31
|
+
[
|
|
32
|
+
`["src/index.ts!", "script/initialize*.js"]`,
|
|
33
|
+
`"src/index.ts!"`,
|
|
34
|
+
"./knip.jsonc"
|
|
35
|
+
],
|
|
36
|
+
[
|
|
37
|
+
`["src/**/*.ts!", "script/**/*.js"]`,
|
|
38
|
+
`"src/**/*.ts!"`,
|
|
39
|
+
"./knip.jsonc"
|
|
40
|
+
],
|
|
41
|
+
// Edge case: migration scripts will rewrite README.md attribution
|
|
42
|
+
[
|
|
43
|
+
/> 💙 This package was templated with .+\./g,
|
|
44
|
+
endOfReadmeTemplateLine,
|
|
45
|
+
"./README.md"
|
|
46
|
+
]
|
|
35
47
|
]
|
|
36
48
|
];
|
|
37
49
|
if (existingPackage.description) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/steps/updateLocalFiles.ts"],"sourcesContent":["import replaceInFile, { From, To } from \"replace-in-file\";\n\nimport { readFileSafeAsJson } from \"../shared/readFileSafeAsJson.js\";\nimport { Options } from \"../shared/types.js\";\nimport { createJoshuaKGoldbergReplacement } from \"./createJoshuaKGoldbergReplacement.js\";\nimport { endOfReadmeTemplateLine } from \"./updateReadme.js\";\n\ninterface ExistingPackageData {\n\tdescription?: string;\n\tversion?: string;\n}\n\nexport async function updateLocalFiles(options: Options) {\n\tconst existingPackage = ((await readFileSafeAsJson(\"./package.json\")) ??\n\t\t{}) as ExistingPackageData;\n\n\tconst replacements: [From, To, (string | string[])?][] = [\n\t\t[/Create TypeScript App/g, options.title],\n\t\tcreateJoshuaKGoldbergReplacement(options),\n\t\t[/JoshuaKGoldberg/g, options.owner, \"package.json\"],\n\t\t[/create-typescript-app/g, options.repository],\n\t\t[/\\/\\*\\n.+\\*\\/\\n\\n/gs, ``, \".eslintrc.cjs\"],\n\t\t[/\"author\": \".+\"/g, `\"author\": \"${options.author}\"`, \"./package.json\"],\n\t\t[/\"test:create\": \".+\\n/g, ``, \"./package.json\"],\n\t\t[/\"test:initialize\": \".*/g, ``, \"./package.json\"],\n\t\t[/\"initialize\": \".*/g, ``, \"./package.json\"],\n\t\t[/\"test:migrate\": \".+\\n/g, ``, \"./package.json\"],\n\t\t[/## Getting Started.*## Development/gs
|
|
1
|
+
{"version":3,"sources":["../../src/steps/updateLocalFiles.ts"],"sourcesContent":["import replaceInFile, { From, To } from \"replace-in-file\";\n\nimport { readFileSafeAsJson } from \"../shared/readFileSafeAsJson.js\";\nimport { Options } from \"../shared/types.js\";\nimport { createJoshuaKGoldbergReplacement } from \"./createJoshuaKGoldbergReplacement.js\";\nimport { endOfReadmeTemplateLine } from \"./updateReadme.js\";\n\ninterface ExistingPackageData {\n\tdescription?: string;\n\tversion?: string;\n}\n\nexport async function updateLocalFiles(options: Options) {\n\tconst existingPackage = ((await readFileSafeAsJson(\"./package.json\")) ??\n\t\t{}) as ExistingPackageData;\n\n\tconst replacements: [From, To, (string | string[])?][] = [\n\t\t[/Create TypeScript App/g, options.title],\n\t\tcreateJoshuaKGoldbergReplacement(options),\n\t\t[/JoshuaKGoldberg/g, options.owner, \"package.json\"],\n\t\t[/create-typescript-app/g, options.repository],\n\t\t[/\\/\\*\\n.+\\*\\/\\n\\n/gs, ``, \".eslintrc.cjs\"],\n\t\t[/\"author\": \".+\"/g, `\"author\": \"${options.author}\"`, \"./package.json\"],\n\t\t...(options.mode === \"migrate\"\n\t\t\t? []\n\t\t\t: ([\n\t\t\t\t\t// Only creating a new repository should remove these parts.\n\t\t\t\t\t// Existing ones might coincidentally have them too.\n\t\t\t\t\t[/\"test:create\": \".+\\n/g, ``, \"./package.json\"],\n\t\t\t\t\t[/\"test:initialize\": \".*/g, ``, \"./package.json\"],\n\t\t\t\t\t[/\"initialize\": \".*/g, ``, \"./package.json\"],\n\t\t\t\t\t[/\"test:migrate\": \".+\\n/g, ``, \"./package.json\"],\n\t\t\t\t\t[\n\t\t\t\t\t\t/## Getting Started.*## Development/gs,\n\t\t\t\t\t\t`## Development`,\n\t\t\t\t\t\t\"./README.md\",\n\t\t\t\t\t],\n\t\t\t\t\t[/\\n## Setup Scripts.*$/gs, \"\", \"./.github/DEVELOPMENT.md\"],\n\t\t\t\t\t[`\\t\\t\"src/initialize/index.ts\",\\n`, ``, \"./knip.jsonc\"],\n\t\t\t\t\t[`\\t\\t\"src/migrate/index.ts\",\\n`, ``, \"./knip.jsonc\"],\n\t\t\t\t\t[\n\t\t\t\t\t\t`[\"src/index.ts!\", \"script/initialize*.js\"]`,\n\t\t\t\t\t\t`\"src/index.ts!\"`,\n\t\t\t\t\t\t\"./knip.jsonc\",\n\t\t\t\t\t],\n\t\t\t\t\t[\n\t\t\t\t\t\t`[\"src/**/*.ts!\", \"script/**/*.js\"]`,\n\t\t\t\t\t\t`\"src/**/*.ts!\"`,\n\t\t\t\t\t\t\"./knip.jsonc\",\n\t\t\t\t\t],\n\t\t\t\t\t// Edge case: migration scripts will rewrite README.md attribution\n\t\t\t\t\t[\n\t\t\t\t\t\t/> 💙 This package was templated with .+\\./g,\n\t\t\t\t\t\tendOfReadmeTemplateLine,\n\t\t\t\t\t\t\"./README.md\",\n\t\t\t\t\t],\n\t\t\t ] as typeof replacements)),\n\t];\n\n\tif (existingPackage.description) {\n\t\treplacements.push([existingPackage.description, options.description]);\n\t}\n\n\tif (options.mode !== \"migrate\") {\n\t\treplacements.push([/\"bin\": \".+\\n/g, ``, \"./package.json\"]);\n\n\t\tif (options.mode === \"initialize\" && existingPackage.version) {\n\t\t\treplacements.push([\n\t\t\t\tnew RegExp(`\"version\": \"${existingPackage.version}\"`, \"g\"),\n\t\t\t\t`\"version\": \"0.0.0\"`,\n\t\t\t\t\"./package.json\",\n\t\t\t]);\n\t\t}\n\t}\n\n\tfor (const [from, to, files = [\"./.github/**/*\", \"./*.*\"]] of replacements) {\n\t\ttry {\n\t\t\tawait replaceInFile({\n\t\t\t\tallowEmptyPaths: true,\n\t\t\t\tfiles,\n\t\t\t\tfrom,\n\t\t\t\tto,\n\t\t\t});\n\t\t} catch (error) {\n\t\t\tconst toString = typeof to === \"function\" ? \"(function)\" : to;\n\t\t\tthrow new Error(\n\t\t\t\t`Failed to replace ${from.toString()} with ${toString} in ${files.toString()}`,\n\t\t\t\t{\n\t\t\t\t\tcause: error,\n\t\t\t\t},\n\t\t\t);\n\t\t}\n\t}\n}\n"],"mappings":"AAAA,OAAO,mBAAiC;AAExC,SAAS,0BAA0B;AAEnC,SAAS,wCAAwC;AACjD,SAAS,+BAA+B;AAOxC,eAAsB,iBAAiB,SAAkB;AACxD,QAAM,kBAAoB,MAAM,mBAAmB,gBAAgB,KAClE,CAAC;AAEF,QAAM,eAAmD;AAAA,IACxD,CAAC,0BAA0B,QAAQ,KAAK;AAAA,IACxC,iCAAiC,OAAO;AAAA,IACxC,CAAC,oBAAoB,QAAQ,OAAO,cAAc;AAAA,IAClD,CAAC,0BAA0B,QAAQ,UAAU;AAAA,IAC7C,CAAC,sBAAsB,IAAI,eAAe;AAAA,IAC1C,CAAC,mBAAmB,cAAc,QAAQ,MAAM,KAAK,gBAAgB;AAAA,IACrE,GAAI,QAAQ,SAAS,YAClB,CAAC,IACA;AAAA;AAAA;AAAA,MAGD,CAAC,yBAAyB,IAAI,gBAAgB;AAAA,MAC9C,CAAC,2BAA2B,IAAI,gBAAgB;AAAA,MAChD,CAAC,sBAAsB,IAAI,gBAAgB;AAAA,MAC3C,CAAC,0BAA0B,IAAI,gBAAgB;AAAA,MAC/C;AAAA,QACC;AAAA,QACA;AAAA,QACA;AAAA,MACD;AAAA,MACA,CAAC,2BAA2B,IAAI,0BAA0B;AAAA,MAC1D,CAAC;AAAA,GAAoC,IAAI,cAAc;AAAA,MACvD,CAAC;AAAA,GAAiC,IAAI,cAAc;AAAA,MACpD;AAAA,QACC;AAAA,QACA;AAAA,QACA;AAAA,MACD;AAAA,MACA;AAAA,QACC;AAAA,QACA;AAAA,QACA;AAAA,MACD;AAAA;AAAA,MAEA;AAAA,QACC;AAAA,QACA;AAAA,QACA;AAAA,MACD;AAAA,IACA;AAAA,EACJ;AAEA,MAAI,gBAAgB,aAAa;AAChC,iBAAa,KAAK,CAAC,gBAAgB,aAAa,QAAQ,WAAW,CAAC;AAAA,EACrE;AAEA,MAAI,QAAQ,SAAS,WAAW;AAC/B,iBAAa,KAAK,CAAC,iBAAiB,IAAI,gBAAgB,CAAC;AAEzD,QAAI,QAAQ,SAAS,gBAAgB,gBAAgB,SAAS;AAC7D,mBAAa,KAAK;AAAA,QACjB,IAAI,OAAO,eAAe,gBAAgB,OAAO,KAAK,GAAG;AAAA,QACzD;AAAA,QACA;AAAA,MACD,CAAC;AAAA,IACF;AAAA,EACD;AAEA,aAAW,CAAC,MAAM,IAAI,QAAQ,CAAC,kBAAkB,OAAO,CAAC,KAAK,cAAc;AAC3E,QAAI;AACH,YAAM,cAAc;AAAA,QACnB,iBAAiB;AAAA,QACjB;AAAA,QACA;AAAA,QACA;AAAA,MACD,CAAC;AAAA,IACF,SAAS,OAAO;AACf,YAAM,WAAW,OAAO,OAAO,aAAa,eAAe;AAC3D,YAAM,IAAI;AAAA,QACT,qBAAqB,KAAK,SAAS,CAAC,SAAS,QAAQ,OAAO,MAAM,SAAS,CAAC;AAAA,QAC5E;AAAA,UACC,OAAO;AAAA,QACR;AAAA,MACD;AAAA,IACD;AAAA,EACD;AACD;","names":[]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import fs from "node:fs/promises";
|
|
1
|
+
import * as fs from "node:fs/promises";
|
|
2
2
|
import { EOL } from "node:os";
|
|
3
3
|
import { readFileSafe } from "../shared/readFileSafe.js";
|
|
4
4
|
const endOfReadmeTemplateLine = `> \u{1F499} This package was templated with [\`create-typescript-app\`](https://github.com/JoshuaKGoldberg/create-typescript-app).`;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/steps/updateReadme.ts"],"sourcesContent":["import 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(options: Pick<Options, \"owner\">) {\n\tlet contents = await readFileSafe(\"./README.md\", \"\");\n\n\tcontents = contents.replaceAll(\"JoshuaKGoldberg\", options.owner);\n\n\tif (!endOfReadmeMatcher.test(contents)) {\n\t\tcontents += endOfReadmeNotice;\n\t}\n\n\tawait fs.writeFile(\"./README.md\", contents);\n}\n"],"mappings":"AAAA,
|
|
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(options: Pick<Options, \"owner\">) {\n\tlet contents = await readFileSafe(\"./README.md\", \"\");\n\n\tcontents = contents.replaceAll(\"JoshuaKGoldberg\", options.owner);\n\n\tif (!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,aAAa,SAAiC;AACnE,MAAI,WAAW,MAAM,aAAa,eAAe,EAAE;AAEnD,aAAW,SAAS,WAAW,mBAAmB,QAAQ,KAAK;AAE/D,MAAI,CAAC,mBAAmB,KAAK,QAAQ,GAAG;AACvC,gBAAY;AAAA,EACb;AAEA,QAAM,GAAG,UAAU,eAAe,QAAQ;AAC3C;","names":[]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import fs from "node:fs/promises";
|
|
1
|
+
import * as fs from "node:fs/promises";
|
|
2
2
|
import { readFileSafe } from "../../shared/readFileSafe.js";
|
|
3
3
|
import { endOfReadmeMatcher, endOfReadmeNotice } from "../updateReadme.js";
|
|
4
4
|
import { findExistingBadges } from "./findExistingBadges.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/steps/writeReadme/index.ts"],"sourcesContent":["import 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\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\t\t.join(\"\\n\");\n}\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"],"mappings":"AAAA,
|
|
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\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\t\t.join(\"\\n\");\n}\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"],"mappings":"AAAA,YAAY,QAAQ;AAEpB,SAAS,oBAAoB;AAE7B,SAAS,oBAAoB,yBAAyB;AACtD,SAAS,0BAA0B;AACnC,SAAS,6BAA6B;AACtC,SAAS,0BAA0B;AAEnC,MAAM,wBAAwB;AAE9B,SAAS,+BAA+B,SAAkB;AACzD,SAAO;AAAA,IACN;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,CAAC,QAAQ,iBAAiB;AAAA,IAC1B;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,CAAC,QAAQ,iBAAiB;AAAA,IAC1B;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACD,EACE,OAAO,OAAO,EACd,KAAK,IAAI;AACZ;AAEA,eAAsB,YAAY,SAAkB;AACnD,QAAM,yBACL,CAAC,QAAQ,0BAA0B,+BAA+B,OAAO;AAC1E,MAAI,WAAW,MAAM,aAAa,aAAa,EAAE;AACjD,MAAI,CAAC,UAAU;AACd,UAAM,GAAG;AAAA,MACR;AAAA,MACA;AAAA,QACC,mBAAmB,SAAS,CAAC,CAAC;AAAA,QAC9B;AAAA,QACA,kBAAkB,MAAM,CAAC;AAAA,MAC1B,EACE,OAAO,OAAO,EACd,KAAK,MAAM;AAAA,IACd;AACA;AAAA,EACD;AAEA,QAAM,oBAAoB,sBAAsB,QAAQ;AAExD,aAAW;AAAA,IACV,mBAAmB,SAAS,mBAAmB,QAAQ,CAAC;AAAA,IACxD,SAAS,MAAM,iBAAiB;AAAA,EACjC,EACE,KAAK,EAAE,EACP,QAAQ,4BAA4B,EAAE,EACtC,QAAQ,kBAAkB,EAAE,EAC5B,WAAW,MAAM,EAAE,EACnB,WAAW,UAAU,MAAM;AAE7B,MAAI,0BAA0B,CAAC,SAAS,SAAS,qBAAqB,GAAG;AACxE,eAAW,CAAC,UAAU,sBAAsB,EAAE,KAAK,MAAM;AAAA,EAC1D;AAEA,MAAI,CAAC,mBAAmB,KAAK,QAAQ,GAAG;AACvC,eAAW,CAAC,UAAU,iBAAiB,EAAE,KAAK,IAAI;AAAA,EACnD;AAEA,QAAM,GAAG,UAAU,aAAa,QAAQ;AACzC;","names":[]}
|
|
@@ -10,7 +10,7 @@ function createDotGitHubActions() {
|
|
|
10
10
|
{ uses: "pnpm/action-setup@v2" },
|
|
11
11
|
{
|
|
12
12
|
uses: "actions/setup-node@v4",
|
|
13
|
-
with: { cache: "pnpm", "node-version": "
|
|
13
|
+
with: { cache: "pnpm", "node-version": "20" }
|
|
14
14
|
},
|
|
15
15
|
{
|
|
16
16
|
run: "pnpm install --frozen-lockfile",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../src/steps/writing/creation/dotGitHub/actions.ts"],"sourcesContent":["import jsYaml from \"js-yaml\";\n\nexport function createDotGitHubActions() {\n\treturn {\n\t\tprepare: {\n\t\t\t\"action.yml\": jsYaml\n\t\t\t\t.dump({\n\t\t\t\t\tdescription: \"Prepares the repo for a typical CI job\",\n\t\t\t\t\tname: \"Prepare\",\n\t\t\t\t\truns: {\n\t\t\t\t\t\tsteps: [\n\t\t\t\t\t\t\t{ uses: \"pnpm/action-setup@v2\" },\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tuses: \"actions/setup-node@v4\",\n\t\t\t\t\t\t\t\twith: { cache: \"pnpm\", \"node-version\": \"
|
|
1
|
+
{"version":3,"sources":["../../../../../src/steps/writing/creation/dotGitHub/actions.ts"],"sourcesContent":["import jsYaml from \"js-yaml\";\n\nexport function createDotGitHubActions() {\n\treturn {\n\t\tprepare: {\n\t\t\t\"action.yml\": jsYaml\n\t\t\t\t.dump({\n\t\t\t\t\tdescription: \"Prepares the repo for a typical CI job\",\n\t\t\t\t\tname: \"Prepare\",\n\t\t\t\t\truns: {\n\t\t\t\t\t\tsteps: [\n\t\t\t\t\t\t\t{ uses: \"pnpm/action-setup@v2\" },\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tuses: \"actions/setup-node@v4\",\n\t\t\t\t\t\t\t\twith: { cache: \"pnpm\", \"node-version\": \"20\" },\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\trun: \"pnpm install --frozen-lockfile\",\n\t\t\t\t\t\t\t\tshell: \"bash\",\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t],\n\t\t\t\t\t\tusing: \"composite\",\n\t\t\t\t\t},\n\t\t\t\t})\n\t\t\t\t.replaceAll(/\\n(\\S)/g, \"\\n\\n$1\"),\n\t\t},\n\t};\n}\n"],"mappings":"AAAA,OAAO,YAAY;AAEZ,SAAS,yBAAyB;AACxC,SAAO;AAAA,IACN,SAAS;AAAA,MACR,cAAc,OACZ,KAAK;AAAA,QACL,aAAa;AAAA,QACb,MAAM;AAAA,QACN,MAAM;AAAA,UACL,OAAO;AAAA,YACN,EAAE,MAAM,uBAAuB;AAAA,YAC/B;AAAA,cACC,MAAM;AAAA,cACN,MAAM,EAAE,OAAO,QAAQ,gBAAgB,KAAK;AAAA,YAC7C;AAAA,YACA;AAAA,cACC,KAAK;AAAA,cACL,OAAO;AAAA,YACR;AAAA,UACD;AAAA,UACA,OAAO;AAAA,QACR;AAAA,MACD,CAAC,EACA,WAAW,WAAW,QAAQ;AAAA,IACjC;AAAA,EACD;AACD;","names":[]}
|
package/lib/steps/writing/creation/dotGitHub/{createDevelopment.js → createDevelopment/index.js}
RENAMED
|
@@ -1,30 +1,44 @@
|
|
|
1
|
-
|
|
1
|
+
import { readFileSafe } from "../../../../../shared/readFileSafe.js";
|
|
2
|
+
import { splitIntoSections } from "./splitIntoSections.js";
|
|
3
|
+
const headingAliases = /* @__PURE__ */ new Map([
|
|
4
|
+
["build", "Building"],
|
|
5
|
+
["builds", "Building"],
|
|
6
|
+
["format", "Formatting"],
|
|
7
|
+
["lint", "Linting"],
|
|
8
|
+
["test", "Testing"],
|
|
9
|
+
["tests", "Testing"]
|
|
10
|
+
]);
|
|
11
|
+
function createLintingSection(options) {
|
|
2
12
|
const lintLines = [
|
|
3
13
|
!options.excludeLintKnip && `- \`pnpm lint:knip\` ([knip](https://github.com/webpro/knip)): Detects unused files, dependencies, and code exports`,
|
|
4
|
-
!options.excludeLintMd && `- \`pnpm lint:md\` ([Markdownlint](https://github.com/DavidAnson/markdownlint)
|
|
14
|
+
!options.excludeLintMd && `- \`pnpm lint:md\` ([Markdownlint](https://github.com/DavidAnson/markdownlint): Checks Markdown source files`,
|
|
5
15
|
!options.excludeLintPackageJson && `- \`pnpm lint:package-json\` ([npm-package-json-lint](https://npmpackagejsonlint.org/)): Lints the \`package.json\` file`,
|
|
6
16
|
!options.excludeLintPackages && `- \`pnpm lint:packages\` ([pnpm dedupe --check](https://pnpm.io/cli/dedupe)): Checks for unnecessarily duplicated packages in the \`pnpm-lock.yml\` file`,
|
|
7
17
|
!options.excludeLintSpelling && `- \`pnpm lint:spelling\` ([cspell](https://cspell.org)): Spell checks across all source files`
|
|
8
18
|
].filter(Boolean);
|
|
9
|
-
return
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
19
|
+
return lintLines.length ? [
|
|
20
|
+
`This package includes several forms of linting to enforce consistent code quality and styling.`,
|
|
21
|
+
`Each should be shown in VS Code, and can be run manually on the command-line:`,
|
|
22
|
+
``,
|
|
23
|
+
`- \`pnpm lint\` ([ESLint](https://eslint.org) with [typescript-eslint](https://typescript-eslint.io)): Lints JavaScript and TypeScript source files`,
|
|
24
|
+
...lintLines,
|
|
25
|
+
``,
|
|
26
|
+
`Read the individual documentation for each linter to understand how it can be configured and used best.`,
|
|
27
|
+
``,
|
|
28
|
+
`For example, ESLint can be run with \`--fix\` to auto-fix some lint rule complaints:`
|
|
29
|
+
].join("\n") : `[ESLint](https://eslint.org) is used with with [typescript-eslint](https://typescript-eslint.io)) to lint JavaScript and TypeScript source files.
|
|
30
|
+
You can run it locally on the command-line:
|
|
15
31
|
|
|
16
32
|
\`\`\`shell
|
|
17
|
-
|
|
18
|
-
cd ${options.repository}
|
|
19
|
-
pnpm install
|
|
33
|
+
pnpm run lint
|
|
20
34
|
\`\`\`
|
|
21
35
|
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
Run [**tsup**](https://tsup.egoist.dev) locally to build source files from \`src/\` into output files in \`lib/\`:
|
|
36
|
+
ESLint can be run with \`--fix\` to auto-fix some lint rule complaints:`;
|
|
37
|
+
}
|
|
38
|
+
async function createDevelopment(options) {
|
|
39
|
+
const existingContents = await readFileSafe(".github/DEVELOPMENT.md", "");
|
|
40
|
+
const newSections = {
|
|
41
|
+
"## Building": `Run [**tsup**](https://tsup.egoist.dev) locally to build source files from \`src/\` into output files in \`lib/\`:
|
|
28
42
|
|
|
29
43
|
\`\`\`shell
|
|
30
44
|
pnpm build
|
|
@@ -34,49 +48,24 @@ Add \`--watch\` to run the builder in a watch mode that continuously cleans and
|
|
|
34
48
|
|
|
35
49
|
\`\`\`shell
|
|
36
50
|
pnpm build --watch
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
## Formatting
|
|
40
|
-
|
|
41
|
-
[Prettier](https://prettier.io) is used to format code.
|
|
51
|
+
\`\`\``,
|
|
52
|
+
"## Formatting": `[Prettier](https://prettier.io) is used to format code.
|
|
42
53
|
It should be applied automatically when you save files in VS Code or make a Git commit.
|
|
43
54
|
|
|
44
55
|
To manually reformat all files, you can run:
|
|
45
56
|
|
|
46
57
|
\`\`\`shell
|
|
47
58
|
pnpm format --write
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
## Linting
|
|
51
|
-
|
|
52
|
-
${lintLines.length ? [
|
|
53
|
-
`This package includes several forms of linting to enforce consistent code quality and styling.`,
|
|
54
|
-
`Each should be shown in VS Code, and can be run manually on the command-line:`,
|
|
55
|
-
``,
|
|
56
|
-
`- \`pnpm lint\` ([ESLint](https://eslint.org) with [typescript-eslint](https://typescript-eslint.io)): Lints JavaScript and TypeScript source files`,
|
|
57
|
-
...lintLines,
|
|
58
|
-
``,
|
|
59
|
-
`Read the individual documentation for each linter to understand how it can be configured and used best.`,
|
|
60
|
-
``,
|
|
61
|
-
`For example, ESLint can be run with \`--fix\` to auto-fix some lint rule complaints:`
|
|
62
|
-
].join("\n") : `[ESLint](https://eslint.org) is used with with [typescript-eslint](https://typescript-eslint.io) to lint JavaScript and TypeScript source files.
|
|
63
|
-
You can run it locally on the command-line:
|
|
64
|
-
|
|
65
|
-
\`\`\`shell
|
|
66
|
-
pnpm run lint
|
|
67
|
-
\`\`\`
|
|
68
|
-
|
|
69
|
-
ESLint can be run with \`--fix\` to auto-fix some lint rule complaints:`}
|
|
59
|
+
\`\`\``,
|
|
60
|
+
"## Linting": `${createLintingSection(options)}
|
|
70
61
|
|
|
71
62
|
\`\`\`shell
|
|
72
63
|
pnpm run lint --fix
|
|
73
64
|
\`\`\`
|
|
74
65
|
|
|
75
|
-
Note that you'll likely need to run \`pnpm build\` before \`pnpm lint\` so that lint rules which check the file system can pick up on any built files
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
[Vitest](https://vitest.dev) is used for tests.
|
|
66
|
+
Note that you'll likely need to run \`pnpm build\` before \`pnpm lint\` so that lint rules which check the file system can pick up on any built files.`,
|
|
67
|
+
...!options.excludeTests && {
|
|
68
|
+
"## Testing": `[Vitest](https://vitest.dev) is used for tests.
|
|
80
69
|
You can run it locally on the command-line:
|
|
81
70
|
|
|
82
71
|
\`\`\`shell
|
|
@@ -90,16 +79,11 @@ pnpm run test --coverage
|
|
|
90
79
|
\`\`\`
|
|
91
80
|
|
|
92
81
|
Note that [console-fail-test](https://github.com/JoshuaKGoldberg/console-fail-test) is enabled for all test runs.
|
|
93
|
-
Calls to \`console.log\`, \`console.warn\`, and other console methods will cause a test to fail
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
To launch it, open a test file, then run _Debug Current Test File_ from the VS Code Debug panel (or press F5).
|
|
99
|
-
`}
|
|
100
|
-
## Type Checking
|
|
101
|
-
|
|
102
|
-
You should be able to see suggestions from [TypeScript](https://typescriptlang.org) in your editor for all open files.
|
|
82
|
+
Calls to \`console.log\`, \`console.warn\`, and other console methods will cause a test to fail.`,
|
|
83
|
+
"### Debugging Tests": `This repository includes a [VS Code launch configuration](https://code.visualstudio.com/docs/editor/debugging) for debugging unit tests.
|
|
84
|
+
To launch it, open a test file, then run _Debug Current Test File_ from the VS Code Debug panel (or press F5).`
|
|
85
|
+
},
|
|
86
|
+
"## Type Checking": `You should be able to see suggestions from [TypeScript](https://typescriptlang.org) in your editor for all open files.
|
|
103
87
|
|
|
104
88
|
However, it can be useful to run the TypeScript command-line (\`tsc\`) to type check all files in \`src/\`:
|
|
105
89
|
|
|
@@ -111,10 +95,45 @@ Add \`--watch\` to keep the type checker running in a watch mode that updates th
|
|
|
111
95
|
|
|
112
96
|
\`\`\`shell
|
|
113
97
|
pnpm tsc --watch
|
|
98
|
+
\`\`\``
|
|
99
|
+
};
|
|
100
|
+
const newSectionHeadings = /* @__PURE__ */ new Set([
|
|
101
|
+
"Development",
|
|
102
|
+
Object.keys(newSections).map((key) => key.replace(/^#* /, ""))
|
|
103
|
+
]);
|
|
104
|
+
const preservedSections = Object.fromEntries(
|
|
105
|
+
splitIntoSections(existingContents).filter(([key]) => {
|
|
106
|
+
const keyText = key.replace(/^#* /, "");
|
|
107
|
+
return !newSectionHeadings.has(
|
|
108
|
+
headingAliases.get(keyText.toLowerCase()) ?? keyText
|
|
109
|
+
);
|
|
110
|
+
})
|
|
111
|
+
);
|
|
112
|
+
const result = `# Development
|
|
113
|
+
${options.guide ? `
|
|
114
|
+
> If you'd like a more guided walkthrough, see [${options.guide.title}](${options.guide.href}).
|
|
115
|
+
> It'll walk you through the common activities you'll need to contribute.
|
|
116
|
+
` : ""}
|
|
117
|
+
After [forking the repo from GitHub](https://help.github.com/articles/fork-a-repo) and [installing pnpm](https://pnpm.io/installation):
|
|
118
|
+
|
|
119
|
+
\`\`\`shell
|
|
120
|
+
git clone https://github.com/<your-name-here>/${options.repository}
|
|
121
|
+
cd ${options.repository}
|
|
122
|
+
pnpm install
|
|
114
123
|
\`\`\`
|
|
124
|
+
|
|
125
|
+
> This repository includes a list of suggested VS Code extensions.
|
|
126
|
+
> It's a good idea to use [VS Code](https://code.visualstudio.com) and accept its suggestion to install them, as they'll help with development.
|
|
127
|
+
|
|
128
|
+
${Object.entries({ ...newSections, ...preservedSections }).map(
|
|
129
|
+
([heading, content]) => `${heading}
|
|
130
|
+
|
|
131
|
+
${content}`
|
|
132
|
+
).join("\n\n")}
|
|
115
133
|
`;
|
|
134
|
+
return result;
|
|
116
135
|
}
|
|
117
136
|
export {
|
|
118
137
|
createDevelopment
|
|
119
138
|
};
|
|
120
|
-
//# sourceMappingURL=
|
|
139
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../../../src/steps/writing/creation/dotGitHub/createDevelopment/index.ts"],"sourcesContent":["import { readFileSafe } from \"../../../../../shared/readFileSafe.js\";\nimport { Options } from \"../../../../../shared/types.js\";\nimport { splitIntoSections } from \"./splitIntoSections.js\";\n\nconst headingAliases = new Map([\n\t[\"build\", \"Building\"],\n\t[\"builds\", \"Building\"],\n\t[\"format\", \"Formatting\"],\n\t[\"lint\", \"Linting\"],\n\t[\"test\", \"Testing\"],\n\t[\"tests\", \"Testing\"],\n]);\n\nfunction createLintingSection(options: Options) {\n\tconst lintLines = [\n\t\t!options.excludeLintKnip &&\n\t\t\t`- \\`pnpm lint:knip\\` ([knip](https://github.com/webpro/knip)): Detects unused files, dependencies, and code exports`,\n\t\t!options.excludeLintMd &&\n\t\t\t`- \\`pnpm lint:md\\` ([Markdownlint](https://github.com/DavidAnson/markdownlint): Checks Markdown source files`,\n\t\t!options.excludeLintPackageJson &&\n\t\t\t`- \\`pnpm lint:package-json\\` ([npm-package-json-lint](https://npmpackagejsonlint.org/)): Lints the \\`package.json\\` file`,\n\t\t!options.excludeLintPackages &&\n\t\t\t`- \\`pnpm lint:packages\\` ([pnpm dedupe --check](https://pnpm.io/cli/dedupe)): Checks for unnecessarily duplicated packages in the \\`pnpm-lock.yml\\` file`,\n\t\t!options.excludeLintSpelling &&\n\t\t\t`- \\`pnpm lint:spelling\\` ([cspell](https://cspell.org)): Spell checks across all source files`,\n\t].filter(Boolean);\n\n\treturn lintLines.length\n\t\t? [\n\t\t\t\t`This package includes several forms of linting to enforce consistent code quality and styling.`,\n\t\t\t\t`Each should be shown in VS Code, and can be run manually on the command-line:`,\n\t\t\t\t``,\n\t\t\t\t`- \\`pnpm lint\\` ([ESLint](https://eslint.org) with [typescript-eslint](https://typescript-eslint.io)): Lints JavaScript and TypeScript source files`,\n\t\t\t\t...lintLines,\n\t\t\t\t``,\n\t\t\t\t`Read the individual documentation for each linter to understand how it can be configured and used best.`,\n\t\t\t\t``,\n\t\t\t\t`For example, ESLint can be run with \\`--fix\\` to auto-fix some lint rule complaints:`,\n\t\t ].join(\"\\n\")\n\t\t: `[ESLint](https://eslint.org) is used with with [typescript-eslint](https://typescript-eslint.io)) to lint JavaScript and TypeScript source files.\nYou can run it locally on the command-line:\n\n\\`\\`\\`shell\npnpm run lint\n\\`\\`\\`\n\nESLint can be run with \\`--fix\\` to auto-fix some lint rule complaints:`;\n}\n\nexport async function createDevelopment(options: Options) {\n\tconst existingContents = await readFileSafe(\".github/DEVELOPMENT.md\", \"\");\n\n\tconst newSections = {\n\t\t\"## Building\": `Run [**tsup**](https://tsup.egoist.dev) locally to build source files from \\`src/\\` into output files in \\`lib/\\`:\n\n\\`\\`\\`shell\npnpm build\n\\`\\`\\`\n\nAdd \\`--watch\\` to run the builder in a watch mode that continuously cleans and recreates \\`lib/\\` as you save files:\n\n\\`\\`\\`shell\npnpm build --watch\n\\`\\`\\``,\n\t\t\"## Formatting\": `[Prettier](https://prettier.io) is used to format code.\nIt should be applied automatically when you save files in VS Code or make a Git commit.\n\nTo manually reformat all files, you can run:\n\n\\`\\`\\`shell\npnpm format --write\n\\`\\`\\``,\n\t\t\"## Linting\": `${createLintingSection(options)}\n\n\\`\\`\\`shell\npnpm run lint --fix\n\\`\\`\\`\n\nNote that you'll likely need to run \\`pnpm build\\` before \\`pnpm lint\\` so that lint rules which check the file system can pick up on any built files.`,\n\t\t...(!options.excludeTests && {\n\t\t\t\"## Testing\": `[Vitest](https://vitest.dev) is used for tests.\nYou can run it locally on the command-line:\n\n\\`\\`\\`shell\npnpm run test\n\\`\\`\\`\n\nAdd the \\`--coverage\\` flag to compute test coverage and place reports in the \\`coverage/\\` directory:\n\n\\`\\`\\`shell\npnpm run test --coverage\n\\`\\`\\`\n\nNote that [console-fail-test](https://github.com/JoshuaKGoldberg/console-fail-test) is enabled for all test runs.\nCalls to \\`console.log\\`, \\`console.warn\\`, and other console methods will cause a test to fail.`,\n\n\t\t\t\"### Debugging Tests\": `This repository includes a [VS Code launch configuration](https://code.visualstudio.com/docs/editor/debugging) for debugging unit tests.\nTo launch it, open a test file, then run _Debug Current Test File_ from the VS Code Debug panel (or press F5).`,\n\t\t}),\n\t\t\"## Type Checking\": `You should be able to see suggestions from [TypeScript](https://typescriptlang.org) in your editor for all open files.\n\nHowever, it can be useful to run the TypeScript command-line (\\`tsc\\`) to type check all files in \\`src/\\`:\n\n\\`\\`\\`shell\npnpm tsc\n\\`\\`\\`\n\nAdd \\`--watch\\` to keep the type checker running in a watch mode that updates the display as you save files:\n\n\\`\\`\\`shell\npnpm tsc --watch\n\\`\\`\\``,\n\t};\n\n\tconst newSectionHeadings = new Set([\n\t\t\"Development\",\n\t\tObject.keys(newSections).map((key) => key.replace(/^#* /, \"\")),\n\t]);\n\n\tconst preservedSections = Object.fromEntries(\n\t\tsplitIntoSections(existingContents).filter(([key]) => {\n\t\t\tconst keyText = key.replace(/^#* /, \"\");\n\t\t\treturn !newSectionHeadings.has(\n\t\t\t\theadingAliases.get(keyText.toLowerCase()) ?? keyText,\n\t\t\t);\n\t\t}),\n\t);\n\n\tconst result = `# Development\n${\n\toptions.guide\n\t\t? `\n> If you'd like a more guided walkthrough, see [${options.guide.title}](${options.guide.href}).\n> It'll walk you through the common activities you'll need to contribute.\n`\n\t\t: \"\"\n}\nAfter [forking the repo from GitHub](https://help.github.com/articles/fork-a-repo) and [installing pnpm](https://pnpm.io/installation):\n\n\\`\\`\\`shell\ngit clone https://github.com/<your-name-here>/${options.repository}\ncd ${options.repository}\npnpm install\n\\`\\`\\`\n\n> This repository includes a list of suggested VS Code extensions.\n> It's a good idea to use [VS Code](https://code.visualstudio.com) and accept its suggestion to install them, as they'll help with development.\n\n${Object.entries({ ...newSections, ...preservedSections })\n\t.map(\n\t\t([heading, content]) => `${heading}\n\n${content}`,\n\t)\n\t.join(\"\\n\\n\")}\n`;\n\n\treturn result;\n}\n"],"mappings":"AAAA,SAAS,oBAAoB;AAE7B,SAAS,yBAAyB;AAElC,MAAM,iBAAiB,oBAAI,IAAI;AAAA,EAC9B,CAAC,SAAS,UAAU;AAAA,EACpB,CAAC,UAAU,UAAU;AAAA,EACrB,CAAC,UAAU,YAAY;AAAA,EACvB,CAAC,QAAQ,SAAS;AAAA,EAClB,CAAC,QAAQ,SAAS;AAAA,EAClB,CAAC,SAAS,SAAS;AACpB,CAAC;AAED,SAAS,qBAAqB,SAAkB;AAC/C,QAAM,YAAY;AAAA,IACjB,CAAC,QAAQ,mBACR;AAAA,IACD,CAAC,QAAQ,iBACR;AAAA,IACD,CAAC,QAAQ,0BACR;AAAA,IACD,CAAC,QAAQ,uBACR;AAAA,IACD,CAAC,QAAQ,uBACR;AAAA,EACF,EAAE,OAAO,OAAO;AAEhB,SAAO,UAAU,SACd;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,GAAG;AAAA,IACH;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACA,EAAE,KAAK,IAAI,IACX;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAQJ;AAEA,eAAsB,kBAAkB,SAAkB;AACzD,QAAM,mBAAmB,MAAM,aAAa,0BAA0B,EAAE;AAExE,QAAM,cAAc;AAAA,IACnB,eAAe;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAWf,iBAAiB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAQjB,cAAc,GAAG,qBAAqB,OAAO,CAAC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAO9C,GAAI,CAAC,QAAQ,gBAAgB;AAAA,MAC5B,cAAc;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,MAgBd,uBAAuB;AAAA;AAAA,IAExB;AAAA,IACA,oBAAoB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAarB;AAEA,QAAM,qBAAqB,oBAAI,IAAI;AAAA,IAClC;AAAA,IACA,OAAO,KAAK,WAAW,EAAE,IAAI,CAAC,QAAQ,IAAI,QAAQ,QAAQ,EAAE,CAAC;AAAA,EAC9D,CAAC;AAED,QAAM,oBAAoB,OAAO;AAAA,IAChC,kBAAkB,gBAAgB,EAAE,OAAO,CAAC,CAAC,GAAG,MAAM;AACrD,YAAM,UAAU,IAAI,QAAQ,QAAQ,EAAE;AACtC,aAAO,CAAC,mBAAmB;AAAA,QAC1B,eAAe,IAAI,QAAQ,YAAY,CAAC,KAAK;AAAA,MAC9C;AAAA,IACD,CAAC;AAAA,EACF;AAEA,QAAM,SAAS;AAAA,EAEf,QAAQ,QACL;AAAA,kDAC8C,QAAQ,MAAM,KAAK,KAAK,QAAQ,MAAM,IAAI;AAAA;AAAA,IAGxF,EACJ;AAAA;AAAA;AAAA;AAAA,gDAIgD,QAAQ,UAAU;AAAA,KAC7D,QAAQ,UAAU;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOrB,OAAO,QAAQ,EAAE,GAAG,aAAa,GAAG,kBAAkB,CAAC,EACvD;AAAA,IACA,CAAC,CAAC,SAAS,OAAO,MAAM,GAAG,OAAO;AAAA;AAAA,EAElC,OAAO;AAAA,EACR,EACC,KAAK,MAAM,CAAC;AAAA;AAGb,SAAO;AACR;","names":[]}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
function splitIntoSections(text) {
|
|
2
|
+
const sections = [];
|
|
3
|
+
if (!text) {
|
|
4
|
+
return sections;
|
|
5
|
+
}
|
|
6
|
+
let remaining = `${text}
|
|
7
|
+
`;
|
|
8
|
+
while (remaining) {
|
|
9
|
+
const indexOfNewline = remaining.indexOf("\n", 1);
|
|
10
|
+
let nextStart = remaining.indexOf("\n#", 1);
|
|
11
|
+
if (nextStart === -1) {
|
|
12
|
+
nextStart = remaining.length;
|
|
13
|
+
}
|
|
14
|
+
const heading = remaining.slice(0, indexOfNewline).trim();
|
|
15
|
+
const contents = remaining.slice(indexOfNewline, nextStart).trimEnd().replace(/^\n+/, "");
|
|
16
|
+
sections.push([heading, contents]);
|
|
17
|
+
remaining = remaining.slice(nextStart);
|
|
18
|
+
}
|
|
19
|
+
return sections;
|
|
20
|
+
}
|
|
21
|
+
export {
|
|
22
|
+
splitIntoSections
|
|
23
|
+
};
|
|
24
|
+
//# sourceMappingURL=splitIntoSections.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../../../src/steps/writing/creation/dotGitHub/createDevelopment/splitIntoSections.ts"],"sourcesContent":["export function splitIntoSections(text: string) {\n\tconst sections: [string, string][] = [];\n\tif (!text) {\n\t\treturn sections;\n\t}\n\n\tlet remaining = `${text}\\n`;\n\n\twhile (remaining) {\n\t\tconst indexOfNewline = remaining.indexOf(\"\\n\", 1);\n\t\tlet nextStart = remaining.indexOf(\"\\n#\", 1);\n\t\tif (nextStart === -1) {\n\t\t\tnextStart = remaining.length;\n\t\t}\n\n\t\tconst heading = remaining.slice(0, indexOfNewline).trim();\n\t\tconst contents = remaining\n\t\t\t.slice(indexOfNewline, nextStart)\n\t\t\t.trimEnd()\n\t\t\t.replace(/^\\n+/, \"\");\n\n\t\tsections.push([heading, contents]);\n\t\tremaining = remaining.slice(nextStart);\n\t}\n\n\treturn sections;\n}\n"],"mappings":"AAAO,SAAS,kBAAkB,MAAc;AAC/C,QAAM,WAA+B,CAAC;AACtC,MAAI,CAAC,MAAM;AACV,WAAO;AAAA,EACR;AAEA,MAAI,YAAY,GAAG,IAAI;AAAA;AAEvB,SAAO,WAAW;AACjB,UAAM,iBAAiB,UAAU,QAAQ,MAAM,CAAC;AAChD,QAAI,YAAY,UAAU,QAAQ,OAAO,CAAC;AAC1C,QAAI,cAAc,IAAI;AACrB,kBAAY,UAAU;AAAA,IACvB;AAEA,UAAM,UAAU,UAAU,MAAM,GAAG,cAAc,EAAE,KAAK;AACxD,UAAM,WAAW,UACf,MAAM,gBAAgB,SAAS,EAC/B,QAAQ,EACR,QAAQ,QAAQ,EAAE;AAEpB,aAAS,KAAK,CAAC,SAAS,QAAQ,CAAC;AACjC,gBAAY,UAAU,MAAM,SAAS;AAAA,EACtC;AAEA,SAAO;AACR;","names":[]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { formatJson } from "../formatters/formatJson.js";
|
|
2
2
|
import { formatYaml } from "../formatters/formatYaml.js";
|
|
3
|
-
import { createDevelopment } from "./createDevelopment.js";
|
|
3
|
+
import { createDevelopment } from "./createDevelopment/index.js";
|
|
4
4
|
async function createDotGitHubFiles(options) {
|
|
5
5
|
return {
|
|
6
6
|
"CODE_OF_CONDUCT.md": `# Contributor Covenant Code of Conduct
|
|
@@ -234,7 +234,7 @@ If you made it all the way to the end, bravo dear user, we love you.
|
|
|
234
234
|
Please include your favorite emoji in the bottom of your issues and PRs to signal to us that you did in fact read this file and are trying to conform to it as best as possible.
|
|
235
235
|
\u{1F496} is a good starter if you're not sure which to use.
|
|
236
236
|
`,
|
|
237
|
-
"DEVELOPMENT.md": createDevelopment(options),
|
|
237
|
+
"DEVELOPMENT.md": await createDevelopment(options),
|
|
238
238
|
...options.funding && {
|
|
239
239
|
"FUNDING.yml": formatYaml({ github: options.funding })
|
|
240
240
|
},
|