nwui-cli 0.3.5 → 0.3.6

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.
@@ -0,0 +1,4 @@
1
+
2
+ > nwui-cli@0.3.5 build /Users/sammoore/git/ronintechnologies/nativewindui/apps/cli
3
+ > tsc && chmod +x ./build/index.js
4
+
@@ -185,8 +185,10 @@ export const installComponent = async (slugs, overwrite = false, directory = `.$
185
185
  throw err;
186
186
  }
187
187
  }
188
- const exampleFiles = Array.from(resolved.components.entries())
189
- .map(([slug, component]) => ({ slug, code: component.implementationCode }));
188
+ const exampleFiles = Array.from(resolved.components.entries()).map(([slug, component]) => ({
189
+ slug,
190
+ code: component.type === "component" ? component.implementationCode : null,
191
+ }));
190
192
  // Create the example usage files
191
193
  // NOTE: do not Promise.all (see above)
192
194
  for (const exampleFile of exampleFiles) {
package/build/login.js CHANGED
@@ -40,12 +40,20 @@ export const isLoggedIn = async () => {
40
40
  *
41
41
  * Returns whether login was successful/completed, but also may throw for some login failures.
42
42
  */
43
- export const login = async () => {
43
+ export const login = async (secondAttempt = false) => {
44
44
  let { user, session } = await checkAndRefreshSession() || { user: null, session: null };
45
45
  if (!user || !session) {
46
46
  const { data, error } = await supabase.auth.signInAnonymously();
47
47
  if (error || user === null || session === null) {
48
- console.error('error:', error);
48
+ if (!secondAttempt && error === null && user === null && session === null) {
49
+ // likely supabase/localStorage emulation layer having a weird incompatibility
50
+ // occurs when the localStorage has not yet been persisted to disk
51
+ if (process.env.NODE_ENV === 'development') {
52
+ console.error('failure to do signInAnonymously (maybe storage issue?), retrying...');
53
+ }
54
+ // after the error occurs, an empty localStorage has been persisted on disk, so retry once
55
+ return login(true);
56
+ }
49
57
  throw error;
50
58
  }
51
59
  user = data.user;
@@ -13,7 +13,7 @@ class Env extends ExpoEnv {
13
13
  get API_BASE_URL() {
14
14
  return process.env["API_BASE_URL"] || (this.NODE_ENV === "development"
15
15
  ? 'http://localhost:3000'
16
- : 'https://staging.nativewindui.com');
16
+ : 'https://nativewindui.com');
17
17
  }
18
18
  get NODE_ENV() {
19
19
  return process.env.NODE_ENV || "production";
package/package.json CHANGED
@@ -1,11 +1,11 @@
1
1
  {
2
2
  "name": "nwui-cli",
3
- "version": "0.3.5",
3
+ "version": "0.3.6",
4
4
  "description": "NativeWindUI CLI",
5
5
  "type": "module",
6
6
  "main": "./build/index.js",
7
7
  "bin": {
8
- "nwui": "build/index.js"
8
+ "nwui-cli": "build/index.js"
9
9
  },
10
10
  "scripts": {
11
11
  "build": "tsc && chmod +x ./build/index.js",
@@ -14,6 +14,7 @@
14
14
  "typecheck": "tsc --noEmit"
15
15
  },
16
16
  "devDependencies": {
17
+ "@nativewindui/registry": "workspace:*",
17
18
  "@tsconfig/node20": "^20.1.4",
18
19
  "@types/figlet": "^1.5.8",
19
20
  "@types/gradient-string": "^1.1.6",