# taro微信小程序 **Repository Path**: migangxiaozi/taro-wechat-mini-program ## Basic Information - **Project Name**: taro微信小程序 - **Description**: 模板 - **Primary Language**: Unknown - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2024-07-11 - **Last Updated**: 2024-07-11 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README React Native Template for Taro ==== ## 需求 0. taro: `@tarojs/cli@^3.5.0` 1. 框架: 'react' 2. 本地taro版本 Taro v3.6.33 3. 本地react版本 react@18.3.1 ## 快速开始 ### 安装 React Native 库 > 安装 `@tarojs/taro-rn`、`@tarojs/components-rn` 和 `@tarojs/router-rn` 的 peerDependencies,它还会运行 `post-install`。当你更改 taro 版本时,请修改并运行 `upgradePeerdeps` 脚本。 > > **在项目初始化后运行此脚本。** ## 微信小程序相关命令 ### 启动开发服务器 在开发模式下启动微信小程序: npm run dev:weapp ## 构建微信小程序 构建微信小程序的生产版本: npm run build:weapp ## 预览微信小程序 使用微信开发者工具预览小程序: npm run preview:weapp ## 上传微信小程序 使用微信开发者工具上传小程序: npm run upload:weapp ## 清理构建目录 使用微信开发者工具上传小程序: npm run clean:weapp `yarn upgradePeerdeps` ### pod 安装 > 当你添加新的 React Native 库或更新 React Native 库版本时,请运行此脚本。 > > 详细信息请参阅 [pod-install](https://www.npmjs.com/package/pod-install)。 `yarn podInstall` ### 启动 iOS 应用 `yarn ios` ### 启动 Android 应用 `yarn android` ### 启动打包器 `yarn start` ### 更多信息 0. [Taro React Native 开发流程](https://taro-docs.jd.com/taro/docs/react-native) 1. [GitHub](https://github.com/NervJS/taro) ## 发布 ### 构建 iOS 包 `yarn build:rn --platform ios` ### 构建 Android 包 `yarn build:rn --platform android` ### 发布 iOS 应用 详细信息请参阅 [发布到 App Store](https://reactnative.cn/docs/publishing-to-app-store)。 ### 发布 Android APK 详细信息请参阅 [签名 APK](https://reactnative.cn/docs/signed-apk-android)。 ## GitHub Workflows > 使用 GitHub Actions 构建您的应用程序。此模板包含基本的 GitHub Action 配置。 详细信息请参阅 [.github/workflows](.github/workflows)。 ### 事件 默认情况下,当您在主分支上推送或拉取请求时,我们会为 Android 和 iOS 组装调试和发布产品。通过修改 [.github/workflows](.github/workflows) 文件来设计自己的工作流程。 详细信息请参阅 [触发工作流程的事件](https://docs.github.com/en/actions/reference/events-that-trigger-workflows)。 ### iOS #### 配置 修改以下配置项以打包和发布您的应用程序。 > [.github/workflows/assemble_ios_debug.yml](.github/workflows/assemble_ios_debug.yml) > [.github/workflows/assemble_ios_release.yml](.github/workflows/assemble_ios_release.yml) ```yml env: APP_ID: com.taro.demo # 应用程序包标识符 APP_NAME: Taro Demo # 应用程序的显示名称 VERSION_NUMBER: 1.0.0 # 应用程序版本号 BUILD_NUMBER: 1.0.0.0 # 仅用于发布的应用程序构建号。 TEAM_ID: XXXXXXXXXX # 团队 ID,在升级项目时使用 PROVISIONING_PROFILE_SPECIFIER: Product_profile # 用于代码签名的配置文件名称 CODE_SIGN_IDENTITY: iPhone Distribution # 代码签名身份类型(iPhone Developer、iPhone Distribution) SIGNING_CERTIFICATE_P12_DATA: ${{secrets.RELEASE_SIGNING_CERTIFICATE_P12_DATA}} SIGNING_CERTIFICATE_PASSWORD: ${{secrets.RELEASE_SIGNING_CERTIFICATE_PASSWORD}} PROVISIONING_PROFILE_DATA: ${{secrets.RELEASE_PROVISIONING_PROFILE_DATA}} APP_STORE_CONNECT_USERNAME: ${{secrets.APP_STORE_CONNECT_USERNAME}} # 此密钥应设置为您的开发者帐户的 Apple ID,仅用于发布。 APP_STORE_CONNECT_PASSWORD: ${{secrets.APP_STORE_CONNECT_PASSWORD}} # 仅用于发布。 ``` 类似 ${{secrets.xxxxx}} 的值是手动生成的,并存储在您的 GitHub 加密密钥中。 ##### SIGNING_CERTIFICATE_P12_DATA `cat Certificates.p12 | base64 | pbcopy` ##### SIGNING_CERTIFICATE_PASSWORD 您的个人信息交换 (.p12) 的加密密码 ##### PROVISIONING_PROFILE_DATA `cat profile.mobileprovision | base64 | pbcopy` ##### APP_STORE_CONNECT_PASSWORD 此密钥应设置为您的 Apple ID 帐户的应用程序特定密码。请按照 [这些说明](https://support.apple.com/en-us/HT204397) 创建一个应用程序特定密码。 #### 了解更多 1. [使用 GitHub Actions 将 iOS 应用发布到 TestFlight 或 App Store](https://betterprogramming.pub/deploy-an-ios-app-to-testflight-or-the-app-store-using-github-actions-c4d7082b1430) 2. [加密密钥](https://docs.github.com/en/actions/reference/encrypted-secrets) 3. [fastlane](https://docs.fastlane.tools/) ### Android #### 配置 修改以下配置项以打包和发布您的应用程序。 > [.github/workflows/assemble_android_debug.yml](.github/workflows/assemble_android_debug.yml) > [.github/workflows/assemble_android_release.yml](.github/workflows/assemble_android_release.yml) ```yml env: APP_ID: com.taro.demo # 应用程序包标识符 APP_NAME: Taro Demo # 应用程序的显示名称 APP_ICON: ic_launcher # 应用程序图标 APP_ROUND_ICON: ic_launcher_round # 应用程序圆形图标 APP_ABI_FILTERS: armeabi-v7a, arm64-v8a # 应用程序 ABI 过滤器 VERSION_NAME: 1.0.0 # 版本名称 VERSION_CODE: 10 # 版本代码 KEYSTORE_FILE: debug.keystore # 密钥库文件 KEYSTORE_PASSWORD: android # 密钥库密码 KEYSTORE_KEY_ALIAS: androiddebugkey # 密钥库密钥别名 KEYSTORE_KEY_PASSWORD: android # 密钥库密钥密码 ``` 为了您的应用程序的安全,请重新生成 .keystore 文件并将密码存储在您的 GitHub 加密密钥中。 #### 了解更多 1. [应用程序签名](https://developer.android.com/studio/publish/app-signing) 2. [加密密钥](https://docs.github.com/en/actions/reference/encrypted-secrets) ## 链接 0. [模板源代码](https://github.com/NervJS/taro-project-templates/tree/v3.1/react-native) 1. [示例项目](https://github.com/wuba/taro-react-native/tree/playground)