40 lines
790 B
JavaScript
40 lines
790 B
JavaScript
|
const {chmod} = require('fs');
|
||
|
const {join} = require('path');
|
||
|
|
||
|
const banner = require('@neutrinojs/banner');
|
||
|
const copy = require('@neutrinojs/copy');
|
||
|
|
||
|
module.exports = require('./src/build/.neutrinorc');
|
||
|
|
||
|
module.exports.use.push(banner({
|
||
|
banner: '#!/usr/bin/env node',
|
||
|
raw: true,
|
||
|
pluginId: 'shebang',
|
||
|
}))
|
||
|
|
||
|
module.exports.use.push(({config}) => {
|
||
|
config
|
||
|
.plugin('executable')
|
||
|
.use(class Executable {
|
||
|
|
||
|
apply(compiler) {
|
||
|
compiler.hooks.afterEmit.tapAsync(
|
||
|
'Executable',
|
||
|
(compilation, callback) => {
|
||
|
chmod(join(__dirname, 'build.js'), 0o755, callback);
|
||
|
},
|
||
|
)
|
||
|
}
|
||
|
|
||
|
});
|
||
|
});
|
||
|
|
||
|
module.exports.use.push(
|
||
|
copy({
|
||
|
patterns: [{
|
||
|
from: 'src/build',
|
||
|
to: 'build',
|
||
|
}],
|
||
|
}),
|
||
|
);
|