Skip to content

Commit

Permalink
Merge branch 'dev-harmony' into feat/pulltorefresh-standard
Browse files Browse the repository at this point in the history
# Conflicts:
#	packages/nutui-taro-demo-rn/scripts/taro/adapted.js
#	packages/nutui-taro-demo-rn/src/app.config.ts
#	src/utils/use-touch.ts
  • Loading branch information
oasis-cloud committed Jul 23, 2024
2 parents 263eba9 + 830366d commit c0eea7d
Show file tree
Hide file tree
Showing 783 changed files with 28,890 additions and 24,877 deletions.
17 changes: 15 additions & 2 deletions .github/workflows/sync-h5.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,21 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: npm i fs-extra --force
- run: node scripts/copy-docs-h5-or-taro.js

- name: Install pnpm
run: corepack enable pnpm

- uses: actions/setup-node@v4
with:
node-version: '18'
cache: 'pnpm'

- name: Install dependencies
run: pnpm install

- name: Generate doc files
run: node scripts/copy-docs-h5-or-taro.js

- name : Sync
uses : JamesIves/[email protected]
with :
Expand Down
17 changes: 15 additions & 2 deletions .github/workflows/sync-migrate.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,21 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: npm i fs-extra --force
- run: node scripts/copy-migrate-from-v1.js

- name: Install pnpm
run: corepack enable pnpm

- uses: actions/setup-node@v4
with:
node-version: '18'
cache: 'pnpm'

- name: Install dependencies
run: pnpm install

- name: Copy migrate from v1
run: node scripts/copy-migrate-from-v1.js

- name : Sync
uses : JamesIves/[email protected]
with :
Expand Down
17 changes: 15 additions & 2 deletions .github/workflows/sync-taro.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,21 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: npm i fs-extra --force
- run: node scripts/copy-docs-h5-or-taro.js taro

- name: Install pnpm
run: corepack enable pnpm

- uses: actions/setup-node@v4
with:
node-version: '18'
cache: 'pnpm'

- name: Install dependencies
run: pnpm install

- name: Generate doc files
run: node scripts/copy-docs-h5-or-taro.js taro

- name : Sync
uses : JamesIves/[email protected]
with :
Expand Down
1 change: 1 addition & 0 deletions .npmrc
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@ strict-peer-dependencies=false
@jdtaro:registry=http://registry.m.jd.com/
@test:registry=http://registry.m.jd.com/
@jmfe:registry=http://registry.m.jd.com/
@dongdesign:registry=http://registry.m.jd.com/
73 changes: 69 additions & 4 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,68 @@
# v2.6.14
`2024-07-19`


* :sparkles: feat(menuitem): 新增css类名,增强自定义样式能力 (#2443) @Alex-huxiyang
* :sparkles: feat(empty): add css variable nutui-empty-background-color (#2451) @Alex-huxiyang
* :sparkles: feat(infiniteLoading): 继承 scrollView 的 props 类型 (#2441) @oasis-cloud
* :bug: fix(cascader): 初始化设置value未成功选中 (#2435) @Alex-huxiyang
* :bug: fix(swiper): display abnormal when dir = 'rtl' (#2454) @Alex-huxiyang
* :bug: fix(form): 兼容校验时机 (#2437) @Alex-huxiyang
* :bug: fix(form): 在FromInstance增加validateFields方法的定义 (#2450) @jinjl


# v2.6.13
`2024-07-12`


* :sparkles: feat: tabs滚动条兼容火狐浏览器 (#2431) @JoanneXu6677
* :sparkles: feat(drag): add the ability to support onDrag, onDragStart, onDragEnd callbacks (#2418) @Alex-huxiyang
* :bug: fix(formItem): validateTrigger无法正确触发校验 (#2433) @Alex-huxiyang
* :bug: fix: 日历组件滚动到顶部时 出现空白问题 (#2409) @522109452
* :bug: fix(imagepreview): 无法在预期情景正确关闭图片的异常 (#2421) @Alex-huxiyang


# v2.6.12
`2024-07-05`


* :sparkles: feat: add pagination whether to show pages in imagepreview (#2411) @xiaoyatong
* :bug: fix(uploader): pre-upload pmage preview bug (#2416) @Alex-huxiyang
* :bug: fix(taro-form-demo): 点击演示demo表单内的重置会触发提交表单事件bug修复 (#2415) @Skedush
* :bug: fix(form): validator 中的 value 类型更新为 any (#2406) @oasis-cloud
* :bug: fix(uploader): 京东小程序中可上传时可选择图片和视频 (#2410) @xueshufive
* :bug: fix(avatarcropper): 报错 (#2364) @Alex-huxiyang
* :bug: fix(form): setFields未触发校验 (#2400) @Alex-huxiyang


# v2.6.11
`2024-06-28`


* :sparkles: feat(table): table新增自定义行 (#2390) @zanyuki-jd
* :bug: fix(fixednav): 可拖拽元素样式缺失 (#2391) @oasis-cloud


# v2.6.10
`2024-06-21`


* 🏡 chore: 文档未来规范 (#2373) @Alex-huxiyang
* 🤖 ci: 统一使用 pnpm @oasis-cloud
* :sparkles: feat(tabpane): 增添修改tabpane背景色的主题变量 (#2366) @Alex-huxiyang
* :bug: fix(tabs): 修复tabs异步设置titles滚动失效(#2351) (#2369) @ShuchenEason
* :bug: fix: umd 中替换环境变量 (#2368) @oasis-cloud


# v2.6.9
`2024-06-14`


* :sparkles: feat(form): footer 容器增加 className (#2345) @oasis-cloud
* :bug: fix: 解决Drag组件拖拽后会在原地留一个遮挡元素问题+解决weapp/taro-h5多个demo拖拽位置不正确问题 (#2330) @irisSong
* :bug: fix(searchbar): 修复 clear 时未触发 change 的问题 (#2262) @eiinu


# v2.6.8
`2024-05-31`

Expand Down Expand Up @@ -37,12 +102,12 @@
`2024-05-17`


*🏡 chore(image): 官网taro的demo显示与h5不一致 (#2244) @Alex.huxiyang
*🏡 chore(image): 官网taro的demo显示与h5不一致 (#2244) @Alex-huxiyang
* :bug: fix(circleprogress): update demo (#2260) @Eiinu
* :bug: fix: 移除 defaultProps(2) (#2254) @Eiinu
* :bug: fix: 关于checkbox&tabs的doc与demo修改 (#2253) @Alex.huxiyang
* :bug: fix(table): 修复部分由于场景下width未生效导致的一些问题 (#2241) @Alex.huxiyang
* :bug: fix(menu): 选项文字很多时右侧箭头展示异常 (#2252) @Alex.huxiyang
* :bug: fix: 关于checkbox&tabs的doc与demo修改 (#2253) @Alex-huxiyang
* :bug: fix(table): 修复部分由于场景下width未生效导致的一些问题 (#2241) @Alex-huxiyang
* :bug: fix(menu): 选项文字很多时右侧箭头展示异常 (#2252) @Alex-huxiyang
* :bug: fix(input): 修复特殊场景下自动清除失效问题 (#2240) @Eiinu


Expand Down
23 changes: 19 additions & 4 deletions gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,27 +4,42 @@ const postcss = require('gulp-postcss')
const rename = require('gulp-rename')
const cssvariables = require('postcss-css-variables')
const insert = require('gulp-insert')
const config = require('./src/config.json')

const argvs = process.argv.splice(4)[0]?.split('/') || []

const adaptedNameArray = []
// eslint-disable-next-line array-callback-return
config.nav.map((item) => {
item.packages.forEach((element) => {
const { name, version } = element
if (version !== '3.0.0') return // 未适配不导出
adaptedNameArray.push(name.toLowerCase())
})
})
const argvs = process.argv.splice(4)[0]?.split('/') || adaptedNameArray
console.log(argvs, 'argvs')

// 监视频率 https://www.martin-brennan.com/gulp-watch-high-cpu-usage/
const interval = { interval: 500 }
// 监视文件变化
gulp.task('watch', function () {
argvs.forEach((argv) => {
gulp.watch(
`src/packages/${argv}/demos/taro/*`,
interval,
gulp.series(`${argv}copyDemo`)
)
gulp.watch(
`src/packages/${argv}/*.scss`,
interval,
gulp.series(`${argv}sass`, `${argv}copyCss`)
)
gulp.watch(
`src/packages/${argv}/demo.taro.tsx`,
interval,
gulp.series(`${argv}copyTaroDemo`)
)
gulp.watch(
`src/packages/${argv}/${argv}.taro.tsx`,
interval,
gulp.series(`${argv}copyTaro`)
)
})
Expand All @@ -33,13 +48,13 @@ gulp.task('watch', function () {
argvs.map((argv) => {
watchTasks.push(...[`${argv}sass`, `${argv}copyCss`])
})
console.log(watchTasks.join(','), 'watchTasks')
gulp.watch(
[
`src/styles/variables.scss`,
'src/styles/mixins/text-ellipsis.scss',
'src/styles/theme-default.scss',
],
interval,
gulp.series(watchTasks)
)
})
Expand Down
Binary file added jdtaro-plugin-platform-jdrn-1.0.9.tgz
Binary file not shown.
33 changes: 21 additions & 12 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@test/nutui-react-taro",
"version": "3.0.0-alpha.0",
"name": "@dongdesign/components",
"version": "1.0.1",
"style": "dist/style.css",
"main": "dist/nutui.react.umd.js",
"module": "dist/es/packages/nutui.react.build.js",
Expand Down Expand Up @@ -42,7 +42,7 @@
],
"publishConfig": {
"access": "public",
"registry": "https://registry.npmjs.org/"
"registry": "http://registry.m.jd.com/"
},
"scripts": {
"add": "node scripts/create-component-mode.js && npm run prepare",
Expand All @@ -60,13 +60,16 @@
"dev:theme": "npm run generate:themes-dev && npm run checked && vite --force --config vite.config.theme.ts",
"dev:taro:weapp": "pnpm --dir ./packages/nutui-taro-demo dev:weapp",
"dev:taro:jd": "pnpm --dir ./packages/nutui-taro-demo dev:jd",
"build:taro:jd": "pnpm --dir ./packages/nutui-taro-demo build:jd",
"dev:taro:h5": "pnpm --dir ./packages/nutui-taro-demo dev:h5",
"dev:taro:h5:jmapp": "pnpm --dir ./packages/nutui-taro-demo dev:h5:jmapp",
"dev:taro:alipay": "pnpm --dir ./packages/nutui-taro-demo dev:alipay",
"dev:taro:harmony": "pnpm --dir ./packages/nutui-taro-demo dev:harmony",
"dev:taro:jdharmony": "pnpm --dir ./packages/nutui-taro-demo dev:jdharmony",
"dev:taro:jdhybrid": "pnpm --dir ./packages/nutui-taro-demo-rn dev:jdhybrid",
"rn:copy": "node ./scripts/rn/copy-file.js",
"dev:taro:rn": "pnpm --dir ./packages/nutui-taro-demo-rn dev:jdrn & pnpm run gulp:watch",
"dev:taro:jdrn": "pnpm run rn:copy && pnpm --dir ./packages/nutui-taro-demo-rn dev:jdrn & pnpm run gulp:watch",
"dev:taro:rn:dark": "THEME=dark pnpm dev:taro:rn",
"gulp:watch": "gulp watch --environment",
"dev:taro:weapp:jmapp": "pnpm --dir ./packages/nutui-taro-demo && npm run dev:weapp:jmapp",
"test": "vitest --coverage",
Expand Down Expand Up @@ -105,21 +108,27 @@
"react-transition-group": "^4.4.5"
},
"devDependencies": {
"@babel/plugin-proposal-class-properties": "^7.18.6",
"@commitlint/cli": "^19.0.3",
"@commitlint/config-conventional": "^19.0.3",
"@loadable/component": "^5.16.3",
"@mdx-js/mdx": "^3.0.1",
"@mdx-js/react": "^3.0.1",
"@mdx-js/rollup": "^3.0.1",
"@pmmmwh/react-refresh-webpack-plugin": "0.5.10",
"@rollup/plugin-babel": "^6.0.4",
"@rollup/plugin-commonjs": "^26.0.1",
"@rollup/plugin-node-resolve": "15.2.3",
"@rollup/plugin-typescript": "^11.1.6",
"@swc/core": "^1.4.8",
"@tarojs/components": "4.0.0-beta.90",
"@tarojs/plugin-platform-alipay": "4.0.0-beta.90",
"@tarojs/plugin-platform-weapp": "4.0.0-beta.90",
"@tarojs/react": "4.0.0-beta.90",
"@tarojs/taro": "4.0.0-beta.90",
"@tarojs/components": "^4.0.0-alpha.34",
"@tarojs/plugin-platform-alipay": "^4.0.0-alpha.34",
"@tarojs/plugin-platform-weapp": "^4.0.0-alpha.34",
"@tarojs/react": "^4.0.0-alpha.34",
"@tarojs/taro": "^4.0.0-alpha.34",
"@testing-library/jest-dom": "^6.4.2",
"@testing-library/react": "^15.0.4",
"@testing-library/react": "^16.0.0",
"@types/fs-extra": "^11.0.4",
"@types/loadable__component": "^5.13.8",
"@types/lodash.isequal": "^4.5.8",
"@types/lodash.kebabcase": "^4.1.9",
Expand Down Expand Up @@ -148,7 +157,7 @@
"eslint-plugin-prettier": "^5.1.3",
"eslint-plugin-react": "^7.33.2",
"eslint-plugin-react-hooks": "^4.6.0",
"eslint-plugin-unused-imports": "^3.1.0",
"eslint-plugin-unused-imports": "^4.0.0",
"fs-extra": "^11.2.0",
"glob": "^10.3.10",
"gulp": "^5.0.0",
Expand All @@ -157,7 +166,7 @@
"gulp-rename": "^2.0.0",
"gulp-replace": "^1.1.4",
"gulp-sass": "^5.1.0",
"happy-dom": "^13.9.0",
"happy-dom": "^14.2.0",
"highlight.js": "^11.9.0",
"husky": "^9.0.11",
"inquirer": "^8.2.6",
Expand Down
26 changes: 25 additions & 1 deletion packages/nutui-codemod/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
一组帮助你升级到 NutUI React 2.x 的 codemod 脚本集合,基于 [jscodeshift](https://github.com/facebook/jscodeshift) 构建。

## 安装和使用
在运行 codemod 脚本钱,请先提交你本地代码的修改。
在运行 codemod 脚本前,请先提交你本地代码的修改。

### 针对 @nutui/nutui-react 的升级可采用下面的脚本
```shell
Expand Down Expand Up @@ -82,3 +82,27 @@ const App = () => {
export default App

```

`package-name-migration`
- 包名替换

```shell
# 使用 npx 直接运行
npx -p @nutui/nutui-react-codemod nutui-react-codemod src -taro -internal

# 或者使用 pnpm 直接运行
pnpm --package=@nutui/nutui-react-codemod dlx nutui-react-codemod src -taro -internal
```

```diff
- import { Button, Collapse } from "@nutui/nutui-react-taro";
- import { Cell } from '@nutui/nutui-react-taro/dist/components/cell/index';
- import '@nutui/nutui-react-taro/dist/components/cell/index';
- import "@nutui/nutui-react-taro/dist/style.css";
- import NutUI from "@nutui/nutui-react-taro";
+ import { Button, Collapse } from "@dongdesign/components";
+ import { Cell } from "@dongdesign/components/dist/components/cell/index";
+ import "@dongdesign/components/dist/components/cell/index";
+ import "@dongdesign/components/dist/style.css";
+ import NutUI from "@dongdesign/components";
```
2 changes: 2 additions & 0 deletions packages/nutui-codemod/bin/cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ const transformers = [
'icon-migration',
'props-changed-migration',
]
process.argv.indexOf('-internal') > -1 &&
transformers.push('package-name-migration')
const transformersDir = path.join(__dirname, '../transforms')
const ignoreConfig = path.join(__dirname, './codemod.ignore')

Expand Down
2 changes: 2 additions & 0 deletions packages/nutui-codemod/bin/config/index.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
const pkgVersion = process.argv.indexOf('-taro') > -1 ? 'taro' : 'h5'
const pkgInfo = {
h5: {
dongDesign: '@dongdesign/ui',
icon: '@nutui/icons-react',
ui: '@nutui/nutui-react',
},
taro: {
dongDesign: '@dongdesign/ui',
icon: '@nutui/icons-react-taro',
ui: '@nutui/nutui-react-taro',
},
Expand Down
15 changes: 15 additions & 0 deletions packages/nutui-codemod/transforms/package-name-migration.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
const findImportDeclaration = require('./utils/find-importDeclaration')

module.exports = (file, api, options) => {
const j = api.jscodeshift
const root = j(file.source)
const literals = findImportDeclaration(j, root, options.pkgInfo)
literals.forEach((path) => {
path.node.source.value = path.node.source.value.replace(
options.pkgInfo.ui,
options.pkgInfo.dongDesign
)
})

return root.toSource()
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
function findImportDeclaration(j, pathCollection, pkgInfo) {
return pathCollection.find(j.ImportDeclaration).filter((path) => {
return path.node.source && path.node.source.value.indexOf(pkgInfo.ui) !== -1
})
}

module.exports = findImportDeclaration
Loading

0 comments on commit c0eea7d

Please sign in to comment.