@wireservers-ui/react-natives 1.0.1-rc2 → 1.0.1

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 (3) hide show
  1. package/README.md +102 -20
  2. package/bin/cli.js +6 -4
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -34,40 +34,122 @@ React-Natives is a collection of 70+ production-ready, accessible React Native c
34
34
 
35
35
  ---
36
36
 
37
- ## Quick Start
37
+ ## Quick Start (Easy Setup)
38
38
 
39
- ### Install
39
+ ### Option A: Fully Automated Setup (Recommended)
40
+
41
+ Use this when starting a new Expo consumer app for the first time.
40
42
 
41
43
  ```bash
42
- npm install @wireservers-ui/react-natives
44
+ npx create-expo-app@latest wsui-init --template blank-typescript
45
+ cd wsui-init
46
+ npm install @wireservers-ui/react-natives@1.0.1
47
+ npx @wireservers-ui/react-natives@1.0.1 init
48
+ npx expo start --clear --web
43
49
  ```
44
50
 
45
- ### Peer Dependencies
51
+ The `init` command will:
52
+
53
+ - Install required runtime styling packages
54
+ - Match `react-dom` to your installed `react` version exactly (prevents React/DOM mismatch)
55
+ - Create config files only when missing
56
+ - Never overwrite existing app/config files in your project
57
+ - Generate a working volume-slider demo in `App.tsx` only if `App.tsx` does not already exist
58
+
59
+ ### Option B: Manual Setup
60
+
61
+ If you prefer full manual control:
46
62
 
47
63
  ```bash
48
- npm install nativewind tailwind-variants react-native-reanimated react-native-gesture-handler react-native-svg
64
+ npm install @wireservers-ui/react-natives
65
+ npm install nativewind tailwindcss tailwind-variants tailwind-merge react-native-reanimated react-native-worklets react-native-svg react-native-web react-dom
49
66
  ```
50
67
 
51
- `react-native-reanimated`, `react-native-gesture-handler`, and `react-native-svg` are optional only required by components that use them.
68
+ Then configure Tailwind, Babel, Metro, and theme CSS yourself.
52
69
 
53
- ### Configure Tailwind
70
+ ---
54
71
 
55
- Add the preset to your `tailwind.config.js`:
72
+ ## Setup Changes (What, How, Why)
56
73
 
57
- ```js
58
- /** @type {import('tailwindcss').Config} */
59
- module.exports = {
60
- content: [
61
- "./app/**/*.{js,jsx,ts,tsx}",
62
- // ...your content paths
63
- ],
64
- presets: [require("@wireservers-ui/react-natives/tailwind-preset")],
65
- };
66
- ```
74
+ This section documents the major setup hardening changes made to ensure reliable first-time consumer setup.
75
+
76
+ ### 1. Added CLI init bootstrap command
77
+
78
+ - What changed:
79
+ Added `bin/cli.js` and package `bin` mapping so consumers can run `npx @wireservers-ui/react-natives init`.
80
+ - How:
81
+ The CLI writes Tailwind, Babel, Metro, and theme files and installs missing runtime dependencies.
82
+ - Why:
83
+ Consumer setup was too error-prone and required manual multi-file configuration.
84
+
85
+ ### 2. Fixed Babel NativeWind wiring
86
+
87
+ - What changed:
88
+ `nativewind/babel` is now configured in `presets` (not `plugins`).
89
+ - How:
90
+ The generated `babel.config.js` uses:
91
+ `presets: [["babel-preset-expo", { jsxImportSource: "nativewind" }], "nativewind/babel"]`.
92
+ - Why:
93
+ Wrong placement caused Babel runtime errors and failed bundling.
94
+
95
+ ### 3. Added missing runtime dependencies for modern Expo stack
67
96
 
68
- The preset includes the NativeWind preset, the full color/theme system, content scanning of the library, and safelist rules — no additional configuration needed.
97
+ - What changed:
98
+ Init installs `react-native-worklets`, `react-native-svg`, `tailwind-merge`, and web deps.
99
+ - How:
100
+ Dependency install list in the CLI now includes all required packages for both native and web usage.
101
+ - Why:
102
+ Missing deps caused runtime/bundling failures (`react-native-worklets/plugin`, SVG resolution, variant merge errors).
103
+
104
+ ### 4. React + React DOM version lockstep
105
+
106
+ - What changed:
107
+ Init now reads the installed `react` version from consumer `node_modules` and installs `react-dom@<exact-react-version>`.
108
+ - How:
109
+ CLI helper resolves `node_modules/react/package.json` and builds a matching `react-dom` install target.
110
+ - Why:
111
+ React web requires exact version parity; mismatch causes immediate runtime failure.
112
+
113
+ ### 5. Tailwind content scanning extended for package source
114
+
115
+ - What changed:
116
+ Generated `tailwind.config.js` now includes:
117
+ `./node_modules/@wireservers-ui/react-natives/src/**/*.{js,jsx,ts,tsx}`
118
+ - How:
119
+ The content path is emitted by init when creating Tailwind config.
120
+ - Why:
121
+ Without this, many library utility classes are not generated in consumer CSS, causing missing colors and broken visual behavior.
122
+
123
+ ### 6. pnpm compatibility for Metro
124
+
125
+ - What changed:
126
+ Init creates/updates `.npmrc` with `node-linker=hoisted` when pnpm is detected, then reinstalls before package additions.
127
+ - How:
128
+ CLI detects lockfile, applies hoisted linker, and runs a reinstall pass.
129
+ - Why:
130
+ Default pnpm linking can break Metro module resolution in Expo projects.
131
+
132
+ ### 7. Non-destructive init behavior
133
+
134
+ - What changed:
135
+ Init no longer overwrites existing project files.
136
+ - How:
137
+ All file writes now follow create-if-missing semantics and print a skip message for existing files.
138
+ - Why:
139
+ Consumers must keep control of their app and config files; setup tooling should be safe by default.
140
+
141
+ ### 8. Published iterative release candidates
142
+
143
+ - What changed:
144
+ Setup fixes were shipped progressively and are now available in stable `1.0.1`.
145
+ - How:
146
+ Verified through clean consumer project runs (`create-expo-app -> install -> init -> expo start`).
147
+ - Why:
148
+ Each release isolated and validated one class of setup problems, reducing regression risk.
149
+
150
+ ---
69
151
 
70
- ### Use Components
152
+ ## Example Usage
71
153
 
72
154
  ```tsx
73
155
  import { Button, ButtonText, Card, CardHeader, CardBody } from "@wireservers-ui/react-natives";
package/bin/cli.js CHANGED
@@ -344,7 +344,7 @@ writeFile("App.tsx", appTsx);
344
344
 
345
345
  // ── Done ───────────────────────────────────────────────────────────────────
346
346
  console.log("\n✅ Setup complete!\n");
347
- console.log(" Created/updated:");
347
+ console.log(" Created if missing (existing files were preserved):");
348
348
  console.log(" • tailwind.config.js");
349
349
  console.log(" • global.css (with theme variables)");
350
350
  console.log(" • nativewind-env.d.ts");
@@ -357,10 +357,12 @@ console.log(" npx expo start --clear\n");
357
357
  // ── Helpers ────────────────────────────────────────────────────────────────
358
358
  function writeFile(name, content) {
359
359
  const filePath = path.join(cwd, name);
360
+ if (fs.existsSync(filePath)) {
361
+ console.log(` ⏭️ ${name} already exists, skipping`);
362
+ return;
363
+ }
360
364
  fs.writeFileSync(filePath, content, "utf8");
361
- console.log(
362
- ` ✏️ ${fs.existsSync(filePath) ? "Updated" : "Created"} ${name}`,
363
- );
365
+ console.log(` ✏️ Created ${name}`);
364
366
  }
365
367
 
366
368
  function writeIfMissing(name, content) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wireservers-ui/react-natives",
3
- "version": "1.0.1-rc2",
3
+ "version": "1.0.1",
4
4
  "description": "A comprehensive React Native component library built with NativeWind and Tailwind Variants",
5
5
  "main": "src/index.ts",
6
6
  "types": "src/index.ts",