2017-08-24 21:54:02 +00:00
|
|
|
const fs = require('fs');
|
|
|
|
const path = require('path');
|
|
|
|
|
|
|
|
function kv(f) {
|
|
|
|
return `"${f}": require('../assets/${f}')`;
|
|
|
|
}
|
|
|
|
|
|
|
|
module.exports = function() {
|
|
|
|
const files = fs.readdirSync(path.join(__dirname, '..', 'assets'));
|
|
|
|
const code = `module.exports = {
|
|
|
|
"package.json": require('../package.json'),
|
|
|
|
${files.map(kv).join(',\n')}
|
|
|
|
};`;
|
|
|
|
return {
|
|
|
|
code,
|
|
|
|
dependencies: files.map(f => require.resolve('../assets/' + f)),
|
2018-03-02 21:58:05 +00:00
|
|
|
cacheable: true
|
2017-08-24 21:54:02 +00:00
|
|
|
};
|
|
|
|
};
|