create-icebreaker 0.1.11 → 0.1.13

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.
Files changed (2) hide show
  1. package/dist/index.mjs +7 -12
  2. package/package.json +2 -2
package/dist/index.mjs CHANGED
@@ -2,10 +2,8 @@ import path from "node:path";
2
2
  import process from "node:process";
3
3
  import { Command, checkbox, input, scaffoldWorkspace, templateChoices } from "@icebreakers/monorepo-templates";
4
4
  import fs from "node:fs/promises";
5
-
6
5
  //#region src/constants.ts
7
6
  const DEFAULT_TARGET = "icebreaker-monorepo";
8
-
9
7
  //#endregion
10
8
  //#region src/package-json.ts
11
9
  async function updateRootPackageJson(targetDir, projectName) {
@@ -30,16 +28,17 @@ async function updateRootPackageJson(targetDir, projectName) {
30
28
  }
31
29
  await fs.writeFile(pkgPath, `${JSON.stringify(pkg, null, 2)}\n`, "utf8");
32
30
  }
33
-
34
31
  //#endregion
35
32
  //#region src/templates.ts
33
+ const templateTokenSplitPattern = /[,\s]+/;
34
+ const numericTemplatePattern = /^\d+$/;
36
35
  function parseTemplateInput(input) {
37
36
  const selections = /* @__PURE__ */ new Set();
38
37
  const unknown = [];
39
- const tokens = input.split(/[,\\s]+/).map((token) => token.trim()).filter(Boolean);
38
+ const tokens = input.split(templateTokenSplitPattern).map((token) => token.trim()).filter(Boolean);
40
39
  for (const token of tokens) {
41
40
  const normalized = token.toLowerCase();
42
- if (/^\\d+$/.test(normalized)) {
41
+ if (numericTemplatePattern.test(normalized)) {
43
42
  const choice = templateChoices[Number(normalized) - 1];
44
43
  if (choice) selections.add(choice.key);
45
44
  else unknown.push(token);
@@ -50,7 +49,7 @@ function parseTemplateInput(input) {
50
49
  else unknown.push(token);
51
50
  }
52
51
  return {
53
- selections: Array.from(selections),
52
+ selections: [...selections],
54
53
  unknown
55
54
  };
56
55
  }
@@ -61,7 +60,6 @@ function resolveTemplateSelections(input) {
61
60
  };
62
61
  return parseTemplateInput(input);
63
62
  }
64
-
65
63
  //#endregion
66
64
  //#region src/prompts.ts
67
65
  async function promptTargetDir(defaultDir) {
@@ -79,7 +77,6 @@ async function promptTemplates() {
79
77
  }))
80
78
  });
81
79
  }
82
-
83
80
  //#endregion
84
81
  //#region src/source-npm.ts
85
82
  async function scaffoldFromNpm(targetDir, selectedTemplates, force = false) {
@@ -90,7 +87,6 @@ async function scaffoldFromNpm(targetDir, selectedTemplates, force = false) {
90
87
  force
91
88
  });
92
89
  }
93
-
94
90
  //#endregion
95
91
  //#region src/index.ts
96
92
  function printNextSteps(targetDir) {
@@ -106,7 +102,7 @@ function printNextSteps(targetDir) {
106
102
  }
107
103
  async function runCreate(targetDirInput, options) {
108
104
  const isInteractive = Boolean(process.stdin.isTTY && process.stdout.isTTY);
109
- let targetInput = targetDirInput || DEFAULT_TARGET;
105
+ let targetInput = targetDirInput || "icebreaker-monorepo";
110
106
  if (isInteractive) targetInput = await promptTargetDir(targetInput);
111
107
  let selectedTemplates = [];
112
108
  if (options.templates) {
@@ -133,6 +129,5 @@ program.parseAsync(process.argv).catch((error) => {
133
129
  process.stderr.write(`[create-icebreaker] ${error instanceof Error ? error.message : error}\n`);
134
130
  process.exitCode = 1;
135
131
  });
136
-
137
132
  //#endregion
138
- export { };
133
+ export {};
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "create-icebreaker",
3
3
  "type": "module",
4
- "version": "0.1.11",
4
+ "version": "0.1.13",
5
5
  "description": "Bootstrap the icebreaker monorepo template via npm create/pnpm create with optional cleanup",
6
6
  "author": "ice breaker <hi@sonofmagic.top>",
7
7
  "license": "MIT",
@@ -31,7 +31,7 @@
31
31
  "node": ">=18.0.0"
32
32
  },
33
33
  "dependencies": {
34
- "@icebreakers/monorepo-templates": "0.1.11"
34
+ "@icebreakers/monorepo-templates": "0.1.13"
35
35
  },
36
36
  "publishConfig": {
37
37
  "access": "public"