UNPKG

sdin

Version:

JavaScript package builder.

2 lines 2.45 kB
import r from"@babel/runtime/helpers/defineProperty";function n(e,t){var i,r=Object.keys(e);return Object.getOwnPropertySymbols&&(i=Object.getOwnPropertySymbols(e),t&&(i=i.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,i)),r}function e(e){for(var t=1;t<arguments.length;t++){var i=null!=arguments[t]?arguments[t]:{};t%2?n(Object(i),!0).forEach(function(t){r(e,t,i[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(i)):n(Object(i)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(i,t))})}return e}import{asyncForEach as t,filterNotNone as a}from"../utils/array";import{SdinTesting as i}from"./testing";import{SdinPlaying as o}from"./playing";import{SdinAbstractProject as s}from"./abstract-project";import{SdinFoundationModule as l}from"./foundation-module";import{SdinIntegrationModule as p}from"./integration-module";import{SdinDeclarationModule as c}from"./declaration-module";import{SdinApplicationModule as u}from"./application-module";import{SdinConfigError as d}from"../tools/errors";import{green as m,yellow as h}from"../utils/print";class g extends s{constructor(t){super(null,null,t),this.datas=e(e({},t.datas),{},{SDIN_PROJECT_NAME:this.pkg.name,SDIN_PROJECT_VERSION:this.pkg.version,SDIN_PROJECT_DESCRIPTION:this.pkg.description,SDIN_PROJECT_AUTHOR_NAME:this.pkg.authorName,SDIN_PROJECT_AUTHOR_EMAIL:this.pkg.authorEmail}),this.modules=this.createModules(t.modules),t.testing&&(this.testing=new i(this,t.testing)),t.playing&&(this.playing=new o(this,t.playing))}createModules(t){var e,i=[],r={};for(e of a(t)){var n=this.createModule(e);if(r[n.name])throw new d(d.MODULE_NAME_IS_REPEATED,'Module name "'.concat(h(n.name),'" is repeated.'));i.push(n),r[n.name]=!0}return i}createModule(t){if("foundation"===t.type)return new l(this,t);if("integration"===t.type)return new p(this,t);if("declaration"===t.type)return new c(this,t);if("application"===t.type)return new u(this,t);throw new d(d.MODULE_TYPE_ILLEGAL,'Module type "'.concat(m(t.type),'" is illegal.'))}async initialize(){this.testing&&await this.testing.initialize(),this.playing&&await this.playing.initialize(),await t(this.modules,t=>t.initialize())}async validate(){this.testing&&await this.testing.validate(),this.playing&&await this.playing.validate(),await t(this.modules,t=>t.validate())}}export{g as SdinProject}; //# sourceMappingURL=project.js.map