React Native与Microsoft App Center的单体代码库

4

我该如何使用单体库在AppCenter上构建/分发React Native应用程序? 我已经尝试了Lerna和nx,但都没有成功。

2个回答

0

我还没有尝试过使用NX,只是用Lerna。我能够在post-clone脚本中完成。

我的项目设置如下:

packages

  • backend
  • reactnativeapp
  • shared

我选择React Native应用程序包/目录中的package.json:

package.json within app center

这是 appcenter-post-clone.sh 构建脚本,代码中包含适当的注释:

#!/usr/bin/env bash

# Create fake yarn lock so appcenter uses Yarn instead of npm install
touch yarn.lock

# Navigate to root directory
cd ../../

# Add global dependencies 
yarn global add @aws-amplify/cli # for aws amplify - exclude if not using
yarn global add lerna

# Private github package permissions - exclude or update based on your needs
npm config set @apptractive:registry https://npm.pkg.github.com
npm config set always-auth true
npm config set //https://npm.pkg.github.com/:_authToken="${NPM_AUTH_TOKEN}"

# Install dependencies using Lerna
yarn run bootstrap --include-dependencies

# Copy RN CLI that Ms App Center depends on
mkdir -p packages/reactnativeapp/node_modules/react-native/local-cli/
cp node_modules/react-native/local-cli/cli.js packages/reactnativeapp/node_modules/react-native/local-cli/cli.js

# Build other packages within monorepo that React Native depends on
cd packages/shared && yarn build

我在App Center Github issue上发布了更多详细信息,特别是如果你也在使用AWS Amplify


0

我正在使用NX React Native和MS App Center。我做了很多解决方法来使它工作。在我看来,如果你使用NX,请避免使用MS App Center。


网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接