create-tamagui 2.0.0-rc.8 → 2.0.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/dist/index.cjs CHANGED
@@ -3,11 +3,14 @@ var __create = Object.create;
3
3
  var __defProp = Object.defineProperty;
4
4
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
5
  var __getOwnPropNames = Object.getOwnPropertyNames;
6
- var __getProtoOf = Object.getPrototypeOf, __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
8
  var __copyProps = (to, from, except, desc) => {
8
- if (from && typeof from == "object" || typeof from == "function")
9
+ if (from && typeof from === "object" || typeof from === "function") {
9
10
  for (let key of __getOwnPropNames(from))
10
- !__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
11
+ if (!__hasOwnProp.call(to, key) && key !== except)
12
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
13
+ }
11
14
  return to;
12
15
  };
13
16
  var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
@@ -15,24 +18,33 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
15
18
  // file that has been converted to a CommonJS file using a Babel-
16
19
  // compatible transform (i.e. "__esModule" has not been set), then set
17
20
  // "default" to the CommonJS "module.exports" for node compatibility.
18
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: !0 }) : target,
21
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
19
22
  mod
20
23
  ));
21
24
 
22
25
  // src/index.ts
23
- var import_node_child_process3 = require("node:child_process"), import_node_fs2 = __toESM(require("node:fs")), import_node_path4 = __toESM(require("node:path")), import_node_process = require("node:process"), import_chalk8 = __toESM(require("chalk")), import_commander = __toESM(require("commander")), import_detect_package_manager = require("detect-package-manager"), import_fs_extra2 = require("fs-extra"), import_opener = __toESM(require("opener")), import_prompts4 = __toESM(require("prompts")), import_zx2 = require("zx");
26
+ var import_chalk10 = __toESM(require("chalk"));
27
+ var import_commander = __toESM(require("commander"));
28
+ var import_detect_package_manager = require("detect-package-manager");
29
+ var import_fs_extra2 = require("fs-extra");
30
+ var import_node_child_process3 = require("node:child_process");
31
+ var import_node_fs3 = __toESM(require("node:fs"));
32
+ var import_node_path4 = __toESM(require("node:path"));
33
+ var import_node_process = require("node:process");
34
+ var import_opener = __toESM(require("opener"));
35
+ var import_prompts4 = __toESM(require("prompts"));
24
36
 
25
37
  // package.json
26
38
  var package_default = {
27
39
  name: "create-tamagui",
28
- version: "2.0.0-rc.7-1770543309730",
40
+ version: "2.0.0-rc.41-1779421707144",
29
41
  gitHead: "a49cc7ea6b93ba384e77a4880ae48ac4a5635c14",
30
42
  bin: "./run.js",
31
43
  files: [
32
44
  "run.js",
33
45
  "dist"
34
46
  ],
35
- sideEffects: !1,
47
+ sideEffects: false,
36
48
  main: "dist/index.cjs",
37
49
  publishConfig: {
38
50
  access: "public"
@@ -43,6 +55,7 @@ var package_default = {
43
55
  "test-disabled": "NODE_ENV=test node -r esbuild-register ../../../node_modules/.bin/playwright test integration.test.ts",
44
56
  "test:debug": "bun run test --debug",
45
57
  test: "bun run build:test && vitest run",
58
+ "test:web": "bun run test",
46
59
  "build:test": "bun run build",
47
60
  prerelease: "rimraf ./dist/",
48
61
  prepublish: "bun run build",
@@ -60,8 +73,7 @@ var package_default = {
60
73
  opener: "^1.5.2",
61
74
  prompts: "2.1.0",
62
75
  rimraf: "^5.0.1",
63
- "validate-npm-package-name": "3.0.0",
64
- zx: "^8.5.5"
76
+ "validate-npm-package-name": "3.0.0"
65
77
  },
66
78
  devDependencies: {
67
79
  "@playwright/test": "^1.49.1",
@@ -94,7 +106,8 @@ var IS_TEST = process.env.NODE_ENV === "test";
94
106
  var import_chalk2 = __toESM(require("chalk"));
95
107
 
96
108
  // src/helpers/rainbowChalk.ts
97
- var import_chalk = __toESM(require("chalk")), rainbowColors = [
109
+ var import_chalk = __toESM(require("chalk"));
110
+ var rainbowColors = [
98
111
  "#f76808",
99
112
  "#f5d90a",
100
113
  "#30a46c",
@@ -106,16 +119,31 @@ var import_chalk = __toESM(require("chalk")), rainbowColors = [
106
119
 
107
120
  // src/helpers/asciiArts.ts
108
121
  var tamaguiRainbowAsciiArt = (function() {
109
- let char0_1 = import_chalk2.default.hex(rainbowColors[0])("\u2580\u2588\u2580"), char0_2 = import_chalk2.default.hex(rainbowColors[0])(" \u2588 "), char1_1 = import_chalk2.default.hex(rainbowColors[1])("\u2584\u2580\u2588"), char1_2 = import_chalk2.default.hex(rainbowColors[1])("\u2588\u2580\u2588"), char2_1 = import_chalk2.default.hex(rainbowColors[2])("\u2588\u2580\u2584\u2580\u2588"), char2_2 = import_chalk2.default.hex(rainbowColors[2])("\u2588 \u2580 \u2588"), char3_1 = import_chalk2.default.hex(rainbowColors[3])("\u2584\u2580\u2588"), char3_2 = import_chalk2.default.hex(rainbowColors[3])("\u2588\u2580\u2588"), char4_1 = import_chalk2.default.hex(rainbowColors[4])("\u2588\u2580\u2580"), char4_2 = import_chalk2.default.hex(rainbowColors[4])("\u2588\u2584\u2588"), char5_1 = import_chalk2.default.hex(rainbowColors[5])("\u2588 \u2588"), char5_2 = import_chalk2.default.hex(rainbowColors[5])("\u2588\u2584\u2588"), char6_1 = import_chalk2.default.hex(rainbowColors[6])("\u2588"), char6_2 = import_chalk2.default.hex(rainbowColors[6])("\u2588");
122
+ const char0_1 = import_chalk2.default.hex(rainbowColors[0])("\u2580\u2588\u2580");
123
+ const char0_2 = import_chalk2.default.hex(rainbowColors[0])(" \u2588 ");
124
+ const char1_1 = import_chalk2.default.hex(rainbowColors[1])("\u2584\u2580\u2588");
125
+ const char1_2 = import_chalk2.default.hex(rainbowColors[1])("\u2588\u2580\u2588");
126
+ const char2_1 = import_chalk2.default.hex(rainbowColors[2])("\u2588\u2580\u2584\u2580\u2588");
127
+ const char2_2 = import_chalk2.default.hex(rainbowColors[2])("\u2588 \u2580 \u2588");
128
+ const char3_1 = import_chalk2.default.hex(rainbowColors[3])("\u2584\u2580\u2588");
129
+ const char3_2 = import_chalk2.default.hex(rainbowColors[3])("\u2588\u2580\u2588");
130
+ const char4_1 = import_chalk2.default.hex(rainbowColors[4])("\u2588\u2580\u2580");
131
+ const char4_2 = import_chalk2.default.hex(rainbowColors[4])("\u2588\u2584\u2588");
132
+ const char5_1 = import_chalk2.default.hex(rainbowColors[5])("\u2588 \u2588");
133
+ const char5_2 = import_chalk2.default.hex(rainbowColors[5])("\u2588\u2584\u2588");
134
+ const char6_1 = import_chalk2.default.hex(rainbowColors[6])("\u2588");
135
+ const char6_2 = import_chalk2.default.hex(rainbowColors[6])("\u2588");
110
136
  return `${char0_1}\u2003${char1_1}\u2003${char2_1}\u2003${char3_1}\u2003${char4_1}\u2003${char5_1}\u2003${char6_1}
111
137
  ${char0_2}\u2003${char1_2}\u2003${char2_2}\u2003${char3_2}\u2003${char4_2}\u2003${char5_2}\u2003${char6_2}
112
138
  `;
113
- })(), takeoutAsciiArt = `\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2557\u2591\u2588\u2588\u2588\u2588\u2588\u2557\u2591\u2588\u2588\u2557\u2591\u2591\u2588\u2588\u2557\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2557\u2591\u2588\u2588\u2588\u2588\u2588\u2557\u2591\u2588\u2588\u2557\u2591\u2591\u2591\u2588\u2588\u2557\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2557
139
+ })();
140
+ var takeoutAsciiArt = `\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2557\u2591\u2588\u2588\u2588\u2588\u2588\u2557\u2591\u2588\u2588\u2557\u2591\u2591\u2588\u2588\u2557\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2557\u2591\u2588\u2588\u2588\u2588\u2588\u2557\u2591\u2588\u2588\u2557\u2591\u2591\u2591\u2588\u2588\u2557\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2557
114
141
  \u255A\u2550\u2550\u2588\u2588\u2554\u2550\u2550\u255D\u2588\u2588\u2554\u2550\u2550\u2588\u2588\u2557\u2588\u2588\u2551\u2591\u2588\u2588\u2554\u255D\u2588\u2588\u2554\u2550\u2550\u2550\u2550\u255D\u2588\u2588\u2554\u2550\u2550\u2588\u2588\u2557\u2588\u2588\u2551\u2591\u2591\u2591\u2588\u2588\u2551\u255A\u2550\u2550\u2588\u2588\u2554\u2550\u2550\u255D
115
142
  \u2591\u2591\u2591\u2588\u2588\u2551\u2591\u2591\u2591\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2551\u2588\u2588\u2588\u2588\u2588\u2550\u255D\u2591\u2588\u2588\u2588\u2588\u2588\u2557\u2591\u2591\u2588\u2588\u2551\u2591\u2591\u2588\u2588\u2551\u2588\u2588\u2551\u2591\u2591\u2591\u2588\u2588\u2551\u2591\u2591\u2591\u2588\u2588\u2551\u2591\u2591\u2591
116
143
  \u2591\u2591\u2591\u2588\u2588\u2551\u2591\u2591\u2591\u2588\u2588\u2554\u2550\u2550\u2588\u2588\u2551\u2588\u2588\u2554\u2550\u2588\u2588\u2557\u2591\u2588\u2588\u2554\u2550\u2550\u255D\u2591\u2591\u2588\u2588\u2551\u2591\u2591\u2588\u2588\u2551\u2588\u2588\u2551\u2591\u2591\u2591\u2588\u2588\u2551\u2591\u2591\u2591\u2588\u2588\u2551\u2591\u2591\u2591
117
144
  \u2591\u2591\u2591\u2588\u2588\u2551\u2591\u2591\u2591\u2588\u2588\u2551\u2591\u2591\u2588\u2588\u2551\u2588\u2588\u2551\u2591\u255A\u2588\u2588\u2557\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2557\u255A\u2588\u2588\u2588\u2588\u2588\u2554\u255D\u255A\u2588\u2588\u2588\u2588\u2588\u2588\u2554\u255D\u2591\u2591\u2591\u2588\u2588\u2551\u2591\u2591\u2591
118
- \u2591\u2591\u2591\u255A\u2550\u255D\u2591\u2591\u2591\u255A\u2550\u255D\u2591\u2591\u255A\u2550\u255D\u255A\u2550\u255D\u2591\u2591\u255A\u2550\u255D\u255A\u2550\u2550\u2550\u2550\u2550\u2550\u255D\u2591\u255A\u2550\u2550\u2550\u2550\u255D\u2591\u2591\u255A\u2550\u2550\u2550\u2550\u2550\u255D\u2591\u2591\u2591\u2591\u255A\u2550\u255D\u2591\u2591\u2591`, tamaguiDuckAsciiArt = ` \u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588
145
+ \u2591\u2591\u2591\u255A\u2550\u255D\u2591\u2591\u2591\u255A\u2550\u255D\u2591\u2591\u255A\u2550\u255D\u255A\u2550\u255D\u2591\u2591\u255A\u2550\u255D\u255A\u2550\u2550\u2550\u2550\u2550\u2550\u255D\u2591\u255A\u2550\u2550\u2550\u2550\u255D\u2591\u2591\u255A\u2550\u2550\u2550\u2550\u2550\u255D\u2591\u2591\u2591\u2591\u255A\u2550\u255D\u2591\u2591\u2591`;
146
+ var tamaguiDuckAsciiArt = ` \u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588
119
147
  \u2588\u2588 \u2588\u2588
120
148
  \u2588\u2588 \u2588\u2588 \u2588\u2588\u2588\u2588\u2588\u2588
121
149
  \u2588\u2588 \u2588\u2588 \u2588\u2588
@@ -126,54 +154,106 @@ ${char0_2}\u2003${char1_2}\u2003${char2_2}\u2003${char3_2}\u2003${char4_2}\u2003
126
154
  \u2588\u2588 \u2588\u2588 `;
127
155
 
128
156
  // src/helpers/cloneStarter.ts
129
- var import_node_child_process = require("node:child_process"), import_node_os = require("node:os"), import_node_path = require("node:path"), import_chalk3 = __toESM(require("chalk")), import_fs_extra = require("fs-extra"), import_rimraf = require("rimraf"), import_zx = require("zx"), open = require("opener"), exec = (cmd, options) => (console.info("$ ", cmd), (0, import_node_child_process.execSync)(cmd, {
130
- stdio: process.env.DEBUG ? "inherit" : "ignore",
131
- ...options
132
- })), tamaguiDir = (0, import_node_path.join)((0, import_node_os.homedir)(), ".tamagui-repo-cache"), targetGitDir = "", cloneStarter = async (template, resolvedProjectPath, projectName) => {
133
- targetGitDir = (0, import_node_path.join)(tamaguiDir, "tamagui", template.repo.url.split("/").at(-1)), console.info(), await setupTamaguiDotDir(template);
134
- let starterDir = (0, import_node_path.join)(targetGitDir, ...template.repo.dir);
135
- console.info(), console.info(
157
+ var import_node_child_process = require("node:child_process");
158
+ var import_node_fs = require("node:fs");
159
+ var import_node_os = require("node:os");
160
+ var import_node_path = require("node:path");
161
+ var import_chalk3 = __toESM(require("chalk"));
162
+ var import_fs_extra = require("fs-extra");
163
+ var import_rimraf = require("rimraf");
164
+ var open = require("opener");
165
+ var exec = (cmd, options) => {
166
+ console.info(`$ `, cmd);
167
+ return (0, import_node_child_process.execSync)(cmd, {
168
+ stdio: process.env.DEBUG ? "inherit" : "ignore",
169
+ ...options
170
+ });
171
+ };
172
+ var tamaguiDir = (0, import_node_path.join)((0, import_node_os.homedir)(), ".tamagui-repo-cache");
173
+ var targetGitDir = "";
174
+ var cloneStarter = async (template, resolvedProjectPath, projectName) => {
175
+ targetGitDir = (0, import_node_path.join)(tamaguiDir, "tamagui", template.repo.url.split("/").at(-1));
176
+ console.info();
177
+ await setupTamaguiDotDir(template);
178
+ const starterDir = (0, import_node_path.join)(targetGitDir, ...template.repo.dir);
179
+ console.info();
180
+ console.info(
136
181
  `Copying starter from ${starterDir} into ${import_chalk3.default.blueBright(projectName)}...`
137
- ), console.info(), await (0, import_fs_extra.copy)(starterDir, resolvedProjectPath), await (0, import_rimraf.rimraf)(`${resolvedProjectPath}/.git`), console.info(import_chalk3.default.green(`${projectName} created!`)), console.info();
182
+ );
183
+ console.info();
184
+ await (0, import_fs_extra.copy)(starterDir, resolvedProjectPath);
185
+ await (0, import_rimraf.rimraf)(`${resolvedProjectPath}/.git`);
186
+ rewriteWorkspaceVersions(resolvedProjectPath);
187
+ console.info(import_chalk3.default.green(`${projectName} created!`));
188
+ console.info();
138
189
  };
139
190
  async function setupTamaguiDotDir(template) {
140
- if (console.info(`Setting up ${import_chalk3.default.blueBright(targetGitDir)}...`), process.env.GITHUB_HEAD_REF)
191
+ console.info(`Setting up ${import_chalk3.default.blueBright(targetGitDir)}...`);
192
+ if (process.env.GITHUB_HEAD_REF) {
141
193
  try {
142
- await import_zx.$`cd ${targetGitDir} && git switch -c ${process.env.GITHUB_HEAD_REF}`;
194
+ (0, import_node_child_process.execSync)(`git switch -c ${process.env.GITHUB_HEAD_REF}`, {
195
+ cwd: targetGitDir,
196
+ stdio: "ignore"
197
+ });
143
198
  } catch {
144
199
  }
145
- let branch = template.repo.branch;
146
- await (0, import_fs_extra.ensureDir)(tamaguiDir), (0, import_zx.cd)(tamaguiDir);
147
- let isInSubDir = template.repo.dir.length > 0, sourceGitRepo = template.repo.url, sourceGitRepoSshFallback = template.repo.sshFallback;
148
- if (await (0, import_fs_extra.pathExists)(targetGitDir))
149
- await (0, import_fs_extra.pathExists)((0, import_node_path.join)(targetGitDir, ".git")) || (console.error(`Corrupt Tamagui directory, please delete ${targetGitDir} and re-run`), process.exit(1));
150
- else {
151
- console.info("Cloning tamagui base directory"), console.info();
152
- let cmd = `git clone --branch ${branch} ${isInSubDir ? "--depth 1 --sparse --filter=blob:none " : ""}${sourceGitRepo} "${targetGitDir}"`;
200
+ }
201
+ const branch = template.repo.branch;
202
+ await (0, import_fs_extra.ensureDir)(tamaguiDir);
203
+ const isInSubDir = template.repo.dir.length > 0;
204
+ const sourceGitRepo = template.repo.url;
205
+ const sourceGitRepoSshFallback = template.repo.sshFallback;
206
+ if (!await (0, import_fs_extra.pathExists)(targetGitDir)) {
207
+ console.info(`Cloning tamagui base directory`);
208
+ console.info();
209
+ const cmd = `git clone --branch ${branch} ${isInSubDir ? "--depth 1 --sparse --filter=blob:none " : ""}${sourceGitRepo} "${targetGitDir}"`;
153
210
  try {
154
211
  try {
155
- console.info(`$ ${cmd}`), console.info(), exec(cmd);
212
+ console.info(`$ ${cmd}`);
213
+ console.info();
214
+ exec(cmd);
156
215
  } catch (error) {
157
216
  if (cmd.includes("https://")) {
158
- console.info("https failed - trying with ssh now...");
159
- let sshCmd = cmd.replace(sourceGitRepo, sourceGitRepoSshFallback);
160
- console.info(`$ ${sshCmd}`), console.info(), exec(sshCmd);
161
- } else
217
+ console.info(`https failed - trying with ssh now...`);
218
+ const sshCmd = cmd.replace(sourceGitRepo, sourceGitRepoSshFallback);
219
+ console.info(`$ ${sshCmd}`);
220
+ console.info();
221
+ exec(sshCmd);
222
+ } else {
162
223
  throw error;
224
+ }
163
225
  }
164
226
  } catch (error) {
165
- throw error instanceof Error && (template.value === "takeout-pro" || template.value === "takeout-pro-classic") && error?.stderr?.includes("Repository not found") && (console.info(
166
- import_chalk3.default.yellow(
167
- "You don't have access to this starter. Check \u{1F961} Tamagui Takeout (https://tamagui.dev/takeout) for more info."
168
- )
169
- ), open("https://tamagui.dev/takeout"), process.exit(0)), error;
227
+ if (error instanceof Error) {
228
+ if (template.value === "takeout-pro" || template.value === "takeout-pro-classic") {
229
+ if (error?.stderr?.includes("Repository not found")) {
230
+ console.info(
231
+ import_chalk3.default.yellow(
232
+ `You don't have access to this starter. Check \u{1F961} Tamagui Takeout (https://tamagui.dev/takeout) for more info.`
233
+ )
234
+ );
235
+ open("https://tamagui.dev/takeout");
236
+ process.exit(0);
237
+ }
238
+ }
239
+ }
240
+ throw error;
170
241
  }
242
+ } else {
243
+ if (!await (0, import_fs_extra.pathExists)((0, import_node_path.join)(targetGitDir, ".git"))) {
244
+ console.error(`Corrupt Tamagui directory, please delete ${targetGitDir} and re-run`);
245
+ process.exit(1);
246
+ }
247
+ }
248
+ if (isInSubDir) {
249
+ const cmd = `git sparse-checkout set code/starters`;
250
+ exec(cmd, { cwd: targetGitDir });
251
+ console.info();
171
252
  }
172
- isInSubDir && (exec("git sparse-checkout set code/starters", { cwd: targetGitDir }), console.info());
173
253
  try {
174
- let remoteName = getDefaultRemoteName();
254
+ const remoteName = getDefaultRemoteName();
175
255
  if (await (0, import_fs_extra.pathExists)((0, import_node_path.join)(targetGitDir, ".git"))) {
176
- let cmd2 = `git pull --rebase --allow-unrelated-histories --depth 1 ${remoteName} ${branch}`;
256
+ const cmd2 = `git pull --rebase --allow-unrelated-histories --depth 1 ${remoteName} ${branch}`;
177
257
  try {
178
258
  exec(cmd2, {
179
259
  cwd: targetGitDir
@@ -184,224 +264,357 @@ async function setupTamaguiDotDir(template) {
184
264
  });
185
265
  }
186
266
  console.info();
187
- } else
267
+ } else {
188
268
  console.warn(
189
269
  `Warning: ${targetGitDir} is not a git repository. Skipping pull operation.`
190
270
  );
271
+ }
191
272
  } catch (err) {
192
- await (0, import_fs_extra.remove)(targetGitDir), console.info(`Error updating: ${err.message} ${err.stack}`), console.info(
193
- "We removed the old template cache, so re-running may fix. If not, please file an issue: https://github.com/tamagui/tamagui/issues/new?assignees=&labels=&template=bug_report.md&title="
194
- ), process.exit(1);
273
+ await (0, import_fs_extra.remove)(targetGitDir);
274
+ console.info(`Error updating: ${err.message} ${err.stack}`);
275
+ console.info(
276
+ `We removed the old template cache, so re-running may fix. If not, please file an issue: https://github.com/tamagui/tamagui/issues/new?assignees=&labels=&template=bug_report.md&title=`
277
+ );
278
+ process.exit(1);
279
+ }
280
+ }
281
+ function rewriteWorkspaceVersions(projectPath2) {
282
+ const pkgPath = (0, import_node_path.join)(projectPath2, "package.json");
283
+ try {
284
+ const pkg = JSON.parse((0, import_node_fs.readFileSync)(pkgPath, "utf-8"));
285
+ if (pkg.workspaces) {
286
+ return;
287
+ }
288
+ const ctPkgPath = require.resolve("create-tamagui/package.json");
289
+ const ctPkg = JSON.parse((0, import_node_fs.readFileSync)(ctPkgPath, "utf-8"));
290
+ const version = `^${ctPkg.version}`;
291
+ let changed = false;
292
+ for (const field of ["dependencies", "devDependencies"]) {
293
+ const deps = pkg[field];
294
+ if (!deps) continue;
295
+ for (const [key, val] of Object.entries(deps)) {
296
+ if (val === "workspace:*") {
297
+ deps[key] = version;
298
+ changed = true;
299
+ }
300
+ }
301
+ }
302
+ if (changed) {
303
+ (0, import_node_fs.writeFileSync)(pkgPath, JSON.stringify(pkg, null, 2) + "\n");
304
+ console.info(import_chalk3.default.dim(` Rewrote workspace:* \u2192 ${version}`));
305
+ }
306
+ } catch {
195
307
  }
196
308
  }
197
309
  var getDefaultRemoteName = () => {
198
310
  try {
199
- return (0, import_fs_extra.pathExists)((0, import_node_path.join)(targetGitDir, ".git")) ? (0, import_node_child_process.execSync)("git remote", { cwd: targetGitDir }).toString().trim().split(`
200
- `)[0] || "origin" : (console.warn(
201
- 'Warning: Not in a git repository. Using default remote name "origin".'
202
- ), "origin");
311
+ if (!(0, import_fs_extra.pathExists)((0, import_node_path.join)(targetGitDir, ".git"))) {
312
+ console.warn(
313
+ 'Warning: Not in a git repository. Using default remote name "origin".'
314
+ );
315
+ return "origin";
316
+ }
317
+ const remotes = (0, import_node_child_process.execSync)("git remote", { cwd: targetGitDir }).toString().trim().split("\n");
318
+ return remotes[0] || "origin";
203
319
  } catch (error) {
204
- return console.warn("Error getting default remote name:", error), console.warn('Using default remote name "origin".'), "origin";
320
+ console.warn("Error getting default remote name:", error);
321
+ console.warn('Using default remote name "origin".');
322
+ return "origin";
205
323
  }
206
324
  };
207
325
 
208
326
  // src/helpers/getProjectName.ts
209
- var import_node_path2 = __toESM(require("node:path")), import_chalk4 = __toESM(require("chalk")), import_prompts = __toESM(require("prompts"));
327
+ var import_node_path2 = __toESM(require("node:path"));
328
+ var import_chalk4 = __toESM(require("chalk"));
329
+ var import_prompts = __toESM(require("prompts"));
210
330
 
211
331
  // src/helpers/validateNpmPackage.ts
212
332
  var import_validate_npm_package_name = __toESM(require("validate-npm-package-name"));
213
333
  function validateNpmName(name) {
214
- let nameValidation = (0, import_validate_npm_package_name.default)(name);
215
- return nameValidation.validForNewPackages ? { valid: !0 } : {
216
- valid: !1,
334
+ const nameValidation = (0, import_validate_npm_package_name.default)(name);
335
+ if (nameValidation.validForNewPackages) {
336
+ return { valid: true };
337
+ }
338
+ return {
339
+ valid: false,
217
340
  problems: [...nameValidation.errors || [], ...nameValidation.warnings || []]
218
341
  };
219
342
  }
220
343
 
221
344
  // src/helpers/getProjectName.ts
222
345
  var getProjectName = async (projectPath2) => {
223
- if (typeof projectPath2 == "string" && (projectPath2 = projectPath2.trim()), !projectPath2) {
224
- let res = await (0, import_prompts.default)({
346
+ if (typeof projectPath2 === "string") {
347
+ projectPath2 = projectPath2.trim();
348
+ }
349
+ if (!projectPath2) {
350
+ const res = await (0, import_prompts.default)({
225
351
  type: "text",
226
352
  name: "path",
227
353
  message: "Project name:",
228
354
  initial: "myapp",
229
355
  validate: (name) => {
230
- let validation = validateNpmName(import_node_path2.default.basename(import_node_path2.default.resolve(name)));
231
- return validation.valid ? !0 : "Invalid project name: " + validation.problems[0];
356
+ const validation = validateNpmName(import_node_path2.default.basename(import_node_path2.default.resolve(name)));
357
+ if (validation.valid) {
358
+ return true;
359
+ }
360
+ return "Invalid project name: " + validation.problems[0];
232
361
  }
233
362
  });
234
- typeof res.path == "string" && (projectPath2 = res.path.trim());
363
+ if (typeof res.path === "string") {
364
+ projectPath2 = res.path.trim();
365
+ }
366
+ }
367
+ if (!projectPath2) {
368
+ console.info();
369
+ console.info("Please specify the project directory:");
370
+ console.info(
371
+ ` ${import_chalk4.default.cyan(package_default.name)} ${import_chalk4.default.green("<project-directory>")}`
372
+ );
373
+ console.info();
374
+ console.info("For example:");
375
+ console.info(` ${import_chalk4.default.cyan(package_default.name)} ${import_chalk4.default.green("my-tamagui-app")}`);
376
+ console.info();
377
+ console.info(`Run ${import_chalk4.default.cyan(`${package_default.name} --help`)} to see all options.`);
378
+ process.exit(1);
235
379
  }
236
- return projectPath2 || (console.info(), console.info("Please specify the project directory:"), console.info(
237
- ` ${import_chalk4.default.cyan(package_default.name)} ${import_chalk4.default.green("<project-directory>")}`
238
- ), console.info(), console.info("For example:"), console.info(` ${import_chalk4.default.cyan(package_default.name)} ${import_chalk4.default.green("my-tamagui-app")}`), console.info(), console.info(`Run ${import_chalk4.default.cyan(`${package_default.name} --help`)} to see all options.`), process.exit(1)), projectPath2;
380
+ return projectPath2;
239
381
  };
240
382
 
241
383
  // src/helpers/getTemplateInfo.ts
242
384
  var import_prompts3 = __toESM(require("prompts"));
243
385
 
244
386
  // src/templates.ts
245
- var import_chalk7 = __toESM(require("chalk"));
387
+ var import_chalk9 = __toESM(require("chalk"));
246
388
 
247
- // src/steps/starter-free.ts
248
- var import_chalk5 = __toESM(require("chalk")), packageManager = "bun", runCommand = (scriptName) => `${packageManager} run ${scriptName}`, main = async ({ isFullClone, projectName }) => {
249
- console.info("Note: you need bun for this repo."), isFullClone && console.info(`${import_chalk5.default.green.bold(
250
- "Done!"
251
- )} created a new project under ./${projectName}
389
+ // src/steps/expo-router.ts
390
+ var import_chalk5 = __toESM(require("chalk"));
391
+ var main = async ({ isFullClone, projectName }) => {
392
+ if (isFullClone) {
393
+ console.info(`
394
+ ${import_chalk5.default.green.bold("Done!")} created a new project under ./${projectName}
252
395
 
253
396
  visit your project:
254
397
  ${import_chalk5.default.green("cd")} ${projectName}
255
- `), console.info(`
398
+ `);
399
+ }
400
+ };
401
+ var expo_router_default = main;
402
+
403
+ // src/steps/remix.ts
404
+ var import_chalk6 = __toESM(require("chalk"));
405
+ var packageManager = "bun";
406
+ var runCommand = (scriptName) => `${packageManager} run ${scriptName}`;
407
+ var main2 = async ({ isFullClone, projectName }) => {
408
+ if (isFullClone) {
409
+ console.info(`
410
+ ${import_chalk6.default.green.bold("Done!")} created a new project under ./${projectName}
411
+
412
+ visit your project:
413
+ ${import_chalk6.default.green("cd")} ${projectName}
414
+ `);
415
+ }
416
+ console.info(`
417
+ To start the Remix development server, run:
418
+ ${import_chalk6.default.green(runCommand("dev"))}
419
+ `);
420
+ };
421
+ var remix_default = main2;
422
+
423
+ // src/steps/starter-free.ts
424
+ var import_chalk7 = __toESM(require("chalk"));
425
+ var packageManager2 = "bun";
426
+ var runCommand2 = (scriptName) => `${packageManager2} run ${scriptName}`;
427
+ var main3 = async ({ isFullClone, projectName }) => {
428
+ console.info(`Note: you need bun for this repo.`);
429
+ if (isFullClone) {
430
+ console.info(`${import_chalk7.default.green.bold(
431
+ "Done!"
432
+ )} created a new project under ./${projectName}
433
+
434
+ visit your project:
435
+ ${import_chalk7.default.green("cd")} ${projectName}
436
+ `);
437
+ }
438
+ console.info(`
256
439
  To start the Next.js development server, run:
257
- ${import_chalk5.default.green(runCommand("web"))}
440
+ ${import_chalk7.default.green(runCommand2("web"))}
258
441
 
259
442
  To start Expo Go for mobile development, run:
260
- ${import_chalk5.default.green(runCommand("native"))}
443
+ ${import_chalk7.default.green(runCommand2("native"))}
261
444
 
262
445
  You can also create Expo development builds by doing:
263
446
 
264
- ${import_chalk5.default.green("cd apps/expo")}
447
+ ${import_chalk7.default.green(`cd apps/expo`)}
265
448
  then:
266
- ${import_chalk5.default.green(runCommand("ios"))}
449
+ ${import_chalk7.default.green(runCommand2("ios"))}
267
450
  or...
268
- ${import_chalk5.default.green(runCommand("android"))}
451
+ ${import_chalk7.default.green(runCommand2("android"))}
269
452
 
270
453
  Be sure to replace yourprojectsname in app.json with the uid you'd like for your app.
271
454
  `);
272
- }, starter_free_default = main;
455
+ };
456
+ var starter_free_default = main3;
273
457
 
274
458
  // src/steps/takeout.ts
275
- var import_node_child_process2 = require("node:child_process"), import_node_fs = require("node:fs"), import_promises = __toESM(require("node:fs/promises")), import_node_path3 = __toESM(require("node:path")), import_chalk6 = __toESM(require("chalk")), import_prompts2 = __toESM(require("prompts"));
276
- var packageManager2 = "bun", runCommand2 = (scriptName) => `${packageManager2} run ${scriptName}`, main2 = async ({ isFullClone, projectName, projectPath: projectPath2 }) => {
459
+ var import_node_child_process2 = require("node:child_process");
460
+ var import_node_fs2 = require("node:fs");
461
+ var import_promises = __toESM(require("node:fs/promises"));
462
+ var import_node_path3 = __toESM(require("node:path"));
463
+ var import_chalk8 = __toESM(require("chalk"));
464
+ var import_prompts2 = __toESM(require("prompts"));
465
+ var packageManager3 = "bun";
466
+ var runCommand3 = (scriptName) => `${packageManager3} run ${scriptName}`;
467
+ var main4 = async ({ isFullClone, projectName, projectPath: projectPath2 }) => {
277
468
  console.info(`
278
- ${tamaguiRainbowAsciiArt.split(`
279
- `).map((line) => ` ${line}`).join(`
280
- `)}
469
+ ${tamaguiRainbowAsciiArt.split("\n").map((line) => ` ${line}`).join("\n")}
281
470
  ${takeoutAsciiArt}
282
471
 
283
- `), console.info();
284
- let { setupSupabase } = await (0, import_prompts2.default)({
472
+ `);
473
+ console.info();
474
+ const { setupSupabase } = await (0, import_prompts2.default)({
285
475
  name: "setupSupabase",
286
476
  message: "Set up Supabase?",
287
477
  type: "confirm",
288
- initial: !0
478
+ initial: true
289
479
  });
290
480
  if (setupSupabase) {
291
481
  console.info();
292
- let { startLocalSupabase } = await (0, import_prompts2.default)({
482
+ const { startLocalSupabase } = await (0, import_prompts2.default)({
293
483
  name: "startLocalSupabase",
294
484
  type: "confirm",
295
485
  message: "Start local Supabase instance for you? (Requires Docker)",
296
- initial: !0
486
+ initial: true
297
487
  });
298
- if (startLocalSupabase && await runRetryableCommand("bun run supa start")) {
299
- console.info();
300
- let { setUpSupabaseEnv } = await (0, import_prompts2.default)({
301
- name: "setUpSupabaseEnv",
302
- type: "confirm",
303
- message: "Do you want us to add the local env variables for you? This will create a file called .env.local.",
304
- initial: !0
305
- });
306
- if (setUpSupabaseEnv) {
307
- let envs = getEnvFromSupabaseStatus(
308
- (0, import_node_child_process2.execSync)("bun run supa status").toString()
309
- ), newEnvContent = Object.entries(envs).map(([key, value]) => `${key}=${value}`).join(`
310
- `);
311
- (0, import_node_fs.existsSync)(import_node_path3.default.join(projectPath2, ".env.local")) && (0, import_node_fs.readFileSync)(import_node_path3.default.join(projectPath2, ".env.local")).toString() !== newEnvContent && (0, import_node_fs.renameSync)(
312
- import_node_path3.default.join(projectPath2, ".env.local"),
313
- import_node_path3.default.join(projectPath2, `.env.local.old-${Number(/* @__PURE__ */ new Date())}`)
314
- ), await import_promises.default.writeFile(import_node_path3.default.join(projectPath2, "./.env.local"), newEnvContent);
488
+ if (startLocalSupabase) {
489
+ const supabaseStarted = await runRetryableCommand(`bun run supa start`);
490
+ if (supabaseStarted) {
491
+ console.info();
492
+ const { setUpSupabaseEnv } = await (0, import_prompts2.default)({
493
+ name: "setUpSupabaseEnv",
494
+ type: "confirm",
495
+ message: "Do you want us to add the local env variables for you? This will create a file called .env.local.",
496
+ initial: true
497
+ });
498
+ if (setUpSupabaseEnv) {
499
+ const envs = getEnvFromSupabaseStatus(
500
+ (0, import_node_child_process2.execSync)("bun run supa status").toString()
501
+ );
502
+ const newEnvContent = Object.entries(envs).map(([key, value]) => `${key}=${value}`).join("\n");
503
+ if ((0, import_node_fs2.existsSync)(import_node_path3.default.join(projectPath2, ".env.local"))) {
504
+ if ((0, import_node_fs2.readFileSync)(import_node_path3.default.join(projectPath2, ".env.local")).toString() !== newEnvContent) {
505
+ (0, import_node_fs2.renameSync)(
506
+ import_node_path3.default.join(projectPath2, ".env.local"),
507
+ import_node_path3.default.join(projectPath2, `.env.local.old-${Number(/* @__PURE__ */ new Date())}`)
508
+ );
509
+ }
510
+ }
511
+ await import_promises.default.writeFile(import_node_path3.default.join(projectPath2, "./.env.local"), newEnvContent);
512
+ }
315
513
  }
316
514
  }
317
515
  console.info();
318
- let { setupRemoteSupabase } = await (0, import_prompts2.default)({
516
+ const { setupRemoteSupabase } = await (0, import_prompts2.default)({
319
517
  name: "setupRemoteSupabase",
320
518
  type: "confirm",
321
519
  message: "Link remote Supabase instance for you? (Create a project on https://app.supabase.com/projects first)",
322
- initial: !0
520
+ initial: true
323
521
  });
324
- setupRemoteSupabase && (await runRetryableCommand("npx supabase login"), console.info(), await linkSupabase());
522
+ if (setupRemoteSupabase) {
523
+ await runRetryableCommand(`npx supabase login`);
524
+ console.info();
525
+ await linkSupabase();
526
+ }
325
527
  }
326
- isFullClone && console.info(`
327
- ${import_chalk6.default.green.bold("Done!")} created a new project under ./${projectName}
528
+ if (isFullClone) {
529
+ console.info(`
530
+ ${import_chalk8.default.green.bold("Done!")} created a new project under ./${projectName}
328
531
 
329
532
  visit your project:
330
- ${import_chalk6.default.green(" cd")} ${projectName}
331
- `), console.info(`
533
+ ${import_chalk8.default.green(" cd")} ${projectName}
534
+ `);
535
+ }
536
+ console.info(`
332
537
  To start the Next.js development server, run:
333
- ${import_chalk6.default.green(runCommand2("web"))}
538
+ ${import_chalk8.default.green(runCommand3("web"))}
334
539
 
335
540
  To start developing with Expo for native, run:
336
- ${import_chalk6.default.green(runCommand2("native"))}
541
+ ${import_chalk8.default.green(runCommand3("native"))}
337
542
 
338
543
  To start developing for Expo dev build, run:
339
- ${import_chalk6.default.green(runCommand2("ios"))}
340
- ${import_chalk6.default.green(runCommand2("android"))}
544
+ ${import_chalk8.default.green(runCommand3("ios"))}
545
+ ${import_chalk8.default.green(runCommand3("android"))}
341
546
 
342
547
  To run Supabase scripts, cd into the supabase package:
343
- ${import_chalk6.default.green("cd supabase")}
548
+ ${import_chalk8.default.green("cd supabase")}
344
549
 
345
- ${import_chalk6.default.green("yarn reset")} - Resets local database
346
- ${import_chalk6.default.green("yarn generate")} - Generates new types
550
+ ${import_chalk8.default.green("yarn reset")} - Resets local database
551
+ ${import_chalk8.default.green("yarn generate")} - Generates new types
347
552
 
348
- Find info on the rest of the scripts in ${import_chalk6.default.cyan("supabase/README.md")}
553
+ Find info on the rest of the scripts in ${import_chalk8.default.cyan(`supabase/README.md`)}
349
554
 
350
555
  If you've purchased and gained access to font and icon packages, you can run:
351
- ${import_chalk6.default.green("yarn add:icon")}
352
- ${import_chalk6.default.green("yarn add:font")}
556
+ ${import_chalk8.default.green("yarn add:icon")}
557
+ ${import_chalk8.default.green("yarn add:font")}
353
558
  `);
354
- }, takeout_default = main2;
559
+ };
560
+ var takeout_default = main4;
355
561
  async function runRetryableCommand(cmd, retriesCount = 0) {
356
562
  try {
357
- return (0, import_node_child_process2.execSync)(cmd, { stdio: "inherit" }), !0;
358
- } catch {
359
- let { tryAgain } = await (0, import_prompts2.default)({
563
+ (0, import_node_child_process2.execSync)(cmd, { stdio: "inherit" });
564
+ return true;
565
+ } catch (error) {
566
+ const { tryAgain } = await (0, import_prompts2.default)({
360
567
  name: "tryAgain",
361
568
  message: "An error occurred. Do you want to try again?",
362
569
  type: "confirm",
363
- initial: !0
570
+ initial: true
364
571
  });
365
- if (tryAgain)
572
+ if (tryAgain) {
366
573
  await runRetryableCommand(cmd, retriesCount + 1);
367
- else
368
- return console.info(
369
- import_chalk6.default.yellow(
370
- `\u26A0\uFE0F Skipping this step. You can try running this command later. The failed command was \`${import_chalk6.default.underline(
574
+ } else {
575
+ console.info(
576
+ import_chalk8.default.yellow(
577
+ `\u26A0\uFE0F Skipping this step. You can try running this command later. The failed command was \`${import_chalk8.default.underline(
371
578
  cmd
372
579
  )}\`.`
373
580
  )
374
- ), !1;
581
+ );
582
+ return false;
583
+ }
375
584
  }
376
585
  }
377
586
  async function linkSupabase() {
378
- let { supabaseRefId } = await (0, import_prompts2.default)({
587
+ const { supabaseRefId } = await (0, import_prompts2.default)({
379
588
  name: "supabaseRefId",
380
589
  type: "text",
381
590
  message: "Enter your supabase project's ID (e.g. abcdefghijklmnopqrst)",
382
- initial: !0
383
- }), cmd = `npx supabase link --project-ref ${supabaseRefId.trim()}`;
591
+ initial: true
592
+ });
593
+ const cmd = `npx supabase link --project-ref ${supabaseRefId.trim()}`;
384
594
  try {
385
- return (0, import_node_child_process2.execSync)(cmd, {
595
+ (0, import_node_child_process2.execSync)(cmd, {
386
596
  stdio: "inherit"
387
- }), !0;
388
- } catch {
389
- let { tryAgain } = await (0, import_prompts2.default)({
597
+ });
598
+ return true;
599
+ } catch (error) {
600
+ const { tryAgain } = await (0, import_prompts2.default)({
390
601
  name: "tryAgain",
391
602
  message: "An error occurred. Do you want to try again?",
392
603
  type: "confirm",
393
- initial: !0
604
+ initial: true
394
605
  });
395
- if (tryAgain)
606
+ if (tryAgain) {
396
607
  await linkSupabase();
397
- else
398
- return console.info(
399
- import_chalk6.default.yellow(
400
- `\u26A0\uFE0F Skipping this step. You can try running this command later. The failed command was \`${import_chalk6.default.underline(
608
+ } else {
609
+ console.info(
610
+ import_chalk8.default.yellow(
611
+ `\u26A0\uFE0F Skipping this step. You can try running this command later. The failed command was \`${import_chalk8.default.underline(
401
612
  cmd
402
613
  )}\`.`
403
614
  )
404
- ), !1;
615
+ );
616
+ return false;
617
+ }
405
618
  }
406
619
  }
407
620
  function getEnvFromSupabaseStatus(status) {
@@ -418,62 +631,90 @@ function getEnvFromSupabaseStatus(status) {
418
631
  // src/templates.ts
419
632
  var templates = [
420
633
  {
421
- title: `${import_chalk7.default.bold.underline(
422
- `\u{1F961} ${import_chalk7.default.magenta("Takeout")} ${import_chalk7.default.green("Free")}`
634
+ title: `${import_chalk9.default.bold.underline(
635
+ `\u{1F961} ${import_chalk9.default.magenta("Takeout")} ${import_chalk9.default.green("Free")}`
423
636
  )} - Full stack starter: https://tamagui.dev/takeout`,
424
637
  value: "takeout-free",
425
638
  type: "free",
426
- hidden: !1,
639
+ hidden: false,
427
640
  packageManager: "bun",
428
641
  repo: {
429
- url: "https://github.com/tamagui/takeout-free",
430
- sshFallback: "git@github.com:tamagui/takeout-free.git",
642
+ url: `https://github.com/tamagui/takeout-free`,
643
+ sshFallback: `git@github.com:tamagui/takeout-free.git`,
431
644
  dir: [],
432
645
  branch: "main"
433
646
  },
434
647
  extraSteps: starter_free_default
435
648
  },
436
649
  {
437
- title: `${import_chalk7.default.bold.underline(
438
- `\u{1F961} ${import_chalk7.default.magenta("Takeout")} ${import_chalk7.default.red("Pro")}`
650
+ title: `${import_chalk9.default.bold.underline(
651
+ `\u{1F961} ${import_chalk9.default.magenta("Takeout")} ${import_chalk9.default.red("Pro")}`
439
652
  )} - Full featured starter: https://tamagui.dev/takeout`,
440
- value: "takeout-pro",
653
+ value: `takeout-pro`,
441
654
  type: "premium",
442
655
  packageManager: "yarn",
443
- hidden: !1,
656
+ hidden: false,
444
657
  repo: {
445
- url: "https://github.com/tamagui/takeout2",
446
- sshFallback: "git@github.com:tamagui/takeout2.git",
658
+ url: `https://github.com/tamagui/takeout2`,
659
+ sshFallback: `git@github.com:tamagui/takeout2.git`,
447
660
  dir: [],
448
661
  branch: "main"
449
662
  },
450
663
  extraSteps: takeout_default
451
664
  },
452
665
  {
453
- title: `${import_chalk7.default.bold.underline(
454
- `\u{1F961} ${import_chalk7.default.magenta("Takeout")} ${import_chalk7.default.yellow("Pro Classic")}`
666
+ title: `${import_chalk9.default.bold.underline(
667
+ `\u{1F961} ${import_chalk9.default.magenta("Takeout")} ${import_chalk9.default.yellow("Pro Classic")}`
455
668
  )} - Original Pro starter: https://tamagui.dev/takeout`,
456
- value: "takeout-pro-classic",
669
+ value: `takeout-pro-classic`,
457
670
  type: "premium",
458
671
  packageManager: "yarn",
459
- hidden: !1,
672
+ hidden: false,
460
673
  repo: {
461
- url: "https://github.com/tamagui/takeout",
462
- sshFallback: "git@github.com:tamagui/takeout.git",
674
+ url: `https://github.com/tamagui/takeout`,
675
+ sshFallback: `git@github.com:tamagui/takeout.git`,
463
676
  dir: [],
464
677
  branch: "main"
465
678
  },
466
679
  extraSteps: takeout_default
467
680
  },
468
681
  {
469
- title: "Next + Expo - Production ready monorepo",
682
+ title: `Expo Router - Expo with file-based routing`,
683
+ value: "expo-router",
684
+ type: "free",
685
+ hidden: false,
686
+ packageManager: "bun",
687
+ repo: {
688
+ url: `https://github.com/tamagui/tamagui`,
689
+ sshFallback: `git@github.com:tamagui/tamagui.git`,
690
+ dir: ["code", "starters", "expo-router"],
691
+ branch: "main"
692
+ },
693
+ extraSteps: expo_router_default
694
+ },
695
+ {
696
+ title: `Remix - Remix with Vite`,
697
+ value: "remix",
698
+ type: "free",
699
+ hidden: false,
700
+ packageManager: "bun",
701
+ repo: {
702
+ url: `https://github.com/tamagui/tamagui`,
703
+ sshFallback: `git@github.com:tamagui/tamagui.git`,
704
+ dir: ["code", "starters", "remix"],
705
+ branch: "main"
706
+ },
707
+ extraSteps: remix_default
708
+ },
709
+ {
710
+ title: `Next + Expo - Production ready monorepo`,
470
711
  value: "starter-free",
471
712
  type: "free",
472
- hidden: !1,
713
+ hidden: false,
473
714
  packageManager: "yarn",
474
715
  repo: {
475
- url: process.env.STARTER_FREE_REPO_SOURCE || "https://github.com/tamagui/starter-free.git",
476
- sshFallback: "git@github.com:tamagui/starter-free.git",
716
+ url: process.env.STARTER_FREE_REPO_SOURCE || `https://github.com/tamagui/starter-free.git`,
717
+ sshFallback: `git@github.com:tamagui/starter-free.git`,
477
718
  dir: [],
478
719
  branch: "main"
479
720
  },
@@ -482,30 +723,54 @@ var templates = [
482
723
  ];
483
724
 
484
725
  // src/helpers/getTemplateInfo.ts
485
- var validTemplates = templates.map(({ value }) => value).join(", "), getTemplateInfo = async (template) => {
726
+ var validTemplates = templates.map(({ value }) => value).join(", ");
727
+ var getTemplateInfo = async (template) => {
486
728
  let res = getValidTemplate(template);
487
- return template && !res && (console.warn(`template ${template} is not valid. valid options: ${validTemplates}`), process.exit(1)), res || (template = (await (0, import_prompts3.default)({
488
- name: "template",
489
- type: "select",
490
- message: "Pick a template:",
491
- choices: templates.filter((t) => !t.hidden)
492
- })).template), res = getValidTemplate(`${template}`), res || (console.warn(`template ${template} is not valid. valid options: ${validTemplates}`), process.exit(1)), res;
493
- }, getValidTemplate = (template) => typeof template == "string" && templates.find(({ value }) => value === template);
729
+ if (template && !res) {
730
+ console.warn(`template ${template} is not valid. valid options: ${validTemplates}`);
731
+ process.exit(1);
732
+ }
733
+ if (!res) {
734
+ template = (await (0, import_prompts3.default)({
735
+ name: "template",
736
+ type: "select",
737
+ message: `Pick a template:`,
738
+ choices: templates.filter((t) => !t.hidden)
739
+ })).template;
740
+ }
741
+ res = getValidTemplate(`${template}`);
742
+ if (!res) {
743
+ console.warn(`template ${template} is not valid. valid options: ${validTemplates}`);
744
+ process.exit(1);
745
+ }
746
+ return res;
747
+ };
748
+ var getValidTemplate = (template) => typeof template === "string" && templates.find(({ value }) => value === template);
494
749
 
495
750
  // src/helpers/installDependencies.ts
496
751
  var PackageManager = __toESM(require("@expo/package-manager"));
497
- async function installDependencies(projectRoot, packageManager3) {
752
+ async function installDependencies(projectRoot, packageManager4) {
498
753
  if (process.env.VITEST) {
499
754
  console.warn("Skipping dependency installation because Vitest 2 is running.");
500
755
  return;
501
756
  }
502
- let options = { cwd: projectRoot };
503
- packageManager3 === "yarn" ? await new PackageManager.YarnPackageManager(options).installAsync() : packageManager3 === "pnpm" ? await new PackageManager.PnpmPackageManager(options).installAsync() : packageManager3 === "bun" ? await new PackageManager.BunPackageManager(options).installAsync() : await new PackageManager.NpmPackageManager(options).installAsync();
757
+ const options = { cwd: projectRoot };
758
+ if (packageManager4 === "yarn") {
759
+ await new PackageManager.YarnPackageManager(options).installAsync();
760
+ } else if (packageManager4 === "pnpm") {
761
+ await new PackageManager.PnpmPackageManager(options).installAsync();
762
+ } else if (packageManager4 === "bun") {
763
+ await new PackageManager.BunPackageManager(options).installAsync();
764
+ } else {
765
+ await new PackageManager.NpmPackageManager(options).installAsync();
766
+ }
504
767
  }
505
768
 
506
769
  // src/index.ts
507
770
  var projectPath = "";
508
- IS_TEST && console.info("\u{1F9D0} Running create-tamagui in test mode \u{1F9D0}");
771
+ if (IS_TEST) {
772
+ console.info(`\u{1F9D0} Running create-tamagui in test mode \u{1F9D0}`);
773
+ }
509
774
  function exit() {
510
775
  process.exit(0);
511
776
  }
@@ -513,93 +778,147 @@ process.on("SIGTERM", exit);
513
778
  process.on("SIGINT", exit);
514
779
  var program = new import_commander.default.Command(package_default.name).version(package_default.version).arguments("<project-directory>").action((name) => {
515
780
  projectPath = name;
516
- }).option("--info", "Just shows the setup guide for the starter.").option(
517
- "--template <template>, -t <template>",
781
+ }).option(`--info`, "Just shows the setup guide for the starter.").option(
782
+ `--template <template>, -t <template>`,
518
783
  "Choose between four or more starter templates.",
519
784
  ""
520
785
  ).allowUnknownOption().usage(
521
- `${import_chalk8.default.green("<project-directory>")} [options]
786
+ `${import_chalk10.default.green("<project-directory>")} [options]
522
787
 
523
788
  Example usage:
524
789
 
525
- ${import_chalk8.default.blueBright(`npx ${package_default.name} next-expo`)}`
790
+ ${import_chalk10.default.blueBright(`npx ${package_default.name} next-expo`)}`
526
791
  ).parse(process.argv);
527
- process.argv.includes("--version") && (console.info(package_default.version), process.exit(0));
792
+ if (process.argv.includes("--version")) {
793
+ console.info(package_default.version);
794
+ process.exit(0);
795
+ }
528
796
  var info = !!program.info;
529
797
  async function run() {
530
798
  try {
531
799
  if (info) {
532
800
  let template2 = await getTemplateInfo(program.template);
533
- template2?.extraSteps && await template2.extraSteps({
534
- isFullClone: !1,
535
- projectName: import_node_path4.default.basename((0, import_node_process.cwd)()),
536
- projectPath: (0, import_node_process.cwd)()
537
- }), process.exit(0);
801
+ if (template2?.extraSteps) {
802
+ await template2.extraSteps({
803
+ isFullClone: false,
804
+ projectName: import_node_path4.default.basename((0, import_node_process.cwd)()),
805
+ projectPath: (0, import_node_process.cwd)()
806
+ });
807
+ }
808
+ process.exit(0);
538
809
  }
539
- console.info(), console.info(
540
- import_chalk8.default.bold(
810
+ console.info();
811
+ console.info(
812
+ import_chalk10.default.bold(
541
813
  ' Note: You may need to run "npm create tamagui@latest" to get the latest version!'
542
814
  )
543
- ), console.info(), console.info(), console.info(tamaguiRainbowAsciiArt), console.info(import_chalk8.default.bold("Creating tamagui app...")), Number.parseFloat(
544
- (0, import_node_child_process3.execSync)("git --version").toString().replace("git version ", "").trim()
545
- ) < 2.27 && (console.error(`
815
+ );
816
+ console.info();
817
+ console.info();
818
+ console.info(tamaguiRainbowAsciiArt);
819
+ console.info(import_chalk10.default.bold("Creating tamagui app..."));
820
+ const gitVersionString = Number.parseFloat(
821
+ (0, import_node_child_process3.execSync)(`git --version`).toString().replace(`git version `, "").trim()
822
+ );
823
+ if (gitVersionString < 2.27) {
824
+ console.error(`
546
825
 
547
826
  \u26A0\uFE0F Tamagui can't install: Git version must be >= 2.27
548
827
 
549
- `), process.exit(1)), projectPath ||= await getProjectName(projectPath);
828
+ `);
829
+ process.exit(1);
830
+ }
831
+ projectPath ||= await getProjectName(projectPath);
550
832
  let template = await getTemplateInfo(program.template);
551
- template.type === "premium" && ((await (0, import_prompts4.default)({
552
- type: "confirm",
553
- name: "purchased",
554
- message: "Have you purchased Takeout on https://tamagui.dev/takeout"
555
- })).purchased || ((0, import_opener.default)("https://tamagui.dev/takeout"), console.info(
556
- `
833
+ if (template.type === "premium") {
834
+ const didPurchase = (await (0, import_prompts4.default)({
835
+ type: "confirm",
836
+ name: "purchased",
837
+ message: `Have you purchased Takeout on https://tamagui.dev/takeout`
838
+ })).purchased;
839
+ if (!didPurchase) {
840
+ (0, import_opener.default)(`https://tamagui.dev/takeout`);
841
+ console.info(
842
+ `
557
843
  Opening Takeout website - once you purchase you can restart the create process. Thank you!
558
844
  `
559
- ), process.exit(0))), console.info();
560
- let resolvedProjectPath = import_node_path4.default.resolve(process.cwd(), projectPath), projectName = import_node_path4.default.basename(resolvedProjectPath), { valid, problems } = validateNpmName(projectName);
561
- valid || (console.error(
562
- `Could not create a project called ${import_chalk8.default.red(
563
- `"${projectName}"`
564
- )} because of npm naming restrictions:`
565
- ), problems.forEach((p) => console.error(` ${import_chalk8.default.red.bold("*")} ${p}`)), process.exit(1)), import_node_fs2.default.existsSync(resolvedProjectPath) && (console.info(), console.info(
566
- import_chalk8.default.red("\u{1F6A8} [tamagui] error"),
567
- `You tried to make a project called ${import_chalk8.default.underline(
568
- import_chalk8.default.blueBright(projectName)
569
- )}, but a folder with that name already exists: ${import_chalk8.default.blueBright(
570
- resolvedProjectPath
571
- )}
572
-
573
- ${import_chalk8.default.bold(import_chalk8.default.red("Please pick a different project name \u{1F978}"))}`
574
- ), console.info(), console.info(), process.exit(1)), console.info(), console.info(`Creating a new tamagui app ${import_chalk8.default.blueBright(resolvedProjectPath)}...`), import_node_fs2.default.mkdirSync(resolvedProjectPath), console.info(import_chalk8.default.green(`${projectName} folder created.`));
845
+ );
846
+ process.exit(0);
847
+ }
848
+ }
849
+ console.info();
850
+ const resolvedProjectPath = import_node_path4.default.resolve(process.cwd(), projectPath);
851
+ const projectName = import_node_path4.default.basename(resolvedProjectPath);
852
+ const { valid, problems } = validateNpmName(projectName);
853
+ if (!valid) {
854
+ console.error(
855
+ `Could not create a project called ${import_chalk10.default.red(
856
+ `"${projectName}"`
857
+ )} because of npm naming restrictions:`
858
+ );
859
+ problems.forEach((p) => console.error(` ${import_chalk10.default.red.bold("*")} ${p}`));
860
+ process.exit(1);
861
+ }
862
+ if (import_node_fs3.default.existsSync(resolvedProjectPath)) {
863
+ console.info();
864
+ console.info(
865
+ import_chalk10.default.red("\u{1F6A8} [tamagui] error"),
866
+ `You tried to make a project called ${import_chalk10.default.underline(
867
+ import_chalk10.default.blueBright(projectName)
868
+ )}, but a folder with that name already exists: ${import_chalk10.default.blueBright(
869
+ resolvedProjectPath
870
+ )}
871
+
872
+ ${import_chalk10.default.bold(import_chalk10.default.red(`Please pick a different project name \u{1F978}`))}`
873
+ );
874
+ console.info();
875
+ console.info();
876
+ process.exit(1);
877
+ }
878
+ console.info();
879
+ console.info(`Creating a new tamagui app ${import_chalk10.default.blueBright(resolvedProjectPath)}...`);
880
+ import_node_fs3.default.mkdirSync(resolvedProjectPath);
881
+ console.info(import_chalk10.default.green(`${projectName} folder created.`));
575
882
  try {
576
- await cloneStarter(template, resolvedProjectPath, projectName), (0, import_zx2.cd)(resolvedProjectPath), console.info();
883
+ await cloneStarter(template, resolvedProjectPath, projectName);
884
+ process.chdir(resolvedProjectPath);
885
+ console.info();
577
886
  } catch (e) {
578
887
  console.error(`[tamagui] Failed to copy example into ${resolvedProjectPath}
579
888
 
580
- `, e), process.exit(1);
889
+ `, e);
890
+ process.exit(1);
581
891
  }
582
- updatePackageJsonName(projectName, resolvedProjectPath), console.info("Installing packages. This might take a couple of minutes."), console.info();
583
- let packageManager3 = ("packageManager" in template ? template.packageManager : void 0) || await (0, import_detect_package_manager.detect)();
892
+ updatePackageJsonName(projectName, resolvedProjectPath);
893
+ console.info("Installing packages. This might take a couple of minutes.");
894
+ console.info();
895
+ const packageManager4 = ("packageManager" in template ? template.packageManager : void 0) || await (0, import_detect_package_manager.detect)();
584
896
  try {
585
- console.info("installing with " + packageManager3), await installDependencies(resolvedProjectPath, packageManager3);
897
+ console.info("installing with " + packageManager4);
898
+ await installDependencies(resolvedProjectPath, packageManager4);
586
899
  } catch (e) {
587
- console.error("[tamagui] error installing with " + packageManager3 + `
588
- ${e}`), process.exit(1);
900
+ console.error("[tamagui] error installing with " + packageManager4 + `
901
+ ${e}`);
902
+ process.exit(1);
589
903
  }
590
904
  await template?.extraSteps?.({
591
- isFullClone: !0,
905
+ isFullClone: true,
592
906
  projectName,
593
907
  projectPath: resolvedProjectPath
594
- }), console.info(), console.info(import_chalk8.default.gray(tamaguiDuckAsciiArt)), process.exit(0);
908
+ });
909
+ console.info();
910
+ console.info(import_chalk10.default.gray(tamaguiDuckAsciiArt));
911
+ process.exit(0);
595
912
  } catch (error) {
596
- console.error("An unexpected error occurred:", error), process.exit(1);
913
+ console.error("An unexpected error occurred:", error);
914
+ process.exit(1);
597
915
  }
598
916
  }
599
917
  function updatePackageJsonName(projectName, dir) {
600
- let packageJsonPath = import_node_path4.default.join(dir, "package.json");
918
+ const packageJsonPath = import_node_path4.default.join(dir, "package.json");
601
919
  if ((0, import_fs_extra2.existsSync)(packageJsonPath)) {
602
- let contentWithUpdatedName = (0, import_fs_extra2.readFileSync)(packageJsonPath).toString().replace(
920
+ const content = (0, import_fs_extra2.readFileSync)(packageJsonPath).toString();
921
+ const contentWithUpdatedName = content.replace(
603
922
  /("name": ")(.*)(",)/,
604
923
  `$1${projectName}$3`
605
924
  );
@@ -607,6 +926,7 @@ function updatePackageJsonName(projectName, dir) {
607
926
  }
608
927
  }
609
928
  run().catch((error) => {
610
- console.error("An unexpected error occurred:", error), process.exit(1);
929
+ console.error("An unexpected error occurred:", error);
930
+ process.exit(1);
611
931
  });
612
932
  //# sourceMappingURL=index.js.map