create-tamagui 1.35.12 → 1.36.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.
@@ -6354,7 +6354,7 @@ var import_prompts = __toESM(require_prompts3());
6354
6354
  // package.json
6355
6355
  var package_default = {
6356
6356
  name: "create-tamagui",
6357
- version: "1.35.11",
6357
+ version: "1.35.12",
6358
6358
  bin: "./run.js",
6359
6359
  main: "dist",
6360
6360
  files: [
@@ -6389,7 +6389,7 @@ var package_default = {
6389
6389
  },
6390
6390
  devDependencies: {
6391
6391
  "@playwright/test": "^1.29.0",
6392
- "@tamagui/build": "1.35.11",
6392
+ "@tamagui/build": "1.35.12",
6393
6393
  "@types/async-retry": "1.4.2",
6394
6394
  "@types/cross-spawn": "^6.0.2",
6395
6395
  "@types/node": "^16.11.9",
@@ -6247,15 +6247,15 @@ var import_chalk2 = __toESM(require_source());
6247
6247
  var packageManager = "yarn";
6248
6248
  var useYarn = packageManager === "yarn";
6249
6249
  var runCommand = (scriptName) => `${packageManager} ${useYarn ? "" : "run "}${scriptName}`;
6250
- var main = async ({ projectName }) => {
6251
- console.log(`
6252
- ${import_chalk2.default.green.bold("Done!")} created a new project under ./${projectName}
6250
+ var main = async ({ isFullClone, projectName }) => {
6251
+ if (isFullClone) {
6252
+ console.log(`${import_chalk2.default.green.bold("Done!")} created a new project under ./${projectName}
6253
6253
 
6254
6254
  cd into the project using:
6255
6255
  ${import_chalk2.default.green("cd")} ${projectName}
6256
-
6257
- Inside that directory, you can run several commands:
6258
-
6256
+ `);
6257
+ }
6258
+ console.log(`
6259
6259
  To start the Next.js development server, run:
6260
6260
  ${import_chalk2.default.green(runCommand("web"))}
6261
6261
 
@@ -6277,14 +6277,16 @@ var import_chalk3 = __toESM(require_source());
6277
6277
  var packageManager2 = "yarn";
6278
6278
  var useYarn2 = packageManager2 === "yarn";
6279
6279
  var runCommand2 = (scriptName) => `${packageManager2} ${useYarn2 ? "" : "run "}${scriptName}`;
6280
- var main2 = async ({ projectName }) => {
6281
- console.log(`
6282
- ${import_chalk3.default.green.bold("Done!")} created a new project under ./${projectName}
6280
+ var main2 = async ({ isFullClone, projectName }) => {
6281
+ if (isFullClone) {
6282
+ console.log(`
6283
+ ${import_chalk3.default.green.bold("Done!")} created a new project under ./${projectName}
6283
6284
 
6284
6285
  cd into the project using:
6285
6286
  ${import_chalk3.default.green("cd")} ${projectName}
6286
-
6287
- Inside that directory:
6287
+ `);
6288
+ }
6289
+ console.log(`
6288
6290
  To start the Next.js development server, run:
6289
6291
  ${import_chalk3.default.green(runCommand2("web"))}
6290
6292
  `);
@@ -6293,6 +6295,7 @@ var simple_web_default = main2;
6293
6295
 
6294
6296
  // src/steps/takeout.ts
6295
6297
  var import_child_process = require("child_process");
6298
+ var import_promises = __toESM(require("fs/promises"));
6296
6299
  var import_chalk5 = __toESM(require_source());
6297
6300
  var import_prompts = __toESM(require_prompts3());
6298
6301
 
@@ -6325,11 +6328,10 @@ var takeoutAsciiArt = `\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2557\u2
6325
6328
  \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`;
6326
6329
 
6327
6330
  // src/steps/takeout.ts
6328
- var import_promises = __toESM(require("fs/promises"));
6329
6331
  var packageManager3 = "yarn";
6330
6332
  var useYarn3 = packageManager3 === "yarn";
6331
6333
  var runCommand3 = (scriptName) => `${packageManager3} ${useYarn3 ? "" : "run "}${scriptName}`;
6332
- var main3 = async ({ projectName }) => {
6334
+ var main3 = async ({ isFullClone, projectName }) => {
6333
6335
  console.log(`
6334
6336
  ${tamaguiRainbowAsciiArt.split("\n").map((line) => ` ${line}`).join("\n")}
6335
6337
  ${takeoutAsciiArt}
@@ -6351,8 +6353,26 @@ ${takeoutAsciiArt}
6351
6353
  initial: true
6352
6354
  });
6353
6355
  if (startLocalSupabase) {
6354
- (0, import_child_process.execSync)(`yarn workspace @my/supabase start`, { stdio: "inherit" });
6355
- console.log("Don't forget to create storage bucket with the name `avatars`.");
6356
+ const supabaseStarted = await runRetryableCommand(`yarn supa start`);
6357
+ if (supabaseStarted) {
6358
+ console.log();
6359
+ const { setUpSupabaseEnv } = await (0, import_prompts.default)({
6360
+ name: "setUpSupabaseEnv",
6361
+ type: "confirm",
6362
+ message: "Do you want us to add the local env variables for you? This will create a file called .env.local.",
6363
+ initial: true
6364
+ });
6365
+ if (setUpSupabaseEnv) {
6366
+ await import_promises.default.writeFile(
6367
+ "./.env.local",
6368
+ `NEXT_PUBLIC_SUPABASE_PROJECT_ID=default
6369
+ NEXT_PUBLIC_SUPABASE_URL=http://localhost:54321
6370
+ NEXT_PUBLIC_SUPABASE_ANON_KEY=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZS1kZW1vIiwicm9sZSI6ImFub24iLCJleHAiOjE5ODM4MTI5OTZ9.CRXP1A7WOeoJeXxjNni43kdQwgnWNReilDMblYTn_I0
6371
+ SUPABASE_SERVICE_ROLE=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZS1kZW1vIiwicm9sZSI6InNlcnZpY2Vfcm9sZSIsImV4cCI6MTk4MzgxMjk5Nn0.EGIM96RAZx35lJzdJsyH-qQwv8Hdp7fsn3W0YpN81IU
6372
+ `
6373
+ );
6374
+ }
6375
+ }
6356
6376
  }
6357
6377
  console.log();
6358
6378
  const { setupRemoteSupabase } = await (0, import_prompts.default)({
@@ -6361,42 +6381,21 @@ ${takeoutAsciiArt}
6361
6381
  message: "Link remote Supabase instance for you? (Create a project on https://app.supabase.com/projects first)",
6362
6382
  initial: true
6363
6383
  });
6364
- console.log();
6365
- const { setUpSupabaseEnv } = await (0, import_prompts.default)({
6366
- name: "setUpSupabaseEnv",
6367
- type: "confirm",
6368
- message: "Do you want us to add the local env variables for you? This will create a file called .env.local.",
6369
- initial: true
6370
- });
6371
- if (setUpSupabaseEnv) {
6372
- await import_promises.default.writeFile("./.env.local", `NEXT_PUBLIC_SUPABASE_PROJECT_ID=default
6373
- NEXT_PUBLIC_SUPABASE_URL=http://localhost:54321
6374
- NEXT_PUBLIC_SUPABASE_ANON_KEY=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZS1kZW1vIiwicm9sZSI6ImFub24iLCJleHAiOjE5ODM4MTI5OTZ9.CRXP1A7WOeoJeXxjNni43kdQwgnWNReilDMblYTn_I0
6375
- SUPABASE_SERVICE_ROLE=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZS1kZW1vIiwicm9sZSI6InNlcnZpY2Vfcm9sZSIsImV4cCI6MTk4MzgxMjk5Nn0.EGIM96RAZx35lJzdJsyH-qQwv8Hdp7fsn3W0YpN81IU
6376
- `);
6377
- }
6378
6384
  if (setupRemoteSupabase) {
6379
- (0, import_child_process.execSync)(`npx supabase login`, { stdio: "inherit" });
6385
+ await runRetryableCommand(`npx supabase login`);
6380
6386
  console.log();
6381
- const { supabaseRefId } = await (0, import_prompts.default)({
6382
- name: "supabaseRefId",
6383
- type: "text",
6384
- message: "Enter your supabase project's ID (e.g. abcdefghijklmnopqrst)",
6385
- initial: true
6386
- });
6387
- (0, import_child_process.execSync)(`yarn workspace @my/supabase link-project ${supabaseRefId.trim()}`, {
6388
- stdio: "inherit"
6389
- });
6387
+ await linkSupabase();
6390
6388
  }
6391
6389
  }
6392
- console.log(`
6393
- ${import_chalk5.default.green.bold("Done!")} created a new project under ./${projectName}
6390
+ if (isFullClone) {
6391
+ console.log(`
6392
+ ${import_chalk5.default.green.bold("Done!")} created a new project under ./${projectName}
6394
6393
 
6395
6394
  cd into the project using:
6396
6395
  ${import_chalk5.default.green(" cd")} ${projectName}
6397
-
6398
- Inside that directory, you can run several commands:
6399
-
6396
+ `);
6397
+ }
6398
+ console.log(`
6400
6399
  To start the Next.js development server, run:
6401
6400
  ${import_chalk5.default.green(runCommand3("web"))}
6402
6401
 
@@ -6420,6 +6419,65 @@ Inside that directory, you can run several commands:
6420
6419
  `);
6421
6420
  };
6422
6421
  var takeout_default = main3;
6422
+ async function runRetryableCommand(cmd, retriesCount = 0) {
6423
+ try {
6424
+ (0, import_child_process.execSync)(cmd, { stdio: "inherit" });
6425
+ return true;
6426
+ } catch (error) {
6427
+ const { tryAgain } = await (0, import_prompts.default)({
6428
+ name: "tryAgain",
6429
+ message: "An error occurred. Do you want to try again?",
6430
+ type: "confirm",
6431
+ initial: true
6432
+ });
6433
+ if (tryAgain) {
6434
+ await runRetryableCommand(cmd, retriesCount + 1);
6435
+ } else {
6436
+ console.log(
6437
+ import_chalk5.default.yellow(
6438
+ `\u26A0\uFE0F Skipping this step. You can try running this command later. The failed command was \`${import_chalk5.default.underline(
6439
+ cmd
6440
+ )}\`.`
6441
+ )
6442
+ );
6443
+ return false;
6444
+ }
6445
+ }
6446
+ }
6447
+ async function linkSupabase() {
6448
+ const { supabaseRefId } = await (0, import_prompts.default)({
6449
+ name: "supabaseRefId",
6450
+ type: "text",
6451
+ message: "Enter your supabase project's ID (e.g. abcdefghijklmnopqrst)",
6452
+ initial: true
6453
+ });
6454
+ const cmd = `yarn supa link-project ${supabaseRefId.trim()}`;
6455
+ try {
6456
+ (0, import_child_process.execSync)(cmd, {
6457
+ stdio: "inherit"
6458
+ });
6459
+ return true;
6460
+ } catch (error) {
6461
+ const { tryAgain } = await (0, import_prompts.default)({
6462
+ name: "tryAgain",
6463
+ message: "An error occurred. Do you want to try again?",
6464
+ type: "confirm",
6465
+ initial: true
6466
+ });
6467
+ if (tryAgain) {
6468
+ await linkSupabase();
6469
+ } else {
6470
+ console.log(
6471
+ import_chalk5.default.yellow(
6472
+ `\u26A0\uFE0F Skipping this step. You can try running this command later. The failed command was \`${import_chalk5.default.underline(
6473
+ cmd
6474
+ )}\`.`
6475
+ )
6476
+ );
6477
+ return false;
6478
+ }
6479
+ }
6480
+ }
6423
6481
 
6424
6482
  // src/templates.ts
6425
6483
  var repoRoot = (0, import_path.join)(__dirname, "..", "..", "..");