setup-nativewind 1.1.1 → 1.1.3

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "setup-nativewind",
3
- "version": "1.1.1",
3
+ "version": "1.1.3",
4
4
  "description": "One command NativeWind setup for Expo and React Native",
5
5
  "main": "src/index.js",
6
6
  "type": "module",
package/src/fileWriter.js CHANGED
@@ -21,4 +21,27 @@ export async function writeConfigFiles(projectType) {
21
21
  await fs.copy(src, dest);
22
22
  console.log(`✅ Created ${file}`);
23
23
  }
24
+
25
+ // For TS projects update tsconfig.json automatically
26
+ if (projectType.includes('ts')) {
27
+ await updateTsConfig(targetDir);
28
+ }
29
+ }
30
+
31
+ async function updateTsConfig(targetDir) {
32
+ const tsconfigPath = path.join(targetDir, 'tsconfig.json');
33
+
34
+ if (!fs.existsSync(tsconfigPath)) return;
35
+
36
+ const tsconfig = fs.readJsonSync(tsconfigPath);
37
+
38
+ if (!tsconfig.include) {
39
+ tsconfig.include = [];
40
+ }
41
+
42
+ if (!tsconfig.include.includes('nativewind-env.d.ts')) {
43
+ tsconfig.include.push('nativewind-env.d.ts');
44
+ fs.writeJsonSync(tsconfigPath, tsconfig, { spaces: 2 });
45
+ console.log('✅ Updated tsconfig.json');
46
+ }
24
47
  }
package/src/index.js CHANGED
@@ -48,6 +48,7 @@ async function run() {
48
48
  console.log(' 2. Start using Tailwind classes in your components');
49
49
  if (projectType.includes('ts')) {
50
50
  console.log(' 3. nativewind-env.d.ts has been created for TypeScript support ✅');
51
+ console.log(' 4. Start your dev server once to resolve any CSS import warnings');
51
52
  }
52
53
  console.log('');
53
54
  }
@@ -0,0 +1,6 @@
1
+ const { getDefaultConfig } = require("expo/metro-config");
2
+ const { withNativeWind } = require("nativewind/metro");
3
+
4
+ const config = getDefaultConfig(__dirname);
5
+
6
+ module.exports = withNativeWind(config, { input: "./global.css" });
@@ -0,0 +1,6 @@
1
+ const { getDefaultConfig } = require("expo/metro-config");
2
+ const { withNativeWind } = require("nativewind/metro");
3
+
4
+ const config = getDefaultConfig(__dirname);
5
+
6
+ module.exports = withNativeWind(config, { input: "./global.css" });