meocord 1.0.2 → 1.0.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -17,7 +17,7 @@
17
17
  * along with this program. If not, see <https://www.gnu.org/licenses/>.
18
18
  */function _typeof(a){"@babel/helpers - typeof";return _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(a){return typeof a}:function(a){return a&&"function"==typeof Symbol&&a.constructor===Symbol&&a!==Symbol.prototype?"symbol":typeof a},_typeof(a)}function ownKeys(a,b){var c=Object.keys(a);if(Object.getOwnPropertySymbols){var d=Object.getOwnPropertySymbols(a);b&&(d=d.filter(function(b){return Object.getOwnPropertyDescriptor(a,b).enumerable})),c.push.apply(c,d)}return c}function _objectSpread(a){for(var b,c=1;c<arguments.length;c++)b=null==arguments[c]?{}:arguments[c],c%2?ownKeys(Object(b),!0).forEach(function(c){_defineProperty(a,c,b[c])}):Object.getOwnPropertyDescriptors?Object.defineProperties(a,Object.getOwnPropertyDescriptors(b)):ownKeys(Object(b)).forEach(function(c){Object.defineProperty(a,c,Object.getOwnPropertyDescriptor(b,c))});return a}function _slicedToArray(a,b){return _arrayWithHoles(a)||_iterableToArrayLimit(a,b)||_unsupportedIterableToArray(a,b)||_nonIterableRest()}function _nonIterableRest(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _unsupportedIterableToArray(b,c){if(b){if("string"==typeof b)return _arrayLikeToArray(b,c);var a={}.toString.call(b).slice(8,-1);return"Object"===a&&b.constructor&&(a=b.constructor.name),"Map"===a||"Set"===a?Array.from(b):"Arguments"===a||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(a)?_arrayLikeToArray(b,c):void 0}}function _arrayLikeToArray(b,c){(null==c||c>b.length)&&(c=b.length);for(var d=0,f=Array(c);d<c;d++)f[d]=b[d];return f}function _iterableToArrayLimit(b,c){var d=null==b?null:"undefined"!=typeof Symbol&&b[Symbol.iterator]||b["@@iterator"];if(null!=d){var g,h,j,k,l=[],a=!0,m=!1;try{if(j=(d=d.call(b)).next,0===c){if(Object(d)!==d)return;a=!1}else for(;!(a=(g=j.call(d)).done)&&(l.push(g.value),l.length!==c);a=!0);}catch(a){m=!0,h=a}finally{try{if(!a&&null!=d["return"]&&(k=d["return"](),Object(k)!==k))return}finally{if(m)throw h}}return l}}function _arrayWithHoles(a){if(Array.isArray(a))return a}function _regeneratorRuntime(){"use strict";/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */function define(a,b,c){return Object.defineProperty(a,b,{value:c,enumerable:!0,configurable:!0,writable:!0}),a[b]}function wrap(b,d,e,f){var g=d&&d.prototype instanceof Generator?d:Generator,i=Object.create(g.prototype),a=new Context(f||[]);return h(i,"_invoke",{value:makeInvokeMethod(b,e,a)}),i}function tryCatch(a,b,c){try{return{type:"normal",arg:a.call(b,c)}}catch(a){return{type:"throw",arg:a}}}function Generator(){}function GeneratorFunction(){}function GeneratorFunctionPrototype(){}function defineIteratorMethods(a){["next","throw","return"].forEach(function(b){define(a,b,function(a){return this._invoke(b,a)})})}function AsyncIterator(b,d){function invoke(e,f,g,i){var a=tryCatch(b[e],b,f);if("throw"!==a.type){var c=a.arg,k=c.value;return k&&"object"==_typeof(k)&&j.call(k,"__await")?d.resolve(k.__await).then(function(a){invoke("next",a,g,i)},function(a){invoke("throw",a,g,i)}):d.resolve(k).then(function(a){c.value=a,g(c)},function(a){return invoke("throw",a,g,i)})}i(a.arg)}var a;h(this,"_invoke",{value:function value(b,c){function callInvokeWithMethodAndArg(){return new d(function(a,d){invoke(b,c,a,d)})}return a=a?a.then(callInvokeWithMethodAndArg,callInvokeWithMethodAndArg):callInvokeWithMethodAndArg()}})}function makeInvokeMethod(a,d,e){var f="suspendedStart";return function(g,h){if(f==="executing")throw Error("Generator is already running");if("completed"===f){if("throw"===g)throw h;return{value:b,done:!0}}for(e.method=g,e.arg=h;;){var i=e.delegate;if(i){var j=maybeInvokeDelegate(i,e);if(j){if(j===m)continue;return j}}if("next"===e.method)e.sent=e._sent=e.arg;else if("throw"===e.method){if("suspendedStart"===f)throw f="completed",e.arg;e.dispatchException(e.arg)}else"return"===e.method&&e.abrupt("return",e.arg);f="executing";var k=tryCatch(a,d,e);if("normal"===k.type){if(f=e.done?"completed":"suspendedYield",k.arg===m)continue;return{value:k.arg,done:e.done}}"throw"===k.type&&(f="completed",e.method="throw",e.arg=k.arg)}}}function maybeInvokeDelegate(c,d){var e=d.method,f=c.iterator[e];if(f===b)return d.delegate=null,"throw"===e&&c.iterator["return"]&&(d.method="return",d.arg=b,maybeInvokeDelegate(c,d),"throw"===d.method)||"return"!==e&&(d.method="throw",d.arg=new TypeError("The iterator does not provide a '"+e+"' method")),m;var g=tryCatch(f,c.iterator,d.arg);if("throw"===g.type)return d.method="throw",d.arg=g.arg,d.delegate=null,m;var h=g.arg;return h?h.done?(d[c.resultName]=h.value,d.next=c.nextLoc,"return"!==d.method&&(d.method="next",d.arg=b),d.delegate=null,m):h:(d.method="throw",d.arg=new TypeError("iterator result is not an object"),d.delegate=null,m)}function pushTryEntry(a){var b={tryLoc:a[0]};1 in a&&(b.catchLoc=a[1]),2 in a&&(b.finallyLoc=a[2],b.afterLoc=a[3]),this.tryEntries.push(b)}function resetTryEntry(a){var b=a.completion||{};b.type="normal",delete b.arg,a.completion=b}function Context(a){this.tryEntries=[{tryLoc:"root"}],a.forEach(pushTryEntry,this),this.reset(!0)}function values(a){if(a||""===a){var c=a[l];if(c)return c.call(a);if("function"==typeof a.next)return a;if(!isNaN(a.length)){var d=-1,e=function next(){for(;++d<a.length;)if(j.call(a,d))return next.value=a[d],next.done=!1,next;return next.value=b,next.done=!0,next};return e.next=e}}throw new TypeError(_typeof(a)+" is not iterable")}_regeneratorRuntime=function _regeneratorRuntime(){return f};var b,f={},e=Object.prototype,j=e.hasOwnProperty,h=Object.defineProperty||function(a,b,c){a[b]=c.value},k="function"==typeof Symbol?Symbol:{},l=k.iterator||"@@iterator",a=k.asyncIterator||"@@asyncIterator",c=k.toStringTag||"@@toStringTag";try{define({},"")}catch(a){define=function define(a,b,c){return a[b]=c}}f.wrap=wrap;var m={},i={};define(i,l,function(){return this});var n=Object.getPrototypeOf,d=n&&n(n(values([])));d&&d!==e&&j.call(d,l)&&(i=d);var o=GeneratorFunctionPrototype.prototype=Generator.prototype=Object.create(i);return GeneratorFunction.prototype=GeneratorFunctionPrototype,h(o,"constructor",{value:GeneratorFunctionPrototype,configurable:!0}),h(GeneratorFunctionPrototype,"constructor",{value:GeneratorFunction,configurable:!0}),GeneratorFunction.displayName=define(GeneratorFunctionPrototype,c,"GeneratorFunction"),f.isGeneratorFunction=function(a){var b="function"==typeof a&&a.constructor;return!!b&&(b===GeneratorFunction||"GeneratorFunction"===(b.displayName||b.name))},f.mark=function(a){return Object.setPrototypeOf?Object.setPrototypeOf(a,GeneratorFunctionPrototype):(a.__proto__=GeneratorFunctionPrototype,define(a,c,"GeneratorFunction")),a.prototype=Object.create(o),a},f.awrap=function(a){return{__await:a}},defineIteratorMethods(AsyncIterator.prototype),define(AsyncIterator.prototype,a,function(){return this}),f.AsyncIterator=AsyncIterator,f.async=function(b,c,d,e,g){void 0===g&&(g=Promise);var h=new AsyncIterator(wrap(b,c,d,e),g);return f.isGeneratorFunction(c)?h:h.next().then(function(a){return a.done?a.value:h.next()})},defineIteratorMethods(o),define(o,c,"Generator"),define(o,l,function(){return this}),define(o,"toString",function(){return"[object Generator]"}),f.keys=function(a){var b=Object(a),c=[];for(var d in b)c.push(d);return c.reverse(),function next(){for(;c.length;){var a=c.pop();if(a in b)return next.value=a,next.done=!1,next}return next.done=!0,next}},f.values=values,Context.prototype={constructor:Context,reset:function reset(a){if(this.prev=0,this.next=0,this.sent=this._sent=b,this.done=!1,this.delegate=null,this.method="next",this.arg=b,this.tryEntries.forEach(resetTryEntry),!a)for(var c in this)"t"===c.charAt(0)&&j.call(this,c)&&!isNaN(+c.slice(1))&&(this[c]=b)},stop:function stop(){this.done=!0;var a=this.tryEntries[0].completion;if("throw"===a.type)throw a.arg;return this.rval},dispatchException:function dispatchException(d){function handle(a,c){return h.type="throw",h.arg=d,e.next=a,c&&(e.method="next",e.arg=b),!!c}if(this.done)throw d;for(var e=this,f=this.tryEntries.length-1;0<=f;--f){var g=this.tryEntries[f],h=g.completion;if("root"===g.tryLoc)return handle("end");if(g.tryLoc<=this.prev){var k=j.call(g,"catchLoc"),l=j.call(g,"finallyLoc");if(k&&l){if(this.prev<g.catchLoc)return handle(g.catchLoc,!0);if(this.prev<g.finallyLoc)return handle(g.finallyLoc)}else if(!k){if(!l)throw Error("try statement without catch or finally");if(this.prev<g.finallyLoc)return handle(g.finallyLoc)}else if(this.prev<g.catchLoc)return handle(g.catchLoc,!0)}}},abrupt:function abrupt(b,c){for(var d,e=this.tryEntries.length-1;0<=e;--e)if(d=this.tryEntries[e],d.tryLoc<=this.prev&&j.call(d,"finallyLoc")&&this.prev<d.finallyLoc){var f=d;break}f&&("break"===b||"continue"===b)&&f.tryLoc<=c&&c<=f.finallyLoc&&(f=null);var g=f?f.completion:{};return g.type=b,g.arg=c,f?(this.method="next",this.next=f.finallyLoc,m):this.complete(g)},complete:function complete(a,b){if("throw"===a.type)throw a.arg;return"break"===a.type||"continue"===a.type?this.next=a.arg:"return"===a.type?(this.rval=this.arg=a.arg,this.method="return",this.next="end"):"normal"===a.type&&b&&(this.next=b),m},finish:function finish(a){for(var b,c=this.tryEntries.length-1;0<=c;--c)if(b=this.tryEntries[c],b.finallyLoc===a)return this.complete(b.completion,b.afterLoc),resetTryEntry(b),m},catch:function _catch(a){for(var b,c=this.tryEntries.length-1;0<=c;--c)if(b=this.tryEntries[c],b.tryLoc===a){var d=b.completion;if("throw"===d.type){var f=d.arg;resetTryEntry(b)}return f}throw Error("illegal catch attempt")},delegateYield:function delegateYield(a,c,d){return this.delegate={iterator:values(a),resultName:c,nextLoc:d},"next"===this.method&&(this.arg=b),m}},f}function asyncGeneratorStep(b,d,f,e,g,h,a){try{var c=b[h](a),i=c.value}catch(a){return void f(a)}c.done?d(i):Promise.resolve(i).then(e,g)}function _asyncToGenerator(b){return function(){var c=this,d=arguments;return new Promise(function(e,f){function _next(a){asyncGeneratorStep(g,e,f,_next,_throw,"next",a)}function _throw(a){asyncGeneratorStep(g,e,f,_next,_throw,"throw",a)}var g=b.apply(c,d);_next(void 0)})}}function _classCallCheck(b,a){if(!(b instanceof a))throw new TypeError("Cannot call a class as a function")}function _defineProperties(a,b){for(var c,d=0;d<b.length;d++)c=b[d],c.enumerable=c.enumerable||!1,c.configurable=!0,"value"in c&&(c.writable=!0),Object.defineProperty(a,_toPropertyKey(c.key),c)}function _createClass(a,b,c){return b&&_defineProperties(a.prototype,b),c&&_defineProperties(a,c),Object.defineProperty(a,"prototype",{writable:!1}),a}function _defineProperty(a,b,c){return(b=_toPropertyKey(b))in a?Object.defineProperty(a,b,{value:c,enumerable:!0,configurable:!0,writable:!0}):a[b]=c,a}function _toPropertyKey(a){var b=_toPrimitive(a,"string");return"symbol"==_typeof(b)?b:b+""}function _toPrimitive(a,b){if("object"!=_typeof(a)||!a)return a;var c=a[Symbol.toPrimitive];if(void 0!==c){var d=c.call(a,b||"default");if("object"!=_typeof(d))return d;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===b?String:Number)(a)}import path from"path";import webpack from"webpack";import{Logger}from"../common/index.js";import{spawn}from"node:child_process";import{capitalize}from"lodash-es";import wait from"../util/wait.util.js";import{GeneratorCLI}from"./generator.js";import*as fs from"node:fs";import{compileAndValidateConfig,setEnvironment}from"../util/common.util.js";import{Command}from"commander";import{compileMeoCordConfig}from"../util/meocord-config-loader.util.js";import{simpleGit}from"simple-git";import chalk from"chalk";import{execSync}from"child_process";import{configureCommandHelp,ensureReady}from"../util/meocord-cli.util.js";import packageJson from"../../package.json"with{type:"json"};import{fileURLToPath}from"url";var __filename=fileURLToPath(import.meta.url),__dirname=path.dirname(__filename),MeoCordCLI=/*#__PURE__*/function(){function MeoCordCLI(){_classCallCheck(this,MeoCordCLI),_defineProperty(this,"appName","MeoCord"),_defineProperty(this,"logger",new Logger(this.appName)),_defineProperty(this,"projectRoot",process.cwd()),_defineProperty(this,"mainJSPath",path.join(this.projectRoot,"dist","main.js")),_defineProperty(this,"webpackConfigPath",path.resolve(__dirname,"..","..","webpack.config.js")),_defineProperty(this,"generatorCLI",new GeneratorCLI(this.appName)),_defineProperty(this,"version",packageJson.version)}return _createClass(MeoCordCLI,[{key:"run",value:(/**
19
19
  * Configures and runs the MeoCord CLI.
20
- */function(){function run(){return a.apply(this,arguments)}var a=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee4(){var a,b=this;return _regeneratorRuntime().wrap(function _callee4$(c){for(;;)switch(c.prev=c.next){case 0:a=new Command,a.name(this.appName.toLowerCase()).description("CLI for managing the ".concat(this.appName," application")).version(this.version),a.command("show").description("Display information").option("-w, --warranty","Display warranty disclaimer").option("-c, --license","Display licensing conditions and usage rights").action(function(b){if(!b.warranty&&!b.license){var c;null===(c=a.commands.find(function(a){return"show"===a.name()}))||void 0===c||c.outputHelp(),process.exit(1)}b.warranty&&console.log("\nThis program is distributed in the hope that it will be useful,\nbut WITHOUT ANY WARRANTY; without even the implied warranty of\nMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n\nThe authors of this software are not responsible for damages caused\nby the usage, misuse, or inability to use the software.\n\nSee the GNU General Public License for full details:\n<https://www.gnu.org/licenses/>.\n "),b.license&&console.log("\nThis program is free software: you can redistribute it and/or\nmodify it under the terms of the GNU General Public License as\npublished by the Free Software Foundation, either version 3 of\nthe License, or (at your option) any later version.\n\nKey conditions of the GNU GPL v3:\n- You can use this software for personal, academic, or commercial purposes.\n- If you distribute modified versions, you must share the source code under the same GPL v3 license.\n- The original copyright must be retained.\n\nFor full license details, refer to:\n<https://www.gnu.org/licenses/gpl-3.0.txt>\n ")}),a.command("create <app-name>").description("Create a new MeoCord application").action(/*#__PURE__*/function(){var a=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(a){return _regeneratorRuntime().wrap(function _callee$(c){for(;1;)switch(c.prev=c.next){case 0:return c.next=2,b.createApp(a);case 2:return c.abrupt("return",c.sent);case 3:case"end":return c.stop()}},_callee)}));return function(b){return a.apply(this,arguments)}}()),a.command("build").description("Build the application").option("-d, --dev","Build in development mode").option("-p, --prod","Build in production mode").action(/*#__PURE__*/function(){var a=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee2(a){var c;return _regeneratorRuntime().wrap(function _callee2$(d){for(;1;)switch(d.prev=d.next){case 0:return d.next=2,ensureReady();case 2:return c=a.prod?"production":"development",setEnvironment(c),d.next=6,compileAndValidateConfig();case 6:return d.next=8,b.build(c);case 8:case"end":return d.stop()}},_callee2)}));return function(b){return a.apply(this,arguments)}}()),a.command("start").description("Start the application").option("-b, --build","Pre-build before starting").option("-d, --dev","Start in development mode").option("-p, --prod","Start in production mode").action(/*#__PURE__*/function(){var a=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee3(a){var c;return _regeneratorRuntime().wrap(function _callee3$(d){for(;1;)switch(d.prev=d.next){case 0:return d.next=2,ensureReady();case 2:if(c=a.prod?"production":"development",setEnvironment(c),!(a.build||a.dev)){d.next=7;break}return d.next=7,compileAndValidateConfig();case 7:if(!a.build){d.next=10;break}return d.next=10,b.build(c);case 10:if(!a.prod){d.next=15;break}return d.next=13,b.startProd();case 13:d.next=17;break;case 15:return d.next=17,b.startDev();case 17:case"end":return d.stop()}},_callee3)}));return function(b){return a.apply(this,arguments)}}()),a=this.generatorCLI.register(a),configureCommandHelp(a),a.showHelpAfterError().parse(process.argv);case 9:case"end":return c.stop()}},_callee4,this)}));return run}())},{key:"createApp",value:function(){function createApp(b){return a.apply(this,arguments)}var a=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee5(a){var b,c,d,e,f,g,h,i,j,k,l,m,n,o,p;return _regeneratorRuntime().wrap(function _callee5$(q){for(;1;)switch(q.prev=q.next){case 0:if(b=a.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,""),c=path.resolve(process.cwd(),b),d="https://github.com/l7aromeo/meocord-template.git",console.info(chalk.blueBright("\uD83D\uDE80 Creating a new MeoCord app: ".concat(chalk.bold(b)))),q.prev=4,!fs.existsSync(c)){q.next=10;break}return console.error(chalk.red("\u274C Directory \"".concat(chalk.bold(b),"\" already exists."))),q.next=9,wait(100);case 9:process.exit(1);case 10:if(e="22.14.0",f=process.version.slice(1).split(".").map(Number),g=_slicedToArray(f,3),h=g[0],i=g[1],j=g[2],k=e.split(".").map(Number),l=_slicedToArray(k,3),m=l[0],n=l[1],o=l[2],!(h<m||h===m&&i<n||h===m&&i===n&&j<o)){q.next=18;break}return console.error(chalk.red("\u274C Node.js v".concat(e," or higher is required. Current version: v").concat(process.version,"."))),q.next=17,wait(100);case 17:process.exit(1);case 18:return console.info(chalk.blueBright("\uD83D\uDCE6 Fetching template...")),q.next=21,simpleGit().clone(d,c);case 21:return console.log(chalk.green("\u2714 App successfully created at: ".concat(chalk.bold(c)))),fs.rmSync(path.join(c,".git"),{recursive:!0,force:!0}),console.info(chalk.blueBright("\uD83D\uDD27 Initializing Git repository...")),p=simpleGit(c),q.next=27,p.init();case 27:return q.next=29,p.add("./*");case 29:return q.next=31,p.commit("Initial commit");case 31:console.log(chalk.green("\u2714 Git repository initialized.")),console.info(chalk.blueBright("\uD83D\uDCE6 Installing dependencies...")),execSync("cd ".concat(b," && corepack enable && yarn install"),{stdio:"inherit"}),console.log(chalk.green("\u2714 Dependencies installed successfully.")),console.log(chalk.greenBright("\uD83C\uDF89 MeoCord app \"".concat(chalk.bold(b),"\" is ready!"))),q.next=44;break;case 38:return q.prev=38,q.t0=q["catch"](4),console.error(chalk.red("\u274C Failed to create app: ".concat(q.t0 instanceof Error?q.t0.message:q.t0+""))),q.next=43,wait(100);case 43:process.exit(1);case 44:case"end":return q.stop()}},_callee5,null,[[4,38]])}));return createApp}()/**
20
+ */function(){function run(){return a.apply(this,arguments)}var a=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee4(){var a,b=this;return _regeneratorRuntime().wrap(function _callee4$(c){for(;;)switch(c.prev=c.next){case 0:a=new Command,a.name(this.appName.toLowerCase()).description("CLI for managing the ".concat(this.appName," application")).version(this.version),a.command("show").description("Display information").option("-w, --warranty","Display warranty disclaimer").option("-c, --license","Display licensing conditions and usage rights").action(function(b){if(!b.warranty&&!b.license){var c;null===(c=a.commands.find(function(a){return"show"===a.name()}))||void 0===c||c.outputHelp(),process.exit(1)}b.warranty&&console.log("\nThis program is distributed in the hope that it will be useful,\nbut WITHOUT ANY WARRANTY; without even the implied warranty of\nMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n\nThe authors of this software are not responsible for damages caused\nby the usage, misuse, or inability to use the software.\n\nSee the GNU General Public License for full details:\n<https://www.gnu.org/licenses/>.\n "),b.license&&console.log("\nThis program is free software: you can redistribute it and/or\nmodify it under the terms of the GNU General Public License as\npublished by the Free Software Foundation, either version 3 of\nthe License, or (at your option) any later version.\n\nKey conditions of the GNU GPL v3:\n- You can use this software for personal, academic, or commercial purposes.\n- If you distribute modified versions, you must share the source code under the same GPL v3 license.\n- The original copyright must be retained.\n\nFor full license details, refer to:\n<https://www.gnu.org/licenses/gpl-3.0.txt>\n ")}),a.command("create <app-name>").description("Create a new MeoCord application").action(/*#__PURE__*/function(){var a=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(a){return _regeneratorRuntime().wrap(function _callee$(c){for(;1;)switch(c.prev=c.next){case 0:return c.next=2,b.createApp(a);case 2:return c.abrupt("return",c.sent);case 3:case"end":return c.stop()}},_callee)}));return function(b){return a.apply(this,arguments)}}()),a.command("build").description("Build the application").option("-d, --dev","Build in development mode").option("-p, --prod","Build in production mode").action(/*#__PURE__*/function(){var a=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee2(a){var c;return _regeneratorRuntime().wrap(function _callee2$(d){for(;1;)switch(d.prev=d.next){case 0:return d.next=2,ensureReady();case 2:return c=a.prod?"production":"development",setEnvironment(c),d.next=6,compileAndValidateConfig();case 6:return d.next=8,b.build(c);case 8:case"end":return d.stop()}},_callee2)}));return function(b){return a.apply(this,arguments)}}()),a.command("start").description("Start the application").option("-b, --build","Pre-build before starting").option("-d, --dev","Start in development mode").option("-p, --prod","Start in production mode").action(/*#__PURE__*/function(){var a=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee3(a){var c;return _regeneratorRuntime().wrap(function _callee3$(d){for(;1;)switch(d.prev=d.next){case 0:return d.next=2,ensureReady();case 2:if(c=a.prod?"production":"development",setEnvironment(c),!(a.build||a.dev)){d.next=7;break}return d.next=7,compileAndValidateConfig();case 7:if(!a.build){d.next=10;break}return d.next=10,b.build(c);case 10:if(!a.prod){d.next=15;break}return d.next=13,b.startProd();case 13:d.next=17;break;case 15:return d.next=17,b.startDev();case 17:case"end":return d.stop()}},_callee3)}));return function(b){return a.apply(this,arguments)}}()),a=this.generatorCLI.register(a),configureCommandHelp(a),a.showHelpAfterError().parse(process.argv);case 9:case"end":return c.stop()}},_callee4,this)}));return run}())},{key:"createApp",value:function(){function createApp(b){return a.apply(this,arguments)}var a=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee5(a){var b,c,d,e,f,g,h,i,j,k,l,m,n,o,p;return _regeneratorRuntime().wrap(function _callee5$(q){for(;1;)switch(q.prev=q.next){case 0:if(b=a.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,""),c=path.resolve(process.cwd(),b),d="https://github.com/l7aromeo/meocord-template.git",console.info(chalk.blueBright("\uD83D\uDE80 Creating a new MeoCord app: ".concat(chalk.bold(b)))),q.prev=4,!fs.existsSync(c)){q.next=10;break}return console.error(chalk.red("\u274C Directory \"".concat(chalk.bold(b),"\" already exists."))),q.next=9,wait(100);case 9:process.exit(1);case 10:if(e="22.14.0",f=process.version.slice(1).split(".").map(Number),g=_slicedToArray(f,3),h=g[0],i=g[1],j=g[2],k=e.split(".").map(Number),l=_slicedToArray(k,3),m=l[0],n=l[1],o=l[2],!(h<m||h===m&&i<n||h===m&&i===n&&j<o)){q.next=18;break}return console.error(chalk.red("\u274C Node.js v".concat(e," or higher is required. Current version: v").concat(process.version,"."))),q.next=17,wait(100);case 17:process.exit(1);case 18:return console.info(chalk.blueBright("\uD83D\uDCE6 Fetching template...")),q.next=21,simpleGit().clone(d,c);case 21:return console.log(chalk.green("\u2714 App successfully created at: ".concat(chalk.bold(c)))),fs.rmSync(path.join(c,".git"),{recursive:!0,force:!0}),console.info(chalk.blueBright("\uD83D\uDD27 Initializing Git repository...")),p=simpleGit(c),q.next=27,p.init();case 27:return q.next=29,p.add("./*");case 29:return q.next=31,p.commit("Initial commit");case 31:console.log(chalk.green("\u2714 Git repository initialized.")),console.info(chalk.blueBright("\uD83D\uDCE6 Installing dependencies...")),execSync("cd ".concat(b," && corepack enable && yarn install"),{stdio:"inherit"}),console.log(chalk.green("\u2714 Dependencies installed successfully.")),console.log(chalk.greenBright("\uD83C\uDF89 MeoCord app \"".concat(chalk.bold(b),"\" is ready!"))),q.next=44;break;case 38:return q.prev=38,q.t0=q["catch"](4),console.error(chalk.red("\u274C Failed to create app: ".concat(q.t0 instanceof Error?q.t0.message:q.t0+""))),q.next=43,wait(100);case 43:process.exit(1);case 44:case"end":return q.stop()}},_callee5,null,[[4,38]])}));return createApp}()/**
21
21
  * Builds the MeoCord application in the specified mode.
22
22
  *
23
23
  * @param mode - The build mode ('production' or 'development').
@@ -16,11 +16,9 @@
16
16
  * along with this program. If not, see <https://www.gnu.org/licenses/>.
17
17
  */
18
18
  import 'reflect-metadata';
19
- import { type interfaces } from 'inversify';
19
+ import { type ServiceIdentifier } from 'inversify';
20
20
  import { MeoCordApp } from '../core/meocord.app.js';
21
- type ServiceIdentifier = interfaces.ServiceIdentifier;
22
21
  export declare class MeoCordFactory {
23
22
  private static logger;
24
23
  static create(target: ServiceIdentifier): MeoCordApp;
25
24
  }
26
- export {};
@@ -16,9 +16,8 @@
16
16
  * along with this program. If not, see <https://www.gnu.org/licenses/>.
17
17
  */
18
18
  import 'reflect-metadata';
19
- import { Container, type interfaces } from 'inversify';
19
+ import { Container, type ServiceIdentifier } from 'inversify';
20
20
  import { type ActivityOptions, type ClientOptions } from 'discord.js';
21
- type ServiceIdentifier = interfaces.ServiceIdentifier;
22
21
  /** The main Inversify container for managing dependencies. */
23
22
  export declare const mainContainer: Container;
24
23
  /**
@@ -60,4 +59,3 @@ export declare function MeoCord(options: {
60
59
  activities?: ActivityOptions[];
61
60
  services?: ServiceIdentifier[];
62
61
  }): (target: any) => void;
63
- export {};
@@ -78,4 +78,4 @@ var b=Reflect.getMetadata("design:paramtypes",a)||[];b.forEach(function(a){mainC
78
78
  * ```
79
79
  */export function UseGuard(){for(var a=arguments.length,b=Array(a),c=0;c<a;c++)b[c]=arguments[c];return function(a,c,d){var e=d.value;// TypeScript: Enforce that the first argument is an Interaction
80
80
  // Store guard metadata for later access (if needed)
81
- d.value=/*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(){var a,d,f,g,h,i,j,k,l,m,n,o=arguments;return _regeneratorRuntime().wrap(function _callee$(p){for(;1;)switch(p.prev=p.next){case 0:for(a=o.length,d=Array(a),f=0;f<a;f++)d[f]=o[f];if(d[0]instanceof BaseInteraction){p.next=3;break}throw new Error("The first argument of ".concat(c+""," must be an instance of Interaction."));case 3:g=0,h=b;case 4:if(!(g<h.length)){p.next=18;break}if(j=h[g],k=void 0,isGuardWithParams(j)?(l=j.provide,m=j.params,k=mainContainer.resolve(l),Object.assign(k,m)):k=mainContainer.resolve(j),k.canActivate){p.next=10;break}throw new Error("Guard ".concat(j.constructor.name," applied to ").concat(c+""," does not have a valid canActivate method."));case 10:return p.next=12,(i=k).canActivate.apply(i,d);case 12:if(n=p.sent,n){p.next=15;break}return p.abrupt("return");case 15:g++,p.next=4;break;case 18:return p.abrupt("return",e.apply(this,d));case 19:case"end":return p.stop()}},_callee,this)})),Reflect.defineMetadata("guards",b,a,c)}}
81
+ d.value=/*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(){var a,d,f,g,h,i,j,k,l,m,n,o=arguments;return _regeneratorRuntime().wrap(function _callee$(p){for(;1;)switch(p.prev=p.next){case 0:for(a=o.length,d=Array(a),f=0;f<a;f++)d[f]=o[f];if(d[0]instanceof BaseInteraction){p.next=3;break}throw new Error("The first argument of ".concat(c+""," must be an instance of Interaction."));case 3:g=0,h=b;case 4:if(!(g<h.length)){p.next=18;break}if(j=h[g],k=void 0,isGuardWithParams(j)?(l=j.provide,m=j.params,k=mainContainer.get(l,{autobind:!0}),Object.assign(k,m)):k=mainContainer.get(j,{autobind:!0}),k.canActivate){p.next=10;break}throw new Error("Guard ".concat(j.constructor.name," applied to ").concat(c+""," does not have a valid canActivate method."));case 10:return p.next=12,(i=k).canActivate.apply(i,d);case 12:if(n=p.sent,n){p.next=15;break}return p.abrupt("return");case 15:g++,p.next=4;break;case 18:return p.abrupt("return",e.apply(this,d));case 19:case"end":return p.stop()}},_callee,this)})),Reflect.defineMetadata("guards",b,a,c)}}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "meocord",
3
3
  "description": "MeoCord is a lightweight and modular framework for building scalable Discord bots using TypeScript and Discord.js. It simplifies bot development with an extensible architecture, TypeScript-first approach, and powerful CLI tools.",
4
- "version": "1.0.2",
4
+ "version": "1.0.4",
5
5
  "packageManager": "yarn@4.7.0",
6
6
  "type": "module",
7
7
  "scripts": {
@@ -59,29 +59,29 @@
59
59
  ],
60
60
  "devDependencies": {
61
61
  "@babel/cli": "^7.26.4",
62
- "@babel/core": "^7.26.9",
62
+ "@babel/core": "^7.26.10",
63
63
  "@babel/preset-env": "^7.26.9",
64
64
  "@babel/preset-typescript": "^7.26.0",
65
- "@eslint/js": "^9.21.0",
65
+ "@eslint/js": "^9.22.0",
66
66
  "@types/copyfiles": "^2.4.4",
67
67
  "@types/lodash-es": "^4.17.12",
68
68
  "@types/webpack-node-externals": "^3.0.4",
69
- "@typescript-eslint/parser": "^8.24.1",
69
+ "@typescript-eslint/parser": "^8.27.0",
70
70
  "babel-plugin-module-resolver": "^5.0.2",
71
71
  "babel-preset-minify": "^0.5.2",
72
72
  "copyfiles": "^2.4.1",
73
- "eslint": "^9.21.0",
74
- "eslint-config-prettier": "^10.0.1",
73
+ "eslint": "^9.22.0",
74
+ "eslint-config-prettier": "^10.1.1",
75
75
  "eslint-plugin-headers": "^1.2.1",
76
76
  "eslint-plugin-import": "^2.31.0",
77
77
  "eslint-plugin-prettier": "^5.2.3",
78
78
  "eslint-plugin-unused-imports": "^4.1.4",
79
79
  "globals": "^16.0.0",
80
80
  "husky": "^9.1.7",
81
- "prettier": "^3.5.2",
82
- "tsc-alias": "^1.8.10",
83
- "typescript": "^5.7.3",
84
- "typescript-eslint": "^8.24.1"
81
+ "prettier": "^3.5.3",
82
+ "tsc-alias": "^1.8.11",
83
+ "typescript": "^5.8.2",
84
+ "typescript-eslint": "^8.27.0"
85
85
  },
86
86
  "peerDependencies": {
87
87
  "discord.js": "^14.17.3",
@@ -95,13 +95,13 @@
95
95
  "discord.js": "^14.18.0",
96
96
  "dotenv": "^16.4.7",
97
97
  "file-loader": "^6.2.0",
98
- "inversify": "^6.2.2",
98
+ "inversify": "^7.1.0",
99
99
  "lodash-es": "^4.17.21",
100
100
  "nodemon": "^3.1.9",
101
101
  "raw-loader": "^4.0.2",
102
102
  "reflect-metadata": "^0.2.2",
103
103
  "simple-git": "^3.27.0",
104
- "terser-webpack-plugin": "^5.3.11",
104
+ "terser-webpack-plugin": "^5.3.14",
105
105
  "ts-loader": "^9.5.2",
106
106
  "tsconfig-paths-webpack-plugin": "^4.2.0",
107
107
  "webpack": "^5.98.0",