meocord 1.0.0 → 1.0.2
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.
- package/README.md +12 -13
- package/dist/bin/meocord.js +2 -2
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -15,6 +15,8 @@ While still growing, MeoCord provides a solid foundation for developers to creat
|
|
|
15
15
|
- [Key Components](#key-components)
|
|
16
16
|
- [Configuration](#configuration)
|
|
17
17
|
- [Getting Started](#getting-started)
|
|
18
|
+
- [Prerequisites](#prerequisites)
|
|
19
|
+
- [Create Fresh App](#create-fresh-app)
|
|
18
20
|
- [CLI Usage](#cli-usage)
|
|
19
21
|
- [Development Guide](#development-guide)
|
|
20
22
|
- [Deployment Guide](#deployment-guide)
|
|
@@ -62,6 +64,12 @@ While still growing, MeoCord provides a solid foundation for developers to creat
|
|
|
62
64
|
|
|
63
65
|
## Getting Started
|
|
64
66
|
|
|
67
|
+
### Prerequisites
|
|
68
|
+
|
|
69
|
+
- **Node.js**: Ensure you have version **22.14.0** or higher, as it’s the current LTS release.
|
|
70
|
+
- **TypeScript**: Version **5.7** or above is required for compatibility with modern features.
|
|
71
|
+
- **Yarn**: Version stable **4.7** (`corepack enable && yarn set version stable`) or above is strongly recommended for managing dependencies and smooth builds.
|
|
72
|
+
|
|
65
73
|
### ⚠️ ESM-Only Framework
|
|
66
74
|
|
|
67
75
|
**MeoCord** is built as an **ECMAScript Module (ESM)** framework. This means:
|
|
@@ -101,7 +109,6 @@ While still growing, MeoCord provides a solid foundation for developers to creat
|
|
|
101
109
|
"emitDecoratorMetadata": true,
|
|
102
110
|
"experimentalDecorators": true,
|
|
103
111
|
"resolveJsonModule": true,
|
|
104
|
-
"verbatimModuleSyntax": true,
|
|
105
112
|
"noUnusedLocals": true,
|
|
106
113
|
"noUnusedParameters": true,
|
|
107
114
|
"skipLibCheck": true,
|
|
@@ -129,9 +136,9 @@ For more migration details, refer to the [Node.js ESM documentation](https://nod
|
|
|
129
136
|
|
|
130
137
|
---
|
|
131
138
|
|
|
132
|
-
###
|
|
139
|
+
### Create Fresh App
|
|
133
140
|
|
|
134
|
-
Follow these steps to
|
|
141
|
+
Follow these steps to create and run a **MeoCord** application:
|
|
135
142
|
|
|
136
143
|
---
|
|
137
144
|
|
|
@@ -439,15 +446,7 @@ This will provide command-specific help and options.
|
|
|
439
446
|
|
|
440
447
|
## Development Guide
|
|
441
448
|
|
|
442
|
-
###
|
|
443
|
-
|
|
444
|
-
- **Node.js**: Ensure you have version **22.x** or higher, as it’s the current LTS release.
|
|
445
|
-
- **TypeScript**: Version **5.x** or above is required for compatibility with modern features.
|
|
446
|
-
- **Yarn**: Version stable (`corepack enable && yarn set version stable`) Strongly recommended for managing dependencies and smooth builds.
|
|
447
|
-
|
|
448
|
-
### Running Your Application
|
|
449
|
-
|
|
450
|
-
#### Development Mode
|
|
449
|
+
### Development Mode
|
|
451
450
|
|
|
452
451
|
Run the application in development mode with live-reload for a seamless coding experience:
|
|
453
452
|
|
|
@@ -455,7 +454,7 @@ Run the application in development mode with live-reload for a seamless coding e
|
|
|
455
454
|
yarn meocord start --dev
|
|
456
455
|
```
|
|
457
456
|
|
|
458
|
-
|
|
457
|
+
### Building for Production
|
|
459
458
|
|
|
460
459
|
Generate an optimized and compiled production build with:
|
|
461
460
|
|
package/dist/bin/meocord.js
CHANGED
|
@@ -15,9 +15,9 @@
|
|
|
15
15
|
*
|
|
16
16
|
* You should have received a copy of the GNU General Public License
|
|
17
17
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
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 _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:(/**
|
|
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;return _regeneratorRuntime().wrap(function _callee5$(
|
|
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}()/**
|
|
21
21
|
* Builds the MeoCord application in the specified mode.
|
|
22
22
|
*
|
|
23
23
|
* @param mode - The build mode ('production' or 'development').
|
package/package.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
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.
|
|
5
|
-
"packageManager": "yarn@4.
|
|
4
|
+
"version": "1.0.2",
|
|
5
|
+
"packageManager": "yarn@4.7.0",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"scripts": {
|
|
8
8
|
"build": "rm -rf ./dist && babel src --out-dir dist --extensions \".ts,.js\" && tsc && tsc-alias && copyfiles -u 1 \"src/**/*.template\" dist",
|