create-typescript-app 2.25.0 → 2.26.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/base.js CHANGED
@@ -116,7 +116,7 @@ const base = createBase({
116
116
  const getBin = lazyValue(async () => await readBin(getPackageData));
117
117
  const getEmoji = lazyValue(async () => await readEmoji(getDescription));
118
118
  const getDescription = lazyValue(
119
- async () => await readDescription(getPackageData, getReadme)
119
+ async () => await readDescription(getPackageData, getReadme, getRepository)
120
120
  );
121
121
  const getDevelopmentDocumentation = lazyValue(
122
122
  async () => await readDevelopmentDocumentation(take)
@@ -4,8 +4,8 @@ import sortPackageJson from "sort-package-json";
4
4
  import { z } from "zod";
5
5
  import { PackageJson } from "zod-package-json";
6
6
  import { base } from "../base.js";
7
+ import { htmlToTextSafe } from "../utils/htmlToTextSafe.js";
7
8
  import { blockRemoveFiles } from "./blockRemoveFiles.js";
8
- import { htmlToTextSafe } from "./html/htmlToTextSafe.js";
9
9
  import { CommandPhase } from "./phases.js";
10
10
  const PackageJsonWithNullableScripts = PackageJson.partial().extend({
11
11
  scripts: z.record(z.string(), z.union([z.string(), z.undefined()])).optional()
@@ -1,5 +1,5 @@
1
1
  import { base } from "../base.js";
2
- import { htmlToTextSafe } from "./html/htmlToTextSafe.js";
2
+ import { htmlToTextSafe } from "../utils/htmlToTextSafe.js";
3
3
  const blockRepositorySettings = base.createBlock({
4
4
  about: {
5
5
  name: "Repository Settings"
@@ -1,5 +1,5 @@
1
1
  var name = "create-typescript-app";
2
- var version = "2.24.5";
2
+ var version = "2.25.0";
3
3
  var description = "Quickstart-friendly TypeScript template with comprehensive, configurable, opinionated tooling. 🎁";
4
4
  var repository = {
5
5
  type: "git",
@@ -50,6 +50,7 @@ var dependencies = {
50
50
  json5: "^2.2.3",
51
51
  "lazy-value": "^3.0.0",
52
52
  lodash: "^4.17.21",
53
+ marked: "^15.0.7",
53
54
  "npm-user": "^6.1.1",
54
55
  "object-strings-deep": "^0.1.1",
55
56
  "parse-author": "^2.0.0",
@@ -1,5 +1,5 @@
1
1
  import { PartialPackageData } from '../types.js';
2
2
 
3
- declare function readDescription(getPackageData: () => Promise<PartialPackageData>, getReadme: () => Promise<string>): Promise<string | undefined>;
3
+ declare function readDescription(getPackageData: () => Promise<PartialPackageData>, getReadme: () => Promise<string>, getRepository: () => Promise<string | undefined>): Promise<string | undefined>;
4
4
 
5
5
  export { readDescription };
@@ -1,16 +1,27 @@
1
+ import { marked } from "marked";
1
2
  import { packageData } from "../data/packageData.js";
3
+ import { htmlToTextSafe } from "../utils/htmlToTextSafe.js";
2
4
  import { readDescriptionFromReadme } from "./readDescriptionFromReadme.js";
3
- async function readDescription(getPackageData, getReadme) {
4
- const { description: inferred } = await getPackageData();
5
- if (!inferred) {
5
+ async function readDescription(getPackageData, getReadme, getRepository) {
6
+ const { description: fromPackageJson } = await getPackageData();
7
+ if (!fromPackageJson) {
6
8
  return void 0;
7
9
  }
8
- const { description: existing } = packageData;
9
10
  const fromReadme = await readDescriptionFromReadme(getReadme);
10
- if (fromReadme?.replaceAll(/<\s*(?:\/\s*)?\w+\s*>/gu, "") === inferred) {
11
- return fromReadme;
11
+ if (!fromReadme) {
12
+ return marked.parseInline(fromPackageJson);
12
13
  }
13
- return existing === inferred ? void 0 : inferred;
14
+ if (await getRepository() !== "create-typescript-app" && fromPackageJson === packageData.description) {
15
+ return void 0;
16
+ }
17
+ const fromPackageJsonNormalized = htmlToTextSafe(
18
+ await marked.parseInline(fromPackageJson)
19
+ );
20
+ const fromReadmeNormalized = htmlToTextSafe(fromReadme);
21
+ if (fromReadmeNormalized !== fromPackageJsonNormalized) {
22
+ return await marked.parseInline(fromPackageJson);
23
+ }
24
+ return fromReadme;
14
25
  }
15
26
  export {
16
27
  readDescription
@@ -0,0 +1,15 @@
1
+ import { convert } from "html-to-text";
2
+ function htmlToTextSafe(raw) {
3
+ return convert(raw, {
4
+ selectors: [
5
+ {
6
+ options: { ignoreHref: true },
7
+ selector: "a"
8
+ }
9
+ ],
10
+ wordwrap: false
11
+ });
12
+ }
13
+ export {
14
+ htmlToTextSafe
15
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-typescript-app",
3
- "version": "2.25.0",
3
+ "version": "2.26.0",
4
4
  "description": "Quickstart-friendly TypeScript template with comprehensive, configurable, opinionated tooling. 🎁",
5
5
  "repository": {
6
6
  "type": "git",
@@ -54,6 +54,7 @@
54
54
  "json5": "^2.2.3",
55
55
  "lazy-value": "^3.0.0",
56
56
  "lodash": "^4.17.21",
57
+ "marked": "^15.0.7",
57
58
  "npm-user": "^6.1.1",
58
59
  "object-strings-deep": "^0.1.1",
59
60
  "parse-author": "^2.0.0",
@@ -1,7 +0,0 @@
1
- import { convert } from "html-to-text";
2
- function htmlToTextSafe(raw) {
3
- return convert(raw, { wordwrap: false });
4
- }
5
- export {
6
- htmlToTextSafe
7
- };
File without changes