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