@exoplay/exobot-build
Version:
build and run tools for exobot
2 lines • 3.38 kB
JavaScript
!function(e,o){for(var r in o)e[r]=o[r]}(exports,function(e){var o={};function r(n){if(o[n])return o[n].exports;var t=o[n]={i:n,l:!1,exports:{}};return e[n].call(t.exports,t,t.exports,r),t.l=!0,t.exports}return r.m=e,r.c=o,r.d=function(e,o,n){r.o(e,o)||Object.defineProperty(e,o,{enumerable:!0,get:n})},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.t=function(e,o){if(1&o&&(e=r(e)),8&o)return e;if(4&o&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&o&&"string"!=typeof e)for(var t in e)r.d(n,t,function(o){return e[o]}.bind(null,t));return n},r.n=function(e){var o=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(o,"a",o),o},r.o=function(e,o){return Object.prototype.hasOwnProperty.call(e,o)},r.p="",r(r.s=6)}([function(e,o){e.exports=require("path")},function(e,o){e.exports=require("webpack")},function(e,o){e.exports=require("yargs")},function(e,o){e.exports=require("chalk")},function(e,o){e.exports=require("progress-bar-webpack-plugin")},function(e,o){e.exports=require("webpack-node-externals")},function(e,o,r){"use strict";r.r(o);var n=r(0),t=r.n(n),a=r(1),i=r.n(a),s=r(2),u=r.n(s),l=r(3),c=r.n(l),p=r(4),d=r.n(p),f=r(5),b=r.n(f);const g=`${t.a.parse(process.cwd()).name}.js`,m={alias:"i",default:`./src/${g}`},x={alias:"o",default:g},y={default:process.cwd()},{argv:j}=u.a.usage("exobot-build [options]").option("input",m).option("output",x).option("cwd",y).option("config",{alias:"c"}).boolean("watch").boolean("start").help("help");function w(e,o){if(e)return console.error(e);const r=o.toJson();return 0<r.errors.length?console.error(r.errors):(0<r.warnings.length&&console.warn(r.warnings),console.log(`Built ${r.outputPath}/${r.assets[0].name}`))}!function(e,o){let r=(e=>{const{input:o,output:r,cwd:n,env:a,minify:s,...u}=e,l=t.a.parse(o).dir,p=t.a.parse(r).dir,f=t.a.join(n,"node_modules");return{mode:"production",target:"node",externals:[b()({modulesDir:f})],devtool:"source-map",context:t.a.join(n,l),entry:{js:t.a.parse(o).base},output:{path:t.a.join(n,p),filename:t.a.parse(r).base,libraryTarget:"commonjs"},module:{rules:[{test:/\.js$/,exclude:/node_modules/,loader:"babel-loader",query:{cacheDirectory:!0,presets:[["@babel/env",a||{targets:{node:"10"},loose:!0}],["babel-preset-minify",s||{mangle:!1}]],plugins:[["@babel/plugin-proposal-decorators",{legacy:!0}],["@babel/plugin-proposal-class-properties",{loose:!0}],"babel-plugin-syntax-export-extensions"]}}]},resolve:{extensions:[".js",".json"],modules:[t.a.join(n,l),t.a.join(n,"node_modules")]},plugins:[new d.a({clear:!1,format:`build [:bar] ${c.a.green(":percent")} (:elapsed seconds)`}),new i.a.LoaderOptionsPlugin({minimize:!0,debug:!0})],node:{global:!1,process:!1,Buffer:!1,crypto:!1,module:!1,clearImmediate:!1,setImmediate:!1,clearTimeout:!1,setTimeout:!1,os:!1,_filename:!1,__dirname:!1},...u||{}}})({input:e.input,output:e.output,cwd:e.cwd});if(e.config){let o=e.config;o.indexOf("babel")&&require("@babel/register"),t.a.isAbsolute(o)||(o=t.a.join(e.cwd,o)),r=(0,require(o).default)(r)}const n=i()(r);j.watch?n.watch({},(e,r)=>{w(e,r),o&&o()}):n.run((e,r)=>{w(e,r),o?o():process.exit()})}(j)}]));
//# sourceMappingURL=exobot-build.js.map