create-typescript-app 1.29.45 → 1.29.47
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/initialize/initializeWithOptions.js +1 -1
- package/lib/initialize/initializeWithOptions.js.map +1 -1
- package/lib/steps/updateLocalFiles.d.ts +3 -1
- package/lib/steps/updateLocalFiles.js +2 -2
- package/lib/steps/updateLocalFiles.js.map +1 -1
- package/lib/steps/updateReadme.js +7 -2
- package/lib/steps/updateReadme.js.map +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/initialize/initializeWithOptions.ts"],"sourcesContent":["import { withSpinner, withSpinners } from \"../shared/cli/spinners.js\";\nimport { GitHubAndOptions } from \"../shared/options/readOptions.js\";\nimport { addOwnerAsAllContributor } from \"../steps/addOwnerAsAllContributor.js\";\nimport { clearChangelog } from \"../steps/clearChangelog.js\";\nimport { initializeGitHubRepository } from \"../steps/initializeGitHubRepository/index.js\";\nimport { removeSetupScripts } from \"../steps/removeSetupScripts.js\";\nimport { resetGitTags } from \"../steps/resetGitTags.js\";\nimport { runCommands } from \"../steps/runCommands.js\";\nimport { uninstallPackages } from \"../steps/uninstallPackages.js\";\nimport { updateAllContributorsTable } from \"../steps/updateAllContributorsTable.js\";\nimport { updateLocalFiles } from \"../steps/updateLocalFiles.js\";\nimport { updateReadme } from \"../steps/updateReadme.js\";\n\nexport async function initializeWithOptions({\n\tgithub,\n\toptions,\n}: GitHubAndOptions) {\n\tawait withSpinners(\"Initializing local files\", [\n\t\t[\n\t\t\t\"Updating local files\",\n\t\t\tasync () => {\n\t\t\t\tawait updateLocalFiles(options);\n\t\t\t},\n\t\t],\n\t\t[\"Updating README.md\", updateReadme],\n\t\t[\"Clearing changelog\", clearChangelog],\n\t\t[\n\t\t\t\"Updating all-contributors table\",\n\t\t\tasync () => {\n\t\t\t\tawait updateAllContributorsTable(options);\n\t\t\t},\n\t\t],\n\t\t[\"Resetting Git tags\", resetGitTags],\n\t]);\n\n\tif (!options.excludeContributors) {\n\t\tawait withSpinner(\"Updating existing contributor details\", async () => {\n\t\t\tawait addOwnerAsAllContributor(options.owner);\n\t\t});\n\t}\n\n\tif (github) {\n\t\tawait withSpinner(\"Initializing GitHub repository\", async () => {\n\t\t\tawait initializeGitHubRepository(github.octokit, options);\n\t\t});\n\t}\n\n\tif (!options.skipRemoval) {\n\t\tawait withSpinner(\"Removing setup scripts\", removeSetupScripts);\n\t}\n\n\tif (!options.skipUninstall) {\n\t\tawait withSpinner(\n\t\t\t\"Uninstalling initialization-only packages\",\n\t\t\tuninstallPackages,\n\t\t);\n\t}\n\n\tawait runCommands(\"Cleaning up files\", [\n\t\t\"pnpm lint --fix\",\n\t\t\"pnpm format --write\",\n\t]);\n}\n"],"mappings":"AAAA,SAAS,aAAa,oBAAoB;AAE1C,SAAS,gCAAgC;AACzC,SAAS,sBAAsB;AAC/B,SAAS,kCAAkC;AAC3C,SAAS,0BAA0B;AACnC,SAAS,oBAAoB;AAC7B,SAAS,mBAAmB;AAC5B,SAAS,yBAAyB;AAClC,SAAS,kCAAkC;AAC3C,SAAS,wBAAwB;AACjC,SAAS,oBAAoB;AAE7B,eAAsB,sBAAsB;AAAA,EAC3C;AAAA,EACA;AACD,GAAqB;AACpB,QAAM,aAAa,4BAA4B;AAAA,IAC9C;AAAA,MACC;AAAA,MACA,YAAY;AACX,cAAM,iBAAiB,
|
|
1
|
+
{"version":3,"sources":["../../src/initialize/initializeWithOptions.ts"],"sourcesContent":["import { withSpinner, withSpinners } from \"../shared/cli/spinners.js\";\nimport { GitHubAndOptions } from \"../shared/options/readOptions.js\";\nimport { addOwnerAsAllContributor } from \"../steps/addOwnerAsAllContributor.js\";\nimport { clearChangelog } from \"../steps/clearChangelog.js\";\nimport { initializeGitHubRepository } from \"../steps/initializeGitHubRepository/index.js\";\nimport { removeSetupScripts } from \"../steps/removeSetupScripts.js\";\nimport { resetGitTags } from \"../steps/resetGitTags.js\";\nimport { runCommands } from \"../steps/runCommands.js\";\nimport { uninstallPackages } from \"../steps/uninstallPackages.js\";\nimport { updateAllContributorsTable } from \"../steps/updateAllContributorsTable.js\";\nimport { updateLocalFiles } from \"../steps/updateLocalFiles.js\";\nimport { updateReadme } from \"../steps/updateReadme.js\";\n\nexport async function initializeWithOptions({\n\tgithub,\n\toptions,\n}: GitHubAndOptions) {\n\tawait withSpinners(\"Initializing local files\", [\n\t\t[\n\t\t\t\"Updating local files\",\n\t\t\tasync () => {\n\t\t\t\tawait updateLocalFiles(options, { resetPackageVersion: true });\n\t\t\t},\n\t\t],\n\t\t[\"Updating README.md\", updateReadme],\n\t\t[\"Clearing changelog\", clearChangelog],\n\t\t[\n\t\t\t\"Updating all-contributors table\",\n\t\t\tasync () => {\n\t\t\t\tawait updateAllContributorsTable(options);\n\t\t\t},\n\t\t],\n\t\t[\"Resetting Git tags\", resetGitTags],\n\t]);\n\n\tif (!options.excludeContributors) {\n\t\tawait withSpinner(\"Updating existing contributor details\", async () => {\n\t\t\tawait addOwnerAsAllContributor(options.owner);\n\t\t});\n\t}\n\n\tif (github) {\n\t\tawait withSpinner(\"Initializing GitHub repository\", async () => {\n\t\t\tawait initializeGitHubRepository(github.octokit, options);\n\t\t});\n\t}\n\n\tif (!options.skipRemoval) {\n\t\tawait withSpinner(\"Removing setup scripts\", removeSetupScripts);\n\t}\n\n\tif (!options.skipUninstall) {\n\t\tawait withSpinner(\n\t\t\t\"Uninstalling initialization-only packages\",\n\t\t\tuninstallPackages,\n\t\t);\n\t}\n\n\tawait runCommands(\"Cleaning up files\", [\n\t\t\"pnpm lint --fix\",\n\t\t\"pnpm format --write\",\n\t]);\n}\n"],"mappings":"AAAA,SAAS,aAAa,oBAAoB;AAE1C,SAAS,gCAAgC;AACzC,SAAS,sBAAsB;AAC/B,SAAS,kCAAkC;AAC3C,SAAS,0BAA0B;AACnC,SAAS,oBAAoB;AAC7B,SAAS,mBAAmB;AAC5B,SAAS,yBAAyB;AAClC,SAAS,kCAAkC;AAC3C,SAAS,wBAAwB;AACjC,SAAS,oBAAoB;AAE7B,eAAsB,sBAAsB;AAAA,EAC3C;AAAA,EACA;AACD,GAAqB;AACpB,QAAM,aAAa,4BAA4B;AAAA,IAC9C;AAAA,MACC;AAAA,MACA,YAAY;AACX,cAAM,iBAAiB,SAAS,EAAE,qBAAqB,KAAK,CAAC;AAAA,MAC9D;AAAA,IACD;AAAA,IACA,CAAC,sBAAsB,YAAY;AAAA,IACnC,CAAC,sBAAsB,cAAc;AAAA,IACrC;AAAA,MACC;AAAA,MACA,YAAY;AACX,cAAM,2BAA2B,OAAO;AAAA,MACzC;AAAA,IACD;AAAA,IACA,CAAC,sBAAsB,YAAY;AAAA,EACpC,CAAC;AAED,MAAI,CAAC,QAAQ,qBAAqB;AACjC,UAAM,YAAY,yCAAyC,YAAY;AACtE,YAAM,yBAAyB,QAAQ,KAAK;AAAA,IAC7C,CAAC;AAAA,EACF;AAEA,MAAI,QAAQ;AACX,UAAM,YAAY,kCAAkC,YAAY;AAC/D,YAAM,2BAA2B,OAAO,SAAS,OAAO;AAAA,IACzD,CAAC;AAAA,EACF;AAEA,MAAI,CAAC,QAAQ,aAAa;AACzB,UAAM,YAAY,0BAA0B,kBAAkB;AAAA,EAC/D;AAEA,MAAI,CAAC,QAAQ,eAAe;AAC3B,UAAM;AAAA,MACL;AAAA,MACA;AAAA,IACD;AAAA,EACD;AAEA,QAAM,YAAY,qBAAqB;AAAA,IACtC;AAAA,IACA;AAAA,EACD,CAAC;AACF;","names":[]}
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { Options } from '../shared/types.js';
|
|
2
2
|
|
|
3
|
-
declare function updateLocalFiles(options: Options
|
|
3
|
+
declare function updateLocalFiles(options: Options, config?: {
|
|
4
|
+
resetPackageVersion: boolean;
|
|
5
|
+
}): Promise<void>;
|
|
4
6
|
|
|
5
7
|
export { updateLocalFiles };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import replaceInFile from "replace-in-file";
|
|
2
2
|
import { readFileSafeAsJson } from "../shared/readFileSafeAsJson.js";
|
|
3
|
-
async function updateLocalFiles(options) {
|
|
3
|
+
async function updateLocalFiles(options, config = { resetPackageVersion: false }) {
|
|
4
4
|
const existingPackage = await readFileSafeAsJson("./package.json") ?? {};
|
|
5
5
|
const replacements = [
|
|
6
6
|
[/Create TypeScript App/g, options.title],
|
|
@@ -38,7 +38,7 @@ async function updateLocalFiles(options) {
|
|
|
38
38
|
options.description
|
|
39
39
|
]);
|
|
40
40
|
}
|
|
41
|
-
if (existingPackage.version) {
|
|
41
|
+
if (config.resetPackageVersion && existingPackage.version) {
|
|
42
42
|
replacements.push([
|
|
43
43
|
new RegExp(`"version": "${existingPackage.version}"`, "g"),
|
|
44
44
|
`"version": "0.0.0"`,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/steps/updateLocalFiles.ts"],"sourcesContent":["import replaceInFile from \"replace-in-file\";\n\nimport { readFileSafeAsJson } from \"../shared/readFileSafeAsJson.js\";\nimport { Options } from \"../shared/types.js\";\n\ninterface ExistingPackageData {\n\tdescription?: string;\n\tversion?: string;\n}\n\nexport async function updateLocalFiles(
|
|
1
|
+
{"version":3,"sources":["../../src/steps/updateLocalFiles.ts"],"sourcesContent":["import replaceInFile from \"replace-in-file\";\n\nimport { readFileSafeAsJson } from \"../shared/readFileSafeAsJson.js\";\nimport { Options } from \"../shared/types.js\";\n\ninterface ExistingPackageData {\n\tdescription?: string;\n\tversion?: string;\n}\n\nexport async function updateLocalFiles(\n\toptions: Options,\n\tconfig = { resetPackageVersion: false },\n) {\n\tconst existingPackage = ((await readFileSafeAsJson(\"./package.json\")) ??\n\t\t{}) as ExistingPackageData;\n\n\tconst replacements = [\n\t\t[/Create TypeScript App/g, options.title],\n\t\t[/JoshuaKGoldberg(?!\\/console-fail-test)/g, options.owner],\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[/\"bin\": \".+\\n/g, ``, \"./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, `## Development`, \"./README.md\"],\n\t\t[/\\n## Setup Scripts.*$/gs, \"\", \"./.github/DEVELOPMENT.md\"],\n\t\t[`\\t\\t\"src/initialize/index.ts\",\\n`, ``, \"./knip.jsonc\"],\n\t\t[`\\t\\t\"src/migrate/index.ts\",\\n`, ``, \"./knip.jsonc\"],\n\t\t[\n\t\t\t`[\"src/index.ts!\", \"script/initialize*.js\"]`,\n\t\t\t`\"src/index.ts!\"`,\n\t\t\t\"./knip.jsonc\",\n\t\t],\n\t\t[`[\"src/**/*.ts!\", \"script/**/*.js\"]`, `\"src/**/*.ts!\"`, \"./knip.jsonc\"],\n\t\t// Edge case: migration scripts will rewrite README.md attribution\n\t\t[\n\t\t\t`> 💙 This package is based on [@${options.owner}](https://github.com/${options.owner})'s [${options.repository}](https://github.com/JoshuaKGoldberg/${options.repository}).`,\n\t\t\t`> 💙 This package is based on [@JoshuaKGoldberg](https://github.com/JoshuaKGoldberg)'s [create-typescript-app](https://github.com/JoshuaKGoldberg/create-typescript-app).`,\n\t\t\t\"./README.md\",\n\t\t],\n\t];\n\n\tif (existingPackage.description) {\n\t\treplacements.push([\n\t\t\tnew RegExp(existingPackage.description, \"g\"),\n\t\t\toptions.description,\n\t\t]);\n\t}\n\n\tif (config.resetPackageVersion && existingPackage.version) {\n\t\treplacements.push([\n\t\t\tnew RegExp(`\"version\": \"${existingPackage.version}\"`, \"g\"),\n\t\t\t`\"version\": \"0.0.0\"`,\n\t\t\t\"./package.json\",\n\t\t]);\n\t}\n\n\tfor (const [from, to, files = [\"./.github/**/*\", \"./*.*\"]] of replacements) {\n\t\ttry {\n\t\t\t// @ts-expect-error -- https://github.com/microsoft/TypeScript/issues/54342\n\t\t\tawait replaceInFile({ files, from, to });\n\t\t} catch (error) {\n\t\t\tthrow new Error(\n\t\t\t\t`Failed to replace ${from.toString()} with ${to} 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,mBAAmB;AAE1B,SAAS,0BAA0B;AAQnC,eAAsB,iBACrB,SACA,SAAS,EAAE,qBAAqB,MAAM,GACrC;AACD,QAAM,kBAAoB,MAAM,mBAAmB,gBAAgB,KAClE,CAAC;AAEF,QAAM,eAAe;AAAA,IACpB,CAAC,0BAA0B,QAAQ,KAAK;AAAA,IACxC,CAAC,2CAA2C,QAAQ,KAAK;AAAA,IACzD,CAAC,0BAA0B,QAAQ,UAAU;AAAA,IAC7C,CAAC,sBAAsB,IAAI,eAAe;AAAA,IAC1C,CAAC,mBAAmB,cAAc,QAAQ,MAAM,KAAK,gBAAgB;AAAA,IACrE,CAAC,iBAAiB,IAAI,gBAAgB;AAAA,IACtC,CAAC,yBAAyB,IAAI,gBAAgB;AAAA,IAC9C,CAAC,2BAA2B,IAAI,gBAAgB;AAAA,IAChD,CAAC,sBAAsB,IAAI,gBAAgB;AAAA,IAC3C,CAAC,0BAA0B,IAAI,gBAAgB;AAAA,IAC/C,CAAC,wCAAwC,kBAAkB,aAAa;AAAA,IACxE,CAAC,2BAA2B,IAAI,0BAA0B;AAAA,IAC1D,CAAC;AAAA,GAAoC,IAAI,cAAc;AAAA,IACvD,CAAC;AAAA,GAAiC,IAAI,cAAc;AAAA,IACpD;AAAA,MACC;AAAA,MACA;AAAA,MACA;AAAA,IACD;AAAA,IACA,CAAC,sCAAsC,kBAAkB,cAAc;AAAA;AAAA,IAEvE;AAAA,MACC,0CAAmC,QAAQ,KAAK,wBAAwB,QAAQ,KAAK,QAAQ,QAAQ,UAAU,wCAAwC,QAAQ,UAAU;AAAA,MACzK;AAAA,MACA;AAAA,IACD;AAAA,EACD;AAEA,MAAI,gBAAgB,aAAa;AAChC,iBAAa,KAAK;AAAA,MACjB,IAAI,OAAO,gBAAgB,aAAa,GAAG;AAAA,MAC3C,QAAQ;AAAA,IACT,CAAC;AAAA,EACF;AAEA,MAAI,OAAO,uBAAuB,gBAAgB,SAAS;AAC1D,iBAAa,KAAK;AAAA,MACjB,IAAI,OAAO,eAAe,gBAAgB,OAAO,KAAK,GAAG;AAAA,MACzD;AAAA,MACA;AAAA,IACD,CAAC;AAAA,EACF;AAEA,aAAW,CAAC,MAAM,IAAI,QAAQ,CAAC,kBAAkB,OAAO,CAAC,KAAK,cAAc;AAC3E,QAAI;AAEH,YAAM,cAAc,EAAE,OAAO,MAAM,GAAG,CAAC;AAAA,IACxC,SAAS,OAAO;AACf,YAAM,IAAI;AAAA,QACT,qBAAqB,KAAK,SAAS,CAAC,SAAS,EAAE,OAAO,MAAM,SAAS,CAAC;AAAA,QACtE;AAAA,UACC,OAAO;AAAA,QACR;AAAA,MACD;AAAA,IACD;AAAA,EACD;AACD;","names":[]}
|
|
@@ -1,14 +1,19 @@
|
|
|
1
1
|
import fs from "node:fs/promises";
|
|
2
2
|
import { EOL } from "node:os";
|
|
3
|
+
import { readFileSafe } from "../shared/readFileSafe.js";
|
|
4
|
+
const detectionLine = `<!-- You can remove this notice if you don't want it \u{1F642} no worries! -->`;
|
|
3
5
|
const endOfReadmeNotice = [
|
|
4
6
|
``,
|
|
5
|
-
|
|
7
|
+
detectionLine,
|
|
6
8
|
``,
|
|
7
9
|
`> \u{1F499} This package is based on [@JoshuaKGoldberg](https://github.com/JoshuaKGoldberg)'s [create-typescript-app](https://github.com/JoshuaKGoldberg/create-typescript-app).`,
|
|
8
10
|
``
|
|
9
11
|
].join(EOL);
|
|
10
12
|
async function updateReadme() {
|
|
11
|
-
await
|
|
13
|
+
const contents = await readFileSafe("./README.md", "");
|
|
14
|
+
if (!contents.includes(detectionLine)) {
|
|
15
|
+
await fs.appendFile("./README.md", endOfReadmeNotice);
|
|
16
|
+
}
|
|
12
17
|
}
|
|
13
18
|
export {
|
|
14
19
|
endOfReadmeNotice,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/steps/updateReadme.ts"],"sourcesContent":["import fs from \"node:fs/promises\";\nimport { EOL } from \"node:os\";\n\
|
|
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\";\n\nconst detectionLine = `<!-- You can remove this notice if you don't want it 🙂 no worries! -->`;\n\nexport const endOfReadmeNotice = [\n\t``,\n\tdetectionLine,\n\t``,\n\t`> 💙 This package is based on [@JoshuaKGoldberg](https://github.com/JoshuaKGoldberg)'s [create-typescript-app](https://github.com/JoshuaKGoldberg/create-typescript-app).`,\n\t``,\n].join(EOL);\n\nexport async function updateReadme() {\n\tconst contents = await readFileSafe(\"./README.md\", \"\");\n\n\tif (!contents.includes(detectionLine)) {\n\t\tawait fs.appendFile(\"./README.md\", endOfReadmeNotice);\n\t}\n}\n"],"mappings":"AAAA,OAAO,QAAQ;AACf,SAAS,WAAW;AAEpB,SAAS,oBAAoB;AAE7B,MAAM,gBAAgB;AAEf,MAAM,oBAAoB;AAAA,EAChC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACD,EAAE,KAAK,GAAG;AAEV,eAAsB,eAAe;AACpC,QAAM,WAAW,MAAM,aAAa,eAAe,EAAE;AAErD,MAAI,CAAC,SAAS,SAAS,aAAa,GAAG;AACtC,UAAM,GAAG,WAAW,eAAe,iBAAiB;AAAA,EACrD;AACD;","names":[]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-typescript-app",
|
|
3
|
-
"version": "1.29.
|
|
3
|
+
"version": "1.29.47",
|
|
4
4
|
"description": "Quickstart-friendly TypeScript template with comprehensive formatting, linting, releases, testing, and other great tooling built-in. ✨",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|