chore: fix ci in npm 8

This commit is contained in:
afc163 2021-12-03 23:54:08 +08:00
parent f0fb377d14
commit bcb5002f08
6 changed files with 52 additions and 17 deletions

View File

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

View File

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

View File

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

View File

@ -14,8 +14,31 @@ jobs:
- name: checkout - name: checkout
uses: actions/checkout@master 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 - name: install
run: npm install if: steps.node_modules_cache_id.outputs.cache-hit != 'true'
run: npm ci
- name: test - name: test
run: npm run test-image run: npm run test-image

View File

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

View File

@ -2,7 +2,7 @@
// This config is for building dist files // This config is for building dist files
const chalk = require('chalk'); const chalk = require('chalk');
const getWebpackConfig = require('@ant-design/tools/lib/getWebpackConfig'); 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 { BundleAnalyzerPlugin } = require('webpack-bundle-analyzer');
const { ESBuildMinifyPlugin } = require('esbuild-loader'); const { ESBuildMinifyPlugin } = require('esbuild-loader');
const DuplicatePackageCheckerPlugin = require('duplicate-package-checker-webpack-plugin'); const DuplicatePackageCheckerPlugin = require('duplicate-package-checker-webpack-plugin');
@ -103,9 +103,22 @@ function processWebpackThemeConfig(themeConfig, theme, vars) {
// apply ${theme} less variables // apply ${theme} less variables
injectLessVariables(config, vars); injectLessVariables(config, vars);
const themeReg = new RegExp(`${theme}(.min)?\\.js(\\.map)?$`);
// ignore emit ${theme} entry js & js.map file // 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,
},
}),
);
}); });
} }