@mayrlabs/setup-project 0.1.8 → 0.1.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/dist/index.mjs CHANGED
@@ -29,6 +29,262 @@ var init_esm_shims = __esm({
29
29
  }
30
30
  });
31
31
 
32
+ // src/utils/prompts/clack.ts
33
+ import {
34
+ intro,
35
+ outro,
36
+ text,
37
+ confirm,
38
+ select,
39
+ multiselect,
40
+ note,
41
+ isCancel,
42
+ cancel,
43
+ log
44
+ } from "@clack/prompts";
45
+ var ClackProvider;
46
+ var init_clack = __esm({
47
+ "src/utils/prompts/clack.ts"() {
48
+ "use strict";
49
+ init_esm_shims();
50
+ ClackProvider = class {
51
+ intro(message) {
52
+ intro(message);
53
+ }
54
+ outro(message) {
55
+ outro(message);
56
+ }
57
+ async text(opts) {
58
+ return text(opts);
59
+ }
60
+ async confirm(opts) {
61
+ return confirm(opts);
62
+ }
63
+ async select(opts) {
64
+ return select({
65
+ message: opts.message,
66
+ options: opts.options.map((o) => ({
67
+ label: o.label,
68
+ value: o.value,
69
+ hint: o.hint
70
+ }))
71
+ });
72
+ }
73
+ async multiselect(opts) {
74
+ return multiselect({
75
+ message: opts.message,
76
+ options: opts.options.map((o) => ({
77
+ label: o.label,
78
+ value: o.value,
79
+ hint: o.hint
80
+ }))
81
+ });
82
+ }
83
+ note(message, title) {
84
+ note(message, title);
85
+ }
86
+ isCancel(value) {
87
+ return isCancel(value);
88
+ }
89
+ cancel(message) {
90
+ cancel(message);
91
+ }
92
+ log = {
93
+ message: (msg) => log.message(msg),
94
+ info: (msg) => log.info(msg),
95
+ success: (msg) => log.success(msg),
96
+ warn: (msg) => log.warn(msg),
97
+ error: (msg) => log.error(msg)
98
+ };
99
+ };
100
+ }
101
+ });
102
+
103
+ // src/utils/prompts/top.ts
104
+ import { confirm as confirm2, question, select as select2, multiselect as multiselect2 } from "@topcli/prompts";
105
+ import pc from "picocolors";
106
+ var CANCEL_SYMBOL, TopCliProvider;
107
+ var init_top = __esm({
108
+ "src/utils/prompts/top.ts"() {
109
+ "use strict";
110
+ init_esm_shims();
111
+ CANCEL_SYMBOL = /* @__PURE__ */ Symbol("cancel");
112
+ TopCliProvider = class {
113
+ intro(message) {
114
+ console.log(pc.bgCyan(pc.black(` ${message} `)));
115
+ }
116
+ outro(message) {
117
+ console.log(pc.bgCyan(pc.black(` ${message} `)));
118
+ }
119
+ async text(opts) {
120
+ try {
121
+ return await question(opts.message, {
122
+ defaultValue: opts.initialValue || opts.defaultValue,
123
+ validators: [
124
+ {
125
+ validate: (value) => opts.validate?.(value) || ""
126
+ }
127
+ ]
128
+ });
129
+ } catch {
130
+ return CANCEL_SYMBOL;
131
+ }
132
+ }
133
+ async confirm(opts) {
134
+ try {
135
+ return await confirm2(opts.message, {
136
+ initial: opts.initialValue
137
+ });
138
+ } catch {
139
+ return CANCEL_SYMBOL;
140
+ }
141
+ }
142
+ async select(opts) {
143
+ try {
144
+ const optionMap = /* @__PURE__ */ new Map();
145
+ const choices = opts.options.map((o) => {
146
+ const key = String(o.value);
147
+ optionMap.set(key, o.value);
148
+ const isSelected = opts.initialValue === o.value;
149
+ return {
150
+ label: o.label,
151
+ value: key,
152
+ description: o.hint,
153
+ selected: isSelected
154
+ };
155
+ });
156
+ const resultKey = await select2(opts.message, {
157
+ choices,
158
+ autocomplete: true,
159
+ maxVisible: 10
160
+ });
161
+ return optionMap.get(resultKey);
162
+ } catch {
163
+ return CANCEL_SYMBOL;
164
+ }
165
+ }
166
+ async multiselect(opts) {
167
+ try {
168
+ const optionMap = /* @__PURE__ */ new Map();
169
+ const choices = opts.options.map((o) => {
170
+ const key = String(o.value);
171
+ optionMap.set(key, o.value);
172
+ const isSelected = opts.initialValue?.some((iv) => iv === o.value);
173
+ return {
174
+ label: o.label,
175
+ value: key,
176
+ description: o.hint,
177
+ selected: isSelected
178
+ };
179
+ });
180
+ const resultKeys = await multiselect2(opts.message, {
181
+ choices,
182
+ autocomplete: true,
183
+ maxVisible: 10,
184
+ showHint: true
185
+ });
186
+ return resultKeys.map((k) => optionMap.get(k));
187
+ } catch {
188
+ return CANCEL_SYMBOL;
189
+ }
190
+ }
191
+ note(message, title) {
192
+ if (title) {
193
+ console.log(pc.blue(pc.bold(`${title}`)));
194
+ }
195
+ console.log(pc.dim(message));
196
+ }
197
+ isCancel(value) {
198
+ return value === CANCEL_SYMBOL;
199
+ }
200
+ cancel(message) {
201
+ if (message) console.log(pc.red(pc.bold("\xD7")) + " " + message);
202
+ else console.log(pc.red(pc.bold("\xD7")) + " Operation cancelled.");
203
+ }
204
+ log = {
205
+ message: (msg) => console.log(msg),
206
+ info: (msg) => console.log(pc.blue(pc.bold("INFO")) + " " + msg),
207
+ success: (msg) => console.log(pc.green(pc.bold("SUCCESS")) + " " + msg),
208
+ warn: (msg) => console.log(pc.yellow(pc.bold("WARN")) + " " + msg),
209
+ error: (msg) => console.log(pc.red(pc.bold("ERROR")) + " " + msg)
210
+ };
211
+ };
212
+ }
213
+ });
214
+
215
+ // src/utils/prompts/types.ts
216
+ var init_types = __esm({
217
+ "src/utils/prompts/types.ts"() {
218
+ "use strict";
219
+ init_esm_shims();
220
+ }
221
+ });
222
+
223
+ // src/utils/prompts/index.ts
224
+ var Prompts, prompts;
225
+ var init_prompts = __esm({
226
+ "src/utils/prompts/index.ts"() {
227
+ "use strict";
228
+ init_esm_shims();
229
+ init_clack();
230
+ init_top();
231
+ init_types();
232
+ Prompts = class _Prompts {
233
+ provider;
234
+ static instance;
235
+ constructor() {
236
+ this.provider = new TopCliProvider();
237
+ }
238
+ static getInstance() {
239
+ if (!_Prompts.instance) {
240
+ _Prompts.instance = new _Prompts();
241
+ }
242
+ return _Prompts.instance;
243
+ }
244
+ setProvider(provider) {
245
+ this.provider = provider;
246
+ }
247
+ useClack() {
248
+ this.provider = new ClackProvider();
249
+ }
250
+ useTopCli() {
251
+ this.provider = new TopCliProvider();
252
+ }
253
+ intro(message) {
254
+ this.provider.intro(message);
255
+ }
256
+ outro(message) {
257
+ this.provider.outro(message);
258
+ }
259
+ text(opts) {
260
+ return this.provider.text(opts);
261
+ }
262
+ confirm(opts) {
263
+ return this.provider.confirm(opts);
264
+ }
265
+ select(opts) {
266
+ return this.provider.select(opts);
267
+ }
268
+ multiselect(opts) {
269
+ return this.provider.multiselect(opts);
270
+ }
271
+ note(message, title) {
272
+ this.provider.note(message, title);
273
+ }
274
+ isCancel(value) {
275
+ return this.provider.isCancel(value);
276
+ }
277
+ cancel(message) {
278
+ this.provider.cancel(message);
279
+ }
280
+ get log() {
281
+ return this.provider.log;
282
+ }
283
+ };
284
+ prompts = Prompts.getInstance();
285
+ }
286
+ });
287
+
32
288
  // src/utils/pm.ts
33
289
  import { execa } from "execa";
34
290
  async function getPackageManager() {
@@ -155,16 +411,15 @@ var init_options = __esm({
155
411
  });
156
412
 
157
413
  // src/utils/handle-cancel.ts
158
- import { cancel, isCancel, confirm } from "@clack/prompts";
159
414
  async function withCancelHandling(promptFn, cancelMessage = "Operation cancelled.") {
160
415
  while (true) {
161
416
  const response = await promptFn();
162
- if (isCancel(response)) {
163
- const shouldCancel = await confirm({
417
+ if (prompts.isCancel(response)) {
418
+ const shouldCancel = await prompts.confirm({
164
419
  message: "Do you really want to cancel options selection?"
165
420
  });
166
- if (isCancel(shouldCancel) || shouldCancel) {
167
- cancel(cancelMessage);
421
+ if (prompts.isCancel(shouldCancel) || shouldCancel) {
422
+ prompts.cancel(cancelMessage);
168
423
  process.exit(0);
169
424
  }
170
425
  continue;
@@ -177,18 +432,18 @@ var init_handle_cancel = __esm({
177
432
  "src/utils/handle-cancel.ts"() {
178
433
  "use strict";
179
434
  init_esm_shims();
435
+ init_prompts();
180
436
  }
181
437
  });
182
438
 
183
439
  // src/features/husky.ts
184
- import { select, log, text } from "@clack/prompts";
185
440
  import { execa as execa2 } from "execa";
186
441
  import fs from "fs-extra";
187
- import pc from "picocolors";
442
+ import pc2 from "picocolors";
188
443
  async function promptHusky(config2) {
189
- log.message(pc.bgMagenta(pc.black(" Husky Configuration ")));
444
+ prompts.log.message(pc2.bgMagenta(pc2.black(" Husky Configuration ")));
190
445
  const hookType = await withCancelHandling(
191
- async () => select({
446
+ async () => prompts.select({
192
447
  message: "What pre-commit hook would you like to use?",
193
448
  options: HUSKY_HOOK_OPTIONS
194
449
  })
@@ -199,7 +454,7 @@ async function promptHusky(config2) {
199
454
  config2.enableTool("lintStaged");
200
455
  } else if (hookType === "custom") {
201
456
  const script = await withCancelHandling(
202
- async () => text({
457
+ async () => prompts.text({
203
458
  message: "Enter your custom pre-commit script:",
204
459
  placeholder: huskyConfig.options.customScript,
205
460
  validate(value) {
@@ -214,7 +469,7 @@ async function installHusky(config2) {
214
469
  await installPackages(["husky"], true);
215
470
  try {
216
471
  await execa2("npx", ["husky", "init"]);
217
- } catch (e) {
472
+ } catch {
218
473
  await execa2("npm", ["pkg", "set", "scripts.prepare=husky"]);
219
474
  await execa2("npm", ["run", "prepare"]);
220
475
  }
@@ -236,6 +491,7 @@ var init_husky = __esm({
236
491
  "src/features/husky.ts"() {
237
492
  "use strict";
238
493
  init_esm_shims();
494
+ init_prompts();
239
495
  init_pm();
240
496
  init_options();
241
497
  init_handle_cancel();
@@ -244,14 +500,13 @@ var init_husky = __esm({
244
500
 
245
501
  // src/utils/config-file.ts
246
502
  import fs2 from "fs-extra";
247
- import { select as select2 } from "@clack/prompts";
248
503
  import path2 from "path";
249
504
  async function resolveConfigFile(toolName, candidates) {
250
505
  for (const file of candidates) {
251
506
  if (await fs2.pathExists(file)) return file;
252
507
  }
253
508
  const response = await withCancelHandling(
254
- async () => select2({
509
+ async () => prompts.select({
255
510
  message: `Where do you want to store the ${toolName} config?`,
256
511
  options: candidates.map((c) => ({ value: c, label: c })),
257
512
  initialValue: candidates[0]
@@ -277,6 +532,7 @@ var init_config_file = __esm({
277
532
  "src/utils/config-file.ts"() {
278
533
  "use strict";
279
534
  init_esm_shims();
535
+ init_prompts();
280
536
  init_handle_cancel();
281
537
  }
282
538
  });
@@ -330,7 +586,7 @@ async function configurePrettierPlugins(plugins) {
330
586
  return;
331
587
  }
332
588
  currentConfig = await fs3.readJson(configFile);
333
- } catch (e) {
589
+ } catch {
334
590
  }
335
591
  }
336
592
  const existingPlugins = currentConfig.plugins || [];
@@ -1561,50 +1817,50 @@ var init_eslint = __esm({
1561
1817
  });
1562
1818
 
1563
1819
  // src/steps/install-plugin.ts
1564
- import { multiselect, outro, confirm as confirm2 } from "@clack/prompts";
1565
- import pc2 from "picocolors";
1820
+ import pc3 from "picocolors";
1566
1821
  async function installPlugins(tool) {
1567
1822
  const pluginsList = PLUGINS[tool];
1568
1823
  const selectedPlugins = await withCancelHandling(
1569
- async () => multiselect({
1824
+ async () => prompts.multiselect({
1570
1825
  message: `Select ${tool} plugins to install:`,
1571
1826
  options: pluginsList,
1572
- required: true
1827
+ required: true,
1828
+ initialValue: []
1573
1829
  })
1574
1830
  );
1575
1831
  if (selectedPlugins.length === 0) {
1576
- outro(pc2.yellow("No plugins selected."));
1832
+ prompts.outro(pc3.yellow("No plugins selected."));
1577
1833
  return;
1578
1834
  }
1579
1835
  const packagesToInstall = selectedPlugins.map((val) => {
1580
1836
  const p = pluginsList.find((opt) => opt.value === val);
1581
1837
  return p ? p.package : val;
1582
1838
  });
1583
- outro(
1584
- pc2.blue(`Installing ${packagesToInstall.length} plugins for ${tool}...`)
1839
+ prompts.outro(
1840
+ pc3.blue(`Installing ${packagesToInstall.length} plugins for ${tool}...`)
1585
1841
  );
1586
1842
  await installPackages(packagesToInstall, true);
1587
1843
  await configurePlugins(tool, selectedPlugins);
1588
1844
  }
1589
1845
  async function configurePlugins(tool, plugins) {
1590
1846
  const shouldConfigure = await withCancelHandling(
1591
- async () => confirm2({
1847
+ async () => prompts.confirm({
1592
1848
  message: `Do you want to configure the selected plugins in your ${tool} config file?`,
1593
1849
  initialValue: true
1594
1850
  })
1595
1851
  );
1596
1852
  if (!shouldConfigure) {
1597
- outro(pc2.yellow("Skipping configuration."));
1853
+ prompts.outro(pc3.yellow("Skipping configuration."));
1598
1854
  return;
1599
1855
  }
1600
1856
  switch (tool) {
1601
1857
  case "prettier":
1602
1858
  await configurePrettierPlugins(plugins);
1603
- outro(pc2.green("Prettier plugins configured in .prettierrc"));
1859
+ prompts.outro(pc3.green("Prettier plugins configured in .prettierrc"));
1604
1860
  break;
1605
1861
  case "eslint":
1606
1862
  await configureEslintPlugins(plugins);
1607
- outro(pc2.green("ESLint plugins configured in .eslintrc.json"));
1863
+ prompts.outro(pc3.green("ESLint plugins configured in .eslintrc.json"));
1608
1864
  break;
1609
1865
  }
1610
1866
  }
@@ -1617,17 +1873,17 @@ var init_install_plugin = __esm({
1617
1873
  init_eslint();
1618
1874
  init_handle_cancel();
1619
1875
  init_pm();
1876
+ init_prompts();
1620
1877
  }
1621
1878
  });
1622
1879
 
1623
1880
  // src/features/formatter.ts
1624
- import { select as select3, log as log2, confirm as confirm3 } from "@clack/prompts";
1625
- import pc3 from "picocolors";
1881
+ import pc4 from "picocolors";
1626
1882
  async function promptFormatter(config2) {
1627
1883
  const formatterConfig = config2.get("formatter");
1628
- log2.message(pc3.bgBlue(pc3.white(" Formatter Configuration ")));
1884
+ prompts.log.message(pc4.bgBlue(pc4.white(" Formatter Configuration ")));
1629
1885
  const formatter = await withCancelHandling(
1630
- async () => select3({
1886
+ async () => prompts.select({
1631
1887
  message: "Select a formatter:",
1632
1888
  options: FORMATTER_OPTIONS,
1633
1889
  initialValue: formatterConfig.options.choice
@@ -1638,12 +1894,12 @@ async function promptFormatter(config2) {
1638
1894
  async function installFormatter(config2) {
1639
1895
  const formatter = config2.get("formatter").options.choice;
1640
1896
  if (!formatter) return;
1641
- log2.message(pc3.white(pc3.bgBlack(` Installing ${formatter}... `)));
1897
+ prompts.log.message(pc4.white(pc4.bgBlack(` Installing ${formatter}... `)));
1642
1898
  if (formatter === "prettier") await installPrettier();
1643
1899
  else if (formatter === "oxfmt") await installOxfmt();
1644
1900
  if (!PLUGINABLE_TOOLS.includes(formatter)) return;
1645
1901
  const shouldConfigure = await withCancelHandling(
1646
- async () => confirm3({
1902
+ async () => prompts.confirm({
1647
1903
  message: `Do you want to install plugins for ${formatter}?`,
1648
1904
  initialValue: true
1649
1905
  })
@@ -1655,6 +1911,7 @@ var init_formatter = __esm({
1655
1911
  "src/features/formatter.ts"() {
1656
1912
  "use strict";
1657
1913
  init_esm_shims();
1914
+ init_prompts();
1658
1915
  init_options();
1659
1916
  init_handle_cancel();
1660
1917
  init_prettier();
@@ -1677,13 +1934,12 @@ var init_oxlint = __esm({
1677
1934
  });
1678
1935
 
1679
1936
  // src/features/linter.ts
1680
- import { select as select4, log as log3, confirm as confirm4 } from "@clack/prompts";
1681
- import pc4 from "picocolors";
1937
+ import pc5 from "picocolors";
1682
1938
  async function promptLinter(config2) {
1683
1939
  const linterConfig = config2.get("linter");
1684
- log3.message(pc4.bgYellow(pc4.black(" Linter Configuration ")));
1940
+ prompts.log.message(pc5.bgYellow(pc5.black(" Linter Configuration ")));
1685
1941
  const linter = await withCancelHandling(
1686
- async () => select4({
1942
+ async () => prompts.select({
1687
1943
  message: "Select a linter:",
1688
1944
  options: LINTER_OPTIONS,
1689
1945
  initialValue: linterConfig.options.choice
@@ -1694,12 +1950,12 @@ async function promptLinter(config2) {
1694
1950
  async function installLinter(config2) {
1695
1951
  const linter = config2.get("linter").options.choice;
1696
1952
  if (!linter) return;
1697
- log3.message(pc4.white(pc4.bgBlack(` Installing ${linter}... `)));
1953
+ prompts.log.message(pc5.white(pc5.bgBlack(` Installing ${linter}... `)));
1698
1954
  if (linter === "eslint") await installEslint();
1699
1955
  else if (linter === "oxlint") await installOxlint();
1700
1956
  if (!PLUGINABLE_TOOLS.includes(linter)) return;
1701
1957
  const shouldConfigure = await withCancelHandling(
1702
- async () => confirm4({
1958
+ async () => prompts.confirm({
1703
1959
  message: `Do you want to install plugins for ${linter}?`,
1704
1960
  initialValue: true
1705
1961
  })
@@ -1711,6 +1967,7 @@ var init_linter = __esm({
1711
1967
  "src/features/linter.ts"() {
1712
1968
  "use strict";
1713
1969
  init_esm_shims();
1970
+ init_prompts();
1714
1971
  init_options();
1715
1972
  init_handle_cancel();
1716
1973
  init_eslint();
@@ -1721,19 +1978,18 @@ var init_linter = __esm({
1721
1978
  });
1722
1979
 
1723
1980
  // src/features/lint-staged.ts
1724
- import { multiselect as multiselect2, log as log4 } from "@clack/prompts";
1725
- import pc5 from "picocolors";
1981
+ import pc6 from "picocolors";
1726
1982
  async function promptLintStaged(config2) {
1727
- log4.message(pc5.bgGreen(pc5.black(" Lint-staged Configuration ")));
1983
+ prompts.log.message(pc6.bgGreen(pc6.black(" Lint-staged Configuration ")));
1728
1984
  const lintExtensions = await withCancelHandling(
1729
- async () => multiselect2({
1985
+ async () => prompts.multiselect({
1730
1986
  message: "Select extensions to lint:",
1731
1987
  options: LINT_STAGED_EXTENSIONS,
1732
1988
  required: false
1733
1989
  })
1734
1990
  );
1735
1991
  const formatExtensions = await withCancelHandling(
1736
- async () => multiselect2({
1992
+ async () => prompts.multiselect({
1737
1993
  message: "Select extensions to format:",
1738
1994
  options: LINT_STAGED_EXTENSIONS,
1739
1995
  required: false
@@ -1789,6 +2045,7 @@ var init_lint_staged = __esm({
1789
2045
  "src/features/lint-staged.ts"() {
1790
2046
  "use strict";
1791
2047
  init_esm_shims();
2048
+ init_prompts();
1792
2049
  init_pm();
1793
2050
  init_formatter();
1794
2051
  init_linter();
@@ -1799,33 +2056,32 @@ var init_lint_staged = __esm({
1799
2056
  });
1800
2057
 
1801
2058
  // src/features/env.ts
1802
- import { select as select5, confirm as confirm5, text as text2, multiselect as multiselect3, log as log5 } from "@clack/prompts";
1803
2059
  import fs5 from "fs-extra";
1804
2060
  import path3 from "path";
1805
- import pc6 from "picocolors";
2061
+ import pc7 from "picocolors";
1806
2062
  async function promptEnv(config2) {
1807
- log5.message(pc6.bgCyan(pc6.black(" Env Validation Configuration ")));
2063
+ prompts.log.message(pc7.bgCyan(pc7.black(" Env Validation Configuration ")));
1808
2064
  const variant = await withCancelHandling(
1809
- async () => select5({
2065
+ async () => prompts.select({
1810
2066
  message: "Which @t3-oss/env variant?",
1811
2067
  options: ENV_VARIANT_OPTIONS
1812
2068
  })
1813
2069
  );
1814
2070
  const validator = await withCancelHandling(
1815
- async () => select5({
2071
+ async () => prompts.select({
1816
2072
  message: "Which validator?",
1817
2073
  options: ENV_VALIDATOR_OPTIONS
1818
2074
  })
1819
2075
  );
1820
2076
  const installPresets = await withCancelHandling(
1821
- async () => confirm5({
2077
+ async () => prompts.confirm({
1822
2078
  message: "Install presets?"
1823
2079
  })
1824
2080
  );
1825
2081
  let presets;
1826
2082
  if (installPresets) {
1827
2083
  presets = await withCancelHandling(
1828
- async () => multiselect3({
2084
+ async () => prompts.multiselect({
1829
2085
  message: "Select preset to extend:",
1830
2086
  options: ENV_PRESET_OPTIONS,
1831
2087
  required: false
@@ -1833,13 +2089,13 @@ async function promptEnv(config2) {
1833
2089
  );
1834
2090
  }
1835
2091
  const split = await withCancelHandling(
1836
- async () => select5({
2092
+ async () => prompts.select({
1837
2093
  message: "Split or Joined env files?",
1838
2094
  options: ENV_SPLIT_OPTIONS
1839
2095
  })
1840
2096
  );
1841
2097
  const location = await withCancelHandling(
1842
- async () => text2({
2098
+ async () => prompts.text({
1843
2099
  message: "Where should the environment files be created?",
1844
2100
  initialValue: config2.get("env").options.location || "src/lib",
1845
2101
  placeholder: "src/lib"
@@ -1913,6 +2169,7 @@ var init_env = __esm({
1913
2169
  "src/features/env.ts"() {
1914
2170
  "use strict";
1915
2171
  init_esm_shims();
2172
+ init_prompts();
1916
2173
  init_pm();
1917
2174
  init_options();
1918
2175
  init_handle_cancel();
@@ -1920,13 +2177,12 @@ var init_env = __esm({
1920
2177
  });
1921
2178
 
1922
2179
  // src/features/test.ts
1923
- import { select as select6, log as log6 } from "@clack/prompts";
1924
2180
  import fs6 from "fs-extra";
1925
- import pc7 from "picocolors";
2181
+ import pc8 from "picocolors";
1926
2182
  async function promptTest(config2) {
1927
- log6.message(pc7.bgRed(pc7.white(" Test Runner Configuration ")));
2183
+ prompts.log.message(pc8.bgRed(pc8.white(" Test Runner Configuration ")));
1928
2184
  const runner = await withCancelHandling(
1929
- async () => select6({
2185
+ async () => prompts.select({
1930
2186
  message: "Select a test runner:",
1931
2187
  options: TEST_RUNNER_OPTIONS
1932
2188
  })
@@ -1971,6 +2227,7 @@ var init_test = __esm({
1971
2227
  "src/features/test.ts"() {
1972
2228
  "use strict";
1973
2229
  init_esm_shims();
2230
+ init_prompts();
1974
2231
  init_pm();
1975
2232
  init_options();
1976
2233
  init_handle_cancel();
@@ -1978,14 +2235,13 @@ var init_test = __esm({
1978
2235
  });
1979
2236
 
1980
2237
  // src/features/editor-config.ts
1981
- import { select as select7, log as log7 } from "@clack/prompts";
1982
2238
  import fs7 from "fs-extra";
1983
- import pc8 from "picocolors";
2239
+ import pc9 from "picocolors";
1984
2240
  async function promptEditorConfig(config2) {
1985
- log7.message(pc8.bgWhite(pc8.black(" EditorConfig Configuration ")));
2241
+ prompts.log.message(pc9.bgWhite(pc9.black(" EditorConfig Configuration ")));
1986
2242
  const currentPreset = config2.get("editorConfig").options.preset;
1987
2243
  const preset = await withCancelHandling(
1988
- async () => select7({
2244
+ async () => prompts.select({
1989
2245
  message: "Select EditorConfig preset:",
1990
2246
  options: EDITOR_CONFIG_OPTIONS,
1991
2247
  initialValue: currentPreset
@@ -2009,42 +2265,42 @@ var init_editor_config = __esm({
2009
2265
  "src/features/editor-config.ts"() {
2010
2266
  "use strict";
2011
2267
  init_esm_shims();
2268
+ init_prompts();
2012
2269
  init_options();
2013
2270
  init_handle_cancel();
2014
2271
  }
2015
2272
  });
2016
2273
 
2017
2274
  // src/features/license.ts
2018
- import { text as text3, select as select8, log as log8 } from "@clack/prompts";
2019
2275
  import fs8 from "fs-extra";
2020
2276
  import path4 from "path";
2021
- import pc9 from "picocolors";
2277
+ import pc10 from "picocolors";
2022
2278
  async function promptLicense(config2) {
2023
- log8.message(pc9.bgGreen(pc9.black(" License Configuration ")));
2279
+ prompts.log.message(pc10.bgGreen(pc10.black(" License Configuration ")));
2024
2280
  const licenseOptions = config2.get("license").options;
2025
2281
  licenseOptions.name = await withCancelHandling(
2026
- async () => text3({
2282
+ async () => prompts.text({
2027
2283
  message: "License Holder Name:",
2028
2284
  placeholder: "John Doe",
2029
2285
  initialValue: licenseOptions.name
2030
2286
  })
2031
2287
  );
2032
2288
  licenseOptions.email = await withCancelHandling(
2033
- async () => text3({
2289
+ async () => prompts.text({
2034
2290
  message: "License Holder Email:",
2035
2291
  placeholder: "john@example.com",
2036
2292
  initialValue: licenseOptions.email
2037
2293
  })
2038
2294
  );
2039
2295
  licenseOptions.website = await withCancelHandling(
2040
- async () => text3({
2296
+ async () => prompts.text({
2041
2297
  message: "License Holder Website:",
2042
2298
  placeholder: "https://example.com",
2043
2299
  initialValue: licenseOptions.website
2044
2300
  })
2045
2301
  );
2046
2302
  licenseOptions.type = await withCancelHandling(
2047
- async () => select8({
2303
+ async () => prompts.select({
2048
2304
  message: "Select License Type:",
2049
2305
  options: LICENSE_TYPE_OPTIONS
2050
2306
  })
@@ -2082,13 +2338,14 @@ var init_license = __esm({
2082
2338
  "src/features/license.ts"() {
2083
2339
  "use strict";
2084
2340
  init_esm_shims();
2341
+ init_prompts();
2085
2342
  init_options();
2086
2343
  init_handle_cancel();
2087
2344
  }
2088
2345
  });
2089
2346
 
2090
2347
  // src/core/config.ts
2091
- import pc10 from "picocolors";
2348
+ import pc11 from "picocolors";
2092
2349
  var Config, config;
2093
2350
  var init_config = __esm({
2094
2351
  "src/core/config.ts"() {
@@ -2139,6 +2396,49 @@ var init_config = __esm({
2139
2396
  }
2140
2397
  };
2141
2398
  }
2399
+ clear() {
2400
+ this.data = {
2401
+ husky: {
2402
+ selected: false,
2403
+ options: { hookType: "none", customScript: "npm run test" }
2404
+ },
2405
+ formatter: {
2406
+ selected: false,
2407
+ options: { choice: "prettier" }
2408
+ },
2409
+ linter: {
2410
+ selected: false,
2411
+ options: { choice: "eslint" }
2412
+ },
2413
+ lintStaged: {
2414
+ selected: false,
2415
+ options: { lintExtensions: [], formatExtensions: [] }
2416
+ },
2417
+ env: {
2418
+ selected: false,
2419
+ options: {
2420
+ variant: "@t3-oss/env-nextjs",
2421
+ validator: "zod",
2422
+ installPresets: false,
2423
+ presets: [],
2424
+ split: "split",
2425
+ location: "src/lib"
2426
+ }
2427
+ },
2428
+ test: {
2429
+ selected: false,
2430
+ options: { runner: "vitest" }
2431
+ },
2432
+ editorConfig: {
2433
+ selected: false,
2434
+ options: { preset: "default" }
2435
+ },
2436
+ license: {
2437
+ selected: false,
2438
+ options: { name: "", email: "", website: "", type: "MIT" }
2439
+ }
2440
+ };
2441
+ }
2142
2442
  get(tool) {
2143
2443
  return this.data[tool];
2144
2444
  }
@@ -2147,47 +2447,47 @@ var init_config = __esm({
2147
2447
  }
2148
2448
  get summary() {
2149
2449
  const lines = [];
2150
- lines.push(pc10.bold("The following actions will be performed:"));
2450
+ lines.push(pc11.bold("The following actions will be performed:"));
2151
2451
  lines.push("");
2152
2452
  if (this.data.husky.selected) {
2153
- lines.push(pc10.magenta(`\u2022 Install and configure Husky`));
2453
+ lines.push(pc11.magenta(`\u2022 Install and configure Husky`));
2154
2454
  if (this.data.husky.options.hookType === "custom") {
2155
- lines.push(pc10.dim(` - Custom hook script`));
2455
+ lines.push(pc11.dim(` - Custom hook script`));
2156
2456
  }
2157
2457
  }
2158
2458
  if (this.data.formatter.selected) {
2159
2459
  const choice = this.data.formatter.options.choice;
2160
- lines.push(pc10.blue(`\u2022 Install and configure ${choice || "Formatter"}`));
2460
+ lines.push(pc11.blue(`\u2022 Install and configure ${choice || "Formatter"}`));
2161
2461
  }
2162
2462
  if (this.data.linter.selected) {
2163
2463
  const choice = this.data.linter.options.choice;
2164
- lines.push(pc10.yellow(`\u2022 Install and configure ${choice || "Linter"}`));
2464
+ lines.push(pc11.yellow(`\u2022 Install and configure ${choice || "Linter"}`));
2165
2465
  }
2166
2466
  if (this.data.lintStaged.selected) {
2167
- lines.push(pc10.green(`\u2022 Install and configure Lint-staged`));
2467
+ lines.push(pc11.green(`\u2022 Install and configure Lint-staged`));
2168
2468
  const lintExts = this.data.lintStaged.options.lintExtensions.join(", ");
2169
2469
  const formatExts = this.data.lintStaged.options.formatExtensions.join(", ");
2170
- if (lintExts) lines.push(pc10.dim(` - Lint: ${lintExts}`));
2171
- if (formatExts) lines.push(pc10.dim(` - Format: ${formatExts}`));
2470
+ if (lintExts) lines.push(pc11.dim(` - Lint: ${lintExts}`));
2471
+ if (formatExts) lines.push(pc11.dim(` - Format: ${formatExts}`));
2172
2472
  }
2173
2473
  if (this.data.env.selected) {
2174
- lines.push(pc10.cyan(`\u2022 Install and configure Env Validation`));
2175
- lines.push(pc10.dim(` - Variant: ${this.data.env.options.variant}`));
2176
- lines.push(pc10.dim(` - Validator: ${this.data.env.options.validator}`));
2474
+ lines.push(pc11.cyan(`\u2022 Install and configure Env Validation`));
2475
+ lines.push(pc11.dim(` - Variant: ${this.data.env.options.variant}`));
2476
+ lines.push(pc11.dim(` - Validator: ${this.data.env.options.validator}`));
2177
2477
  }
2178
2478
  if (this.data.test.selected) {
2179
2479
  const runner = this.data.test.options.runner;
2180
- lines.push(pc10.red(`\u2022 Install and configure Test Runner (${runner})`));
2480
+ lines.push(pc11.red(`\u2022 Install and configure Test Runner (${runner})`));
2181
2481
  }
2182
2482
  if (this.data.editorConfig.selected) {
2183
2483
  const preset = this.data.editorConfig.options.preset;
2184
- lines.push(pc10.white(`\u2022 Create .editorconfig (${preset})`));
2484
+ lines.push(pc11.white(`\u2022 Create .editorconfig (${preset})`));
2185
2485
  }
2186
2486
  if (this.data.license.selected) {
2187
2487
  const type = this.data.license.options.type;
2188
2488
  const name = this.data.license.options.name;
2189
- lines.push(pc10.green(`\u2022 Create LICENSE (${type})`));
2190
- lines.push(pc10.dim(` - Holder: ${name}`));
2489
+ lines.push(pc11.green(`\u2022 Create LICENSE (${type})`));
2490
+ lines.push(pc11.dim(` - Holder: ${name}`));
2191
2491
  }
2192
2492
  return lines.join("\n");
2193
2493
  }
@@ -2196,8 +2496,56 @@ var init_config = __esm({
2196
2496
  }
2197
2497
  });
2198
2498
 
2499
+ // src/utils/spinner.ts
2500
+ import spinners from "cli-spinners";
2501
+ import pc12 from "picocolors";
2502
+ var Spinner, spinner;
2503
+ var init_spinner = __esm({
2504
+ "src/utils/spinner.ts"() {
2505
+ "use strict";
2506
+ init_esm_shims();
2507
+ Spinner = class {
2508
+ timer = null;
2509
+ frameIndex = 0;
2510
+ spinner = spinners.dots;
2511
+ text = "";
2512
+ start(text2) {
2513
+ this.text = text2;
2514
+ this.frameIndex = 0;
2515
+ if (this.timer) clearInterval(this.timer);
2516
+ this.timer = setInterval(() => {
2517
+ const frame = this.spinner.frames[this.frameIndex];
2518
+ process.stdout.write(`\r${pc12.magenta(frame)} ${this.text}`);
2519
+ this.frameIndex = (this.frameIndex + 1) % this.spinner.frames.length;
2520
+ }, this.spinner.interval);
2521
+ }
2522
+ stop(text2) {
2523
+ if (this.timer) {
2524
+ clearInterval(this.timer);
2525
+ this.timer = null;
2526
+ process.stdout.write("\r\x1B[K");
2527
+ if (text2) {
2528
+ console.log(text2);
2529
+ }
2530
+ }
2531
+ }
2532
+ success(text2) {
2533
+ this.stop();
2534
+ console.log(`${pc12.green("\u2714")} ${text2 || this.text}`);
2535
+ }
2536
+ fail(text2) {
2537
+ this.stop();
2538
+ console.log(`${pc12.red("\u2716")} ${text2 || this.text}`);
2539
+ }
2540
+ message(text2) {
2541
+ this.text = text2;
2542
+ }
2543
+ };
2544
+ spinner = () => new Spinner();
2545
+ }
2546
+ });
2547
+
2199
2548
  // src/steps/execution.ts
2200
- import { spinner } from "@clack/prompts";
2201
2549
  async function execution(config2) {
2202
2550
  const s = spinner();
2203
2551
  if (config2.get("husky").selected) {
@@ -2248,6 +2596,7 @@ var init_execution = __esm({
2248
2596
  "src/steps/execution.ts"() {
2249
2597
  "use strict";
2250
2598
  init_esm_shims();
2599
+ init_spinner();
2251
2600
  init_husky();
2252
2601
  init_formatter();
2253
2602
  init_linter();
@@ -2324,15 +2673,14 @@ var init_git = __esm({
2324
2673
  });
2325
2674
 
2326
2675
  // src/steps/git-check.ts
2327
- import { confirm as confirm6, spinner as spinner2, text as text4 } from "@clack/prompts";
2328
2676
  async function gitCheck() {
2329
2677
  if (await isGitRepository()) {
2330
2678
  if (await isGitDirty()) {
2331
- const shouldCommit = await confirm6({
2679
+ const shouldCommit = await prompts.confirm({
2332
2680
  message: "Your working directory is dirty. Would you like to commit changes before proceeding?"
2333
2681
  });
2334
2682
  if (shouldCommit) {
2335
- const message = await text4({
2683
+ const message = await prompts.text({
2336
2684
  message: "Enter commit message:",
2337
2685
  placeholder: "wip: pre-setup commit",
2338
2686
  validate(value) {
@@ -2340,7 +2688,7 @@ async function gitCheck() {
2340
2688
  }
2341
2689
  });
2342
2690
  if (typeof message === "string") {
2343
- const s = spinner2();
2691
+ const s = spinner();
2344
2692
  s.start("Committing changes...");
2345
2693
  await commitChanges(message);
2346
2694
  s.stop("Changes committed.");
@@ -2354,6 +2702,8 @@ var init_git_check = __esm({
2354
2702
  "use strict";
2355
2703
  init_esm_shims();
2356
2704
  init_git();
2705
+ init_prompts();
2706
+ init_spinner();
2357
2707
  }
2358
2708
  });
2359
2709
 
@@ -2363,54 +2713,57 @@ var init_package = __esm({
2363
2713
  "package.json"() {
2364
2714
  package_default = {
2365
2715
  name: "@mayrlabs/setup-project",
2366
- version: "0.1.8",
2367
- description: "Interactive CLI to setup project tools",
2716
+ version: "0.1.9",
2368
2717
  private: false,
2369
- publishConfig: {
2370
- access: "public"
2371
- },
2718
+ description: "Interactive CLI to setup project tools",
2372
2719
  keywords: [
2373
- "setup",
2374
2720
  "cli",
2375
- "scaffold",
2721
+ "eslint",
2376
2722
  "husky",
2377
2723
  "prettier",
2378
- "eslint"
2379
- ],
2380
- bin: {
2381
- "setup-project": "dist/index.js"
2382
- },
2383
- files: [
2384
- "dist",
2385
- "README.md",
2386
- "CHANGELOG.md",
2387
- "package.json"
2724
+ "scaffold",
2725
+ "setup"
2388
2726
  ],
2389
2727
  homepage: "https://github.com/MayR-Labs/mayrlabs-js/tree/main/packages/setup-project#readme",
2390
2728
  bugs: {
2391
2729
  url: "https://github.com/MayR-Labs/mayrlabs-js/issues"
2392
2730
  },
2393
- repository: {
2394
- type: "git",
2395
- url: "git+https://github.com/MayR-Labs/mayrlabs-js.git",
2396
- directory: "packages/setup-project"
2397
- },
2398
2731
  license: "MIT",
2399
2732
  author: {
2400
2733
  name: "Aghogho Meyoron",
2401
2734
  email: "youngmayor.dev@gmail.com",
2402
2735
  url: "https://mayrlabs.com"
2403
2736
  },
2737
+ repository: {
2738
+ type: "git",
2739
+ url: "git+https://github.com/MayR-Labs/mayrlabs-js.git",
2740
+ directory: "packages/setup-project"
2741
+ },
2742
+ bin: {
2743
+ "setup-project": "dist/index.js"
2744
+ },
2745
+ files: [
2746
+ "dist",
2747
+ "README.md",
2748
+ "CHANGELOG.md",
2749
+ "package.json"
2750
+ ],
2404
2751
  type: "commonjs",
2405
2752
  main: "dist/index.js",
2753
+ publishConfig: {
2754
+ access: "public"
2755
+ },
2406
2756
  scripts: {
2407
2757
  build: "tsup",
2758
+ lint: "eslint . --max-warnings 0",
2408
2759
  demo: "tsx src/cli/index.ts",
2409
2760
  test: "vitest",
2410
2761
  prepublishOnly: "npm run build"
2411
2762
  },
2412
2763
  dependencies: {
2413
2764
  "@clack/prompts": "^0.7.0",
2765
+ "@topcli/prompts": "^2.4.1",
2766
+ "cli-spinners": "^3.4.0",
2414
2767
  commander: "^11.1.0",
2415
2768
  execa: "^8.0.1",
2416
2769
  figlet: "^1.10.0",
@@ -2419,10 +2772,12 @@ var init_package = __esm({
2419
2772
  zod: "^3.22.4"
2420
2773
  },
2421
2774
  devDependencies: {
2775
+ "@repo/eslint-config": "^0.0.0",
2422
2776
  "@types/figlet": "^1.7.0",
2423
2777
  "@types/fs-extra": "^11.0.4",
2424
2778
  "@types/node": "^20.11.16",
2425
2779
  "@vitest/coverage-v8": "^4.0.18",
2780
+ eslint: "^9.39.2",
2426
2781
  tsup: "^8.5.1",
2427
2782
  tsx: "^4.21.0",
2428
2783
  typescript: "^5.3.3",
@@ -2433,12 +2788,12 @@ var init_package = __esm({
2433
2788
  });
2434
2789
 
2435
2790
  // src/utils/display.ts
2436
- import pc11 from "picocolors";
2791
+ import pc13 from "picocolors";
2437
2792
  import figlet from "figlet";
2438
2793
  function introScreen() {
2439
2794
  console.log();
2440
2795
  console.log(
2441
- pc11.cyan(
2796
+ pc13.cyan(
2442
2797
  figlet.textSync("MayR\nLabs", {
2443
2798
  font: "Graceful",
2444
2799
  horizontalLayout: "default",
@@ -2448,33 +2803,33 @@ function introScreen() {
2448
2803
  })
2449
2804
  )
2450
2805
  );
2451
- console.log(pc11.cyan(`${package_default.name} - v${package_default.version}`));
2806
+ console.log(pc13.cyan(`${package_default.name} - v${package_default.version}`));
2452
2807
  console.log();
2453
2808
  }
2454
2809
  function showAbout() {
2455
2810
  introScreen();
2456
- console.log(pc11.bold("About:"));
2811
+ console.log(pc13.bold("About:"));
2457
2812
  console.log(
2458
2813
  " Interactive CLI to setup project tools like Husky, Prettier, ESLint, etc."
2459
2814
  );
2460
2815
  console.log("");
2461
- console.log(pc11.bold("How to use:"));
2816
+ console.log(pc13.bold("How to use:"));
2462
2817
  console.log(
2463
2818
  " Run 'npx @mayrlabs/setup-project' and follow the interactive prompts."
2464
2819
  );
2465
2820
  console.log("");
2466
2821
  }
2467
2822
  function showVisit() {
2468
- console.log(pc11.bold("Project Homepage:"));
2469
- console.log(pc11.underline(pc11.cyan(package_default.homepage)));
2823
+ console.log(pc13.bold("Project Homepage:"));
2824
+ console.log(pc13.underline(pc13.cyan(package_default.homepage)));
2470
2825
  console.log("");
2471
2826
  }
2472
2827
  function showManual() {
2473
2828
  introScreen();
2474
- console.log(pc11.bold("Usage:"));
2829
+ console.log(pc13.bold("Usage:"));
2475
2830
  console.log(" npx @mayrlabs/setup-project [command] [options]");
2476
2831
  console.log("");
2477
- console.log(pc11.bold("Commands:"));
2832
+ console.log(pc13.bold("Commands:"));
2478
2833
  console.log(" about Show project details");
2479
2834
  console.log(" version Show version information");
2480
2835
  console.log(" visit Visit project homepage");
@@ -2482,7 +2837,7 @@ function showManual() {
2482
2837
  console.log(" configure [tool] Configure a specific tool");
2483
2838
  console.log(" plugin [tool] Manage plugins for tools");
2484
2839
  console.log("");
2485
- console.log(pc11.bold("Options:"));
2840
+ console.log(pc13.bold("Options:"));
2486
2841
  console.log(" -a, --about Show project details");
2487
2842
  console.log(" -v, --version Show version information");
2488
2843
  console.log(" -V, --visit Visit project homepage");
@@ -2498,11 +2853,10 @@ var init_display = __esm({
2498
2853
  });
2499
2854
 
2500
2855
  // src/cli/commands/configure.ts
2501
- import { intro, outro as outro2, select as select9 } from "@clack/prompts";
2502
- import pc12 from "picocolors";
2856
+ import pc14 from "picocolors";
2503
2857
  async function configure(toolName) {
2504
2858
  introScreen();
2505
- intro(pc12.inverse(pc12.bold(pc12.blue(" Configuration Mode "))));
2859
+ prompts.intro(pc14.inverse(pc14.bold(pc14.blue(" Configuration Mode "))));
2506
2860
  await gitCheck();
2507
2861
  let selectedTool;
2508
2862
  if (toolName) {
@@ -2511,13 +2865,13 @@ async function configure(toolName) {
2511
2865
  selectedTool = tool.value;
2512
2866
  } else {
2513
2867
  console.log(
2514
- pc12.yellow(`Tool '${toolName}' not found or not configurable.`)
2868
+ pc14.yellow(`Tool '${toolName}' not found or not configurable.`)
2515
2869
  );
2516
2870
  }
2517
2871
  }
2518
2872
  if (!selectedTool) {
2519
2873
  const selection = await withCancelHandling(
2520
- async () => select9({
2874
+ async () => prompts.select({
2521
2875
  message: "Select a tool to configure:",
2522
2876
  options: TOOL_OPTIONS
2523
2877
  })
@@ -2560,9 +2914,9 @@ async function configure(toolName) {
2560
2914
  await installLicense(config);
2561
2915
  break;
2562
2916
  }
2563
- outro2(pc12.green(`${selectedTool} configured successfully!`));
2917
+ prompts.outro(pc14.green(`${selectedTool} configured successfully!`));
2564
2918
  } catch (error) {
2565
- outro2(pc12.red(`Failed to configure ${selectedTool}.`));
2919
+ prompts.outro(pc14.red(`Failed to configure ${selectedTool}.`));
2566
2920
  console.error(error);
2567
2921
  process.exit(1);
2568
2922
  }
@@ -2571,6 +2925,7 @@ var init_configure = __esm({
2571
2925
  "src/cli/commands/configure.ts"() {
2572
2926
  "use strict";
2573
2927
  init_esm_shims();
2928
+ init_prompts();
2574
2929
  init_config();
2575
2930
  init_options();
2576
2931
  init_husky();
@@ -2588,15 +2943,14 @@ var init_configure = __esm({
2588
2943
  });
2589
2944
 
2590
2945
  // src/cli/commands/plugin.ts
2591
- import { intro as intro2, outro as outro3, select as select10 } from "@clack/prompts";
2592
- import pc13 from "picocolors";
2946
+ import pc15 from "picocolors";
2593
2947
  async function plugin(toolName) {
2594
2948
  introScreen();
2595
- intro2(pc13.inverse(pc13.bold(pc13.magenta(" Plugin Manager "))));
2949
+ prompts.intro(pc15.inverse(pc15.bold(pc15.magenta(" Plugin Manager "))));
2596
2950
  await gitCheck();
2597
2951
  if (!toolName) {
2598
2952
  toolName = await withCancelHandling(
2599
- async () => select10({
2953
+ async () => prompts.select({
2600
2954
  message: "Select a tool to add plugins to:",
2601
2955
  options: [
2602
2956
  { value: "eslint", label: "ESLint" },
@@ -2606,12 +2960,13 @@ async function plugin(toolName) {
2606
2960
  );
2607
2961
  }
2608
2962
  await installPlugins(toolName);
2609
- outro3(pc13.green("Plugins installed successfully!"));
2963
+ prompts.outro(pc15.green("Plugins installed successfully!"));
2610
2964
  }
2611
2965
  var init_plugin = __esm({
2612
2966
  "src/cli/commands/plugin.ts"() {
2613
2967
  "use strict";
2614
2968
  init_esm_shims();
2969
+ init_prompts();
2615
2970
  init_handle_cancel();
2616
2971
  init_display();
2617
2972
  init_git_check();
@@ -2620,12 +2975,12 @@ var init_plugin = __esm({
2620
2975
  });
2621
2976
 
2622
2977
  // src/cli/index.ts
2623
- import { outro as outro4, multiselect as multiselect4, note, confirm as confirm7, intro as intro3 } from "@clack/prompts";
2624
- import pc14 from "picocolors";
2978
+ import pc16 from "picocolors";
2625
2979
  import { program } from "commander";
2626
2980
  var require_index = __commonJS({
2627
2981
  "src/cli/index.ts"() {
2628
2982
  init_esm_shims();
2983
+ init_prompts();
2629
2984
  init_husky();
2630
2985
  init_formatter();
2631
2986
  init_linter();
@@ -2646,12 +3001,12 @@ var require_index = __commonJS({
2646
3001
  async function main() {
2647
3002
  try {
2648
3003
  introScreen();
2649
- intro3(
2650
- pc14.inverse(pc14.bold(pc14.cyan(" Welcome to the Project Setup Wizard ")))
3004
+ prompts.intro(
3005
+ pc16.inverse(pc16.bold(pc16.cyan(" Welcome to the Project Setup Wizard ")))
2651
3006
  );
2652
3007
  await gitCheck();
2653
3008
  const tools = await withCancelHandling(
2654
- async () => multiselect4({
3009
+ async () => prompts.multiselect({
2655
3010
  message: "Select tools to configure:",
2656
3011
  options: TOOL_OPTIONS,
2657
3012
  required: false
@@ -2666,23 +3021,25 @@ var require_index = __commonJS({
2666
3021
  if (config.get("test").selected) await promptTest(config);
2667
3022
  if (config.get("editorConfig").selected) await promptEditorConfig(config);
2668
3023
  if (config.get("license").selected) await promptLicense(config);
2669
- note(config.summary, "Configuration Summary");
3024
+ prompts.note(config.summary, "Configuration Summary");
2670
3025
  const proceed = await withCancelHandling(
2671
- async () => confirm7({
3026
+ async () => prompts.confirm({
2672
3027
  message: "Do you want to proceed with the installation?"
2673
3028
  })
2674
3029
  );
2675
3030
  if (!proceed) {
2676
- outro4(pc14.yellow("Installation cancelled."));
3031
+ prompts.outro(pc16.yellow("Installation cancelled."));
2677
3032
  process.exit(0);
2678
3033
  }
2679
3034
  await execution(config);
2680
- outro4(pc14.green("Setup complete!"));
3035
+ prompts.outro(pc16.green("Setup complete!"));
2681
3036
  } catch (error) {
2682
3037
  const logPath = await logError(error);
2683
- outro4(pc14.red(`
3038
+ prompts.outro(
3039
+ pc16.red(`
2684
3040
  Something went wrong!
2685
- Error log saved to: ${logPath}`));
3041
+ Error log saved to: ${logPath}`)
3042
+ );
2686
3043
  process.exit(1);
2687
3044
  }
2688
3045
  }