create-typescript-app 2.22.7 → 2.22.9

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
@@ -21,6 +21,7 @@ import { readFileSafe } from "./options/readFileSafe.js";
21
21
  import { readFunding } from "./options/readFunding.js";
22
22
  import { readGitDefaults } from "./options/readGitDefaults.js";
23
23
  import { readGuide } from "./options/readGuide.js";
24
+ import { readKeywords } from "./options/readKeywords.js";
24
25
  import { readLogo } from "./options/readLogo.js";
25
26
  import { readNode } from "./options/readNode.js";
26
27
  import { readNpmDefaults } from "./options/readNpmDefaults.js";
@@ -133,6 +134,9 @@ const base = createBase({
133
134
  getEmailFromNpm
134
135
  )
135
136
  );
137
+ const getKeywords = lazyValue(
138
+ async () => await readKeywords(getPackageData)
139
+ );
136
140
  const getEmailFromCodeOfConduct = lazyValue(
137
141
  async () => await readEmailFromCodeOfConduct(take)
138
142
  );
@@ -206,6 +210,7 @@ const base = createBase({
206
210
  explainer: getExplainer,
207
211
  funding: getFunding,
208
212
  guide: getGuide,
213
+ keywords: getKeywords,
209
214
  logo: getLogo,
210
215
  node: getNode,
211
216
  owner: getOwner,
@@ -49,16 +49,13 @@ const blockPackageJson = base.createBlock({
49
49
  ...options.pnpm && {
50
50
  packageManager: `pnpm@${options.pnpm}`
51
51
  },
52
- files: [
52
+ files: processFiles([
53
53
  ...collectBinFiles(options.bin),
54
54
  ...addons.properties.files ?? [],
55
55
  "package.json",
56
56
  "README.md"
57
- ].filter(Boolean).sort(),
58
- keywords: options.keywords?.flatMap(
59
- (keyword) => keyword.split(/ /)
60
- ),
61
- license: "MIT",
57
+ ]),
58
+ keywords: options.keywords,
62
59
  name: options.repository,
63
60
  repository: {
64
61
  type: "git",
@@ -98,6 +95,12 @@ function collectBinFiles(bin) {
98
95
  const files = typeof bin === "object" ? Object.values(bin) : [bin];
99
96
  return files.map((file) => file.replace(/^\.\//, ""));
100
97
  }
98
+ function processFiles(files) {
99
+ const sortedByLength = files.filter(Boolean).sort((a, b) => a.length - b.length);
100
+ return sortedByLength.filter(
101
+ (file, i) => !sortedByLength.slice(0, i).some((earlier) => earlier.endsWith("/") && file.startsWith(earlier))
102
+ ).sort();
103
+ }
101
104
  function removeRangePrefix(version) {
102
105
  const raw = version.replaceAll(/[\^~><=]/gu, "").split(" ")[0];
103
106
  return semver.coerce(raw) ?? raw;
@@ -1,5 +1,5 @@
1
1
  var name = "create-typescript-app";
2
- var version = "2.22.6";
2
+ var version = "2.22.8";
3
3
  var description = "Quickstart-friendly TypeScript template with comprehensive, configurable, opinionated tooling. 🎁";
4
4
  var repository = {
5
5
  type: "git",
@@ -0,0 +1,5 @@
1
+ import { PartialPackageData } from '../types.js';
2
+
3
+ declare function readKeywords(getPackageData: () => Promise<PartialPackageData>): Promise<string[] | undefined>;
4
+
5
+ export { readKeywords };
@@ -0,0 +1,7 @@
1
+ async function readKeywords(getPackageData) {
2
+ const { keywords } = await getPackageData();
3
+ return keywords && Array.from(new Set((await getPackageData()).keywords)).sort();
4
+ }
5
+ export {
6
+ readKeywords
7
+ };
package/lib/types.d.ts CHANGED
@@ -21,6 +21,7 @@ interface PartialPackageData {
21
21
  engines?: {
22
22
  node?: string;
23
23
  };
24
+ keywords?: string[];
24
25
  name?: string;
25
26
  packageManager?: string;
26
27
  publishConfig?: PartialPublishConfig;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-typescript-app",
3
- "version": "2.22.7",
3
+ "version": "2.22.9",
4
4
  "description": "Quickstart-friendly TypeScript template with comprehensive, configurable, opinionated tooling. 🎁",
5
5
  "repository": {
6
6
  "type": "git",