diff --git a/.antd-tools.config.js b/.antd-tools.config.js index 4fddb635f2..7a5bec3673 100644 --- a/.antd-tools.config.js +++ b/.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; diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 84ff65ecf0..1100b3bc76 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -453,4 +453,44 @@ jobs: run: npm test 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 \ No newline at end of file diff --git a/package.json b/package.json index 228498e5b3..33b7735a28 100644 --- a/package.json +++ b/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", diff --git a/tests/dekko/lib.test.js b/tests/dekko/lib.test.js index b7043ffa10..fb7be23135 100644 --- a/tests/dekko/lib.test.js +++ b/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 =>