chore: add build script && gen name list
This commit is contained in:
parent
b707f7aa47
commit
faaac9023e
|
@ -49,6 +49,7 @@
|
|||
"omi": "^6.17.1",
|
||||
"omio": "latest",
|
||||
"optimize-css-assets-webpack-plugin": "^5.0.1",
|
||||
"progress-bar-webpack-plugin": "^2.1.0",
|
||||
"resolve-url-loader": "^3.1.0",
|
||||
"sass-loader": "^7.1.0",
|
||||
"style-loader": "^0.23.1",
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -0,0 +1,28 @@
|
|||
const fs = require("fs");
|
||||
const path = require('path');
|
||||
|
||||
const root = '../node_modules/@material-ui/icons/esm'
|
||||
|
||||
const arr = [];
|
||||
|
||||
const files = fs.readdirSync(root);
|
||||
|
||||
|
||||
const hyphenateRE = /\B([A-Z])/g
|
||||
const hyphenate = function (str) {
|
||||
return str.replace(hyphenateRE, '-$1').toLowerCase()
|
||||
}
|
||||
|
||||
|
||||
//遍历这些文件或者文件夹
|
||||
for (let i = 0; i < files.length; i++) {
|
||||
|
||||
const type = path.extname(files[i]).substring(1)
|
||||
const name = path.basename(files[i], '.' + type)
|
||||
|
||||
|
||||
const data = fs.readFileSync(root + '/' + files[i], "utf-8")
|
||||
console.log(data)
|
||||
}
|
||||
|
||||
fs.writeFileSync('./list.json', JSON.stringify({ list: arr }))
|
|
@ -4,13 +4,17 @@ const webpack = require('webpack')
|
|||
|
||||
const pkgName = require('../package.json')
|
||||
const componentName = pkgName.name.split('/')[1]
|
||||
const ProgressBarPlugin = require('progress-bar-webpack-plugin');
|
||||
|
||||
|
||||
const config = {
|
||||
devtool: 'source-map',
|
||||
// devtool: 'source-map',
|
||||
entry: {
|
||||
'AccessAlarm': './esm/AccessAlarm.js'
|
||||
'access-alarm': './esm/AccessAlarm.js'
|
||||
},
|
||||
plugins: [
|
||||
new ProgressBarPlugin()
|
||||
],
|
||||
output: {
|
||||
path: path.resolve(__dirname, '../dist/'),
|
||||
filename: '[name].js',
|
||||
|
@ -87,10 +91,13 @@ const config = {
|
|||
}
|
||||
}
|
||||
|
||||
webpack(config, (err, stats) => { // Stats Object
|
||||
const compilation = webpack(config, (err, stats) => { // Stats Object
|
||||
if (err || stats.hasErrors()) {
|
||||
// Handle errors here
|
||||
}
|
||||
// Done processing
|
||||
})
|
||||
|
||||
compilation.hooks.done.tap('buildModule',function(){
|
||||
|
||||
})
|
||||
|
|
Loading…
Reference in New Issue