mirror of
https://github.com/ant-design/ant-design.git
synced 2025-06-11 11:32:52 +08:00
chore: revert compile with lib (#38832)
* chore: revert compile with lib * chore: lib dekko test * fix: filename has spaces * chore: bump @ant-design/tools
This commit is contained in:
parent
870080bfd0
commit
b22ab1a83c
@ -1,23 +1,21 @@
|
|||||||
const fs = require('fs');
|
const fs = require('fs');
|
||||||
const path = require('path');
|
const path = require('path');
|
||||||
|
|
||||||
|
const restCssPath = path.join(process.cwd(), 'components', 'style', 'reset.css');
|
||||||
|
|
||||||
function finalizeCompile() {
|
function finalizeCompile() {
|
||||||
if (fs.existsSync(path.join(__dirname, './es'))) {
|
if (fs.existsSync(path.join(__dirname, './es'))) {
|
||||||
// Build less entry file: dist/antd.less
|
fs.copyFileSync(restCssPath, path.join(process.cwd(), 'es', 'style', 'reset.css'));
|
||||||
fs.copyFileSync(
|
}
|
||||||
path.join(process.cwd(), 'components', 'style', 'reset.css'),
|
|
||||||
path.join(process.cwd(), 'es', 'style', 'reset.css'),
|
if (fs.existsSync(path.join(__dirname, './lib'))) {
|
||||||
);
|
fs.copyFileSync(restCssPath, path.join(process.cwd(), 'lib', 'style', 'reset.css'));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function finalizeDist() {
|
function finalizeDist() {
|
||||||
if (fs.existsSync(path.join(__dirname, './dist'))) {
|
if (fs.existsSync(path.join(__dirname, './dist'))) {
|
||||||
// Build less entry file: dist/antd.less
|
fs.copyFileSync(restCssPath, path.join(process.cwd(), 'dist', 'reset.css'));
|
||||||
fs.copyFileSync(
|
|
||||||
path.join(process.cwd(), 'components', 'style', 'reset.css'),
|
|
||||||
path.join(process.cwd(), 'dist', 'reset.css'),
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
11
.github/workflows/test.yml
vendored
11
.github/workflows/test.yml
vendored
@ -250,6 +250,12 @@ jobs:
|
|||||||
path: node_modules
|
path: node_modules
|
||||||
key: node_modules-${{ hashFiles('**/package-temp-dir/package-lock.json') }}
|
key: node_modules-${{ hashFiles('**/package-temp-dir/package-lock.json') }}
|
||||||
|
|
||||||
|
- name: cache lib
|
||||||
|
uses: actions/cache@v3
|
||||||
|
with:
|
||||||
|
path: lib
|
||||||
|
key: lib-${{ github.sha }}
|
||||||
|
|
||||||
- name: cache es
|
- name: cache es
|
||||||
uses: actions/cache@v3
|
uses: actions/cache@v3
|
||||||
with:
|
with:
|
||||||
@ -258,6 +264,9 @@ jobs:
|
|||||||
|
|
||||||
- name: compile
|
- name: compile
|
||||||
run: npm run compile
|
run: npm run compile
|
||||||
|
|
||||||
|
- name: check
|
||||||
|
run: node ./tests/dekko/lib.test.js
|
||||||
needs: setup
|
needs: setup
|
||||||
|
|
||||||
compiled-module-test:
|
compiled-module-test:
|
||||||
@ -266,7 +275,7 @@ jobs:
|
|||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
react: ['16', '17', '18']
|
react: ['16', '17', '18']
|
||||||
module: [es]
|
module: [lib, es]
|
||||||
shard: ['1/2', '2/2']
|
shard: ['1/2', '2/2']
|
||||||
env:
|
env:
|
||||||
REACT: ${{ matrix.react }}
|
REACT: ${{ matrix.react }}
|
||||||
|
@ -33,12 +33,13 @@
|
|||||||
"files": [
|
"files": [
|
||||||
"dist",
|
"dist",
|
||||||
"es",
|
"es",
|
||||||
|
"lib",
|
||||||
"locale"
|
"locale"
|
||||||
],
|
],
|
||||||
"sideEffects": [
|
"sideEffects": [
|
||||||
"*.less"
|
"*.less"
|
||||||
],
|
],
|
||||||
"main": "dist/antd.js",
|
"main": "lib/index.js",
|
||||||
"module": "es/index.js",
|
"module": "es/index.js",
|
||||||
"unpkg": "dist/antd.min.js",
|
"unpkg": "dist/antd.min.js",
|
||||||
"typings": "es/index.d.ts",
|
"typings": "es/index.d.ts",
|
||||||
@ -59,7 +60,7 @@
|
|||||||
"pretest": "npm run version",
|
"pretest": "npm run version",
|
||||||
"predist": "npm run version",
|
"predist": "npm run version",
|
||||||
"presite": "npm run version && npm run collect-token-statistic",
|
"presite": "npm run version && npm run collect-token-statistic",
|
||||||
"compile": "npm run clean && antd-tools run compile-experimental",
|
"compile": "npm run clean && antd-tools run compile",
|
||||||
"changelog": "node ./scripts/print-changelog",
|
"changelog": "node ./scripts/print-changelog",
|
||||||
"predeploy": "antd-tools run clean && npm run site && cp CNAME _site && npm run site:test",
|
"predeploy": "antd-tools run clean && npm run site && cp CNAME _site && npm run site:test",
|
||||||
"deploy": "gh-pages -d _site -b gh-pages -f",
|
"deploy": "gh-pages -d _site -b gh-pages -f",
|
||||||
@ -77,7 +78,7 @@
|
|||||||
"lint:script": "eslint . --ext .js,.jsx,.ts,.tsx",
|
"lint:script": "eslint . --ext .js,.jsx,.ts,.tsx",
|
||||||
"pre-publish": "npm run test-all -- --skip-build",
|
"pre-publish": "npm run test-all -- --skip-build",
|
||||||
"prettier": "prettier -c --write **/*",
|
"prettier": "prettier -c --write **/*",
|
||||||
"pub": "npm run version && npm run collect-token-statistic && antd-tools run pub-experimental",
|
"pub": "npm run version && npm run collect-token-statistic && antd-tools run pub",
|
||||||
"rome:format": "rome format --write .",
|
"rome:format": "rome format --write .",
|
||||||
"prepublishOnly": "antd-tools run guard",
|
"prepublishOnly": "antd-tools run guard",
|
||||||
"postpublish": "node ./scripts/post-script.js",
|
"postpublish": "node ./scripts/post-script.js",
|
||||||
@ -157,7 +158,7 @@
|
|||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@ant-design/bisheng-plugin": "^3.3.0-alpha.4",
|
"@ant-design/bisheng-plugin": "^3.3.0-alpha.4",
|
||||||
"@ant-design/hitu": "^0.0.0-alpha.13",
|
"@ant-design/hitu": "^0.0.0-alpha.13",
|
||||||
"@ant-design/tools": "^16.0.0-alpha.3",
|
"@ant-design/tools": "^16.1.0-alpha.2",
|
||||||
"@docsearch/css": "^3.0.0",
|
"@docsearch/css": "^3.0.0",
|
||||||
"@emotion/babel-preset-css-prop": "^11.10.0",
|
"@emotion/babel-preset-css-prop": "^11.10.0",
|
||||||
"@emotion/css": "^11.10.5",
|
"@emotion/css": "^11.10.5",
|
||||||
|
60
tests/dekko/lib.test.js
Normal file
60
tests/dekko/lib.test.js
Normal file
@ -0,0 +1,60 @@
|
|||||||
|
const $ = require('dekko');
|
||||||
|
const chalk = require('chalk');
|
||||||
|
const path = require('path');
|
||||||
|
|
||||||
|
function getFileName(filePath) {
|
||||||
|
return filePath.slice(filePath.lastIndexOf(path.sep) + 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
$('lib').isDirectory().hasFile('index.js').hasFile('index.d.ts');
|
||||||
|
|
||||||
|
$('lib/*')
|
||||||
|
.filter(
|
||||||
|
(filename) =>
|
||||||
|
!filename.endsWith('index.js') &&
|
||||||
|
!filename.endsWith('index.d.ts') &&
|
||||||
|
!filename.endsWith('.map'),
|
||||||
|
)
|
||||||
|
.isDirectory()
|
||||||
|
.filter(
|
||||||
|
(filename) =>
|
||||||
|
!filename.endsWith('style') && !filename.endsWith('_util') && !filename.endsWith('locale'),
|
||||||
|
)
|
||||||
|
.hasFile('index.js')
|
||||||
|
.hasFile('index.d.ts');
|
||||||
|
|
||||||
|
// locale
|
||||||
|
|
||||||
|
const filterLocaleFile = (filePath) => {
|
||||||
|
const fileName = getFileName(filePath);
|
||||||
|
return (
|
||||||
|
!fileName.endsWith('index.js') &&
|
||||||
|
!fileName.endsWith('.d.ts') &&
|
||||||
|
!fileName.endsWith('.map') &&
|
||||||
|
!fileName.endsWith('style') &&
|
||||||
|
!fileName.includes('-') &&
|
||||||
|
!fileName.endsWith('LocaleReceiver.js') &&
|
||||||
|
!fileName.endsWith('context.js')
|
||||||
|
);
|
||||||
|
};
|
||||||
|
const localeFiles = $('lib/locale/*').filter(filterLocaleFile);
|
||||||
|
const localeProviderFiles = $('lib/locale-provider/*').filter(filterLocaleFile);
|
||||||
|
|
||||||
|
function compare(originFiles, targetFiles, targetPath) {
|
||||||
|
originFiles.assert(
|
||||||
|
`not exist in '${targetPath}'. Please use 'scripts/generateLegacyLocale.js' to refresh locale files.`,
|
||||||
|
(filePath) => {
|
||||||
|
const fileName = getFileName(filePath);
|
||||||
|
|
||||||
|
return targetFiles.filenames.some(
|
||||||
|
(targetFilePath) => getFileName(targetFilePath) === fileName,
|
||||||
|
);
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
compare(localeFiles, localeProviderFiles, '/locale-provider');
|
||||||
|
compare(localeProviderFiles, localeFiles, '/locale');
|
||||||
|
|
||||||
|
// eslint-disable-next-line no-console
|
||||||
|
console.log(chalk.green('✨ `lib` directory is valid.'));
|
Loading…
Reference in New Issue
Block a user