@wireservers-ui/react-natives 1.0.1-rc1 ā 1.0.1-rc3
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/bin/cli.js +25 -5
- package/package.json +1 -1
package/bin/cli.js
CHANGED
|
@@ -27,6 +27,18 @@ const pm = detectPackageManager();
|
|
|
27
27
|
const installCmd = pm === "yarn" ? "yarn add" : `${pm} install`;
|
|
28
28
|
let needsReinstall = false;
|
|
29
29
|
|
|
30
|
+
function getInstalledReactVersion() {
|
|
31
|
+
const reactPkgPath = path.join(cwd, "node_modules", "react", "package.json");
|
|
32
|
+
if (!fs.existsSync(reactPkgPath)) return null;
|
|
33
|
+
|
|
34
|
+
try {
|
|
35
|
+
const reactPkg = JSON.parse(fs.readFileSync(reactPkgPath, "utf8"));
|
|
36
|
+
return typeof reactPkg.version === "string" ? reactPkg.version : null;
|
|
37
|
+
} catch {
|
|
38
|
+
return null;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
|
|
30
42
|
console.log(`\nš Initializing @wireservers-ui/react-natives...\n`);
|
|
31
43
|
console.log(` Package manager: ${pm}`);
|
|
32
44
|
|
|
@@ -64,6 +76,11 @@ if (needsReinstall) {
|
|
|
64
76
|
|
|
65
77
|
// āā 2. Install peer dependencies āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā
|
|
66
78
|
console.log("\nš¦ Installing peer dependencies...\n");
|
|
79
|
+
const reactVersion = getInstalledReactVersion();
|
|
80
|
+
const reactDomPackage = reactVersion
|
|
81
|
+
? `react-dom@${reactVersion}`
|
|
82
|
+
: "react-dom";
|
|
83
|
+
|
|
67
84
|
const peers = [
|
|
68
85
|
"nativewind@^4",
|
|
69
86
|
"tailwindcss@^3",
|
|
@@ -72,7 +89,7 @@ const peers = [
|
|
|
72
89
|
"react-native-reanimated",
|
|
73
90
|
"react-native-worklets",
|
|
74
91
|
"react-native-svg",
|
|
75
|
-
|
|
92
|
+
reactDomPackage,
|
|
76
93
|
"react-native-web",
|
|
77
94
|
];
|
|
78
95
|
|
|
@@ -92,6 +109,7 @@ module.exports = {
|
|
|
92
109
|
"./App.{js,jsx,ts,tsx}",
|
|
93
110
|
"./app/**/*.{js,jsx,ts,tsx}",
|
|
94
111
|
"./components/**/*.{js,jsx,ts,tsx}",
|
|
112
|
+
"./node_modules/@wireservers-ui/react-natives/src/**/*.{js,jsx,ts,tsx}",
|
|
95
113
|
],
|
|
96
114
|
presets: [require("@wireservers-ui/react-natives/tailwind-preset")],
|
|
97
115
|
};
|
|
@@ -326,7 +344,7 @@ writeFile("App.tsx", appTsx);
|
|
|
326
344
|
|
|
327
345
|
// āā Done āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā
|
|
328
346
|
console.log("\nā
Setup complete!\n");
|
|
329
|
-
console.log(" Created
|
|
347
|
+
console.log(" Created if missing (existing files were preserved):");
|
|
330
348
|
console.log(" ⢠tailwind.config.js");
|
|
331
349
|
console.log(" ⢠global.css (with theme variables)");
|
|
332
350
|
console.log(" ⢠nativewind-env.d.ts");
|
|
@@ -339,10 +357,12 @@ console.log(" npx expo start --clear\n");
|
|
|
339
357
|
// āā Helpers āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā
|
|
340
358
|
function writeFile(name, content) {
|
|
341
359
|
const filePath = path.join(cwd, name);
|
|
360
|
+
if (fs.existsSync(filePath)) {
|
|
361
|
+
console.log(` āļø ${name} already exists, skipping`);
|
|
362
|
+
return;
|
|
363
|
+
}
|
|
342
364
|
fs.writeFileSync(filePath, content, "utf8");
|
|
343
|
-
console.log(
|
|
344
|
-
` āļø ${fs.existsSync(filePath) ? "Updated" : "Created"} ${name}`,
|
|
345
|
-
);
|
|
365
|
+
console.log(` āļø Created ${name}`);
|
|
346
366
|
}
|
|
347
367
|
|
|
348
368
|
function writeIfMissing(name, content) {
|
package/package.json
CHANGED