diff --git a/.gitignore b/.gitignore index 7993f8519c..f56e3aa29f 100644 --- a/.gitignore +++ b/.gitignore @@ -39,6 +39,9 @@ yarn-debug.log* yarn-error.log* pnpm-debug.log* +# Other lock files +pnpm-lock.*.yaml + # Editor directories and files .idea .vscode diff --git a/.pnpmfile.cjs b/.pnpmfile.cjs new file mode 100644 index 0000000000..0840426c34 --- /dev/null +++ b/.pnpmfile.cjs @@ -0,0 +1,22 @@ +function readPackage(pkg, context) { + if(pkg.name == '@nutui/nutui-react-taro') { + // console.log(pkg) + // delete pkg.devDependencies[] + // delete pkg.dependencies[] + } + if (pkg.name === '@nutui/nutui-taro-demo') { + delete pkg.dependencies['@jdreact/jdreact-jsbundle-commonpack'] + delete pkg.dependencies['@jdtaro/plugin-platform-jdhybrid'] + delete pkg.dependencies['@jdtaro/taro-platform-jdharmony'] + delete pkg.dependencies['@jdtaro/plugin-platform-jdharmony-cpp'] + delete pkg.dependencies['@dongdesign/inject-jd-platform-styles'] + } + return pkg; +} + +module.exports = { + hooks: { + readPackage, + }, +} + diff --git a/README.md b/README.md index 35209b73a1..521c49bc93 100644 --- a/README.md +++ b/README.md @@ -71,25 +71,55 @@ pnpm run dev # visit in browser: http:http://localhost:3000 (you don't have to open it manually if you've run it in the browser again) ``` -### running with mini-program +### running with Taro ```sh -# Clone repository +# Clone the repository git clone https://github.com/jdf2e/nutui-react.git -# Enter the project dictionary +# Navigate to the project root directory cd nutui-react # Install dependencies pnpm install -# Start development -# dir:packages/nutui-taro-demo/dist/weapp -pnpm run dev:taro:weapp +# Enter mini-program development mode +# Taro H5 +pnpm dev:taro h5 +# WeChat Mini Program +pnpm dev:taro weapp +# JD Mini Program +pnpm dev:taro jd +# For other platforms, refer to the scripts in the package.json file in the demo directory +``` + +### running with JDTaro + +1. Add a .npmrc file in the root directory of the repository with the following configuration: + +```shell +git-branch-lockfile=true +``` + +```sh +# Clone the repository +git clone https://github.com/jdf2e/nutui-react.git + +# Navigate to the project root directory +cd nutui-react + +# Install dependencies +pnpm install -# OR run as jd mini-program -# dir:packages/nutui-taro-demo/dist/jd -pnpm run dev:taro:jd +# Enter mini-program development mode +# Taro H5 +pnpm dev:jdtaro h5 +# WeChat Mini Program +pnpm dev:jdtaro weapp +# JD Mini Program +pnpm dev:jdtaro jd +# harmony cpp +pnpm dev:jdtaro:jdharmonycpp ``` ## Build Versions diff --git a/README_ZH.md b/README_ZH.md index 4aa857794e..4d3f637008 100644 --- a/README_ZH.md +++ b/README_ZH.md @@ -71,9 +71,9 @@ pnpm run dev ``` -### 本地运行小程序 +### 本地运行 Taro 相关的预览 -```sh +````sh # 克隆仓库 git clone https://github.com/jdf2e/nutui-react.git @@ -84,14 +84,46 @@ cd nutui-react pnpm install # 进入小程序开发模式 -# 访问:src/sites/mobile-taro/dist/weapp -pnpm run dev:taro:weapp - -# 其他小程序类似,如京东小程序 -# 访问:src/sites/mobile-taro/dist/jd -pnpm run dev:taro:jd +```shell +# Taro H5 +pnpm dev:taro h5 +# 微信小程序 +pnpm dev:taro weapp +# 京东小程序 +pnpm dev:taro jd +# 其他平台 参考 demo 目录中 package.json 的 script +```` + +### 本地运行 JDTaro 相关的预览 + +1. 仓库根目录下增加 .npmrc 文件,增加如下配置: + +```shell +git-branch-lockfile=true ``` +````sh +# 克隆仓库 +git clone https://github.com/jdf2e/nutui-react.git + +# 进入项目根目录 +cd nutui-react + +# 安装依赖 +pnpm install --ignore-pnpmfile + +# 进入小程序开发模式 +```shell +# Taro H5 +pnpm dev:jdtaro h5 +# 微信小程序 +pnpm dev:jdtaro weapp +# 京东小程序 +pnpm dev:jdtaro jd +# harmony cpp +pnpm dev:jdtaro:jdharmonycpp +```` + ## 构建版本 > AMD 环境、Webpack、Vite 等构建工具环境、服务端建议使用 es 版,非模块化环境(如通过 `