Browse Source

chore: fix ci in npm 8

pull/33156/head
afc163 3 years ago
parent
commit
bcb5002f08
  1. 4
      .github/workflows/preview-build.yml
  2. 2
      .github/workflows/site-deploy.yml
  3. 4
      .github/workflows/test.yml
  4. 25
      .github/workflows/ui.yml
  5. 15
      package.json
  6. 19
      webpack.config.js

4
.github/workflows/preview-build.yml

@ -2,7 +2,7 @@
name: Preview Build
on:
on:
pull_request:
types: [opened, synchronize, reopened]
@ -22,7 +22,7 @@ jobs:
key: lock-${{ github.sha }}
- name: create package-lock.json
run: npm i --package-lock-only
run: npm i --package-lock-only --ignore-scripts
- name: hack for single file
run: |

2
.github/workflows/site-deploy.yml

@ -19,7 +19,7 @@ jobs:
key: lock-${{ github.sha }}
- name: create package-lock.json
run: npm i --package-lock-only
run: npm i --package-lock-only --ignore-scripts
- name: hack for single file
run: |

4
.github/workflows/test.yml

@ -18,7 +18,7 @@ jobs:
key: lock-${{ github.sha }}
- name: create package-lock.json
run: npm i --package-lock-only
run: npm i --package-lock-only --ignore-scripts
- name: hack for single file
run: |
@ -496,4 +496,4 @@ jobs:
- name: lessc mixins
run: npx lessc --js ./es/style/mixins/index.less
needs: setup
needs: setup

25
.github/workflows/ui.yml

@ -14,8 +14,31 @@ jobs:
- name: checkout
uses: actions/checkout@master
- name: cache package-lock.json
uses: actions/cache@v2
with:
path: package-temp-dir
key: lock-${{ github.sha }}
- name: create package-lock.json
run: npm i --package-lock-only --ignore-scripts
- name: hack for single file
run: |
if [ ! -d "package-temp-dir" ]; then
mkdir package-temp-dir
fi
cp package-lock.json package-temp-dir
- name: cache node_modules
id: node_modules_cache_id
uses: actions/cache@v2
with:
path: node_modules
key: node_modules-${{ hashFiles('**/package-temp-dir/package-lock.json') }}
- name: install
run: npm install
if: steps.node_modules_cache_id.outputs.cache-hit != 'true'
run: npm ci
- name: test
run: npm run test-image

15
package.json

@ -98,7 +98,7 @@
"site:test": "jest --config .jest.site.js --cache=false --force-exit",
"test-image": "npm run dist && docker-compose run tests",
"version": "node ./scripts/generate-version",
"install-react-16": "npm i --no-save react@16 react-dom@16 react-test-renderer@16 enzyme-adapter-react-16",
"install-react-16": "npm i --no-save --legacy-peer-deps react@16 react-dom@16 react-test-renderer@16 enzyme-adapter-react-16",
"argos": "argos upload imageSnapshots"
},
"browserslist": [
@ -157,7 +157,7 @@
"devDependencies": {
"@ant-design/bisheng-plugin": "^3.0.1",
"@ant-design/hitu": "^0.0.0-alpha.13",
"@ant-design/tools": "^14.0.0-alpha.3",
"@ant-design/tools": "^14.0.2",
"@docsearch/css": "^3.0.0-alpha.39",
"@docsearch/react": "^3.0.0-alpha.39",
"@qixian.cs/github-contributors-list": "^1.0.3",
@ -192,6 +192,7 @@
"cheerio": "^1.0.0-rc.3",
"concurrently": "^6.0.0",
"cross-env": "^7.0.0",
"css-minimizer-webpack-plugin": "^3.2.0",
"dekko": "^0.2.1",
"docsearch.js": "^2.6.3",
"duplicate-package-checker-webpack-plugin": "^3.0.0",
@ -218,7 +219,6 @@
"http-server": "^14.0.0",
"husky": "^7.0.1",
"identity-obj-proxy": "^3.0.0",
"ignore-emit-webpack-plugin": "^2.0.6",
"immer": "^9.0.1",
"immutability-helper": "^3.0.0",
"inquirer": "^8.0.0",
@ -232,15 +232,16 @@
"jsonml.js": "^0.1.0",
"less-vars-to-js": "^1.3.0",
"lz-string": "^1.4.4",
"mini-css-extract-plugin": "^2.4.5",
"mockdate": "^3.0.0",
"open": "^8.0.1",
"prettier": "^2.3.2",
"prettier-plugin-jsdoc": "^0.3.0",
"pretty-quick": "^3.0.0",
"querystring": "^0.2.0",
"qs": "^6.10.1",
"rc-footer": "^0.6.6",
"rc-tween-one": "^3.0.3",
"rc-virtual-list": "^3.2.4",
"rc-virtual-list": "^3.4.2",
"react": "^17.0.1",
"react-color": "^2.17.3",
"react-copy-to-clipboard": "^5.0.1",
@ -260,13 +261,12 @@
"react-sticky": "^6.0.3",
"react-test-renderer": "^17.0.1",
"react-text-loop-next": "0.0.3",
"react-virtualized": "^9.22.0",
"react-window": "^1.8.5",
"remark": "^14.0.1",
"remark-cli": "^10.0.0",
"remark-lint": "^9.0.0",
"remark-preset-lint-recommended": "^6.0.0",
"reqwest": "^2.0.5",
"remove-files-webpack-plugin": "^1.4.5",
"rimraf": "^3.0.0",
"scrollama": "^2.0.0",
"simple-git": "^2.23.0",
@ -281,7 +281,6 @@
"typescript": "~4.5.2",
"webpack-bundle-analyzer": "^4.1.0",
"xhr-mock": "^2.4.1",
"xhr2": "^0.2.0",
"yaml-front-matter": "^4.0.0"
},
"peerDependencies": {

19
webpack.config.js

@ -2,7 +2,7 @@
// This config is for building dist files
const chalk = require('chalk');
const getWebpackConfig = require('@ant-design/tools/lib/getWebpackConfig');
const IgnoreEmitPlugin = require('ignore-emit-webpack-plugin');
const RemovePlugin = require('remove-files-webpack-plugin');
const { BundleAnalyzerPlugin } = require('webpack-bundle-analyzer');
const { ESBuildMinifyPlugin } = require('esbuild-loader');
const DuplicatePackageCheckerPlugin = require('duplicate-package-checker-webpack-plugin');
@ -103,9 +103,22 @@ function processWebpackThemeConfig(themeConfig, theme, vars) {
// apply ${theme} less variables
injectLessVariables(config, vars);
const themeReg = new RegExp(`${theme}(.min)?\\.js(\\.map)?$`);
// ignore emit ${theme} entry js & js.map file
config.plugins.push(new IgnoreEmitPlugin(themeReg));
config.plugins.push(
new RemovePlugin({
after: {
root: './dist',
include: [
`antd.${theme}.js`,
`antd.${theme}.js.map`,
`antd.${theme}.min.js`,
`antd.${theme}.min.js.map`,
],
log: false,
logWarning: false,
},
}),
);
});
}

Loading…
Cancel
Save