Skip to content

Commit

Permalink
refactor: remove special handling for rntaro's environment configurat…
Browse files Browse the repository at this point in the history
…ion and component (jdf2e#2934)
  • Loading branch information
irisSong authored Jan 13, 2025
1 parent 010f96d commit 44053c0
Show file tree
Hide file tree
Showing 84 changed files with 180 additions and 715 deletions.
130 changes: 0 additions & 130 deletions gulpfile.js

This file was deleted.

4 changes: 1 addition & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,11 +51,9 @@
"checked:taro": "npm run generate:file:taro && tsc --project ./tsconfig.taro.json --noEmit",
"changelog": "node ./scripts/generate-changelog.js",
"clone:jdharmony": "node ./scripts/harmony/clone-jdharmony.js",
"clone:rn": "pnpm run update:taro:entry && node ./scripts/rn/copy-file.js",
"dev": "vite --open --force",
"dev:rtl": "VITE_RTL=rtl vite --open --force",
"dev:jrkf": "VITE_APP_PROJECT_ID=jrkf vite --open --force",
"dev:taro:jdrn": "pnpm run clone:rn && pnpm --dir ./packages/nutui-taro-demo dev:jdrn",
"dev:taro:rn:dark": "THEME=dark pnpm dev:taro:rn",
"dev:taro": "pnpm run update:taro:entry && pnpm --dir ./packages/nutui-taro-demo dev",
"dev:taro:h5": "pnpm dev:taro h5",
Expand Down Expand Up @@ -93,7 +91,7 @@
"e2e:open:h5": "start-server-and-test dev http://localhost:5173/ cypress:open",
"e2e:run:taro": "start-server-and-test dev:taro:h5 http://localhost:10086 cypress:run:taro",
"e2e:open:taro": "start-server-and-test dev:taro:h5 http://localhost:10086 cypress:open:taro",
"update:taro:entry": "node ./scripts/rn/update-taro-entry",
"update:taro:entry": "node ./scripts/harmony/update-taro-entry",
"upgradeTaro": "pnpm --dir ./packages/nutui-taro-demo upgradeTaro"
},
"lint-staged": {
Expand Down
5 changes: 1 addition & 4 deletions packages/nutui-taro-demo/babel.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,7 @@ module.exports = {
],
],
plugins: [
!(process.env.TARO_ENV === 'rn' || process.env.TARO_ENV === 'jdrn') && [
'@babel/plugin-transform-typescript',
{ allowDeclareFields: true },
],
['@babel/plugin-transform-typescript', { allowDeclareFields: true }],
projectID === 'jmapp' && [
replaceIcons({
sourceLibrary: ['@nutui/icons-react-taro', '@nutui/icons-react'],
Expand Down
23 changes: 1 addition & 22 deletions packages/nutui-taro-demo/config/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,20 +10,14 @@ if (projectID) {
themeStr = `src/styles/theme-${projectID}.scss`
}

let plugins = !['harmony', 'jdharmony', 'rn', 'jdrn'].includes(
process.env.TARO_ENV
)
let plugins = !['harmony', 'jdharmony'].includes(process.env.TARO_ENV)
? ['@tarojs/plugin-html']
: []

if (process.env.TARO_ENV === 'harmony') {
plugins.push('@tarojs/plugin-platform-harmony-ets')
}

if ((process.env.TARO_ENV === 'rn' || process.env.TARO_ENV === 'jdrn') && JD) {
plugins.push('@jdtaro/plugin-platform-jdrn')
}

// 小程序、jd H5 通过此插件覆盖
if (
(process.env.TARO_ENV === 'weapp' ||
Expand Down Expand Up @@ -255,21 +249,6 @@ const config = {
},
},
},
rn: {
appName: 'JDReactAPIDemos',
postcss: {
'postcss-css-variables': {
enable: true,
config: {
// variables: {
// '--nutui-color-primary': '#000',
// '--nutui-color-primary-stop-1': '#000',
// '--nutui-color-primary-stop-2': '#000',
// },
},
},
},
},
isWatch: true,
}

Expand Down
2 changes: 0 additions & 2 deletions packages/nutui-taro-demo/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@
"dev:jdharmony": "pnpm exec taro build native-components --type jdharmony",
"dev:jdharmonycpp": "pnpm exec taro build native-components --type jdharmony_cpp",
"dev:jdhybrid": "npm run build:jdhybrid -- --watch",
"dev:jdrn": "node ./scripts/taro/generate-nutui-taro.js && taro build --type jdrn --watch --reset-cache",
"dev:quickapp": "npm run build:quickapp -- --watch",
"dev:weapp:jmapp": "VITE_APP_PROJECT_ID=jmapp npm run build:weapp -- --watch ",
"dev:swan:jmapp": "VITE_APP_PROJECT_ID=jmapp npm run build:swan -- --watch",
Expand All @@ -59,7 +58,6 @@
"dependencies": {
"@babel/runtime": "^7.23.9",
"@dongdesign/inject-jd-platform-styles": "1.0.4",
"@jdreact/jdreact-jsbundle-commonpack": "1.0.425",
"@jdtaro/plugin-platform-jdhybrid": "0.2.1",
"@jdtaro/taro-platform-jdharmony": "2.0.70",
"@jdtaro/plugin-platform-jdharmony-cpp": "0.1.4-alpha.3",
Expand Down
82 changes: 0 additions & 82 deletions packages/nutui-taro-demo/scripts/taro/generate-nutui-taro.js

This file was deleted.

10 changes: 4 additions & 6 deletions packages/nutui-taro-demo/src/app.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
import { Component } from 'react'
import Taro from '@tarojs/taro'
import './app.scss'

if (Taro.getEnv() !== 'RN') {
import('@/sites/assets/styles/reset.scss');
import('@/packages/nutui.react.scss.taro');
import('@nutui/touch-emulator');
}
import('@/sites/assets/styles/reset.scss')
import('@/packages/nutui.react.scss.taro')
import('@nutui/touch-emulator')

// console.log(NutUI)
class App extends Component {
render() {
Expand Down
File renamed without changes.
Loading

0 comments on commit 44053c0

Please sign in to comment.