|
|
@ -1,8 +1,5 @@ |
|
|
|
#!/usr/bin/env node
|
|
|
|
|
|
|
|
/* eslint-disable */ |
|
|
|
'use strict'; |
|
|
|
|
|
|
|
const fs = require('fs'); |
|
|
|
const path = require('path'); |
|
|
|
const packageInfo = require('../package.json'); |
|
|
@ -14,8 +11,9 @@ if (fs.existsSync(path.join(__dirname, '../lib'))) { |
|
|
|
const versionFileContent = fs.readFileSync(versionFilePath).toString(); |
|
|
|
fs.writeFileSync( |
|
|
|
versionFilePath, |
|
|
|
versionFileContent.replace(`require('../../package.json')`, `{ version: '${packageInfo.version}' }`) |
|
|
|
versionFileContent.replace("require('../../package.json')", `{ version: '${packageInfo.version}' }`) |
|
|
|
); |
|
|
|
// eslint-disable-next-line
|
|
|
|
console.log('Wrote version into lib/version/index.js'); |
|
|
|
|
|
|
|
// Build package.json version to lib/version/index.d.ts
|
|
|
@ -25,6 +23,7 @@ if (fs.existsSync(path.join(__dirname, '../lib'))) { |
|
|
|
versionDefPath, |
|
|
|
`declare var _default: "${packageInfo.version}";\nexport default _default;\n` |
|
|
|
); |
|
|
|
// eslint-disable-next-line
|
|
|
|
console.log('Wrote version into lib/version/index.d.ts'); |
|
|
|
} |
|
|
|
|
|
|
@ -34,10 +33,10 @@ if (fs.existsSync(path.join(__dirname, '../dist'))) { |
|
|
|
let componentsLessContent = ''; |
|
|
|
|
|
|
|
// Build components in one file: lib/style/components.less
|
|
|
|
fs.readdir(componentsPath, function (err, files) { |
|
|
|
files.forEach(function (file) { |
|
|
|
fs.readdir(componentsPath, (err, files) => { |
|
|
|
files.forEach((file) => { |
|
|
|
if (fs.existsSync(path.join(componentsPath, file, 'style', 'index.less'))) { |
|
|
|
componentsLessContent += `@import "../${path.join(file, 'style', 'index.less')}";\n` |
|
|
|
componentsLessContent += `@import "../${path.join(file, 'style', 'index.less')}";\n`; |
|
|
|
} |
|
|
|
}); |
|
|
|
fs.writeFileSync(path.join(process.cwd(), 'lib', 'style', 'components.less'), componentsLessContent); |
|
|
@ -48,5 +47,6 @@ if (fs.existsSync(path.join(__dirname, '../dist'))) { |
|
|
|
'@import "../lib/style/index.less";\n@import "../lib/style/components.less";' |
|
|
|
); |
|
|
|
}); |
|
|
|
// eslint-disable-next-line
|
|
|
|
console.log('Built a entry less file to dist/antd.less'); |
|
|
|
} |
|
|
|