create-typescript-app 1.29.52 → 1.30.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 +7 -5
- package/lib/create/createRerunSuggestion.js +8 -1
- package/lib/create/createRerunSuggestion.js.map +1 -1
- package/lib/shared/options/args.d.ts +6 -0
- package/lib/shared/options/args.js +2 -0
- package/lib/shared/options/args.js.map +1 -1
- package/lib/shared/options/getPrefillOrPromptedOption.js +1 -2
- package/lib/shared/options/getPrefillOrPromptedOption.js.map +1 -1
- package/lib/shared/options/{readGitAndNpmDefaults → readOptionDefaults}/index.d.ts +2 -1
- package/lib/shared/options/{readGitAndNpmDefaults → readOptionDefaults}/index.js +2 -2
- package/lib/shared/options/readOptionDefaults/index.js.map +1 -0
- package/lib/shared/options/readOptionDefaults/parsePackageAuthor.js.map +1 -0
- package/lib/shared/options/readOptionDefaults/readDefaultsFromReadme.d.ts +6 -0
- package/lib/shared/options/readOptionDefaults/readDefaultsFromReadme.js +16 -0
- package/lib/shared/options/readOptionDefaults/readDefaultsFromReadme.js.map +1 -0
- package/lib/shared/options/readOptions.js +15 -1
- package/lib/shared/options/readOptions.js.map +1 -1
- package/lib/shared/types.d.ts +6 -1
- package/package.json +2 -2
- package/lib/shared/options/readGitAndNpmDefaults/index.js.map +0 -1
- package/lib/shared/options/readGitAndNpmDefaults/parsePackageAuthor.js.map +0 -1
- package/lib/shared/options/readGitAndNpmDefaults/readTitleFromReadme.d.ts +0 -3
- package/lib/shared/options/readGitAndNpmDefaults/readTitleFromReadme.js +0 -8
- package/lib/shared/options/readGitAndNpmDefaults/readTitleFromReadme.js.map +0 -1
- /package/lib/shared/options/{readGitAndNpmDefaults → readOptionDefaults}/parsePackageAuthor.d.ts +0 -0
- /package/lib/shared/options/{readGitAndNpmDefaults → readOptionDefaults}/parsePackageAuthor.js +0 -0
package/README.md
CHANGED
|
@@ -26,11 +26,7 @@
|
|
|
26
26
|
<img alt="TypeScript: Strict 💪" src="https://img.shields.io/badge/typescript-strict_💪-21bb42.svg" />
|
|
27
27
|
</p>
|
|
28
28
|
|
|
29
|
-
|
|
30
|
-
It can be configured to set up a _lot_ of tooling out of the box.
|
|
31
|
-
Each of the included tools exists for a good reason and provides real value.
|
|
32
|
-
|
|
33
|
-
If you don't want to use any particular tool, you can always remove it manually.
|
|
29
|
+
<img align="right" alt="Project logo: the TypeScript blue square with rounded corners, but a plus sign instead of 'TS'" src="./create-typescript-app.png">
|
|
34
30
|
|
|
35
31
|
## Getting Started
|
|
36
32
|
|
|
@@ -47,6 +43,12 @@ Use the corresponding docs page to get started:
|
|
|
47
43
|
- [Initializing from the template](./docs/Initialization.md): creating a new repository with the [_Use this template_](https://github.com/JoshuaKGoldberg/create-typescript-app/generate) button on GitHub
|
|
48
44
|
- [Migrating an existing repository](./docs/Migration.md): adding this template's tooling on top of an existing repository
|
|
49
45
|
|
|
46
|
+
Note that this template is early stage, opinionated, and not endorsed by the TypeScript team.
|
|
47
|
+
It can be configured to set up a _lot_ of tooling out of the box.
|
|
48
|
+
Each of the included tools exists for a good reason and provides real value.
|
|
49
|
+
|
|
50
|
+
If you don't want to use any particular tool, you can always remove it manually.
|
|
51
|
+
|
|
50
52
|
## Explainer
|
|
51
53
|
|
|
52
54
|
This template is available for anybody who wants to set up a Node application using TypeScript.
|
|
@@ -5,7 +5,14 @@ function getFirstMatchingArg(key) {
|
|
|
5
5
|
);
|
|
6
6
|
}
|
|
7
7
|
function createRerunSuggestion(mode, options) {
|
|
8
|
-
const
|
|
8
|
+
const optionsNormalized = {
|
|
9
|
+
...options,
|
|
10
|
+
...options.logo ? {
|
|
11
|
+
logo: options.logo.src,
|
|
12
|
+
logoAlt: options.logo.alt
|
|
13
|
+
} : { logo: void 0 }
|
|
14
|
+
};
|
|
15
|
+
const args = Object.entries(optionsNormalized).filter(([, value]) => !!value).map(([key, value]) => {
|
|
9
16
|
const valueStringified = `${value}`;
|
|
10
17
|
return `--${getFirstMatchingArg(key)} ${valueStringified.includes(" ") ? `"${value}"` : value}`;
|
|
11
18
|
}).join(" ");
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/create/createRerunSuggestion.ts"],"sourcesContent":["import { Mode } from \"../bin/mode.js\";\nimport { allArgOptions } from \"../shared/options/args.js\";\nimport { Options } from \"../shared/types.js\";\n\nfunction getFirstMatchingArg(key: string) {\n\treturn Object.keys(allArgOptions).find(\n\t\t(arg) => arg.replaceAll(\"-\", \"\") === key.toLowerCase(),\n\t);\n}\n\nexport function createRerunSuggestion(\n\tmode: Mode,\n\toptions: Partial<Options>,\n): string {\n\tconst args = Object.entries(
|
|
1
|
+
{"version":3,"sources":["../../src/create/createRerunSuggestion.ts"],"sourcesContent":["import { Mode } from \"../bin/mode.js\";\nimport { allArgOptions } from \"../shared/options/args.js\";\nimport { Options } from \"../shared/types.js\";\n\nfunction getFirstMatchingArg(key: string) {\n\treturn Object.keys(allArgOptions).find(\n\t\t(arg) => arg.replaceAll(\"-\", \"\") === key.toLowerCase(),\n\t);\n}\n\nexport function createRerunSuggestion(\n\tmode: Mode,\n\toptions: Partial<Options>,\n): string {\n\tconst optionsNormalized = {\n\t\t...options,\n\t\t...(options.logo\n\t\t\t? {\n\t\t\t\t\tlogo: options.logo.src,\n\t\t\t\t\tlogoAlt: options.logo.alt,\n\t\t\t }\n\t\t\t: { logo: undefined }),\n\t};\n\n\tconst args = Object.entries(optionsNormalized)\n\t\t.filter(([, value]) => !!value)\n\t\t.map(([key, value]) => {\n\t\t\tconst valueStringified = `${value}`;\n\t\t\treturn `--${getFirstMatchingArg(key)} ${\n\t\t\t\tvalueStringified.includes(\" \") ? `\"${value}\"` : value\n\t\t\t}`;\n\t\t})\n\t\t.join(\" \");\n\n\treturn `npx create-typescript-app --mode ${mode} ${args}`;\n}\n"],"mappings":"AACA,SAAS,qBAAqB;AAG9B,SAAS,oBAAoB,KAAa;AACzC,SAAO,OAAO,KAAK,aAAa,EAAE;AAAA,IACjC,CAAC,QAAQ,IAAI,WAAW,KAAK,EAAE,MAAM,IAAI,YAAY;AAAA,EACtD;AACD;AAEO,SAAS,sBACf,MACA,SACS;AACT,QAAM,oBAAoB;AAAA,IACzB,GAAG;AAAA,IACH,GAAI,QAAQ,OACT;AAAA,MACA,MAAM,QAAQ,KAAK;AAAA,MACnB,SAAS,QAAQ,KAAK;AAAA,IACtB,IACA,EAAE,MAAM,OAAU;AAAA,EACtB;AAEA,QAAM,OAAO,OAAO,QAAQ,iBAAiB,EAC3C,OAAO,CAAC,CAAC,EAAE,KAAK,MAAM,CAAC,CAAC,KAAK,EAC7B,IAAI,CAAC,CAAC,KAAK,KAAK,MAAM;AACtB,UAAM,mBAAmB,GAAG,KAAK;AACjC,WAAO,KAAK,oBAAoB,GAAG,CAAC,IACnC,iBAAiB,SAAS,GAAG,IAAI,IAAI,KAAK,MAAM,KACjD;AAAA,EACD,CAAC,EACA,KAAK,GAAG;AAEV,SAAO,oCAAoC,IAAI,IAAI,IAAI;AACxD;","names":[]}
|
|
@@ -56,6 +56,12 @@ declare const allArgOptions: {
|
|
|
56
56
|
readonly funding: {
|
|
57
57
|
readonly type: "string";
|
|
58
58
|
};
|
|
59
|
+
readonly logo: {
|
|
60
|
+
readonly type: "string";
|
|
61
|
+
};
|
|
62
|
+
readonly "logo-alt": {
|
|
63
|
+
readonly type: "string";
|
|
64
|
+
};
|
|
59
65
|
readonly owner: {
|
|
60
66
|
readonly type: "string";
|
|
61
67
|
};
|
|
@@ -18,6 +18,8 @@ const allArgOptions = {
|
|
|
18
18
|
"exclude-renovate": { type: "boolean" },
|
|
19
19
|
"exclude-tests": { type: "boolean" },
|
|
20
20
|
funding: { type: "string" },
|
|
21
|
+
logo: { type: "string" },
|
|
22
|
+
"logo-alt": { type: "string" },
|
|
21
23
|
owner: { type: "string" },
|
|
22
24
|
repository: { type: "string" },
|
|
23
25
|
"skip-github-api": { type: "boolean" },
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/shared/options/args.ts"],"sourcesContent":["export const allArgOptions = {\n\tauthor: { type: \"string\" },\n\tbase: { type: \"string\" },\n\t\"create-repository\": { type: \"boolean\" },\n\tdescription: { type: \"string\" },\n\temail: { type: \"string\" },\n\t\"exclude-compliance\": { type: \"boolean\" },\n\t\"exclude-contributors\": { type: \"boolean\" },\n\t\"exclude-lint-json\": { type: \"boolean\" },\n\t\"exclude-lint-knip\": { type: \"boolean\" },\n\t\"exclude-lint-md\": { type: \"boolean\" },\n\t\"exclude-lint-package-json\": { type: \"boolean\" },\n\t\"exclude-lint-packages\": { type: \"boolean\" },\n\t\"exclude-lint-perfectionist\": { type: \"boolean\" },\n\t\"exclude-lint-spelling\": { type: \"boolean\" },\n\t\"exclude-lint-yml\": { type: \"boolean\" },\n\t\"exclude-releases\": { type: \"boolean\" },\n\t\"exclude-renovate\": { type: \"boolean\" },\n\t\"exclude-tests\": { type: \"boolean\" },\n\tfunding: { type: \"string\" },\n\towner: { type: \"string\" },\n\trepository: { type: \"string\" },\n\t\"skip-github-api\": { type: \"boolean\" },\n\t\"skip-install\": { type: \"boolean\" },\n\t\"skip-removal\": { type: \"boolean\" },\n\t\"skip-restore\": { type: \"boolean\" },\n\t\"skip-uninstall\": { type: \"boolean\" },\n\ttitle: { type: \"string\" },\n} as const;\n"],"mappings":"AAAO,MAAM,gBAAgB;AAAA,EAC5B,QAAQ,EAAE,MAAM,SAAS;AAAA,EACzB,MAAM,EAAE,MAAM,SAAS;AAAA,EACvB,qBAAqB,EAAE,MAAM,UAAU;AAAA,EACvC,aAAa,EAAE,MAAM,SAAS;AAAA,EAC9B,OAAO,EAAE,MAAM,SAAS;AAAA,EACxB,sBAAsB,EAAE,MAAM,UAAU;AAAA,EACxC,wBAAwB,EAAE,MAAM,UAAU;AAAA,EAC1C,qBAAqB,EAAE,MAAM,UAAU;AAAA,EACvC,qBAAqB,EAAE,MAAM,UAAU;AAAA,EACvC,mBAAmB,EAAE,MAAM,UAAU;AAAA,EACrC,6BAA6B,EAAE,MAAM,UAAU;AAAA,EAC/C,yBAAyB,EAAE,MAAM,UAAU;AAAA,EAC3C,8BAA8B,EAAE,MAAM,UAAU;AAAA,EAChD,yBAAyB,EAAE,MAAM,UAAU;AAAA,EAC3C,oBAAoB,EAAE,MAAM,UAAU;AAAA,EACtC,oBAAoB,EAAE,MAAM,UAAU;AAAA,EACtC,oBAAoB,EAAE,MAAM,UAAU;AAAA,EACtC,iBAAiB,EAAE,MAAM,UAAU;AAAA,EACnC,SAAS,EAAE,MAAM,SAAS;AAAA,EAC1B,OAAO,EAAE,MAAM,SAAS;AAAA,EACxB,YAAY,EAAE,MAAM,SAAS;AAAA,EAC7B,mBAAmB,EAAE,MAAM,UAAU;AAAA,EACrC,gBAAgB,EAAE,MAAM,UAAU;AAAA,EAClC,gBAAgB,EAAE,MAAM,UAAU;AAAA,EAClC,gBAAgB,EAAE,MAAM,UAAU;AAAA,EAClC,kBAAkB,EAAE,MAAM,UAAU;AAAA,EACpC,OAAO,EAAE,MAAM,SAAS;AACzB;","names":[]}
|
|
1
|
+
{"version":3,"sources":["../../../src/shared/options/args.ts"],"sourcesContent":["export const allArgOptions = {\n\tauthor: { type: \"string\" },\n\tbase: { type: \"string\" },\n\t\"create-repository\": { type: \"boolean\" },\n\tdescription: { type: \"string\" },\n\temail: { type: \"string\" },\n\t\"exclude-compliance\": { type: \"boolean\" },\n\t\"exclude-contributors\": { type: \"boolean\" },\n\t\"exclude-lint-json\": { type: \"boolean\" },\n\t\"exclude-lint-knip\": { type: \"boolean\" },\n\t\"exclude-lint-md\": { type: \"boolean\" },\n\t\"exclude-lint-package-json\": { type: \"boolean\" },\n\t\"exclude-lint-packages\": { type: \"boolean\" },\n\t\"exclude-lint-perfectionist\": { type: \"boolean\" },\n\t\"exclude-lint-spelling\": { type: \"boolean\" },\n\t\"exclude-lint-yml\": { type: \"boolean\" },\n\t\"exclude-releases\": { type: \"boolean\" },\n\t\"exclude-renovate\": { type: \"boolean\" },\n\t\"exclude-tests\": { type: \"boolean\" },\n\tfunding: { type: \"string\" },\n\tlogo: { type: \"string\" },\n\t\"logo-alt\": { type: \"string\" },\n\towner: { type: \"string\" },\n\trepository: { type: \"string\" },\n\t\"skip-github-api\": { type: \"boolean\" },\n\t\"skip-install\": { type: \"boolean\" },\n\t\"skip-removal\": { type: \"boolean\" },\n\t\"skip-restore\": { type: \"boolean\" },\n\t\"skip-uninstall\": { type: \"boolean\" },\n\ttitle: { type: \"string\" },\n} as const;\n"],"mappings":"AAAO,MAAM,gBAAgB;AAAA,EAC5B,QAAQ,EAAE,MAAM,SAAS;AAAA,EACzB,MAAM,EAAE,MAAM,SAAS;AAAA,EACvB,qBAAqB,EAAE,MAAM,UAAU;AAAA,EACvC,aAAa,EAAE,MAAM,SAAS;AAAA,EAC9B,OAAO,EAAE,MAAM,SAAS;AAAA,EACxB,sBAAsB,EAAE,MAAM,UAAU;AAAA,EACxC,wBAAwB,EAAE,MAAM,UAAU;AAAA,EAC1C,qBAAqB,EAAE,MAAM,UAAU;AAAA,EACvC,qBAAqB,EAAE,MAAM,UAAU;AAAA,EACvC,mBAAmB,EAAE,MAAM,UAAU;AAAA,EACrC,6BAA6B,EAAE,MAAM,UAAU;AAAA,EAC/C,yBAAyB,EAAE,MAAM,UAAU;AAAA,EAC3C,8BAA8B,EAAE,MAAM,UAAU;AAAA,EAChD,yBAAyB,EAAE,MAAM,UAAU;AAAA,EAC3C,oBAAoB,EAAE,MAAM,UAAU;AAAA,EACtC,oBAAoB,EAAE,MAAM,UAAU;AAAA,EACtC,oBAAoB,EAAE,MAAM,UAAU;AAAA,EACtC,iBAAiB,EAAE,MAAM,UAAU;AAAA,EACnC,SAAS,EAAE,MAAM,SAAS;AAAA,EAC1B,MAAM,EAAE,MAAM,SAAS;AAAA,EACvB,YAAY,EAAE,MAAM,SAAS;AAAA,EAC7B,OAAO,EAAE,MAAM,SAAS;AAAA,EACxB,YAAY,EAAE,MAAM,SAAS;AAAA,EAC7B,mBAAmB,EAAE,MAAM,UAAU;AAAA,EACrC,gBAAgB,EAAE,MAAM,UAAU;AAAA,EAClC,gBAAgB,EAAE,MAAM,UAAU;AAAA,EAClC,gBAAgB,EAAE,MAAM,UAAU;AAAA,EAClC,kBAAkB,EAAE,MAAM,UAAU;AAAA,EACpC,OAAO,EAAE,MAAM,SAAS;AACzB;","names":[]}
|
|
@@ -4,7 +4,7 @@ async function getPrefillOrPromptedOption(existingValue, message, getPlaceholder
|
|
|
4
4
|
if (existingValue) {
|
|
5
5
|
return existingValue;
|
|
6
6
|
}
|
|
7
|
-
|
|
7
|
+
return filterPromptCancel(
|
|
8
8
|
await prompts.text({
|
|
9
9
|
message,
|
|
10
10
|
placeholder: await getPlaceholder?.(),
|
|
@@ -15,7 +15,6 @@ async function getPrefillOrPromptedOption(existingValue, message, getPlaceholder
|
|
|
15
15
|
}
|
|
16
16
|
})
|
|
17
17
|
);
|
|
18
|
-
return value;
|
|
19
18
|
}
|
|
20
19
|
export {
|
|
21
20
|
getPrefillOrPromptedOption
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/shared/options/getPrefillOrPromptedOption.ts"],"sourcesContent":["import * as prompts from \"@clack/prompts\";\n\nimport { filterPromptCancel } from \"../prompts.js\";\n\nexport async function getPrefillOrPromptedOption(\n\texistingValue: string | undefined,\n\tmessage: string,\n\tgetPlaceholder?: () => Promise<string | undefined>,\n) {\n\tif (existingValue) {\n\t\treturn existingValue;\n\t}\n\n\
|
|
1
|
+
{"version":3,"sources":["../../../src/shared/options/getPrefillOrPromptedOption.ts"],"sourcesContent":["import * as prompts from \"@clack/prompts\";\n\nimport { filterPromptCancel } from \"../prompts.js\";\n\nexport async function getPrefillOrPromptedOption(\n\texistingValue: string | undefined,\n\tmessage: string,\n\tgetPlaceholder?: () => Promise<string | undefined>,\n) {\n\tif (existingValue) {\n\t\treturn existingValue;\n\t}\n\n\treturn filterPromptCancel(\n\t\tawait prompts.text({\n\t\t\tmessage,\n\t\t\tplaceholder: await getPlaceholder?.(),\n\t\t\tvalidate: (val) => {\n\t\t\t\tif (val.length === 0) {\n\t\t\t\t\treturn \"Please enter a value.\";\n\t\t\t\t}\n\t\t\t},\n\t\t}),\n\t);\n}\n"],"mappings":"AAAA,YAAY,aAAa;AAEzB,SAAS,0BAA0B;AAEnC,eAAsB,2BACrB,eACA,SACA,gBACC;AACD,MAAI,eAAe;AAClB,WAAO;AAAA,EACR;AAEA,SAAO;AAAA,IACN,MAAM,QAAQ,KAAK;AAAA,MAClB;AAAA,MACA,aAAa,MAAM,iBAAiB;AAAA,MACpC,UAAU,CAAC,QAAQ;AAClB,YAAI,IAAI,WAAW,GAAG;AACrB,iBAAO;AAAA,QACR;AAAA,MACD;AAAA,IACD,CAAC;AAAA,EACF;AACD;","names":[]}
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
declare function getGitAndNpmDefaults(): {
|
|
2
|
+
logo: () => Promise<string | undefined>;
|
|
3
|
+
title: () => Promise<string | undefined>;
|
|
2
4
|
author: () => Promise<string>;
|
|
3
5
|
description: () => Promise<string | undefined>;
|
|
4
6
|
email: () => Promise<string | undefined>;
|
|
5
7
|
funding: () => Promise<string | undefined>;
|
|
6
8
|
owner: () => Promise<string | undefined>;
|
|
7
9
|
repository: () => Promise<string | undefined>;
|
|
8
|
-
title: () => Promise<string | undefined>;
|
|
9
10
|
};
|
|
10
11
|
|
|
11
12
|
export { getGitAndNpmDefaults };
|
|
@@ -8,7 +8,7 @@ import { readPackageData } from "../../packages.js";
|
|
|
8
8
|
import { tryCatchAsync } from "../../tryCatchAsync.js";
|
|
9
9
|
import { tryCatchLazyValueAsync } from "../../tryCatchLazyValueAsync.js";
|
|
10
10
|
import { parsePackageAuthor } from "./parsePackageAuthor.js";
|
|
11
|
-
import {
|
|
11
|
+
import { readDefaultsFromReadme } from "./readDefaultsFromReadme.js";
|
|
12
12
|
function getGitAndNpmDefaults() {
|
|
13
13
|
const gitDefaults = tryCatchLazyValueAsync(
|
|
14
14
|
async () => gitUrlParse(await gitRemoteOriginUrl())
|
|
@@ -31,7 +31,7 @@ function getGitAndNpmDefaults() {
|
|
|
31
31
|
),
|
|
32
32
|
owner: async () => (await gitDefaults())?.organization ?? (await packageAuthor()).author,
|
|
33
33
|
repository: async () => (await gitDefaults())?.name ?? (await packageData()).name,
|
|
34
|
-
|
|
34
|
+
...readDefaultsFromReadme()
|
|
35
35
|
};
|
|
36
36
|
}
|
|
37
37
|
export {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../src/shared/options/readOptionDefaults/index.ts"],"sourcesContent":["import { $ } from \"execa\";\nimport gitRemoteOriginUrl from \"git-remote-origin-url\";\nimport gitUrlParse from \"git-url-parse\";\nimport lazyValue from \"lazy-value\";\nimport fs from \"node:fs/promises\";\nimport npmUser from \"npm-user\";\n\nimport { readPackageData } from \"../../packages.js\";\nimport { tryCatchAsync } from \"../../tryCatchAsync.js\";\nimport { tryCatchLazyValueAsync } from \"../../tryCatchLazyValueAsync.js\";\nimport { parsePackageAuthor } from \"./parsePackageAuthor.js\";\nimport { readDefaultsFromReadme } from \"./readDefaultsFromReadme.js\";\n\nexport function getGitAndNpmDefaults() {\n\tconst gitDefaults = tryCatchLazyValueAsync(async () =>\n\t\tgitUrlParse(await gitRemoteOriginUrl()),\n\t);\n\n\tconst npmDefaults = tryCatchLazyValueAsync(\n\t\tasync () => await npmUser((await $`npm whoami`).stdout),\n\t);\n\n\tconst packageData = lazyValue(readPackageData);\n\tconst packageAuthor = lazyValue(async () =>\n\t\tparsePackageAuthor(await packageData()),\n\t);\n\n\treturn {\n\t\tauthor: async () => (await packageAuthor()).author ?? npmDefaults.name,\n\t\tdescription: async () => (await packageData()).description,\n\t\temail: async () =>\n\t\t\t(await npmDefaults())?.email ??\n\t\t\t(await packageAuthor()).email ??\n\t\t\t(await tryCatchAsync(\n\t\t\t\tasync () => (await $`git config --get user.email`).stdout,\n\t\t\t)),\n\t\tfunding: async () =>\n\t\t\tawait tryCatchAsync(\n\t\t\t\tasync () =>\n\t\t\t\t\t(await fs.readFile(\".github/FUNDING.yml\"))\n\t\t\t\t\t\t.toString()\n\t\t\t\t\t\t.split(\":\")[1]\n\t\t\t\t\t\t?.trim(),\n\t\t\t),\n\t\towner: async () =>\n\t\t\t(await gitDefaults())?.organization ?? (await packageAuthor()).author,\n\t\trepository: async () =>\n\t\t\t(await gitDefaults())?.name ?? (await packageData()).name,\n\t\t...readDefaultsFromReadme(),\n\t};\n}\n"],"mappings":"AAAA,SAAS,SAAS;AAClB,OAAO,wBAAwB;AAC/B,OAAO,iBAAiB;AACxB,OAAO,eAAe;AACtB,OAAO,QAAQ;AACf,OAAO,aAAa;AAEpB,SAAS,uBAAuB;AAChC,SAAS,qBAAqB;AAC9B,SAAS,8BAA8B;AACvC,SAAS,0BAA0B;AACnC,SAAS,8BAA8B;AAEhC,SAAS,uBAAuB;AACtC,QAAM,cAAc;AAAA,IAAuB,YAC1C,YAAY,MAAM,mBAAmB,CAAC;AAAA,EACvC;AAEA,QAAM,cAAc;AAAA,IACnB,YAAY,MAAM,SAAS,MAAM,eAAe,MAAM;AAAA,EACvD;AAEA,QAAM,cAAc,UAAU,eAAe;AAC7C,QAAM,gBAAgB;AAAA,IAAU,YAC/B,mBAAmB,MAAM,YAAY,CAAC;AAAA,EACvC;AAEA,SAAO;AAAA,IACN,QAAQ,aAAa,MAAM,cAAc,GAAG,UAAU,YAAY;AAAA,IAClE,aAAa,aAAa,MAAM,YAAY,GAAG;AAAA,IAC/C,OAAO,aACL,MAAM,YAAY,IAAI,UACtB,MAAM,cAAc,GAAG,SACvB,MAAM;AAAA,MACN,aAAa,MAAM,gCAAgC;AAAA,IACpD;AAAA,IACD,SAAS,YACR,MAAM;AAAA,MACL,aACE,MAAM,GAAG,SAAS,qBAAqB,GACtC,SAAS,EACT,MAAM,GAAG,EAAE,CAAC,GACX,KAAK;AAAA,IACV;AAAA,IACD,OAAO,aACL,MAAM,YAAY,IAAI,iBAAiB,MAAM,cAAc,GAAG;AAAA,IAChE,YAAY,aACV,MAAM,YAAY,IAAI,SAAS,MAAM,YAAY,GAAG;AAAA,IACtD,GAAG,uBAAuB;AAAA,EAC3B;AACD;","names":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../src/shared/options/readOptionDefaults/parsePackageAuthor.ts"],"sourcesContent":["import { PartialPackageData } from \"../../types.js\";\n\nexport function parsePackageAuthor(packageData: PartialPackageData) {\n\tconst [packageAuthor, packageEmail] =\n\t\ttypeof packageData.author === \"string\"\n\t\t\t? [\n\t\t\t\t\tpackageData.author.split(\"<\")[0].trim(),\n\t\t\t\t\tpackageData.author.split(/<|>/)[1]?.trim(),\n\t\t\t ]\n\t\t\t: [packageData.author?.name, packageData.author?.email];\n\n\treturn {\n\t\tauthor: packageAuthor,\n\t\temail: packageEmail,\n\t};\n}\n"],"mappings":"AAEO,SAAS,mBAAmB,aAAiC;AACnE,QAAM,CAAC,eAAe,YAAY,IACjC,OAAO,YAAY,WAAW,WAC3B;AAAA,IACA,YAAY,OAAO,MAAM,GAAG,EAAE,CAAC,EAAE,KAAK;AAAA,IACtC,YAAY,OAAO,MAAM,KAAK,EAAE,CAAC,GAAG,KAAK;AAAA,EACzC,IACA,CAAC,YAAY,QAAQ,MAAM,YAAY,QAAQ,KAAK;AAExD,SAAO;AAAA,IACN,QAAQ;AAAA,IACR,OAAO;AAAA,EACR;AACD;","names":[]}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import lazyValue from "lazy-value";
|
|
2
|
+
import { readFileSafe } from "../../readFileSafe.js";
|
|
3
|
+
function readDefaultsFromReadme() {
|
|
4
|
+
const readme = lazyValue(async () => await readFileSafe("README.md", ""));
|
|
5
|
+
const imageTag = lazyValue(
|
|
6
|
+
async () => (await readme()).match(/<img.+src.+\/>/)?.[0]
|
|
7
|
+
);
|
|
8
|
+
return {
|
|
9
|
+
logo: async () => (await imageTag())?.match(/src\s*=(.+)?\/>/)?.[1]?.replaceAll(/^['"]|['"]$/g, ""),
|
|
10
|
+
title: async () => (await readme()).match(/^(?:# |<h1\s+align="center">)(.*?)(?:<\/h1>)?$/i)?.[1]?.trim()?.replace(/<[^>]+(?:>|$)/g, "")
|
|
11
|
+
};
|
|
12
|
+
}
|
|
13
|
+
export {
|
|
14
|
+
readDefaultsFromReadme
|
|
15
|
+
};
|
|
16
|
+
//# sourceMappingURL=readDefaultsFromReadme.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../src/shared/options/readOptionDefaults/readDefaultsFromReadme.ts"],"sourcesContent":["import lazyValue from \"lazy-value\";\n\nimport { readFileSafe } from \"../../readFileSafe.js\";\n\nexport function readDefaultsFromReadme() {\n\tconst readme = lazyValue(async () => await readFileSafe(\"README.md\", \"\"));\n\n\tconst imageTag = lazyValue(\n\t\tasync () => (await readme()).match(/<img.+src.+\\/>/)?.[0],\n\t);\n\n\treturn {\n\t\tlogo: async () =>\n\t\t\t(await imageTag())\n\t\t\t\t?.match(/src\\s*=(.+)?\\/>/)?.[1]\n\t\t\t\t?.replaceAll(/^['\"]|['\"]$/g, \"\"),\n\t\ttitle: async () =>\n\t\t\t(await readme())\n\t\t\t\t.match(/^(?:# |<h1\\s+align=\"center\">)(.*?)(?:<\\/h1>)?$/i)?.[1]\n\t\t\t\t?.trim()\n\t\t\t\t?.replace(/<[^>]+(?:>|$)/g, \"\"),\n\t};\n}\n"],"mappings":"AAAA,OAAO,eAAe;AAEtB,SAAS,oBAAoB;AAEtB,SAAS,yBAAyB;AACxC,QAAM,SAAS,UAAU,YAAY,MAAM,aAAa,aAAa,EAAE,CAAC;AAExE,QAAM,WAAW;AAAA,IAChB,aAAa,MAAM,OAAO,GAAG,MAAM,gBAAgB,IAAI,CAAC;AAAA,EACzD;AAEA,SAAO;AAAA,IACN,MAAM,aACJ,MAAM,SAAS,IACb,MAAM,iBAAiB,IAAI,CAAC,GAC5B,WAAW,gBAAgB,EAAE;AAAA,IACjC,OAAO,aACL,MAAM,OAAO,GACZ,MAAM,iDAAiD,IAAI,CAAC,GAC3D,KAAK,GACL,QAAQ,kBAAkB,EAAE;AAAA,EACjC;AACD;","names":[]}
|
|
@@ -7,7 +7,7 @@ import { augmentOptionsWithExcludes } from "./augmentOptionsWithExcludes.js";
|
|
|
7
7
|
import { ensureRepositoryExists } from "./ensureRepositoryExists.js";
|
|
8
8
|
import { getGitHub } from "./getGitHub.js";
|
|
9
9
|
import { getPrefillOrPromptedOption } from "./getPrefillOrPromptedOption.js";
|
|
10
|
-
import { getGitAndNpmDefaults } from "./
|
|
10
|
+
import { getGitAndNpmDefaults } from "./readOptionDefaults/index.js";
|
|
11
11
|
async function readOptions(args) {
|
|
12
12
|
const defaults = getGitAndNpmDefaults();
|
|
13
13
|
const { values } = parseArgs({
|
|
@@ -103,12 +103,24 @@ async function readOptions(args) {
|
|
|
103
103
|
if (!options.title) {
|
|
104
104
|
return { cancelled: true, options };
|
|
105
105
|
}
|
|
106
|
+
let logo;
|
|
107
|
+
if (options.logo) {
|
|
108
|
+
const alt = await getPrefillOrPromptedOption(
|
|
109
|
+
options.logoAlt,
|
|
110
|
+
"What is the alt text (non-visual description) of the logo?"
|
|
111
|
+
);
|
|
112
|
+
if (!alt) {
|
|
113
|
+
return { cancelled: true, options };
|
|
114
|
+
}
|
|
115
|
+
logo = { alt, src: options.logo };
|
|
116
|
+
}
|
|
106
117
|
const augmentedOptions = await augmentOptionsWithExcludes({
|
|
107
118
|
...options,
|
|
108
119
|
author: options.author ?? await defaults.owner(),
|
|
109
120
|
description: options.description,
|
|
110
121
|
email: options.email ?? await defaults.email(),
|
|
111
122
|
funding: options.funding ?? await defaults.funding(),
|
|
123
|
+
logo,
|
|
112
124
|
owner: options.owner,
|
|
113
125
|
repository,
|
|
114
126
|
title: options.title
|
|
@@ -150,6 +162,8 @@ const optionsSchema = z.object({
|
|
|
150
162
|
excludeRenovate: z.boolean().optional(),
|
|
151
163
|
excludeTests: z.boolean().optional(),
|
|
152
164
|
funding: z.string().optional(),
|
|
165
|
+
logo: z.string().optional(),
|
|
166
|
+
logoAlt: z.string().optional(),
|
|
153
167
|
owner: z.string().optional(),
|
|
154
168
|
repository: z.string().optional(),
|
|
155
169
|
skipGitHubApi: z.boolean(),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/shared/options/readOptions.ts"],"sourcesContent":["import { parseArgs } from \"node:util\";\nimport { titleCase } from \"title-case\";\nimport { z } from \"zod\";\n\nimport { withSpinner } from \"../cli/spinners.js\";\nimport { Options } from \"../types.js\";\nimport { allArgOptions } from \"./args.js\";\nimport { augmentOptionsWithExcludes } from \"./augmentOptionsWithExcludes.js\";\nimport { ensureRepositoryExists } from \"./ensureRepositoryExists.js\";\nimport { GitHub, getGitHub } from \"./getGitHub.js\";\nimport { getPrefillOrPromptedOption } from \"./getPrefillOrPromptedOption.js\";\nimport { getGitAndNpmDefaults } from \"./readGitAndNpmDefaults/index.js\";\n\nexport interface GitHubAndOptions {\n\tgithub: GitHub | undefined;\n\toptions: Options;\n}\n\nexport interface OptionsParseCancelled {\n\tcancelled: true;\n\toptions: object;\n\tzodError?: z.ZodError<object>;\n}\n\nexport interface OptionsParseSuccess extends GitHubAndOptions {\n\tcancelled: false;\n}\n\nexport type OptionsParseResult = OptionsParseCancelled | OptionsParseSuccess;\n\nexport async function readOptions(args: string[]): Promise<OptionsParseResult> {\n\tconst defaults = getGitAndNpmDefaults();\n\tconst { values } = parseArgs({\n\t\targs,\n\t\toptions: allArgOptions,\n\t\tstrict: false,\n\t\ttokens: true,\n\t});\n\n\tconst mappedOptions = {\n\t\tauthor: values.author,\n\t\tbase: values.base,\n\t\tcreateRepository: values[\"create-repository\"],\n\t\tdescription: values.description,\n\t\temail: values.email,\n\t\texcludeCompliance: values[\"exclude-compliance\"],\n\t\texcludeContributors: values[\"exclude-contributors\"],\n\t\texcludeLintJson: values[\"exclude-lint-json\"],\n\t\texcludeLintKnip: values[\"exclude-lint-knip\"],\n\t\texcludeLintMd: values[\"exclude-lint-md\"],\n\t\texcludeLintPackageJson: values[\"exclude-lint-package-json\"],\n\t\texcludeLintPackages: values[\"exclude-lint-packages\"],\n\t\texcludeLintPerfectionist: values[\"exclude-lint-perfectionist\"],\n\t\texcludeLintSpelling: values[\"exclude-lint-spelling\"],\n\t\texcludeLintYml: values[\"exclude-lint-yml\"],\n\t\texcludeReleases: values[\"exclude-releases\"],\n\t\texcludeRenovate: values[\"exclude-renovate\"],\n\t\texcludeTests: values[\"unit-tests\"],\n\t\tfunding: values.funding,\n\t\towner: values.owner,\n\t\trepository: values.repository,\n\t\tskipGitHubApi: !!values[\"skip-github-api\"],\n\t\tskipInstall: !!values[\"skip-install\"],\n\t\tskipRemoval: !!values[\"skip-removal\"],\n\t\tskipRestore: values[\"skip-restore\"],\n\t\tskipUninstall: !!values[\"skip-uninstall\"],\n\t\ttitle: values.title,\n\t};\n\n\tconst optionsParseResult = optionsSchema.safeParse(mappedOptions);\n\n\tif (!optionsParseResult.success) {\n\t\treturn {\n\t\t\tcancelled: true,\n\t\t\toptions: mappedOptions,\n\t\t\tzodError: optionsParseResult.error,\n\t\t};\n\t}\n\n\tconst options = optionsParseResult.data;\n\n\toptions.owner ??= await getPrefillOrPromptedOption(\n\t\toptions.owner,\n\t\t\"What organization or user will the repository be under?\",\n\t\tdefaults.owner,\n\t);\n\tif (!options.owner) {\n\t\treturn {\n\t\t\tcancelled: true,\n\t\t\toptions,\n\t\t};\n\t}\n\n\toptions.repository ??= await getPrefillOrPromptedOption(\n\t\toptions.repository,\n\t\t\"What will the kebab-case name of the repository be?\",\n\t\tdefaults.repository,\n\t);\n\tif (!options.repository) {\n\t\treturn {\n\t\t\tcancelled: true,\n\t\t\toptions,\n\t\t};\n\t}\n\n\tconst { github, repository } = await ensureRepositoryExists(\n\t\tvalues[\"skip-github-api\"]\n\t\t\t? undefined\n\t\t\t: await withSpinner(\"Checking GitHub authentication\", getGitHub),\n\t\t{\n\t\t\tcreateRepository: options.createRepository,\n\t\t\towner: options.owner,\n\t\t\trepository: options.repository,\n\t\t},\n\t);\n\tif (!repository) {\n\t\treturn { cancelled: true, options };\n\t}\n\n\toptions.description ??= await getPrefillOrPromptedOption(\n\t\toptions.description,\n\t\t\"How would you describe the new package?\",\n\t\tasync () =>\n\t\t\t(await defaults.description()) ?? \"A very lovely package. Hooray!\",\n\t);\n\tif (!options.description) {\n\t\treturn { cancelled: true, options };\n\t}\n\n\toptions.title ??= await getPrefillOrPromptedOption(\n\t\toptions.title,\n\t\t\"What will the Title Case title of the repository be?\",\n\t\tasync () =>\n\t\t\t(await defaults.title()) ?? titleCase(repository).replaceAll(\"-\", \" \"),\n\t);\n\tif (!options.title) {\n\t\treturn { cancelled: true, options };\n\t}\n\n\tconst augmentedOptions = await augmentOptionsWithExcludes({\n\t\t...options,\n\t\tauthor: options.author ?? (await defaults.owner()),\n\t\tdescription: options.description,\n\t\temail: options.email ?? (await defaults.email()),\n\t\tfunding: options.funding ?? (await defaults.funding()),\n\t\towner: options.owner,\n\t\trepository,\n\t\ttitle: options.title,\n\t});\n\n\tif (!augmentedOptions) {\n\t\treturn {\n\t\t\tcancelled: true,\n\t\t\toptions,\n\t\t};\n\t}\n\n\treturn {\n\t\tcancelled: false,\n\t\tgithub,\n\t\toptions: augmentedOptions,\n\t};\n}\n\nconst optionsSchema = z.object({\n\tauthor: z.string().optional(),\n\tbase: z\n\t\t.union([\n\t\t\tz.literal(\"common\"),\n\t\t\tz.literal(\"everything\"),\n\t\t\tz.literal(\"minimum\"),\n\t\t\tz.literal(\"prompt\"),\n\t\t])\n\t\t.optional(),\n\tcreateRepository: z.boolean().optional(),\n\tdescription: z.string().optional(),\n\temail: z.string().email().optional(),\n\texcludeCompliance: z.boolean().optional(),\n\texcludeContributors: z.boolean().optional(),\n\texcludeLintJson: z.boolean().optional(),\n\texcludeLintKnip: z.boolean().optional(),\n\texcludeLintMd: z.boolean().optional(),\n\texcludeLintPackageJson: z.boolean().optional(),\n\texcludeLintPackages: z.boolean().optional(),\n\texcludeLintPerfectionist: z.boolean().optional(),\n\texcludeLintSpelling: z.boolean().optional(),\n\texcludeLintYml: z.boolean().optional(),\n\texcludeReleases: z.boolean().optional(),\n\texcludeRenovate: z.boolean().optional(),\n\texcludeTests: z.boolean().optional(),\n\tfunding: z.string().optional(),\n\towner: z.string().optional(),\n\trepository: z.string().optional(),\n\tskipGitHubApi: z.boolean(),\n\tskipInstall: z.boolean(),\n\tskipRemoval: z.boolean(),\n\tskipRestore: z.boolean().optional(),\n\tskipUninstall: z.boolean(),\n\ttitle: z.string().optional(),\n});\n"],"mappings":"AAAA,SAAS,iBAAiB;AAC1B,SAAS,iBAAiB;AAC1B,SAAS,SAAS;AAElB,SAAS,mBAAmB;AAE5B,SAAS,qBAAqB;AAC9B,SAAS,kCAAkC;AAC3C,SAAS,8BAA8B;AACvC,SAAiB,iBAAiB;AAClC,SAAS,kCAAkC;AAC3C,SAAS,4BAA4B;AAmBrC,eAAsB,YAAY,MAA6C;AAC9E,QAAM,WAAW,qBAAqB;AACtC,QAAM,EAAE,OAAO,IAAI,UAAU;AAAA,IAC5B;AAAA,IACA,SAAS;AAAA,IACT,QAAQ;AAAA,IACR,QAAQ;AAAA,EACT,CAAC;AAED,QAAM,gBAAgB;AAAA,IACrB,QAAQ,OAAO;AAAA,IACf,MAAM,OAAO;AAAA,IACb,kBAAkB,OAAO,mBAAmB;AAAA,IAC5C,aAAa,OAAO;AAAA,IACpB,OAAO,OAAO;AAAA,IACd,mBAAmB,OAAO,oBAAoB;AAAA,IAC9C,qBAAqB,OAAO,sBAAsB;AAAA,IAClD,iBAAiB,OAAO,mBAAmB;AAAA,IAC3C,iBAAiB,OAAO,mBAAmB;AAAA,IAC3C,eAAe,OAAO,iBAAiB;AAAA,IACvC,wBAAwB,OAAO,2BAA2B;AAAA,IAC1D,qBAAqB,OAAO,uBAAuB;AAAA,IACnD,0BAA0B,OAAO,4BAA4B;AAAA,IAC7D,qBAAqB,OAAO,uB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AAE,SAAS;AAAA,EACvC,aAAa,EAAE,OAAO,EAAE,SAAS;AAAA,EACjC,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,SAAS;AAAA,EACnC,mBAAmB,EAAE,QAAQ,EAAE,SAAS;AAAA,EACxC,qBAAqB,EAAE,QAAQ,EAAE,SAAS;AAAA,EAC1C,iBAAiB,EAAE,QAAQ,EAAE,SAAS;AAAA,EACtC,iBAAiB,EAAE,QAAQ,EAAE,SAAS;AAAA,EACtC,eAAe,EAAE,QAAQ,EAAE,SAAS;AAAA,EACpC,wBAAwB,EAAE,QAAQ,EAAE,SAAS;AAAA,EAC7C,qBAAqB,EAAE,QAAQ,EAAE,SAAS;AAAA,EAC1C,0BAA0B,EAAE,QAAQ,EAAE,SAAS;AAAA,EAC/C,qBAAqB,EAAE,QAAQ,EAAE,SAAS;AAAA,EAC1C,gBAAgB,EAAE,QAAQ,EAAE,SAAS;AAAA,EACrC,iBAAiB,EAAE,QAAQ,EAAE,SAAS;AAAA,EACtC,iBAAiB,EAAE,QAAQ,EAAE,SAAS;AAAA,EACtC,cAAc,EAAE,QAAQ,EAAE,SAAS;AAAA,EACnC,SAAS,EAAE,OAAO,EAAE,SAAS;AAAA,EAC7B,OAAO,EAAE,OAAO,EAAE,SAAS;AAAA,EAC3B,YAAY,EAAE,OAAO,EAAE,SAAS;AAAA,EAChC,eAAe,EAAE,QAAQ;AAAA,EACzB,aAAa,EAAE,QAAQ;AAAA,EACvB,aAAa,EAAE,QAAQ;AAAA,EACvB,aAAa,EAAE,QAAQ,EAAE,SAAS;AAAA,EAClC,eAAe,EAAE,QAAQ;AAAA,EACzB,OAAO,EAAE,OAAO,EAAE,SAAS;AAC5B,CAAC;","names":[]}
|
|
1
|
+
{"version":3,"sources":["../../../src/shared/options/readOptions.ts"],"sourcesContent":["import { parseArgs } from \"node:util\";\nimport { titleCase } from \"title-case\";\nimport { z } from \"zod\";\n\nimport { withSpinner } from \"../cli/spinners.js\";\nimport { Options, OptionsLogo } from \"../types.js\";\nimport { allArgOptions } from \"./args.js\";\nimport { augmentOptionsWithExcludes } from \"./augmentOptionsWithExcludes.js\";\nimport { ensureRepositoryExists } from \"./ensureRepositoryExists.js\";\nimport { GitHub, getGitHub } from \"./getGitHub.js\";\nimport { getPrefillOrPromptedOption } from \"./getPrefillOrPromptedOption.js\";\nimport { getGitAndNpmDefaults } from \"./readOptionDefaults/index.js\";\n\nexport interface GitHubAndOptions {\n\tgithub: GitHub | undefined;\n\toptions: Options;\n}\n\nexport interface OptionsParseCancelled {\n\tcancelled: true;\n\toptions: object;\n\tzodError?: z.ZodError<object>;\n}\n\nexport interface OptionsParseSuccess extends GitHubAndOptions {\n\tcancelled: false;\n}\n\nexport type OptionsParseResult = OptionsParseCancelled | OptionsParseSuccess;\n\nexport async function readOptions(args: string[]): Promise<OptionsParseResult> {\n\tconst defaults = getGitAndNpmDefaults();\n\tconst { values } = parseArgs({\n\t\targs,\n\t\toptions: allArgOptions,\n\t\tstrict: false,\n\t\ttokens: true,\n\t});\n\n\tconst mappedOptions = {\n\t\tauthor: values.author,\n\t\tbase: values.base,\n\t\tcreateRepository: values[\"create-repository\"],\n\t\tdescription: values.description,\n\t\temail: values.email,\n\t\texcludeCompliance: values[\"exclude-compliance\"],\n\t\texcludeContributors: values[\"exclude-contributors\"],\n\t\texcludeLintJson: values[\"exclude-lint-json\"],\n\t\texcludeLintKnip: values[\"exclude-lint-knip\"],\n\t\texcludeLintMd: values[\"exclude-lint-md\"],\n\t\texcludeLintPackageJson: values[\"exclude-lint-package-json\"],\n\t\texcludeLintPackages: values[\"exclude-lint-packages\"],\n\t\texcludeLintPerfectionist: values[\"exclude-lint-perfectionist\"],\n\t\texcludeLintSpelling: values[\"exclude-lint-spelling\"],\n\t\texcludeLintYml: values[\"exclude-lint-yml\"],\n\t\texcludeReleases: values[\"exclude-releases\"],\n\t\texcludeRenovate: values[\"exclude-renovate\"],\n\t\texcludeTests: values[\"unit-tests\"],\n\t\tfunding: values.funding,\n\t\towner: values.owner,\n\t\trepository: values.repository,\n\t\tskipGitHubApi: !!values[\"skip-github-api\"],\n\t\tskipInstall: !!values[\"skip-install\"],\n\t\tskipRemoval: !!values[\"skip-removal\"],\n\t\tskipRestore: values[\"skip-restore\"],\n\t\tskipUninstall: !!values[\"skip-uninstall\"],\n\t\ttitle: values.title,\n\t};\n\n\tconst optionsParseResult = optionsSchema.safeParse(mappedOptions);\n\n\tif (!optionsParseResult.success) {\n\t\treturn {\n\t\t\tcancelled: true,\n\t\t\toptions: mappedOptions,\n\t\t\tzodError: optionsParseResult.error,\n\t\t};\n\t}\n\n\tconst options = optionsParseResult.data;\n\n\toptions.owner ??= await getPrefillOrPromptedOption(\n\t\toptions.owner,\n\t\t\"What organization or user will the repository be under?\",\n\t\tdefaults.owner,\n\t);\n\tif (!options.owner) {\n\t\treturn {\n\t\t\tcancelled: true,\n\t\t\toptions,\n\t\t};\n\t}\n\n\toptions.repository ??= await getPrefillOrPromptedOption(\n\t\toptions.repository,\n\t\t\"What will the kebab-case name of the repository be?\",\n\t\tdefaults.repository,\n\t);\n\tif (!options.repository) {\n\t\treturn {\n\t\t\tcancelled: true,\n\t\t\toptions,\n\t\t};\n\t}\n\n\tconst { github, repository } = await ensureRepositoryExists(\n\t\tvalues[\"skip-github-api\"]\n\t\t\t? undefined\n\t\t\t: await withSpinner(\"Checking GitHub authentication\", getGitHub),\n\t\t{\n\t\t\tcreateRepository: options.createRepository,\n\t\t\towner: options.owner,\n\t\t\trepository: options.repository,\n\t\t},\n\t);\n\tif (!repository) {\n\t\treturn { cancelled: true, options };\n\t}\n\n\toptions.description ??= await getPrefillOrPromptedOption(\n\t\toptions.description,\n\t\t\"How would you describe the new package?\",\n\t\tasync () =>\n\t\t\t(await defaults.description()) ?? \"A very lovely package. Hooray!\",\n\t);\n\tif (!options.description) {\n\t\treturn { cancelled: true, options };\n\t}\n\n\toptions.title ??= await getPrefillOrPromptedOption(\n\t\toptions.title,\n\t\t\"What will the Title Case title of the repository be?\",\n\t\tasync () =>\n\t\t\t(await defaults.title()) ?? titleCase(repository).replaceAll(\"-\", \" \"),\n\t);\n\tif (!options.title) {\n\t\treturn { cancelled: true, options };\n\t}\n\n\tlet logo: OptionsLogo | undefined;\n\n\tif (options.logo) {\n\t\tconst alt = await getPrefillOrPromptedOption(\n\t\t\toptions.logoAlt,\n\t\t\t\"What is the alt text (non-visual description) of the logo?\",\n\t\t);\n\t\tif (!alt) {\n\t\t\treturn { cancelled: true, options };\n\t\t}\n\n\t\tlogo = { alt, src: options.logo };\n\t}\n\n\tconst augmentedOptions = await augmentOptionsWithExcludes({\n\t\t...options,\n\t\tauthor: options.author ?? (await defaults.owner()),\n\t\tdescription: options.description,\n\t\temail: options.email ?? (await defaults.email()),\n\t\tfunding: options.funding ?? (await defaults.funding()),\n\t\tlogo,\n\t\towner: options.owner,\n\t\trepository,\n\t\ttitle: options.title,\n\t});\n\n\tif (!augmentedOptions) {\n\t\treturn {\n\t\t\tcancelled: true,\n\t\t\toptions,\n\t\t};\n\t}\n\n\treturn {\n\t\tcancelled: false,\n\t\tgithub,\n\t\toptions: augmentedOptions,\n\t};\n}\n\nconst optionsSchema = z.object({\n\tauthor: z.string().optional(),\n\tbase: z\n\t\t.union([\n\t\t\tz.literal(\"common\"),\n\t\t\tz.literal(\"everything\"),\n\t\t\tz.literal(\"minimum\"),\n\t\t\tz.literal(\"prompt\"),\n\t\t])\n\t\t.optional(),\n\tcreateRepository: z.boolean().optional(),\n\tdescription: z.string().optional(),\n\temail: z.string().email().optional(),\n\texcludeCompliance: z.boolean().optional(),\n\texcludeContributors: z.boolean().optional(),\n\texcludeLintJson: z.boolean().optional(),\n\texcludeLintKnip: z.boolean().optional(),\n\texcludeLintMd: z.boolean().optional(),\n\texcludeLintPackageJson: z.boolean().optional(),\n\texcludeLintPackages: z.boolean().optional(),\n\texcludeLintPerfectionist: z.boolean().optional(),\n\texcludeLintSpelling: z.boolean().optional(),\n\texcludeLintYml: z.boolean().optional(),\n\texcludeReleases: z.boolean().optional(),\n\texcludeRenovate: z.boolean().optional(),\n\texcludeTests: z.boolean().optional(),\n\tfunding: z.string().optional(),\n\tlogo: z.string().optional(),\n\tlogoAlt: z.string().optional(),\n\towner: z.string().optional(),\n\trepository: z.string().optional(),\n\tskipGitHubApi: z.boolean(),\n\tskipInstall: z.boolean(),\n\tskipRemoval: z.boolean(),\n\tskipRestore: z.boolean().optional(),\n\tskipUninstall: z.boolean(),\n\ttitle: z.string().optional(),\n});\n"],"mappings":"AAAA,SAAS,iBAAiB;AAC1B,SAAS,iBAAiB;AAC1B,SAAS,SAAS;AAElB,SAAS,mBAAmB;AAE5B,SAAS,qBAAqB;AAC9B,SAAS,kCAAkC;AAC3C,SAAS,8BAA8B;AACvC,SAAiB,iBAAiB;AAClC,SAAS,kCAAkC;AAC3C,SAAS,4BAA4B;AAmBrC,eAAsB,YAAY,MAA6C;AAC9E,QAAM,WAAW,qBAAqB;AACtC,QAAM,EAAE,OAAO,IAAI,UAAU;AAAA,IAC5B;AAAA,IACA,SAAS;AAAA,IACT,QAAQ;AAAA,IACR,QAAQ;AAAA,EACT,CAAC;AAED,QAAM,gBAAgB;AAAA,IACrB,QAAQ,OAAO;AAAA,IACf,MAAM,OAAO;AAAA,IACb,kBAAkB,OAAO,mBAAmB;AAAA,IAC5C,aAAa,OAAO;AAAA,IACpB,OAAO,OAAO;AAAA,IACd,mBAAmB,OAAO,oBAAoB;AAAA,IAC9C,qBAAqB,OAAO,sBAAsB;AAAA,IAClD,iBAAiB,OAAO,mBAAmB;AAAA,IAC3C,iBAAiB,OAAO,mBAAmB;AAAA,IAC3C,eAAe,OAAO,iBAAiB;AAAA,IACvC,wBAAwB,OAAO,2BAA2B;AAAA,IAC1D,qBAAqB,OAAO,uBAAuB;AAAA,IACnD,0BAA0B,OAAO,4BAA4B;AAAA,IAC7D,qBAAqB,OAAO,uBAAuB;AAAA,IACnD,gBAAgB,OAAO,kBAAkB;AAAA,IACzC,iBAAiB,OAAO,kBAAkB;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eAAe,EAAE,QAAQ;AAAA,EACzB,OAAO,EAAE,OAAO,EAAE,SAAS;AAC5B,CAAC;","names":[]}
|
package/lib/shared/types.d.ts
CHANGED
|
@@ -21,6 +21,10 @@ interface PartialPackageData {
|
|
|
21
21
|
} | string;
|
|
22
22
|
}
|
|
23
23
|
type InputBase = "common" | "everything" | "minimum" | "prompt";
|
|
24
|
+
interface OptionsLogo {
|
|
25
|
+
alt: string;
|
|
26
|
+
src: string;
|
|
27
|
+
}
|
|
24
28
|
interface Options {
|
|
25
29
|
author?: string;
|
|
26
30
|
base?: InputBase;
|
|
@@ -41,6 +45,7 @@ interface Options {
|
|
|
41
45
|
excludeRenovate?: boolean;
|
|
42
46
|
excludeTests?: boolean;
|
|
43
47
|
funding?: string;
|
|
48
|
+
logo: OptionsLogo | undefined;
|
|
44
49
|
owner: string;
|
|
45
50
|
repository: string;
|
|
46
51
|
skipGitHubApi: boolean;
|
|
@@ -51,4 +56,4 @@ interface Options {
|
|
|
51
56
|
title: string;
|
|
52
57
|
}
|
|
53
58
|
|
|
54
|
-
export { AllContributorContributor, AllContributorsData, InputBase, Options, PartialPackageData };
|
|
59
|
+
export { AllContributorContributor, AllContributorsData, InputBase, Options, OptionsLogo, PartialPackageData };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-typescript-app",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.30.0",
|
|
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",
|
|
@@ -91,7 +91,7 @@
|
|
|
91
91
|
"globby": "^13.2.2",
|
|
92
92
|
"husky": "^8.0.3",
|
|
93
93
|
"jsonc-eslint-parser": "^2.3.0",
|
|
94
|
-
"knip": "2.
|
|
94
|
+
"knip": "2.25.1",
|
|
95
95
|
"lint-staged": "^14.0.1",
|
|
96
96
|
"markdownlint": "^0.31.0",
|
|
97
97
|
"markdownlint-cli": "^0.36.0",
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/shared/options/readGitAndNpmDefaults/index.ts"],"sourcesContent":["import { $ } from \"execa\";\nimport gitRemoteOriginUrl from \"git-remote-origin-url\";\nimport gitUrlParse from \"git-url-parse\";\nimport lazyValue from \"lazy-value\";\nimport fs from \"node:fs/promises\";\nimport npmUser from \"npm-user\";\n\nimport { readPackageData } from \"../../packages.js\";\nimport { tryCatchAsync } from \"../../tryCatchAsync.js\";\nimport { tryCatchLazyValueAsync } from \"../../tryCatchLazyValueAsync.js\";\nimport { parsePackageAuthor } from \"./parsePackageAuthor.js\";\nimport { readTitleFromReadme } from \"./readTitleFromReadme.js\";\n\nexport function getGitAndNpmDefaults() {\n\tconst gitDefaults = tryCatchLazyValueAsync(async () =>\n\t\tgitUrlParse(await gitRemoteOriginUrl()),\n\t);\n\n\tconst npmDefaults = tryCatchLazyValueAsync(\n\t\tasync () => await npmUser((await $`npm whoami`).stdout),\n\t);\n\n\tconst packageData = lazyValue(readPackageData);\n\tconst packageAuthor = lazyValue(async () =>\n\t\tparsePackageAuthor(await packageData()),\n\t);\n\n\treturn {\n\t\tauthor: async () => (await packageAuthor()).author ?? npmDefaults.name,\n\t\tdescription: async () => (await packageData()).description,\n\t\temail: async () =>\n\t\t\t(await npmDefaults())?.email ??\n\t\t\t(await packageAuthor()).email ??\n\t\t\t(await tryCatchAsync(\n\t\t\t\tasync () => (await $`git config --get user.email`).stdout,\n\t\t\t)),\n\t\tfunding: async () =>\n\t\t\tawait tryCatchAsync(\n\t\t\t\tasync () =>\n\t\t\t\t\t(await fs.readFile(\".github/FUNDING.yml\"))\n\t\t\t\t\t\t.toString()\n\t\t\t\t\t\t.split(\":\")[1]\n\t\t\t\t\t\t?.trim(),\n\t\t\t),\n\t\towner: async () =>\n\t\t\t(await gitDefaults())?.organization ?? (await packageAuthor()).author,\n\t\trepository: async () =>\n\t\t\t(await gitDefaults())?.name ?? (await packageData()).name,\n\t\ttitle: async () => await readTitleFromReadme(),\n\t};\n}\n"],"mappings":"AAAA,SAAS,SAAS;AAClB,OAAO,wBAAwB;AAC/B,OAAO,iBAAiB;AACxB,OAAO,eAAe;AACtB,OAAO,QAAQ;AACf,OAAO,aAAa;AAEpB,SAAS,uBAAuB;AAChC,SAAS,qBAAqB;AAC9B,SAAS,8BAA8B;AACvC,SAAS,0BAA0B;AACnC,SAAS,2BAA2B;AAE7B,SAAS,uBAAuB;AACtC,QAAM,cAAc;AAAA,IAAuB,YAC1C,YAAY,MAAM,mBAAmB,CAAC;AAAA,EACvC;AAEA,QAAM,cAAc;AAAA,IACnB,YAAY,MAAM,SAAS,MAAM,eAAe,MAAM;AAAA,EACvD;AAEA,QAAM,cAAc,UAAU,eAAe;AAC7C,QAAM,gBAAgB;AAAA,IAAU,YAC/B,mBAAmB,MAAM,YAAY,CAAC;AAAA,EACvC;AAEA,SAAO;AAAA,IACN,QAAQ,aAAa,MAAM,cAAc,GAAG,UAAU,YAAY;AAAA,IAClE,aAAa,aAAa,MAAM,YAAY,GAAG;AAAA,IAC/C,OAAO,aACL,MAAM,YAAY,IAAI,UACtB,MAAM,cAAc,GAAG,SACvB,MAAM;AAAA,MACN,aAAa,MAAM,gCAAgC;AAAA,IACpD;AAAA,IACD,SAAS,YACR,MAAM;AAAA,MACL,aACE,MAAM,GAAG,SAAS,qBAAqB,GACtC,SAAS,EACT,MAAM,GAAG,EAAE,CAAC,GACX,KAAK;AAAA,IACV;AAAA,IACD,OAAO,aACL,MAAM,YAAY,IAAI,iBAAiB,MAAM,cAAc,GAAG;AAAA,IAChE,YAAY,aACV,MAAM,YAAY,IAAI,SAAS,MAAM,YAAY,GAAG;AAAA,IACtD,OAAO,YAAY,MAAM,oBAAoB;AAAA,EAC9C;AACD;","names":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/shared/options/readGitAndNpmDefaults/parsePackageAuthor.ts"],"sourcesContent":["import { PartialPackageData } from \"../../types.js\";\n\nexport function parsePackageAuthor(packageData: PartialPackageData) {\n\tconst [packageAuthor, packageEmail] =\n\t\ttypeof packageData.author === \"string\"\n\t\t\t? [\n\t\t\t\t\tpackageData.author.split(\"<\")[0].trim(),\n\t\t\t\t\tpackageData.author.split(/<|>/)[1]?.trim(),\n\t\t\t ]\n\t\t\t: [packageData.author?.name, packageData.author?.email];\n\n\treturn {\n\t\tauthor: packageAuthor,\n\t\temail: packageEmail,\n\t};\n}\n"],"mappings":"AAEO,SAAS,mBAAmB,aAAiC;AACnE,QAAM,CAAC,eAAe,YAAY,IACjC,OAAO,YAAY,WAAW,WAC3B;AAAA,IACA,YAAY,OAAO,MAAM,GAAG,EAAE,CAAC,EAAE,KAAK;AAAA,IACtC,YAAY,OAAO,MAAM,KAAK,EAAE,CAAC,GAAG,KAAK;AAAA,EACzC,IACA,CAAC,YAAY,QAAQ,MAAM,YAAY,QAAQ,KAAK;AAExD,SAAO;AAAA,IACN,QAAQ;AAAA,IACR,OAAO;AAAA,EACR;AACD;","names":[]}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { readFileSafe } from "../../readFileSafe.js";
|
|
2
|
-
async function readTitleFromReadme() {
|
|
3
|
-
return (await readFileSafe("./README.md", "")).match(/^(?:# |<h1\s+align="center">)(.*?)(?:<\/h1>)?$/i)?.[1]?.trim().replace(/<[^>]+(?:>|$)/g, "");
|
|
4
|
-
}
|
|
5
|
-
export {
|
|
6
|
-
readTitleFromReadme
|
|
7
|
-
};
|
|
8
|
-
//# sourceMappingURL=readTitleFromReadme.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/shared/options/readGitAndNpmDefaults/readTitleFromReadme.ts"],"sourcesContent":["import { readFileSafe } from \"../../readFileSafe.js\";\n\nexport async function readTitleFromReadme() {\n\treturn (await readFileSafe(\"./README.md\", \"\"))\n\t\t.match(/^(?:# |<h1\\s+align=\"center\">)(.*?)(?:<\\/h1>)?$/i)?.[1]\n\t\t?.trim()\n\t\t.replace(/<[^>]+(?:>|$)/g, \"\");\n}\n"],"mappings":"AAAA,SAAS,oBAAoB;AAE7B,eAAsB,sBAAsB;AAC3C,UAAQ,MAAM,aAAa,eAAe,EAAE,GAC1C,MAAM,iDAAiD,IAAI,CAAC,GAC3D,KAAK,EACN,QAAQ,kBAAkB,EAAE;AAC/B;","names":[]}
|
/package/lib/shared/options/{readGitAndNpmDefaults → readOptionDefaults}/parsePackageAuthor.d.ts
RENAMED
|
File without changes
|
/package/lib/shared/options/{readGitAndNpmDefaults → readOptionDefaults}/parsePackageAuthor.js
RENAMED
|
File without changes
|