Browse Source

fix: missing `default.css` (#32116)

* chore: Add CI for compile

* chore: Add missing compile file
pull/32131/head
二货机器人 3 years ago
committed by GitHub
parent
commit
020c4ba7d0
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 22
      .antd-tools.config.js
  2. 40
      .github/workflows/test.yml
  3. 2
      package.json
  4. 2
      tests/dekko/lib.test.js

22
.antd-tools.config.js

@ -35,24 +35,6 @@ function finalizeCompile() {
);
});
}
// Create entry for babel plugin import
function patchEntry(styleEntry) {
if (fs.existsSync(styleEntry)) {
fs.writeFileSync(
path.join(styleEntry, 'style', 'index-default.less'),
[
// Inject variable
'@root-entry-name: default;',
// Point to origin file
"@import './index';",
].join('\n'),
);
}
}
patchEntry(path.join(process.cwd(), 'lib'));
patchEntry(path.join(process.cwd(), 'es'));
}
function buildThemeFile(theme, vars) {
@ -154,6 +136,7 @@ function needTransformStyle(content) {
module.exports = {
compile: {
includeLessFile: [/(\/|\\)components(\/|\\)style(\/|\\)default.less$/],
transformTSFile(file) {
if (isComponentStyleEntry(file)) {
let content = file.contents.toString();
@ -162,8 +145,7 @@ module.exports = {
const cloneFile = file.clone();
// Origin
content = content.replace('../../style/index.less', '../../style/index-default.less');
// content = content.replace('./index.less', './index-default.less');
content = content.replace('../../style/index.less', '../../style/default.less');
cloneFile.contents = Buffer.from(content);
return cloneFile;

40
.github/workflows/test.yml

@ -454,3 +454,43 @@ jobs:
env:
LIB_DIR: dist
needs: setup
style:
name: style compile
runs-on: ubuntu-latest
steps:
- name: checkout
uses: actions/checkout@master
- name: restore cache from package-lock.json
uses: actions/cache@v2
with:
path: package-temp-dir
key: lock-${{ github.sha }}
- name: restore cache from node_modules
uses: actions/cache@v2
with:
path: node_modules
key: node_modules-${{ hashFiles('**/package-temp-dir/package-lock.json') }}
- name: compile
run: npm run compile
- name: dist
run: npm run dist
env:
NODE_OPTIONS: --max_old_space_size=4096
- name: lessc default
run: npx lessc --js ./dist/antd.less
- name: lessc dark
run: npx lessc --js ./dist/antd.dark.less
- name: lessc variable
run: npx lessc --js ./dist/antd.variable.less
- name: lessc component
run: npx lessc --js ./es/button/style/index.less
needs: setup

2
package.json

@ -153,7 +153,7 @@
"devDependencies": {
"@ant-design/bisheng-plugin": "^2.3.0",
"@ant-design/hitu": "^0.0.0-alpha.13",
"@ant-design/tools": "^14.0.0-alpha.2",
"@ant-design/tools": "^14.0.0-alpha.3",
"@docsearch/css": "^3.0.0-alpha.39",
"@docsearch/react": "^3.0.0-alpha.39",
"@qixian.cs/github-contributors-list": "^1.0.3",

2
tests/dekko/lib.test.js

@ -8,6 +8,8 @@ function getFileName(filePath) {
$('lib').isDirectory().hasFile('index.js').hasFile('index.d.ts');
$('lib/style').isDirectory().hasFile('index.css').hasFile('default.css');
$('lib/*')
.filter(
filename =>

Loading…
Cancel
Save