Skip to content

Commit

Permalink
feat: use pnpm
Browse files Browse the repository at this point in the history
  • Loading branch information
zhiqingchen committed Jan 5, 2024
1 parent 436d069 commit a76addc
Show file tree
Hide file tree
Showing 9 changed files with 9,674 additions and 9,389 deletions.
29 changes: 7 additions & 22 deletions .github/workflows/assemble_android_debug.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,30 +43,14 @@ jobs:
with:
distribution: 'zulu'
java-version: '17'
- name: Cache node_modules Folder
uses: actions/cache@v2
- uses: pnpm/action-setup@v2
with:
path: ${{ github.workspace }}/node_modules
key: ${{ runner.os }}-node_modules
restore-keys: ${{ runner.os }}-node_modules
- name: Get Yarn Cache Directory Path
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn cache dir)"
- name: Cache Yarn
uses: actions/cache@v2
env:
cache-name: yarn-cache
version: 8
- uses: actions/setup-node@v3
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/package.json') }}
restore-keys: |
${{ runner.os }}-yarn-
- name: Install Dependencies
run: |
yarn
# - name: Build Taro React Native Bundle
# run: |
# yarn build:rn --platform android
node-version: 20
cache: 'pnpm'
- run: pnpm install
- name: Cache Gradle
uses: actions/cache@v2
env:
Expand All @@ -84,6 +68,7 @@ jobs:
bundle exec fastlane assemble
env:
KEYSTORE_FILE: ${{ github.workspace }}/android/app/${{ env.KEYSTORE_FILE }}
NODE_PATH: ${{ github.workspace }}/node_modules/.pnpm/node_modules:$NODE_PATH
- name: Upload Android Products
uses: actions/upload-artifact@v2
with:
Expand Down
34 changes: 7 additions & 27 deletions .github/workflows/assemble_android_release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,35 +43,14 @@ jobs:
with:
distribution: 'zulu'
java-version: '17'
- name: Cache node_modules Folder
uses: actions/cache@v2
- uses: pnpm/action-setup@v2
with:
path: ${{ github.workspace }}/node_modules
key: ${{ runner.os }}-node_modules
restore-keys: ${{ runner.os }}-node_modules
- name: Get Yarn Cache Directory Path
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn cache dir)"
- name: Cache Yarn
uses: actions/cache@v2
env:
cache-name: yarn-cache
version: 8
- uses: actions/setup-node@v3
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/package.json') }}
restore-keys: |
${{ runner.os }}-yarn-
- name: Install Dependencies
run: |
yarn
# - name: Build Taro React Native Bundle
# run: |
# yarn build:rn --platform android
# - name: Upload Taro React Native Bundle
# uses: actions/upload-artifact@v2
# with:
# name: taro-android-bundle
# path: ${{ github.workspace }}/android/app/src/main/assets/index.android.bundle
node-version: 20
cache: 'pnpm'
- run: pnpm install
- name: Cache Gradle
uses: actions/cache@v2
env:
Expand All @@ -89,6 +68,7 @@ jobs:
bundle exec fastlane assemble
env:
KEYSTORE_FILE: ${{ github.workspace }}/android/app/${{ env.KEYSTORE_FILE }}
NODE_PATH: ${{ github.workspace }}/node_modules/.pnpm/node_modules:$NODE_PATH
- name: Upload Android Products
uses: actions/upload-artifact@v2
with:
Expand Down
36 changes: 7 additions & 29 deletions .github/workflows/assemble_ios_debug.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,37 +31,14 @@ jobs:
steps:
- name: Checkout Project
uses: actions/checkout@v2
- name: Cache node_modules Folder
uses: actions/cache@v2
- uses: pnpm/action-setup@v2
with:
path: ${{ github.workspace }}/node_modules
key: ${{ runner.os }}-node_modules
restore-keys: ${{ runner.os }}-node_modules
- name: Get Yarn Cache Directory Path
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn cache dir)"
- name: Cache Yarn
uses: actions/cache@v2
env:
cache-name: yarn-cache
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/package.json') }}
restore-keys: |
${{ runner.os }}-yarn-
- name: Cache Pods
uses: actions/cache@v2
version: 8
- uses: actions/setup-node@v3
with:
path: ios/Pods
key: ${{ runner.os }}-pods-${{ hashFiles('**/Podfile.lock') }}
restore-keys: |
${{ runner.os }}-pods-
- name: Install Dependencies
run: |
yarn
# - name: Build Taro React Native Bundle
# run: |
# yarn build:rn --platform ios
node-version: 20
cache: 'pnpm'
- run: pnpm install
- name: Install pods
run: cd ios && pod update --no-repo-update
- name: Import signing certificate
Expand All @@ -86,6 +63,7 @@ jobs:
FL_CODE_SIGN_IDENTITY: ${{ env.CODE_SIGN_IDENTITY }}
FL_PROVISIONING_PROFILE_SPECIFIER: ${{ env.PROVISIONING_PROFILE_SPECIFIER }}
FASTLANE_TEAM_ID: ${{ env.TEAM_ID }}
NODE_PATH: ${{ github.workspace }}/node_modules/.pnpm/node_modules:$NODE_PATH
run: |
cd ios
bundle update
Expand Down
41 changes: 7 additions & 34 deletions .github/workflows/assemble_ios_release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,42 +37,14 @@ jobs:
run: echo "::set-output name=timestamp::$(date +'%s')"
- name: Checkout Project
uses: actions/checkout@v2
- name: Cache node_modules Folder
uses: actions/cache@v2
- uses: pnpm/action-setup@v2
with:
path: ${{ github.workspace }}/node_modules
key: ${{ runner.os }}-node_modules
restore-keys: ${{ runner.os }}-node_modules
- name: Get Yarn Cache Directory Path
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn cache dir)"
- name: Cache Yarn
uses: actions/cache@v2
env:
cache-name: yarn-cache
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/package.json') }}
restore-keys: |
${{ runner.os }}-yarn-
- name: Cache Pods
uses: actions/cache@v2
version: 8
- uses: actions/setup-node@v3
with:
path: ios/Pods
key: ${{ runner.os }}-pods-${{ hashFiles('**/Podfile.lock') }}
restore-keys: |
${{ runner.os }}-pods-
- name: Install Dependencies
run: |
yarn
# - name: Build Taro React Native Bundle
# run: |
# yarn build:rn --platform ios
# - name: Upload Taro React Native Bundle
# uses: actions/upload-artifact@v2
# with:
# name: taro-ios-bundle
# path: ${{ github.workspace }}/ios/main.jsbundle
node-version: 20
cache: 'pnpm'
- run: pnpm install
- name: Install pods
run: cd ios && pod update --no-repo-update
- name: Import signing certificate
Expand All @@ -97,6 +69,7 @@ jobs:
FL_CODE_SIGN_IDENTITY: ${{ env.CODE_SIGN_IDENTITY }}
FL_PROVISIONING_PROFILE_SPECIFIER: ${{ env.PROVISIONING_PROFILE_SPECIFIER }}
FASTLANE_TEAM_ID: ${{ env.TEAM_ID }}
NODE_PATH: ${{ github.workspace }}/node_modules/.pnpm/node_modules:$NODE_PATH
run: |
cd ios
bundle update
Expand Down
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ Taro 原生 React Native 壳工程,和 React Native init 的工程的区别如

0. 集成了 [expo](https://docs.expo.dev/bare/installing-expo-modules/)
1. 集成了 Taro 依赖的所有原生库
2. debug 方式变更: 在 JS 工程中 `yarn dev:rn` 启动 metro server
3. release 方式变更: 在 JS 工程中 `yarn buid:rn` 打包 jsbundle 并通过配置 `rn.output` 输出到壳工程
2. debug 方式变更: 在 JS 工程中 `pnpm dev:rn` 启动 metro server
3. release 方式变更: 在 JS 工程中 `pnpm buid:rn` 打包 jsbundle 并通过配置 `rn.output` 输出到壳工程

## 该仓库如何生成

Expand Down Expand Up @@ -39,8 +39,8 @@ npx install-expo-modules@latest
4. 更新 Taro 需要的依赖(如果还没正式发布,则使用对应的 alpha 或 beta 版本)

```
yarn
yarn upgradePeerdeps
pnpm
pnpm upgradePeerdeps
```

5. 添加打包脚本,此部分可以直接 cherry-pick
Expand All @@ -58,5 +58,5 @@ https://react-native-community.github.io/upgrade-helper/

> 使用 Taro 最新版,或者修改 `upgradePeerdeps` 指定 Taro 版本,再执行:
```
yarn upgradePeerdeps
pnpm upgradePeerdeps
```
Loading

0 comments on commit a76addc

Please sign in to comment.