@react-native-reusables/cli 0.5.0-beta.3 → 0.5.0-beta.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/bin.cjs +80 -35
  2. package/package.json +2 -2
package/bin.cjs CHANGED
@@ -17843,7 +17843,7 @@ var OP_YIELD = "Yield";
17843
17843
  var OP_REVERT_FLAGS = "RevertFlags";
17844
17844
 
17845
17845
  // ../../node_modules/effect/dist/esm/internal/version.js
17846
- var moduleVersion = "3.17.2";
17846
+ var moduleVersion = "3.17.4";
17847
17847
  var getCurrentVersion = () => moduleVersion;
17848
17848
 
17849
17849
  // ../../node_modules/effect/dist/esm/internal/effectable.js
@@ -31025,7 +31025,7 @@ var unsafeMakeZoned = (input, options3) => {
31025
31025
  }
31026
31026
  const self2 = unsafeMake9(input);
31027
31027
  if (self2.epochMillis < minEpochMillis || self2.epochMillis > maxEpochMillis) {
31028
- throw new IllegalArgumentException2(`Epoch millis out of range: ${self2.epochMillis}`);
31028
+ throw new RangeError(`Epoch millis out of range: ${self2.epochMillis}`);
31029
31029
  }
31030
31030
  let zone;
31031
31031
  if (options3?.timeZone === void 0) {
@@ -31045,7 +31045,7 @@ var unsafeMakeZoned = (input, options3) => {
31045
31045
  if (options3?.adjustForTimeZone !== true) {
31046
31046
  return makeZonedProto(self2.epochMillis, zone, self2.partsUtc);
31047
31047
  }
31048
- return makeZonedFromAdjusted(self2.epochMillis, zone);
31048
+ return makeZonedFromAdjusted(self2.epochMillis, zone, options3?.disambiguation ?? "compatible");
31049
31049
  };
31050
31050
  var makeZoned = /* @__PURE__ */ liftThrowable(unsafeMakeZoned);
31051
31051
  var zonedStringRegex = /^(.{17,35})\[(.+)\]$/;
@@ -31177,9 +31177,55 @@ var setPartsDate = (date10, parts2) => {
31177
31177
  date10.setUTCMilliseconds(parts2.millis);
31178
31178
  }
31179
31179
  };
31180
- var makeZonedFromAdjusted = (adjustedMillis, zone) => {
31181
- const offset = zone._tag === "Offset" ? zone.offset : calculateNamedOffset(adjustedMillis, zone);
31182
- return makeZonedProto(adjustedMillis - offset, zone);
31180
+ var constDayMillis = 24 * 60 * 60 * 1e3;
31181
+ var makeZonedFromAdjusted = (adjustedMillis, zone, disambiguation) => {
31182
+ if (zone._tag === "Offset") {
31183
+ return makeZonedProto(adjustedMillis - zone.offset, zone);
31184
+ }
31185
+ const beforeOffset = calculateNamedOffset(adjustedMillis - constDayMillis, adjustedMillis, zone);
31186
+ const afterOffset = calculateNamedOffset(adjustedMillis + constDayMillis, adjustedMillis, zone);
31187
+ if (beforeOffset === afterOffset) {
31188
+ return makeZonedProto(adjustedMillis - beforeOffset, zone);
31189
+ }
31190
+ const isForwards = beforeOffset < afterOffset;
31191
+ const transitionMillis = beforeOffset - afterOffset;
31192
+ if (isForwards) {
31193
+ const currentAfterOffset = calculateNamedOffset(adjustedMillis - afterOffset, adjustedMillis, zone);
31194
+ if (currentAfterOffset === afterOffset) {
31195
+ return makeZonedProto(adjustedMillis - afterOffset, zone);
31196
+ }
31197
+ const before2 = makeZonedProto(adjustedMillis - beforeOffset, zone);
31198
+ const beforeAdjustedMillis = toDate(before2).getTime();
31199
+ if (adjustedMillis !== beforeAdjustedMillis) {
31200
+ switch (disambiguation) {
31201
+ case "reject": {
31202
+ const formatted = new Date(adjustedMillis).toISOString();
31203
+ throw new RangeError(`Gap time: ${formatted} does not exist in time zone ${zone.id}`);
31204
+ }
31205
+ case "earlier":
31206
+ return makeZonedProto(adjustedMillis - afterOffset, zone);
31207
+ case "compatible":
31208
+ case "later":
31209
+ return before2;
31210
+ }
31211
+ }
31212
+ return before2;
31213
+ }
31214
+ const currentBeforeOffset = calculateNamedOffset(adjustedMillis - beforeOffset, adjustedMillis, zone);
31215
+ if (currentBeforeOffset === beforeOffset) {
31216
+ if (disambiguation === "earlier" || disambiguation === "compatible") {
31217
+ return makeZonedProto(adjustedMillis - beforeOffset, zone);
31218
+ }
31219
+ const laterOffset = calculateNamedOffset(adjustedMillis - beforeOffset + transitionMillis, adjustedMillis + transitionMillis, zone);
31220
+ if (laterOffset === beforeOffset) {
31221
+ return makeZonedProto(adjustedMillis - beforeOffset, zone);
31222
+ }
31223
+ if (disambiguation === "reject") {
31224
+ const formatted = new Date(adjustedMillis).toISOString();
31225
+ throw new RangeError(`Ambiguous time: ${formatted} occurs twice in time zone ${zone.id}`);
31226
+ }
31227
+ }
31228
+ return makeZonedProto(adjustedMillis - afterOffset, zone);
31183
31229
  };
31184
31230
  var offsetRegex = /([+-])(\d{2}):(\d{2})$/;
31185
31231
  var parseOffset = (offset) => {
@@ -31190,8 +31236,8 @@ var parseOffset = (offset) => {
31190
31236
  const [, sign2, hours2, minutes2] = match19;
31191
31237
  return (sign2 === "+" ? 1 : -1) * (Number(hours2) * 60 + Number(minutes2)) * 60 * 1e3;
31192
31238
  };
31193
- var calculateNamedOffset = (adjustedMillis, zone) => {
31194
- const offset = zone.format.formatToParts(adjustedMillis).find((_) => _.type === "timeZoneName")?.value ?? "";
31239
+ var calculateNamedOffset = (utcMillis, adjustedMillis, zone) => {
31240
+ const offset = zone.format.formatToParts(utcMillis).find((_) => _.type === "timeZoneName")?.value ?? "";
31195
31241
  if (offset === "GMT") {
31196
31242
  return 0;
31197
31243
  }
@@ -55191,10 +55237,11 @@ var CliOptions = class extends Context_exports.Tag("CommandOptions")() {
55191
55237
  };
55192
55238
  var cwd = Options_exports.directory("cwd", { exists: "yes" }).pipe(Options_exports.withDefault("."), Options_exports.withAlias("c"));
55193
55239
  var yes = Options_exports.boolean("yes", { aliases: ["y"] });
55194
- var summary5 = Options_exports.boolean("summary");
55240
+ var summary5 = Options_exports.boolean("summary").pipe(Options_exports.withAlias("s"));
55195
55241
  var overwrite = Options_exports.boolean("overwrite", { aliases: ["o"] });
55196
55242
  var all12 = Options_exports.boolean("all", { aliases: ["a"] });
55197
- var path4 = Options_exports.text("path").pipe(Options_exports.withDefault(""));
55243
+ var path4 = Options_exports.text("path").pipe(Options_exports.withDefault(""), Options_exports.withAlias("p"));
55244
+ var template = Options_exports.text("template").pipe(Options_exports.withAlias("t"), Options_exports.withDefault(""));
55198
55245
 
55199
55246
  // src/project-manifest.ts
55200
55247
  var DEPENDENCIES = [
@@ -55286,7 +55333,7 @@ var DEPRECATED_FROM_LIB = [
55286
55333
  includes: [
55287
55334
  {
55288
55335
  content: ["useColorScheme"],
55289
- message: "lib/useColorScheme is deprecated. Use NativeWind's color scheme hook instead.",
55336
+ message: "lib/useColorScheme is deprecated. Use Nativewind's color scheme hook instead.",
55290
55337
  docs: "https://www.nativewind.dev/docs/api/use-color-scheme"
55291
55338
  }
55292
55339
  ]
@@ -55446,6 +55493,11 @@ var TEMPLATES = [
55446
55493
  name: "Minimal",
55447
55494
  url: "https://github.com/founded-labs/react-native-reusables-templates.git",
55448
55495
  subPath: "minimal"
55496
+ },
55497
+ {
55498
+ name: "Clerk auth",
55499
+ url: "https://github.com/founded-labs/react-native-reusables-templates.git",
55500
+ subPath: "clerk-auth"
55449
55501
  }
55450
55502
  ];
55451
55503
  var PROJECT_MANIFEST = {
@@ -55605,13 +55657,6 @@ var ProjectConfig = class extends Effect_exports.Service()("ProjectConfig", {
55605
55657
  if (!agreeToWrite) {
55606
55658
  return yield* Effect_exports.fail(new Error("Unable to continue without a valid components.json file."));
55607
55659
  }
55608
- const style = options3.yes ? "default" : yield* Prompt_exports.select({
55609
- message: "Which style would you like to use?",
55610
- choices: [
55611
- { title: "default", value: "default" },
55612
- { title: "new-york", value: "new-york" }
55613
- ]
55614
- });
55615
55660
  const baseColor = options3.yes ? "neutral" : yield* Prompt_exports.select({
55616
55661
  message: "Which color would you like to use as the base color?",
55617
55662
  choices: [
@@ -55683,7 +55728,7 @@ var ProjectConfig = class extends Effect_exports.Service()("ProjectConfig", {
55683
55728
  }
55684
55729
  const newComponentJson = yield* Schema_exports.encode(componentJsonSchema)({
55685
55730
  $schema: "https://ui.shadcn.com/schema.json",
55686
- style,
55731
+ style: "new-york",
55687
55732
  aliases: aliases2,
55688
55733
  rsc: false,
55689
55734
  tsx: true,
@@ -58138,11 +58183,7 @@ var Add = class extends Effect_exports.Service()("Add", {
58138
58183
  return {
58139
58184
  run: (options3) => Effect_exports.gen(function* () {
58140
58185
  yield* Effect_exports.logDebug(`Add options: ${JSON.stringify(options3, null, 2)}`);
58141
- const componentJson = yield* projectConfig.getComponentJson();
58142
- const style = yield* pipe(
58143
- componentJson.style,
58144
- Schema_exports.decodeUnknown(Schema_exports.Union(Schema_exports.Literal("default"), Schema_exports.Literal("new-york")))
58145
- );
58186
+ yield* projectConfig.getComponentJson();
58146
58187
  const components = options3.all ? PROJECT_MANIFEST.components : options3.args?.components ?? [];
58147
58188
  if (components.length === 0) {
58148
58189
  const selectedComponents = yield* Prompt_exports.multiSelect({
@@ -58160,8 +58201,11 @@ var Add = class extends Effect_exports.Service()("Add", {
58160
58201
  yield* Effect_exports.fail(new Error("No components selected."));
58161
58202
  }
58162
58203
  yield* Effect_exports.logDebug(`Selected components: ${components.join(", ")}`);
58163
- const baseUrl = process.env.NODE_ENV === "development" ? "http://localhost:3000/local/r" : "https://reactnativereusables.com/r";
58164
- const componentUrls = components.map((component) => `${baseUrl}/${style}/${component}.json`);
58204
+ const baseUrl = process.env.NODE_ENV === "development" ? "http://localhost:3000/local/r/new-york" : "https://reactnativereusables.com/r/new-york";
58205
+ const componentUrls = components.map((component) => {
58206
+ const lowerCaseComponent = component.toLocaleLowerCase();
58207
+ return lowerCaseComponent.startsWith("http") ? lowerCaseComponent : `${baseUrl}/${lowerCaseComponent}.json`;
58208
+ });
58165
58209
  const shadcnOptions = toShadcnOptions(options3);
58166
58210
  const commandArgs = ["shadcn@latest", "add", ...shadcnOptions, ...componentUrls];
58167
58211
  yield* Effect_exports.logDebug(`Running command: npx ${commandArgs.join(" ")}`);
@@ -58359,7 +58403,7 @@ var Template = class extends Effect_exports.Service()("src/services/template", {
58359
58403
  `\x1B[22m\x1B[38;5;250m\u21AA Documentation: \x1B[37mhttps://reactnativereusables.com\x1B[0m`
58360
58404
  );
58361
58405
  yield* Effect_exports.log(
58362
- `\x1B[22m\x1B[38;5;250m\u21AA Report issues: \x1B[37mhttps://github.com/mrzachnugent/react-native-reusables/issues\x1B[0m`
58406
+ `\x1B[22m\x1B[38;5;250m\u21AA Report issues: \x1B[37mhttps://github.com/founded-labs/react-native-reusables/issues\x1B[0m`
58363
58407
  );
58364
58408
  return newRepoPath;
58365
58409
  }),
@@ -58380,7 +58424,7 @@ var Init = class extends Effect_exports.Service()("Init", {
58380
58424
  const fs = yield* FileSystem_exports.FileSystem;
58381
58425
  const path7 = yield* Path_exports.Path;
58382
58426
  const doctor = yield* Doctor;
58383
- const template = yield* Template;
58427
+ const template2 = yield* Template;
58384
58428
  return {
58385
58429
  run: (options3) => Effect_exports.gen(function* () {
58386
58430
  yield* Effect_exports.logDebug(`Init options: ${JSON.stringify(options3, null, 2)}`);
@@ -58409,14 +58453,15 @@ var Init = class extends Effect_exports.Service()("Init", {
58409
58453
  message: "What is the name of your project? (e.g. my-app)",
58410
58454
  default: "my-app"
58411
58455
  });
58412
- const selectedTemplate = yield* Prompt_exports.select({
58456
+ const templateFromFlag = PROJECT_MANIFEST.templates.find((t) => t.subPath === options3.template);
58457
+ const selectedTemplate = templateFromFlag ? templateFromFlag : yield* Prompt_exports.select({
58413
58458
  message: "Select a template",
58414
- choices: PROJECT_MANIFEST.templates.map((template2) => ({
58415
- title: template2.name,
58416
- value: template2
58459
+ choices: PROJECT_MANIFEST.templates.map((template3) => ({
58460
+ title: template3.name,
58461
+ value: template3
58417
58462
  }))
58418
58463
  });
58419
- yield* template.clone({
58464
+ yield* template2.clone({
58420
58465
  cwd: options3.cwd,
58421
58466
  name: projectName,
58422
58467
  repo: selectedTemplate
@@ -58445,7 +58490,7 @@ var addArgs = Args_exports.all({
58445
58490
  });
58446
58491
  var AddCommand = Command_exports2.make("add", { args: addArgs, cwd, yes, overwrite, all: all12, path: path4 }).pipe(Command_exports2.withDescription("Add React Native components to your project")).pipe(Command_exports2.withHandler(make70));
58447
58492
  var DoctorCommand = Command_exports2.make("doctor", { cwd, summary: summary5, yes }).pipe(Command_exports2.withDescription("Check your project setup and diagnose issues")).pipe(Command_exports2.withHandler(make69));
58448
- var InitCommand = Command_exports2.make("init", { cwd }).pipe(Command_exports2.withDescription("Initialize a new React Native project with reusables")).pipe(Command_exports2.withHandler(make71));
58493
+ var InitCommand = Command_exports2.make("init", { cwd, template }).pipe(Command_exports2.withDescription("Initialize a new React Native project with reusables")).pipe(Command_exports2.withHandler(make71));
58449
58494
  var Cli = Command_exports2.make("react-native-reusables/cli", { cwd }).pipe(Command_exports2.withDescription("React Native Reusables CLI - A powerful toolkit for React Native development")).pipe(
58450
58495
  Command_exports2.withHandler(
58451
58496
  (options3) => Effect_exports.gen(function* () {
@@ -58470,7 +58515,7 @@ var Cli = Command_exports2.make("react-native-reusables/cli", { cwd }).pipe(Comm
58470
58515
  } else if (choice6 === "doctor") {
58471
58516
  yield* make69({ cwd: options3.cwd, summary: false, yes: false });
58472
58517
  } else if (choice6 === "init") {
58473
- yield* make71({ cwd: options3.cwd });
58518
+ yield* make71({ cwd: options3.cwd, template: "" });
58474
58519
  }
58475
58520
  })
58476
58521
  )
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@react-native-reusables/cli",
3
- "version": "0.5.0-beta.3",
3
+ "version": "0.5.0-beta.5",
4
4
  "type": "module",
5
5
  "description": "A CLI for React Native Reusables",
6
6
  "main": "bin.cjs",
@@ -10,7 +10,7 @@
10
10
  },
11
11
  "repository": {
12
12
  "type": "git",
13
- "url": "https://github.com/mrzachnugent/react-native-reusables.git",
13
+ "url": "https://github.com/founded-labs/react-native-reusables.git",
14
14
  "directory": "apps/cli"
15
15
  },
16
16
  "license": "MIT"