diff --git a/README.md b/README.md index 3111134b..4f1e611b 100644 --- a/README.md +++ b/README.md @@ -7,7 +7,7 @@ ## :star: Features - Elegant usage directly within the RN-Boiler Cli -- Fastlane (App center included) +- Fastlane - Lefthook - Boot Splash - Expo Image @@ -43,16 +43,22 @@ npx rn-boiler MyApp Args command: -- skip install deps: - -```sh ---skipInstall ``` - -- skip init git: - -```sh ---skipGit +Usage: rn-boiler [options] + +Arguments: + project-name Project name + +Options: + -v, --version Output the current version + -pm, --package-manager Use different package manager (choices: + "yarn", "bun", "npm", default: "bun") + --skip-install Skip install dependencies. Default: false. + (default: false) + --skip-git Skip git init. Default: false. (default: + false) + --verbose Default: false. (default: false) + -h, --help display help for command ```

Preview

diff --git a/package.json b/package.json index dac5bf8b..0524601a 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "rn-boiler-template", "private": false, - "version": "1.72.7", + "version": "1.72.10", "description": "Clean and minimalist React Native template for a quick start with TypeScript and components", "scripts": { "test": "exit 0" diff --git a/template/GITLABRUNNER.MD b/template/GITLABRUNNER.MD index 3ef94bff..8f31cd7c 100644 --- a/template/GITLABRUNNER.MD +++ b/template/GITLABRUNNER.MD @@ -5,15 +5,15 @@ You can config gitlab CI runner to create build automatically. - Create new repo for gitlab CI - Create Runner for gitlab CI -- Move fastlane, build_script folder to new repo -- Add new files [README.MD](#readmemd), [.gitlab-ci.yml](#gitlab-ciyml), [pull_repo.sh](#pull_reposh), [release.sh](#releasesh) and [build_script](#build_script) folder to new repo +- Move fastlane, build-ci folder to new repo +- Add new files [README.MD](#readmemd), [.gitlab-ci.yml](#gitlab-ciyml), [pull_repo.sh](#pull_reposh), [release.sh](#releasesh) and [build-ci](#build-ci) folder to new repo ### README.MD ```md ## Requiement -- [rbenv](https://github.com/rbenv/rbenv) +- [rbenv](https://github.com/rbenv/rbenv)(version >= 2.7.6) - [fnm](https://github.com/Schniz/fnm) - [fastlane](https://fastlane.tools/) - [Gitlab-Runner](https://docs.gitlab.com/runner/) for macos. executor should be shell @@ -201,7 +201,7 @@ done ``` -### build_script +### build-ci #### build-android.ts @@ -310,7 +310,7 @@ import { execSync } from 'child_process'; . ├── fastlane - ├── build_script + ├── build-ci │ ├── build-android.ts │ ├── deploy-android.ts │ ├── build-ios.ts diff --git a/template/README.md b/template/README.md index 85c821b5..45a3eceb 100644 --- a/template/README.md +++ b/template/README.md @@ -3,8 +3,9 @@ # Setup - Setup development environment [React Native CLI](https://reactnative.dev/docs/environment-setup) -- We recommended to use [yarn](https://classic.yarnpkg.com/en/docs/install/#mac-stable) -- Ruby version: 2.7.6 (recommended use [rbenv](https://github.com/rbenv/rbenv) to manage the Ruby programming language) +- Node version >= 18 (recommended use [fnm](https://github.com/Schniz/fnm)) +- We recommended to use [yarn](https://classic.yarnpkg.com/en/docs/install/#mac-stable) or [bun](https://bun.sh/) +- Ruby version: 2.7.6 (recommended use [rbenv](https://github.com/rbenv/rbenv)) # Importance before commit diff --git a/template/android/app/src/main/java/com/helloworld/MainActivity.java b/template/android/app/src/main/java/com/helloworld/MainActivity.java index ff1ae7ee..0602df58 100644 --- a/template/android/app/src/main/java/com/helloworld/MainActivity.java +++ b/template/android/app/src/main/java/com/helloworld/MainActivity.java @@ -13,7 +13,7 @@ public class MainActivity extends ReactActivity { @Override protected void onCreate(Bundle savedInstanceState) { - RNBootSplash.init(this); + RNBootSplash.init(this, R.style.BootTheme); super.onCreate(savedInstanceState); } diff --git a/template/package.json b/template/package.json index 6983b866..7fbb7554 100644 --- a/template/package.json +++ b/template/package.json @@ -78,9 +78,9 @@ "eslint": "^8.19.0", "eslint-plugin-import": "^2.27.5", "jest": "^29.2.1", - "lefthook": "^1.4.5", + "lefthook": "^1.4.11", "metro-react-native-babel-preset": "0.76.8", - "patch-package": "^6.4.7", + "patch-package": "^8.0.0", "prettier": "^2.4.1", "react-native-mmkv-flipper-plugin": "^1.0.0", "react-test-renderer": "18.2.0", diff --git a/template/build_script/build-android.ts b/template/scripts/build-ci/build-android.ts similarity index 100% rename from template/build_script/build-android.ts rename to template/scripts/build-ci/build-android.ts diff --git a/template/build_script/build-ios.ts b/template/scripts/build-ci/build-ios.ts similarity index 100% rename from template/build_script/build-ios.ts rename to template/scripts/build-ci/build-ios.ts diff --git a/template/build_script/deploy-android.ts b/template/scripts/build-ci/deploy-android.ts similarity index 100% rename from template/build_script/deploy-android.ts rename to template/scripts/build-ci/deploy-android.ts diff --git a/template/build_script/deploy-ios.ts b/template/scripts/build-ci/deploy-ios.ts similarity index 100% rename from template/build_script/deploy-ios.ts rename to template/scripts/build-ci/deploy-ios.ts diff --git a/template/scripts/common.ts b/template/scripts/common.ts index 2223ea26..e7a4de84 100644 --- a/template/scripts/common.ts +++ b/template/scripts/common.ts @@ -95,3 +95,28 @@ import Config from 'react-native-config'; return envJson; }; + +export const getRubyVersion = () => { + try { + return Number( + execSync('ruby -e "puts RUBY_VERSION"') + .toString() + .trim() + .split('.') + .join(''), + ); + } catch { + return 0; + } +}; + +export const getAndroidHome = () => { + try { + return ( + execSync('echo $ANDROID_HOME').toString().trim() || + execSync('echo $ANDROID_SDK_ROOT').toString().trim() + ); + } catch { + return ''; + } +}; diff --git a/template/scripts/setup.ts b/template/scripts/setup.ts index 7f7935ac..b43ba2d2 100644 --- a/template/scripts/setup.ts +++ b/template/scripts/setup.ts @@ -1,29 +1,49 @@ import { execSync } from 'child_process'; +import { getAndroidHome, getRubyVersion } from './common'; + (function () { execSync('yarn patch-package', { stdio: 'inherit' }); + if (getAndroidHome() !== '') { + execSync(`echo "sdk.dir=${getAndroidHome()}" > android/local.properties`, { + stdio: 'inherit', + }); + } + if (process.platform === 'darwin') { execSync('cd ios && touch tmp.xcconfig'); - console.log( - ' 🧐🧐🧐🧐🧐 Starting bundle install!! 🧐🧐🧐🧐🧐', - ); + if (getRubyVersion() < 276) { + console.log( + ' 🧐🧐🧐🧐🧐 Installing CocoaPods dependencies!! 🧐🧐🧐🧐🧐', + ); - execSync('bundle install', { - stdio: 'inherit', - }); + execSync('pod install --project-directory=ios', { + stdio: 'inherit', + }); - console.log('bundle install Done!!✨✨✨✨✨'); + console.log(' ✨✨✨✨✨ Pod done!!! ✨✨✨✨✨'); + } else { + console.log( + ' 🧐🧐🧐🧐🧐 Installing Bundle dependencies!! 🧐🧐🧐🧐🧐', + ); - console.log( - ' 🧐🧐🧐🧐🧐 Starting pod install!! 🧐🧐🧐🧐🧐', - ); + execSync('bundle install', { + stdio: 'inherit', + }); - execSync('bundle exec pod install --project-directory=ios', { - stdio: 'inherit', - }); + console.log('bundle install Done!!✨✨✨✨✨'); + + console.log( + ' 🧐🧐🧐🧐🧐 Installing CocoaPods dependencies!! 🧐🧐🧐🧐🧐', + ); + + execSync('bundle exec pod install --project-directory=ios', { + stdio: 'inherit', + }); - console.log(' ✨✨✨✨✨ Pod done!!! ✨✨✨✨✨'); + console.log(' ✨✨✨✨✨ Pod done!!! ✨✨✨✨✨'); + } } })();