nx-react-native-cli 2.0.1 → 2.0.2

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 (41) hide show
  1. package/lib/index.cjs +1 -1
  2. package/package.json +1 -1
  3. package/templates/apps/mobile/assets/fonts/InterBlack.ttf +0 -0
  4. package/templates/apps/mobile/assets/fonts/InterBlackItalic.ttf +0 -0
  5. package/templates/apps/mobile/assets/fonts/InterBold.ttf +0 -0
  6. package/templates/apps/mobile/assets/fonts/InterBoldItalic.ttf +0 -0
  7. package/templates/apps/mobile/assets/fonts/InterExtraBold.ttf +0 -0
  8. package/templates/apps/mobile/assets/fonts/InterExtraBoldItalic.ttf +0 -0
  9. package/templates/apps/mobile/assets/fonts/InterExtraLight.ttf +0 -0
  10. package/templates/apps/mobile/assets/fonts/InterExtraLightItalic.ttf +0 -0
  11. package/templates/apps/mobile/assets/fonts/InterItalic.ttf +0 -0
  12. package/templates/apps/mobile/assets/fonts/InterLight.ttf +0 -0
  13. package/templates/apps/mobile/assets/fonts/InterLightItalic.ttf +0 -0
  14. package/templates/apps/mobile/assets/fonts/InterMedium.ttf +0 -0
  15. package/templates/apps/mobile/assets/fonts/InterMediumItalic.ttf +0 -0
  16. package/templates/apps/mobile/assets/fonts/InterRegular.ttf +0 -0
  17. package/templates/apps/mobile/assets/fonts/InterSemiBold.ttf +0 -0
  18. package/templates/apps/mobile/assets/fonts/InterSemiBoldItalic.ttf +0 -0
  19. package/templates/apps/mobile/assets/fonts/InterThin.ttf +0 -0
  20. package/templates/apps/mobile/assets/fonts/InterThinItalic.ttf +0 -0
  21. package/templates/apps/mobile/react-native.config.js +1 -1
  22. package/templates/apps/mobile/src/tailwind/index.ts +50 -1
  23. package/templates/apps/mobile/tailwind.config.js +19 -1
  24. package/templates/apps/mobile/src/assets/fonts/MontserratBlack.ttf +0 -0
  25. package/templates/apps/mobile/src/assets/fonts/MontserratBlackItalic.ttf +0 -0
  26. package/templates/apps/mobile/src/assets/fonts/MontserratBold.ttf +0 -0
  27. package/templates/apps/mobile/src/assets/fonts/MontserratBoldItalic.ttf +0 -0
  28. package/templates/apps/mobile/src/assets/fonts/MontserratExtraBold.ttf +0 -0
  29. package/templates/apps/mobile/src/assets/fonts/MontserratExtraBoldItalic.ttf +0 -0
  30. package/templates/apps/mobile/src/assets/fonts/MontserratExtraLight.ttf +0 -0
  31. package/templates/apps/mobile/src/assets/fonts/MontserratExtraLightItalic.ttf +0 -0
  32. package/templates/apps/mobile/src/assets/fonts/MontserratItalic.ttf +0 -0
  33. package/templates/apps/mobile/src/assets/fonts/MontserratLight.ttf +0 -0
  34. package/templates/apps/mobile/src/assets/fonts/MontserratLightItalic.ttf +0 -0
  35. package/templates/apps/mobile/src/assets/fonts/MontserratMedium.ttf +0 -0
  36. package/templates/apps/mobile/src/assets/fonts/MontserratMediumItalic.ttf +0 -0
  37. package/templates/apps/mobile/src/assets/fonts/MontserratRegular.ttf +0 -0
  38. package/templates/apps/mobile/src/assets/fonts/MontserratSemiBold.ttf +0 -0
  39. package/templates/apps/mobile/src/assets/fonts/MontserratSemiBoldItalic.ttf +0 -0
  40. package/templates/apps/mobile/src/assets/fonts/MontserratThin.ttf +0 -0
  41. package/templates/apps/mobile/src/assets/fonts/MontserratThinItalic.ttf +0 -0
package/lib/index.cjs CHANGED
@@ -63,7 +63,7 @@ ${g}${I}${E}${T2.default.cursorHide}`});var d1=j(require("node:readline"),1),q=j
63
63
  `),this)}stop(){return this.#c?(clearInterval(this.#x),this.#x=void 0,this.#u=0,this.clear(),this.#r.hideCursor&&bl.show(this.#n),this.#r.discardStdin&&ei.default.stdin.isTTY&&this.#t&&(wl.stop(),this.#t=!1),this):this}succeed(r){return this.stopAndPersist({symbol:Xn.success,text:r})}fail(r){return this.stopAndPersist({symbol:Xn.error,text:r})}warn(r){return this.stopAndPersist({symbol:Xn.warning,text:r})}info(r){return this.stopAndPersist({symbol:Xn.info,text:r})}stopAndPersist(r={}){if(this.#l)return this;let t=r.prefixText??this.#a,n=this.#p(t," "),i=r.symbol??" ",u=r.text??this.text,o=typeof u=="string"?" "+u:"",a=r.suffixText??this.#s,s=this.#m(a," "),c=n+i+o+s+`
64
64
  `;return this.stop(),this.#n.write(c),this}};function hn(e){return new Al(e)}var $1=require("child_process"),tt=j(require("fs"),1),oa=j(require("path"),1);var N1={dependencies:{"@gorhom/bottom-sheet":"latest","@hookform/resolvers":"latest","@react-native-community/datetimepicker":"latest","@react-native-community/hooks":"latest","@react-navigation/core":"latest","@react-navigation/material-top-tabs":"latest","@react-navigation/native-stack":"latest","@react-navigation/native":"latest","@react-navigation/routers":"latest","@react-navigation/stack":"latest","@shopify/react-native-skia":"latest","@tanstack/query-async-storage-persister":"latest","@tanstack/query-core":"latest","@tanstack/query-sync-storage-persister":"latest","@tanstack/react-query-persist-client":"latest","@tanstack/react-query":"latest",axios:"latest","babel-plugin-module-resolver":"latest",dayjs:"latest","jotai-optics":"latest",jotai:"latest",lodash:"latest","lottie-react-native":"^7.2.2","react-hook-form":"latest","react-native-dotenv":"latest","react-native-fast-image":"latest","react-native-gesture-handler":"latest","react-native-get-random-values":"latest","react-native-haptic-feedback":"latest","react-native-keyboard-aware-scroll-view":"latest","react-native-mmkv":"^2.12.2","react-native-modal-datetime-picker":"latest","react-native-modal":"latest","react-native-pager-view":"latest","react-native-reanimated":"latest","react-native-safe-area-context":"latest","react-native-screens":"latest","react-native-simple-toast":"latest","react-native-url-polyfill":"latest","react-native":"0.78.0",react:"19.0.0",tailwindcss:"3.4.16",twrnc:"latest",uuid:"latest","zod-validation-error":"latest",zod:"latest",zustand:"latest"}};var U1={devDependencies:{"@babel/core":"^7.25.2","@babel/preset-env":"^7.25.3","@babel/runtime":"^7.25.0","@nx/react-native":"19.7.0","@react-native-community/cli-platform-android":"15.0.1","@react-native-community/cli-platform-ios":"15.0.1","@react-native-community/cli":"15.0.1","@react-native/babel-preset":"0.78.0","@react-native/eslint-config":"0.78.0","@react-native/metro-config":"0.78.0","@react-native/typescript-config":"0.78.0","@swc-node/register":"~1.8.0","@tanstack/eslint-plugin-query":"latest","@types/jest":"^29.5.13","@types/lodash":"latest","@types/react-test-renderer":"^19.0.0","@types/react":"^19.0.0","@typescript-eslint/eslint-plugin":"6.13.2","@typescript-eslint/parser":"6.21.0","babel-plugin-module-resolver":"latest","eslint-config-airbnb-typescript":"17.1.0","eslint-config-prettier":"latest","eslint-import-resolver-typescript":"latest","eslint-plugin-import":"latest","eslint-plugin-prettier":"latest","eslint-plugin-react-hooks":"latest","eslint-plugin-react-perf":"latest","eslint-plugin-react":"latest","eslint-plugin-sonarjs":"0.25.1","eslint-plugin-sort-destructure-keys":"latest","eslint-plugin-sort-keys-fix":"latest","eslint-plugin-tailwindcss":"latest",husky:"latest","prettier-plugin-tailwindcss":"latest",prettier:"3.3.2","react-native-dotenv":"latest","react-native-svg-transformer":"^1.3.0","react-native-svg":"15.11.2"}};function V1(){return __dirname}var pn=(e,r)=>{(0,$1.execSync)(`cd ${e} && ${r}`,{stdio:"inherit"})},Me=(e,r)=>{let t=oa.default.join(V1(),`../templates/${r}`);tt.default.copyFile(t,e,n=>{if(n){console.error(`Error copying file: ${n.message}`);return}})},aa=(e,r)=>{let t=oa.default.join(V1(),`../templates/${r}`);tt.default.cpSync(t,e,{recursive:!0},n=>{if(n){console.error(`Error copying file: ${n.message}`);return}})},W1=e=>{tt.default.rmSync(e,{recursive:!0,force:!0},r=>{if(r){console.error(`Error removing directory: ${r.message}`);return}})},Ol=e=>{tt.default.rmSync(e,{recursive:!0,force:!0},r=>{if(r){console.error(`Error removing file: ${r.message}`);return}})},H1=e=>{let r={doctor:"npx nx react-native doctor",android:"npx nx run-android mobile --skip-nx-cache","android:connect":"cd apps/mobile && npm run android:connect","check-env:mobile":"./check-env.sh apps/mobile/.env apps/mobile/.env.template",clean:"./clean-generated-outputs.sh","create-env":"printenv > ","lint:all":"npx nx run-many -t lint -p mobile --parallel=1 --skip-nx-cache","lint:mobile":"npx nx run mobile:lint --skip-nx-cache","mobile-android":"cd apps/mobile && npm run run-android","mobile-ios":"cd apps/mobile && npm run run-ios",prepare:"husky install","serve:mobile":"cd apps/mobile && npm start","serve:all":"npx nx run-many -t serve -p mobile --parallel=1 --skip-nx-cache",xcode:"cd apps/mobile && npm run xcode","touch-xcode":"cd apps/mobile && npm run touch-xcode","setup-fastlane":"cd apps/mobile && npm run setup-fastlane","deploy-android:dev":"cd apps/mobile && npm run deploy-android:dev","deploy-ios:dev":"cd apps/mobile && npm run deploy-ios:dev","ios-certificates":"cd apps/mobile && npm run ios-certificates","pod-install":"cd apps/mobile && npm run pod-install","react-native-asset":"cd apps/mobile && npx react-native-asset"},t=oa.default.join(e,"package.json"),n=JSON.parse(tt.default.readFileSync(t,"utf8"));n.dependencies={...n.dependencies,...N1.dependencies},n.devDependencies={...n.devDependencies,...U1.devDependencies},n.scripts={...n.scripts,...r},tt.default.writeFileSync(t,JSON.stringify(n,null,2))};var w={title:z.bold.cyan,subtitle:z.cyan,success:z.bold.green,info:z.bold.blue,warning:z.hex("#FFA500").bold,error:z.bold.red,highlight:z.bold.magenta,command:z.yellow.italic,path:z.green.underline,step:e=>z.bgCyan.black(` STEP ${e} `),emoji:{rocket:"\u{1F680}",check:"\u2705",warning:"\u26A0\uFE0F",star:"\u2B50",sparkles:"\u2728",tools:"\u{1F6E0}\uFE0F",mobile:"\u{1F4F1}",folder:"\u{1F4C1}",code:"\u{1F4BB}"}},kS=()=>{console.log(`
65
65
  `),console.log(w.title("\u2554\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2557")),console.log(w.title("\u2551 \u2551")),console.log(w.title("\u2551 ")+w.highlight("NX REACT NATIVE CLI")+w.title(" \u2551")),console.log(w.title("\u2551 ")+w.subtitle("A powerful starter for React Native with NX")+w.title(" \u2551")),console.log(w.title("\u2551 \u2551")),console.log(w.title("\u255A\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u255D")),console.log(`
66
- `)};ai.name("React Native Starter with NX").description("A starter script to create a new React Native project with NX").version("2.0.0");ai.command("create [workspace_name]").description("create nx workspace with react-native").option("--fresh","Create a fresh project without copying template files").action(async(e,r)=>{kS(),e||(e=(await v1.prompt([{type:"input",name:"workspace_name",message:w.info("Enter the workspace name:")}])).workspace_name);let t=r.fresh||!1,n=process.cwd(),i=`${n}/${e}`,u=`${i}/apps/mobile`;console.log(`
66
+ `)};ai.name("React Native Starter with NX").description("A starter script to create a new React Native project with NX").version("2.0.1");ai.command("create [workspace_name]").description("create nx workspace with react-native").option("--fresh","Create a fresh project without copying template files").action(async(e,r)=>{kS(),e||(e=(await v1.prompt([{type:"input",name:"workspace_name",message:w.info("Enter the workspace name:")}])).workspace_name);let t=r.fresh||!1,n=process.cwd(),i=`${n}/${e}`,u=`${i}/apps/mobile`;console.log(`
67
67
  ${w.step(1)} ${w.emoji.folder} ${w.success(`Creating Nx workspace in ${w.path(`./${e}`)}`)}`);let o=hn({text:"Setting up Nx workspace...",color:"cyan"}).start();(0,G1.execSync)(`cd ${n} && npx create-nx-workspace@19.7.0 --preset apps --workspaceType integrated --name ${e} --package-manager=yarn --nxCloud skip`,{stdio:"inherit"}),o.succeed(w.success("Nx workspace created successfully")),console.log(`
68
68
  ${w.step(2)} ${w.emoji.mobile} ${w.success("Adding React Native to your workspace")}`);let a=hn({text:"Installing React Native dependencies...",color:"cyan"}).start();pn(i,"yarn add -D @nx/react-native@19.7.0 --ignore-scripts",{stdio:"inherit"}),pn(i,"npx nx g @nx/react-native:app apps/mobile --bundler vite --install false --skip-nx-cache",{stdio:"inherit"}),H1(i),pn(i,"yarn install",{stdio:"inherit"}),a.succeed(w.success("React Native dependencies installed successfully")),console.log(`
69
69
  ${w.step(3)} ${w.emoji.tools} ${w.success("Setting up project configuration")}`);let s=hn({text:"Configuring project files...",color:"cyan"}).start();aa(`${i}/.vscode`,".vscode"),aa(`${i}/.husky`,".husky"),Me(`${i}/.prettierrc`,".prettierrc"),Me(`${i}/.prettierignore`,".prettierignore"),Me(`${i}/.eslintrc.json`,".eslintrc.json"),Me(`${i}/.eslintrc.json`,".eslintrc.json"),Me(`${i}/.gitignore`,".ignorefile"),Me(`${i}/.ruby-version`,".ruby-version"),Me(`${i}/.nvmrc`,".nvmrc"),Me(`${i}/check-env.sh`,"check-env.sh"),Me(`${i}/clean-generated-outputs.sh`,"clean-generated-outputs.sh"),t||(W1(`${i}/apps/mobile/src`),Ol(`${i}/apps/mobile/.vite.config.ts`),Ol(`${i}/apps/mobile/.babelrc.js`),aa(`${i}/apps`,"apps")),Me(`${i}/apps/mobile/.gitignore`,".ignorefile"),pn(i,`keytool -genkey -keystore ${i}/apps/mobile/android/app/dev.keystore -keyalg RSA -keysize 2048 -validity 10000 -alias dev -dname "cn=Unknown, ou=Unknown, o=Unknown, c=Unknown" -storepass development -keypass development`,{stdio:"inherit"}),s.succeed(w.success("Project configuration completed")),console.log(`
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nx-react-native-cli",
3
- "version": "2.0.1",
3
+ "version": "2.0.2",
4
4
  "description": "A react native starter (with NX) cli script",
5
5
  "type": "module",
6
6
  "files": [
@@ -3,5 +3,5 @@ module.exports = {
3
3
  ios: {},
4
4
  android: {},
5
5
  },
6
- assets: ['./src/assets/fonts'],
6
+ assets: ['./assets/fonts'],
7
7
  };
@@ -1,11 +1,60 @@
1
+ import plugin from 'tailwindcss/plugin';
1
2
  import resolveConfig from 'tailwindcss/resolveConfig';
2
3
  import { create } from 'twrnc';
3
4
 
4
5
  import tailwindConfig from '../../tailwind.config';
5
6
 
7
+ import CONFIG from '@/config';
8
+
6
9
  const theme = resolveConfig(tailwindConfig);
7
10
 
8
- export const tw = create(tailwindConfig);
11
+ export const tw = create({
12
+ ...tailwindConfig,
13
+ plugins: [
14
+ ...tailwindConfig.plugins,
15
+ plugin(({ addUtilities }) => {
16
+ addUtilities({
17
+ '.box': `border border-[#000]`,
18
+ '.font-black-italic': `font-black-italic ${CONFIG.IS_IOS ? 'italic' : ''}`,
19
+ '.font-bold-italic': `font-bold-italic ${CONFIG.IS_IOS ? 'italic' : ''}`,
20
+ '.font-extrabold-italic': `font-extrabold-italic ${CONFIG.IS_IOS ? 'italic' : ''}`,
21
+ '.font-extralight-italic': `font-extralight-italic ${CONFIG.IS_IOS ? 'italic' : ''}`,
22
+ '.font-light-italic': `font-light-italic ${CONFIG.IS_IOS ? 'italic' : ''}`,
23
+ '.font-medium-italic': `font-medium-italic ${CONFIG.IS_IOS ? 'italic' : ''}`,
24
+ '.font-sans-italic': `font-sans-italic ${CONFIG.IS_IOS ? 'italic' : ''}`,
25
+ '.font-semibold-italic': `font-semibold-italic ${CONFIG.IS_IOS ? 'italic' : ''}`,
26
+ '.font-thin-italic': `font-thin-italic ${CONFIG.IS_IOS ? 'italic' : ''}`,
27
+ });
28
+ }),
29
+ ],
30
+ theme: {
31
+ ...tailwindConfig.theme,
32
+ fontFamily: {
33
+ black: CONFIG.IS_ANDROID ? 'InterBlack' : 'Inter 18pt Black',
34
+ 'black-italic': CONFIG.IS_ANDROID ? 'InterBlackItalic' : 'Inter 18pt Black Italic',
35
+ bold: CONFIG.IS_ANDROID ? 'InterBold' : 'Inter 18pt Bold',
36
+ 'bold-italic': CONFIG.IS_ANDROID ? 'InterBoldItalic' : 'Inter 18pt Bold Italic',
37
+ extrabold: CONFIG.IS_ANDROID ? 'InterExtraBold' : 'Inter 18pt ExtraBold',
38
+ 'extrabold-italic': CONFIG.IS_ANDROID
39
+ ? 'InterExtraBoldItalic'
40
+ : 'Inter 18pt ExtraBold Italic',
41
+ extralight: CONFIG.IS_ANDROID ? 'InterExtraLight' : 'Inter 18pt ExtraLight',
42
+ 'extralight-italic': CONFIG.IS_ANDROID
43
+ ? 'InterExtraLightItalic'
44
+ : 'Inter 18pt ExtraLight Italic',
45
+ light: CONFIG.IS_ANDROID ? 'InterLight' : 'Inter 18pt Light',
46
+ 'light-italic': CONFIG.IS_ANDROID ? 'InterLightItalic' : 'Inter 18pt Light Italic',
47
+ medium: CONFIG.IS_ANDROID ? 'InterMedium' : 'Inter 18pt Medium',
48
+ 'medium-italic': CONFIG.IS_ANDROID ? 'InterMediumItalic' : 'Inter 18pt Medium Italic',
49
+ sans: CONFIG.IS_ANDROID ? 'InterRegular' : 'Inter 18pt Regular',
50
+ 'sans-italic': CONFIG.IS_ANDROID ? 'InterItalic' : 'Inter 18pt Italic',
51
+ semibold: CONFIG.IS_ANDROID ? 'InterSemiBold' : 'Inter 18pt SemiBold',
52
+ 'semibold-italic': CONFIG.IS_ANDROID ? 'InterSemiBoldItalic' : 'Inter 18pt SemiBold Italic',
53
+ thin: CONFIG.IS_ANDROID ? 'InterThin' : 'Inter 18pt Thin',
54
+ 'thin-italic': CONFIG.IS_ANDROID ? 'InterThinItalic' : 'Inter 18pt Thin Italic',
55
+ },
56
+ },
57
+ });
9
58
 
10
59
  export const errorContainerStyle = (err: boolean) => err && tw`border-red-600`;
11
60
 
@@ -13,8 +13,26 @@ module.exports = {
13
13
  }),
14
14
  ],
15
15
  theme: {
16
+ // FOR FONTS: This is only for intellisense the real config is in apps/mobile/src/tailwind
16
17
  fontFamily: {
17
- sans: ['Inter 18pt'],
18
+ black: 'InterBlack',
19
+ 'black-italic': 'InterBlackItalic',
20
+ bold: 'InterBold',
21
+ 'bold-italic': 'InterBoldItalic',
22
+ extrabold: 'InterExtraBold',
23
+ 'extrabold-italic': 'InterExtraBoldItalic',
24
+ extralight: 'InterExtraLight',
25
+ 'extralight-italic': 'InterExtraLightItalic',
26
+ light: 'InterLight',
27
+ 'light-italic': 'InterLightItalic',
28
+ medium: 'InterMedium',
29
+ 'medium-italic': 'InterMediumItalic',
30
+ sans: 'Inter',
31
+ 'sans-italic': 'InterItalic',
32
+ semibold: 'InterSemiBold',
33
+ 'semibold-italic': 'InterSemiboldItalic',
34
+ thin: 'InterThin',
35
+ 'thin-italic': 'InterThinItalic',
18
36
  },
19
37
  extend: {
20
38
  flex: {