2019-04-02 19:04:38 +08:00
|
|
|
const fs = require('fs');
|
|
|
|
const path = require('path');
|
|
|
|
|
2022-11-22 16:21:37 +08:00
|
|
|
const restCssPath = path.join(process.cwd(), 'components', 'style', 'reset.css');
|
2022-11-30 11:48:47 +08:00
|
|
|
const tokenStatisticPath = path.join(process.cwd(), 'components', 'version', 'token.json');
|
|
|
|
const tokenMetaPath = path.join(process.cwd(), 'components', 'version', 'token-meta.json');
|
2022-11-22 16:21:37 +08:00
|
|
|
|
2019-04-02 19:04:38 +08:00
|
|
|
function finalizeCompile() {
|
2022-07-04 22:08:24 +08:00
|
|
|
if (fs.existsSync(path.join(__dirname, './es'))) {
|
2022-11-22 16:21:37 +08:00
|
|
|
fs.copyFileSync(restCssPath, path.join(process.cwd(), 'es', 'style', 'reset.css'));
|
2022-11-30 11:48:47 +08:00
|
|
|
fs.copyFileSync(tokenStatisticPath, path.join(process.cwd(), 'es', 'version', 'token.json'));
|
|
|
|
fs.copyFileSync(tokenMetaPath, path.join(process.cwd(), 'es', 'version', 'token-meta.json'));
|
2022-11-22 16:21:37 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
if (fs.existsSync(path.join(__dirname, './lib'))) {
|
|
|
|
fs.copyFileSync(restCssPath, path.join(process.cwd(), 'lib', 'style', 'reset.css'));
|
2022-11-30 11:48:47 +08:00
|
|
|
fs.copyFileSync(tokenStatisticPath, path.join(process.cwd(), 'lib', 'version', 'token.json'));
|
|
|
|
fs.copyFileSync(tokenMetaPath, path.join(process.cwd(), 'lib', 'version', 'token-meta.json'));
|
2020-04-13 00:05:48 +08:00
|
|
|
}
|
2020-03-29 10:39:46 +08:00
|
|
|
}
|
|
|
|
|
2019-04-02 19:04:38 +08:00
|
|
|
function finalizeDist() {
|
|
|
|
if (fs.existsSync(path.join(__dirname, './dist'))) {
|
2022-11-22 16:21:37 +08:00
|
|
|
fs.copyFileSync(restCssPath, path.join(process.cwd(), 'dist', 'reset.css'));
|
2019-04-02 19:04:38 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
module.exports = {
|
|
|
|
compile: {
|
|
|
|
finalize: finalizeCompile,
|
|
|
|
},
|
|
|
|
dist: {
|
|
|
|
finalize: finalizeDist,
|
|
|
|
},
|
2021-08-05 15:30:03 +08:00
|
|
|
bail: true,
|
2019-04-02 19:04:38 +08:00
|
|
|
};
|