@ikas/storefront-cmd 4.0.0-alpha.38 → 4.0.0-alpha.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.
- package/build/ikas.cjs +1 -1
- package/package.json +3 -3
- package/src/scripts/generators/components/index.ts +16 -42
- package/src/scripts/generators/config/content.ts +10 -12
- package/src/scripts/generators/config/index.ts +16 -23
- package/src/scripts/generators/pages/index.ts +7 -7
- package/src/scripts/generators/types/index.ts +3 -9
- package/src/scripts/theme-build/index.ts +5 -5
package/build/ikas.cjs
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
"use strict";var e=require("path"),t=require("fs"),n=require("@ikas/storefront-models");function o(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var r=o(e),s=o(t),a=function(){return a=Object.assign||function(e){for(var t,n=1,o=arguments.length;n<o;n++)for(var r in t=arguments[n])Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e},a.apply(this,arguments)};function i(e,t,n,o){return new(n||(n=Promise))((function(r,s){function a(e){try{c(o.next(e))}catch(e){s(e)}}function i(e){try{c(o.throw(e))}catch(e){s(e)}}function c(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,i)}c((o=o.apply(e,t||[])).next())}))}function c(e,t){var n,o,r,s,a={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return s={next:i(0),throw:i(1),return:i(2)},"function"==typeof Symbol&&(s[Symbol.iterator]=function(){return this}),s;function i(s){return function(i){return function(s){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,o&&(r=2&s[0]?o.return:s[0]?o.throw||((r=o.return)&&r.call(o),0):o.next)&&!(r=r.call(o,s[1])).done)return r;switch(o=0,r&&(s=[2&s[0],r.value]),s[0]){case 0:case 1:r=s;break;case 4:return a.label++,{value:s[1],done:!1};case 5:a.label++,o=s[1],s=[0];continue;case 7:s=a.ops.pop(),a.trys.pop();continue;default:if(!(r=a.trys,(r=r.length>0&&r[r.length-1])||6!==s[0]&&2!==s[0])){a=0;continue}if(3===s[0]&&(!r||s[1]>r[0]&&s[1]<r[3])){a.label=s[1];break}if(6===s[0]&&a.label<r[1]){a.label=r[1],r=s;break}if(r&&a.label<r[2]){a.label=r[2],a.ops.push(s);break}r[2]&&a.ops.pop(),a.trys.pop();continue}s=t.call(e,a)}catch(e){s=[6,e],o=0}finally{n=r=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,i])}}}var p="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},u=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,l=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,f="\\xac\\xb1\\xd7\\xf7\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf\\u2000-\\u206f \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",h="[\\ud800-\\udfff]",m="["+f+"]",d="[\\u0300-\\u036f\\ufe20-\\ufe23\\u20d0-\\u20f0]",g="\\d+",T="[\\u2700-\\u27bf]",y="[a-z\\xdf-\\xf6\\xf8-\\xff]",I="[^\\ud800-\\udfff"+f+g+"\\u2700-\\u27bfa-z\\xdf-\\xf6\\xf8-\\xffA-Z\\xc0-\\xd6\\xd8-\\xde]",k="\\ud83c[\\udffb-\\udfff]",v="[^\\ud800-\\udfff]",C="(?:\\ud83c[\\udde6-\\uddff]){2}",_="[\\ud800-\\udbff][\\udc00-\\udfff]",b="[A-Z\\xc0-\\xd6\\xd8-\\xde]",P="(?:"+y+"|"+I+")",x="(?:"+b+"|"+I+")",E="(?:"+d+"|"+k+")"+"?",N="[\\ufe0e\\ufe0f]?"+E+("(?:\\u200d(?:"+[v,C,_].join("|")+")[\\ufe0e\\ufe0f]?"+E+")*"),S="(?:"+[T,C,_].join("|")+")"+N,O="(?:"+[v+d+"?",d,C,_,h].join("|")+")",L=RegExp("['’]","g"),A=RegExp(d,"g"),w=RegExp(k+"(?="+k+")|"+O+N,"g"),D=RegExp([b+"?"+y+"+(?:['’](?:d|ll|m|re|s|t|ve))?(?="+[m,b,"$"].join("|")+")",x+"+(?:['’](?:D|LL|M|RE|S|T|VE))?(?="+[m,b+P,"$"].join("|")+")",b+"?"+P+"+(?:['’](?:d|ll|m|re|s|t|ve))?",b+"+(?:['’](?:D|LL|M|RE|S|T|VE))?",g,S].join("|"),"g"),J=RegExp("[\\u200d\\ud800-\\udfff\\u0300-\\u036f\\ufe20-\\ufe23\\u20d0-\\u20f0\\ufe0e\\ufe0f]"),R=/[a-z][A-Z]|[A-Z]{2,}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,j="object"==typeof p&&p&&p.Object===Object&&p,U="object"==typeof self&&self&&self.Object===Object&&self,B=j||U||Function("return this")();var F,G=(F={"À":"A","Á":"A","Â":"A","Ã":"A","Ä":"A","Å":"A","à":"a","á":"a","â":"a","ã":"a","ä":"a","å":"a","Ç":"C","ç":"c","Ð":"D","ð":"d","È":"E","É":"E","Ê":"E","Ë":"E","è":"e","é":"e","ê":"e","ë":"e","Ì":"I","Í":"I","Î":"I","Ï":"I","ì":"i","í":"i","î":"i","ï":"i","Ñ":"N","ñ":"n","Ò":"O","Ó":"O","Ô":"O","Õ":"O","Ö":"O","Ø":"O","ò":"o","ó":"o","ô":"o","õ":"o","ö":"o","ø":"o","Ù":"U","Ú":"U","Û":"U","Ü":"U","ù":"u","ú":"u","û":"u","ü":"u","Ý":"Y","ý":"y","ÿ":"y","Æ":"Ae","æ":"ae","Þ":"Th","þ":"th","ß":"ss","Ā":"A","Ă":"A","Ą":"A","ā":"a","ă":"a","ą":"a","Ć":"C","Ĉ":"C","Ċ":"C","Č":"C","ć":"c","ĉ":"c","ċ":"c","č":"c","Ď":"D","Đ":"D","ď":"d","đ":"d","Ē":"E","Ĕ":"E","Ė":"E","Ę":"E","Ě":"E","ē":"e","ĕ":"e","ė":"e","ę":"e","ě":"e","Ĝ":"G","Ğ":"G","Ġ":"G","Ģ":"G","ĝ":"g","ğ":"g","ġ":"g","ģ":"g","Ĥ":"H","Ħ":"H","ĥ":"h","ħ":"h","Ĩ":"I","Ī":"I","Ĭ":"I","Į":"I","İ":"I","ĩ":"i","ī":"i","ĭ":"i","į":"i","ı":"i","Ĵ":"J","ĵ":"j","Ķ":"K","ķ":"k","ĸ":"k","Ĺ":"L","Ļ":"L","Ľ":"L","Ŀ":"L","Ł":"L","ĺ":"l","ļ":"l","ľ":"l","ŀ":"l","ł":"l","Ń":"N","Ņ":"N","Ň":"N","Ŋ":"N","ń":"n","ņ":"n","ň":"n","ŋ":"n","Ō":"O","Ŏ":"O","Ő":"O","ō":"o","ŏ":"o","ő":"o","Ŕ":"R","Ŗ":"R","Ř":"R","ŕ":"r","ŗ":"r","ř":"r","Ś":"S","Ŝ":"S","Ş":"S","Š":"S","ś":"s","ŝ":"s","ş":"s","š":"s","Ţ":"T","Ť":"T","Ŧ":"T","ţ":"t","ť":"t","ŧ":"t","Ũ":"U","Ū":"U","Ŭ":"U","Ů":"U","Ű":"U","Ų":"U","ũ":"u","ū":"u","ŭ":"u","ů":"u","ű":"u","ų":"u","Ŵ":"W","ŵ":"w","Ŷ":"Y","ŷ":"y","Ÿ":"Y","Ź":"Z","Ż":"Z","Ž":"Z","ź":"z","ż":"z","ž":"z","IJ":"IJ","ij":"ij","Œ":"Oe","œ":"oe","ʼn":"'n","ſ":"ss"},function(e){return null==F?void 0:F[e]});function M(e){return J.test(e)}function V(e){return M(e)?function(e){return e.match(w)||[]}(e):function(e){return e.split("")}(e)}var z=Object.prototype.toString,W=B.Symbol,q=W?W.prototype:void 0,X=q?q.toString:void 0;function Y(e){if("string"==typeof e)return e;if(function(e){return"symbol"==typeof e||function(e){return!!e&&"object"==typeof e}(e)&&"[object Symbol]"==z.call(e)}(e))return X?X.call(e):"";var t=e+"";return"0"==t&&1/e==-Infinity?"-0":t}function $(e,t,n){var o=e.length;return n=void 0===n?o:n,!t&&n>=o?e:function(e,t,n){var o=-1,r=e.length;t<0&&(t=-t>r?0:r+t),(n=n>r?r:n)<0&&(n+=r),r=t>n?0:n-t>>>0,t>>>=0;for(var s=Array(r);++o<r;)s[o]=e[o+t];return s}(e,t,n)}function Z(e){return null==e?"":Y(e)}var H,K=(H=function(e,t,n){return t=t.toLowerCase(),e+(n?ee(Z(t).toLowerCase()):t)},function(e){return function(e,t,n,o){var r=-1,s=e?e.length:0;for(o&&s&&(n=e[++r]);++r<s;)n=t(n,e[r],r,e);return n}(function(e,t,n){return e=Z(e),void 0===(t=n?void 0:t)?function(e){return R.test(e)}(e)?function(e){return e.match(D)||[]}(e):function(e){return e.match(u)||[]}(e):e.match(t)||[]}(function(e){return(e=Z(e))&&e.replace(l,G).replace(A,"")}(e).replace(L,"")),H,"")});var Q,ee=(Q="toUpperCase",function(e){var t=M(e=Z(e))?V(e):void 0,n=t?t[0]:e.charAt(0),o=t?$(t,1).join(""):e.slice(1);return n[Q]()+o});var te,ne=(te=K)&&"object"==typeof te&&"default"in te?te.default:te;function oe(e){return Array.isArray(e)?e:void 0===e?[]:function(e){return function(e){return"object"==typeof e&&null!==e}(e)&&"number"==typeof e.length}(e)||e instanceof Set?Array.from(e):[e]}function re(e){return Array.isArray(e)?e:void 0===e?[]:function(e){return function(e){return"object"==typeof e&&null!==e}(e)&&"number"==typeof e.length}(e)?Array.prototype.slice.call(e):[e]}function se(e,t){const n=[],o=re(arguments);return o.splice(0,2),re(e).forEach(((e,r)=>{let s=[];o.forEach((t=>{"function"==typeof t?s=s.concat(t(e)):s.push(t)})),t(e)&&n.push({index:r,replaceWithValue:s})})),n.reverse().forEach((t=>{const n=[t.index,1].concat(t.replaceWithValue);e.splice.apply(e,n)})),e}const ae={short:/^-([^\d-])$/,long:/^--(\S+)/,combinedShort:/^-[^\d-]{2,}$/,optEquals:/^(--\S+?)=(.*)/};class ie extends Array{load(e){if(this.clear(),e&&e!==process.argv)e=oe(e);else{e=process.argv.slice(0);const t=process.execArgv.some(he)?1:2;e.splice(0,t)}e.forEach((e=>this.push(String(e))))}clear(){this.length=0}expandOptionEqualsNotation(){if(this.some((e=>ae.optEquals.test(e)))){const e=[];this.forEach((t=>{const n=t.match(ae.optEquals);n?e.push(n[1],n[2]):e.push(t)})),this.clear(),this.load(e)}}expandGetoptNotation(){this.hasCombinedShortOptions()&&se(this,ae.combinedShort,ce)}hasCombinedShortOptions(){return this.some((e=>ae.combinedShort.test(e)))}static from(e){const t=new this;return t.load(e),t}}function ce(e){return(e=e.slice(1)).split("").map((e=>"-"+e))}function pe(e){return ae.optEquals.test(e)}function ue(e){return(ae.short.test(e)||ae.long.test(e))&&!ae.optEquals.test(e)}function le(e){return ae.short.test(e)?e.match(ae.short)[1]:function(e){return ae.long.test(e)&&!pe(e)}(e)?e.match(ae.long)[1]:pe(e)?e.match(ae.optEquals)[1].replace(/^--/,""):null}function fe(e){return!(ue(e)||ae.combinedShort.test(e)||ae.optEquals.test(e))}function he(e){return["--eval","-e"].indexOf(e)>-1||e.startsWith("--eval=")}function me(e){return"object"==typeof e&&null!==e}function de(e){return void 0!==e}function ge(e){return"function"==typeof e}var Te={isNumber:function(e){return!isNaN(parseFloat(e))&&isFinite(e)},isString:function(e){return"string"==typeof e},isBoolean:function(e){return"boolean"==typeof e},isPlainObject:function(e){return null!==e&&"object"==typeof e&&e.constructor===Object},isArrayLike:function(e){return me(e)&&"number"==typeof e.length},isObject:me,isDefined:de,isFunction:ge,isClass:function(e){return!!ge(e)&&/^class /.test(Function.prototype.toString.call(e))},isPrimitive:function(e){if(null===e)return!0;switch(typeof e){case"string":case"number":case"symbol":case"undefined":case"boolean":return!0;default:return!1}},isPromise:function(e){if(e){const t=de(Promise)&&e instanceof Promise,n=e.then&&"function"==typeof e.then;return!(!t&&!n)}return!1},isIterable:function(e){return!(null===e||!de(e))&&("function"==typeof e[Symbol.iterator]||"function"==typeof e[Symbol.asyncIterator])}};class ye{constructor(e){this.name=e.name,this.type=e.type||String,this.alias=e.alias,this.multiple=e.multiple,this.lazyMultiple=e.lazyMultiple,this.defaultOption=e.defaultOption,this.defaultValue=e.defaultValue,this.group=e.group;for(const t in e)this[t]||(this[t]=e[t])}isBoolean(){return this.type===Boolean||Te.isFunction(this.type)&&"Boolean"===this.type.name}isMultiple(){return this.multiple||this.lazyMultiple}static create(e){return new this(e)}}class Ie extends Array{validate(e){this.some((e=>!e.name))&&ke("INVALID_DEFINITIONS","Invalid option definitions: the `name` property is required on each definition");let t;this.some((e=>e.type&&"function"!=typeof e.type))&&ke("INVALID_DEFINITIONS","Invalid option definitions: the `type` property must be a setter fuction (default: `Boolean`)");this.some((e=>(t=e,Te.isDefined(e.alias)&&Te.isNumber(e.alias))))&&ke("INVALID_DEFINITIONS","Invalid option definition: to avoid ambiguity an alias cannot be numeric [--"+t.name+" alias is -"+t.alias+"]");this.some((e=>(t=e,Te.isDefined(e.alias)&&1!==e.alias.length)))&&ke("INVALID_DEFINITIONS","Invalid option definition: an alias must be a single character");this.some((e=>(t=e,"-"===e.alias)))&&ke("INVALID_DEFINITIONS",'Invalid option definition: an alias cannot be "-"');Ce(this.map((t=>e?t.name.toLowerCase():t.name)))&&ke("INVALID_DEFINITIONS","Two or more option definitions have the same name");Ce(this.map((t=>e&&Te.isDefined(t.alias)?t.alias.toLowerCase():t.alias)))&&ke("INVALID_DEFINITIONS","Two or more option definitions have the same alias");this.filter((e=>!0===e.defaultOption)).length>1&&ke("INVALID_DEFINITIONS","Only one option definition can be the defaultOption");this.some((e=>(t=e,e.isBoolean()&&e.defaultOption)))&&ke("INVALID_DEFINITIONS",`A boolean option ["${t.name}"] can not also be the defaultOption.`)}get(e,t){if(ue(e)){if(ae.short.test(e)){const n=le(e);if(t){const e=n.toLowerCase();return this.find((t=>Te.isDefined(t.alias)&&t.alias.toLowerCase()===e))}return this.find((e=>e.alias===n))}{const n=le(e);if(t){const e=n.toLowerCase();return this.find((t=>t.name.toLowerCase()===e))}return this.find((e=>e.name===n))}}return this.find((t=>t.name===e))}getDefault(){return this.find((e=>!0===e.defaultOption))}isGrouped(){return this.some((e=>e.group))}whereGrouped(){return this.filter(ve)}whereNotGrouped(){return this.filter((e=>!ve(e)))}whereDefaultValueSet(){return this.filter((e=>Te.isDefined(e.defaultValue)))}static from(e,t){if(e instanceof this)return e;const n=super.from(oe(e),(e=>ye.create(e)));return n.validate(t),n}}function ke(e,t){const n=new Error(t);throw n.name=e,n}function ve(e){return oe(e.group).some((e=>e))}function Ce(e){const t={};for(let n=0;n<e.length;n++){const o=e[n];if(t[o])return!0;Te.isDefined(o)&&(t[o]=!0)}}class _e{constructor(e,t){this.options=Object.assign({},t),this.definitions=Ie.from(e,this.options.caseInsensitive),this.argv=ie.from(this.options.argv),this.argv.hasCombinedShortOptions()&&se(this.argv,ae.combinedShort.test.bind(ae.combinedShort),(e=>(e=e.slice(1)).split("").map((t=>({origArg:`-${e}`,arg:"-"+t})))))}*[Symbol.iterator](){const e=this.definitions;let t,n,o,r,s,a=!1,i=!1;for(let c of this.argv){if(Te.isPlainObject(c)&&(s=c.origArg,c=c.arg),i&&this.options.stopAtFirstUnknown){yield{event:"unknown_value",arg:c,name:"_unknown",value:void 0};continue}if(ue(c))t=e.get(c,this.options.caseInsensitive),n=void 0,t?(n=!!t.isBoolean()||null,r="set"):r="unknown_option";else if(pe(c)){const o=c.match(ae.optEquals);t=e.get(o[1],this.options.caseInsensitive),t?t.isBoolean()?(yield{event:"unknown_value",arg:c,name:"_unknown",value:n,def:t},r="set",n=!0):(r="set",n=o[2]):r="unknown_option"}else fe(c)&&(t?(n=c,r="set"):(t=this.definitions.getDefault(),t&&!a?(n=c,r="set"):(r="unknown_value",t=void 0)));o=t?t.name:"_unknown";const p={event:r,arg:c,name:o,value:n,def:t};s&&(p.subArg=c,p.arg=s),yield p,"_unknown"===o&&(i=!0),t&&t.defaultOption&&!t.isMultiple()&&"set"===r&&(a=!0),t&&t.isBoolean()&&(t=void 0),t&&!t.multiple&&Te.isDefined(n)&&null!==n&&(t=void 0),n=void 0,r=void 0,o=void 0,s=void 0}}}const be=new WeakMap;class Pe{constructor(e){this.definition=new ye(e),this.state=null,this.resetToDefault()}get(){return be.get(this)}set(e){this._set(e,"set")}_set(e,t){const n=this.definition;if(n.isMultiple()){if(null!=e){const o=this.get();"default"===this.state&&(o.length=0),o.push(n.type(e)),this.state=t}}else{if(!n.isMultiple()&&"set"===this.state){const t=new Error(`Singular option already set [${this.definition.name}=${this.get()}]`);throw t.name="ALREADY_SET",t.value=e,t.optionName=n.name,t}null==e?be.set(this,e):(be.set(this,n.type(e)),this.state=t)}}resetToDefault(){Te.isDefined(this.definition.defaultValue)?this.definition.isMultiple()?be.set(this,oe(this.definition.defaultValue).slice()):be.set(this,this.definition.defaultValue):this.definition.isMultiple()?be.set(this,[]):be.set(this,null),this.state="default"}static create(e){return(e=new ye(e)).isBoolean()?xe.create(e):new this(e)}}class xe extends Pe{set(e){super.set(!0)}static create(e){return new this(e)}}class Ee extends Map{constructor(e){super(),this.definitions=Ie.from(e),this.set("_unknown",Pe.create({name:"_unknown",multiple:!0}));for(const e of this.definitions.whereDefaultValueSet())this.set(e.name,Pe.create(e))}toObject(e){e=e||{};const t={};for(const n of this){const o=e.camelCase&&"_unknown"!==n[0]?ne(n[0]):n[0],r=n[1];("_unknown"!==o||r.get().length)&&(t[o]=r.get())}return e.skipUnknown&&delete t._unknown,t}}class Ne extends Ee{toObject(e){const t=super.toObject({skipUnknown:e.skipUnknown}),n=super.toObject(e),o=n._unknown;delete n._unknown;const r={_all:n};return o&&o.length&&(r._unknown=o),this.definitions.whereGrouped().forEach((n=>{const o=e.camelCase?ne(n.name):n.name,s=t[n.name];for(const e of oe(n.group))r[e]=r[e]||{},Te.isDefined(s)&&(r[e][o]=s)})),this.definitions.whereNotGrouped().forEach((n=>{const o=e.camelCase?ne(n.name):n.name,s=t[n.name];Te.isDefined(s)&&(r._none||(r._none={}),r._none[o]=s)})),r}}var Se=function(e,t){(t=t||{}).stopAtFirstUnknown&&(t.partial=!0),e=Ie.from(e,t.caseInsensitive);const n=new _e(e,{argv:t.argv,stopAtFirstUnknown:t.stopAtFirstUnknown,caseInsensitive:t.caseInsensitive}),o=new(e.isGrouped()?Ne:Ee)(e);for(const e of n){const n=e.subArg||e.arg;if(!t.partial){if("unknown_value"===e.event){const e=new Error(`Unknown value: ${n}`);throw e.name="UNKNOWN_VALUE",e.value=n,e}if("unknown_option"===e.event){const e=new Error(`Unknown option: ${n}`);throw e.name="UNKNOWN_OPTION",e.optionName=n,e}}let r;o.has(e.name)?r=o.get(e.name):(r=Pe.create(e.def),o.set(e.name,r)),"_unknown"===e.name?r.set(n):r.set(e.value)}return o.toObject({skipUnknown:!t.partial,camelCase:t.camelCase})};function Oe(e,t){return i(this,void 0,void 0,(function(){return c(this,(function(n){try{return s.default.readdirSync(e).forEach((function(n){(null==t?void 0:t.includes(n))||s.default.unlinkSync(r.default.join(e,n))})),[2,!0]}catch(e){return[2,!1]}return[2]}))}))}function Le(e,t,n){var o;return i(this,void 0,void 0,(function(){var a,i,p;return c(this,(function(c){try{return a=e,i=function(e){var t=e.split("/");return t.length>1?{dirParts:t.slice(0,t.length-1),filePart:t[t.length-1]}:{filePart:e}}(t),(null===(o=i.dirParts)||void 0===o?void 0:o.length)&&(a=r.default.join.apply(r.default,function(e,t,n){if(n||2===arguments.length)for(var o,r=0,s=t.length;r<s;r++)!o&&r in t||(o||(o=Array.prototype.slice.call(t,0,r)),o[r]=t[r]);return e.concat(o||Array.prototype.slice.call(t))}([a],i.dirParts,!1))),s.default.existsSync(a)||s.default.mkdirSync(a,{recursive:!0}),p=r.default.join(a,i.filePart),s.default.writeFileSync(p,n),[2,!0]}catch(e){return console.error(e),[2,!1]}return[2]}))}))}var Ae=[{content:'import { IkasLocalThemeAPI } from "@ikas/storefront-next";\n\nexport default IkasLocalThemeAPI.GetComponentDirs.getComponentDirs;\nexport const config = IkasLocalThemeAPI.GetComponentDirs.config;\n',fileName:"getComponentDirs.ts"},{content:'import { IkasLocalThemeAPI } from "@ikas/storefront-next";\n\nexport default IkasLocalThemeAPI.GetTheme.getTheme;\nexport const config = IkasLocalThemeAPI.GetTheme.config;\n',fileName:"getTheme.ts"},{content:'import { IkasLocalThemeAPI } from "@ikas/storefront-next";\n\nexport default IkasLocalThemeAPI.UpdateTheme.updateTheme;\nexport const config = IkasLocalThemeAPI.UpdateTheme.config;\n',fileName:"updateTheme.ts"},{content:'import { IkasLocalThemeAPI } from "@ikas/storefront-next";\n\nexport default IkasLocalThemeAPI.UploadTheme.uploadTheme;\nexport const config = IkasLocalThemeAPI.UploadTheme.config;\n',fileName:"uploadTheme.ts"}],we=function(){function e(){}return e.generate=function(){return i(this,void 0,void 0,(function(){var t,n,o,s,a;return c(this,(function(i){switch(i.label){case 0:return[4,Oe(r.default.join(process.cwd(),"src","pages","api"))];case 1:i.sent(),t=!0,n=0,o=Ae,i.label=2;case 2:return n<o.length?(s=o[n],(a=t)?[4,e.generateAPI(s)]:[3,4]):[3,6];case 3:a=i.sent(),i.label=4;case 4:t=a,i.label=5;case 5:return n++,[3,2];case 6:return[2,t]}}))}))},e.generateAPI=function(e){return Le(r.default.join(process.cwd(),"src","pages","api"),e.fileName,e.content)},e}();function De(e,t){return Object.entries(e||{}).reduce((function(e,n){var o=n[0],r=n[1];return o===t?e.concat(r):"object"==typeof r?e.concat(De(r,t)):e}),[])}var Je={next:"12.2.0",react:"17.0.2","react-dom":"17.0.2",mobx:"^6.1.3",axios:"^0.26.0",lodash:"^4.17.20",archiver:"^5.3.0",cors:"^2.8.5","html-react-parser":"^1.4.0","mobx-react-lite":"^3.1.5","next-transpile-modules":"^9.0.0","@ikas/storefront":"^4.0.0-alpha.7","@ikas/storefront-api":"^4.0.0-alpha.7","@ikas/storefront-assets":"^4.0.0-alpha.7","@ikas/storefront-cmd":"^4.0.0-alpha.7","@ikas/storefront-config":"^4.0.0-alpha.7","@ikas/storefront-model-functions":"^4.0.0-alpha.7","@ikas/storefront-models":"^4.0.0-alpha.7","@ikas/storefront-next":"^4.0.0-alpha.7","@ikas/storefront-providers":"^4.0.0-alpha.7"},Re={"@types/node":"^14.14.6","@types/react":"^17.0.2","@types/react-dom":"^17.0.2","@types/cors":"^2.8.9","@types/archiver":"^5.1.0","@typescript-eslint/eslint-plugin":"^2.10.0","@typescript-eslint/parser":"^2.10.0",eslint:"^6.6.0","eslint-config-react-app":"^5.2.1","eslint-loader":"3.0.3","eslint-plugin-flowtype":"4.6.0","eslint-plugin-import":"2.20.1","eslint-plugin-jsx-a11y":"6.2.3","eslint-plugin-react":"7.19.0","eslint-plugin-react-hooks":"^1.6.1",sass:"^1.43.4",typescript:"^4.5.2"},je={"@types/react":"17.0.2","@types/react-dom":"17.0.2"},Ue={upgradeDependencies:"yarn upgrade @ikas/storefront @ikas/storefront-api @ikas/storefront-assets @ikas/storefront-cmd @ikas/storefront-config @ikas/storefront-model-functions @ikas/storefront-models @ikas/storefront-next @ikas/storefront-providers",dev:"next dev -p 3333",build:"next build",start:"next start",generate:"ikas --generate","prettier:all":"npx prettier@^2.1 './**/src/**/*.(ts|tsx|css|scss)' --write"},Be=function(){function e(){}return e.generate=function(t,n){return i(this,void 0,void 0,(function(){var o,r,s,a;return c(this,(function(i){switch(i.label){case 0:return[4,e.generateTsConfig(n)];case 1:return(a=i.sent())?[4,e.generateBabelRc(n)]:[3,3];case 2:a=i.sent(),i.label=3;case 3:return(s=a)?[4,e.generateNextConfig(n)]:[3,5];case 4:s=i.sent(),i.label=5;case 5:return(r=s)?[4,e.generatePackageJson(n)]:[3,7];case 6:r=i.sent(),i.label=7;case 7:return(o=r)?[4,e.generateEnv(t,n)]:[3,9];case 8:o=i.sent(),i.label=9;case 9:return[2,o]}}))}))},e.generateTsConfig=function(e){return Le(e||process.cwd(),"tsconfig.json",'{\n "compilerOptions": {\n "target": "esnext",\n "lib": [\n "dom",\n "dom.iterable",\n "esnext"\n ],\n "allowJs": true,\n "skipLibCheck": true,\n "strict": true,\n "forceConsistentCasingInFileNames": true,\n "experimentalDecorators": true,\n "noEmit": true,\n "esModuleInterop": true,\n "module": "esnext",\n "moduleResolution": "node",\n "resolveJsonModule": true,\n "isolatedModules": true,\n "jsx": "preserve",\n "baseUrl": ".",\n "useUnknownInCatchVariables": false,\n "incremental": true\n },\n "typeRoots": [\n "./node_modules/@types"\n ],\n "include": [\n "next-env.d.ts",\n "**/*.ts",\n "**/*.tsx",\n "**/typings/global.d.ts",\n ],\n "exclude": [\n "node_modules",\n "./src/pages/api",\n ]\n}')},e.generateBabelRc=function(e){return Le(e||process.cwd(),".babelrc",'{\n "presets": [\n [\n "next/babel",\n {\n "preset-react": { "throwIfNamespace": false },\n }\n ]\n ],\n "plugins": []\n}')},e.generateNextConfig=function(e){return Le(e||process.cwd(),"next.config.js",'const withTM = require("next-transpile-modules")([\n "@ikas/storefront",\n "@ikas/storefront-api",\n "@ikas/storefront-assets",\n "@ikas/storefront-cmd",\n "@ikas/storefront-config",\n "@ikas/storefront-model-functions",\n "@ikas/storefront-models",\n "@ikas/storefront-next",\n "@ikas/storefront-providers",\n]);\n\nconst config = {\n i18n: {\n defaultLocale: "en",\n locales: ["en"],\n localeDetection: false,\n },\n basePath: process.env.NEXTJS_BASE_PATH || "",\n\n images: {\n deviceSizes: [\n 180, 360, 540, 720, 900, 1080, 1296, 1512, 1728, 1950, 2560, 3840,\n ],\n },\n\n webpack: (config, { buildId, dev, isServer, defaultLoaders, webpack }) => {\n if (!isServer) {\n config.resolve.fallback.fs = false;\n config.resolve.fallback.net = false;\n config.resolve.fallback.encoding = false;\n config.resolve.fallback.crypto = false;\n config.resolve.fallback.assert = false;\n config.resolve.fallback.stream = false;\n config.module.rules = [\n ...config.module.rules,\n {\n test: /@ikas/i,\n sideEffects: false,\n },\n ];\n }\n return config;\n },\n};\n\nmodule.exports = withTM(config);')},e.generatePackageJson=function(e){return i(this,void 0,void 0,(function(){var t,n,o,i,p;return c(this,(function(c){switch(c.label){case 0:return c.trys.push([0,3,,4]),t=r.default.join(e||process.cwd(),"package.json"),(n=s.default.readFileSync(t)).length?(o=JSON.parse(n.toString()),(i=function(e){var t="dev"===e?Re:Je,n="dev"===e?"devDependencies":"dependencies";o[n]&&"object"==typeof o[n]?o[n]=a(a({},o[n]),t):o[n]=t;var r,s=(r=o[n],Object.keys(r).sort().reduce((function(e,t){return e[t]=r[t],e}),{}));o[n]=s})("dev"),i("normal"),o.scripts&&"object"==typeof o.scripts?o.scripts=a(a({},o.scripts),Ue):o.scripts=Ue,o.resolutions=a(a({},o.resolutions),je),[4,Le(t,"",JSON.stringify(o,null,2))]):[3,2];case 1:return[2,c.sent()];case 2:return[3,4];case 3:return p=c.sent(),console.error(p),[2,!1];case 4:return[2]}}))}))},e.generateEnv=function(e,t){var n="dev"===e?"NEXT_PUBLIC_ENV=local\nNEXT_PUBLIC_BASE_URL=https://api.myikas.dev/api/sf\nNEXT_PUBLIC_IMG_BASE_URL=https://cdn.myikas.dev/\nNEXT_PUBLIC_UPLOAD_GQL_URL=https://api.myikas.dev/api/admin/graphql\nNEXT_PUBLIC_GQL_URL=https://api.myikas.dev/api/sf/graphql\n":"NEXT_PUBLIC_ENV=local\nNEXT_PUBLIC_BASE_URL=https://api.myikas.com/api/sf\nNEXT_PUBLIC_IMG_BASE_URL=https://cdn.myikas.com/\nNEXT_PUBLIC_UPLOAD_GQL_URL=https://api.myikas.com/api/admin/graphql\nNEXT_PUBLIC_GQL_URL=https://api.myikas.com/api/sf/graphql\n";return Le(t||process.cwd(),".env",n)},e}(),Fe=function(){function e(){}return e.generate=function(e){return Le(r.default.join(process.cwd(),"src","theme.json"),"",JSON.stringify(e,null,2))},e.generateInitialThemeJsonFile=function(){var t={pages:[],components:[],name:"My Theme",customData:[],settings:{colors:[],favicon:{id:null},fontFamily:{name:null,variants:null},stockPreference:n.IkasThemeJsonStockPreference.SHOW_ALL}};return t.pages.push({id:"1",components:[],canonicals:null,description:null,disableIndex:null,name:null,pageTitle:null,slug:null,specifications:[],type:n.IkasThemeJsonPageType.INDEX}),e.generate(t)},e.getTheme=function(){return i(this,void 0,void 0,(function(){var e,t;return c(this,(function(n){try{return e=r.default.join(process.cwd(),"src","theme.json"),[2,(t=s.default.readFileSync(e)).length?JSON.parse(t.toString()):null]}catch(e){console.error(e)}return[2]}))}))},e}(),Ge=[{path:"[slug]/index.tsx",pageComponentName:"SlugPage",pageTypes:[n.IkasThemeJsonPageType.PRODUCT,n.IkasThemeJsonPageType.CATEGORY,n.IkasThemeJsonPageType.BRAND],isDynamicSSG:!0},{path:"account/orders/[id].tsx",pageComponentName:"OrderDetailPage",pageTypes:[n.IkasThemeJsonPageType.ORDER_DETAIL],isSSR:!0},{path:"account/orders/index.tsx",pageComponentName:"OrdersPage",pageTypes:[n.IkasThemeJsonPageType.ORDERS]},{path:"account/addresses.tsx",pageComponentName:"AddressesPage",pageTypes:[n.IkasThemeJsonPageType.ADDRESSES]},{path:"account/favorite-products.tsx",pageComponentName:"FavoriteProductsPage",pageTypes:[n.IkasThemeJsonPageType.FAVORITE_PRODUCTS]},{path:"account/forgot-password.tsx",pageComponentName:"ForgotPasswordPage",pageTypes:[n.IkasThemeJsonPageType.FORGOT_PASSWORD]},{path:"account/index.tsx",pageComponentName:"AccountPage",pageTypes:[n.IkasThemeJsonPageType.ACCOUNT]},{path:"account/login.tsx",pageComponentName:"LoginPage",pageTypes:[n.IkasThemeJsonPageType.LOGIN]},{path:"account/raffles.tsx",pageComponentName:"AccountRafflesPage",pageTypes:[n.IkasThemeJsonPageType.RAFFLE_ACCOUNT]},{path:"account/recover-password.tsx",pageComponentName:"RecoverPasswordPage",pageTypes:[n.IkasThemeJsonPageType.RECOVER_PASSWORD]},{path:"account/register.tsx",pageComponentName:"RegisterPage",pageTypes:[n.IkasThemeJsonPageType.REGISTER]},{path:"blog/[slug].tsx",pageComponentName:"BlogSlugPage",pageTypes:[n.IkasThemeJsonPageType.BLOG,n.IkasThemeJsonPageType.BLOG_CATEGORY],isDynamicSSG:!0},{path:"blog/index.tsx",pageComponentName:"BlogPage",pageTypes:[n.IkasThemeJsonPageType.BLOG_INDEX]},{path:"pages/[slug].tsx",pageComponentName:"CustomPage",pageTypes:[n.IkasThemeJsonPageType.CUSTOM],isDynamicSSG:!0},{path:"raffle/[slug].tsx",pageComponentName:"RafflePage",pageTypes:[n.IkasThemeJsonPageType.RAFFLE_DETAIL],isDynamicSSG:!0},{path:"raffle/index.tsx",pageComponentName:"RafflesPage",pageTypes:[n.IkasThemeJsonPageType.RAFFLE]},{path:"404.tsx",pageComponentName:"NotFoundPage",pageTypes:[n.IkasThemeJsonPageType.NOT_FOUND]},{path:"cart.tsx",pageComponentName:"CartPage",pageTypes:[n.IkasThemeJsonPageType.CART]},{path:"index.tsx",pageComponentName:"IndexPage",pageTypes:[n.IkasThemeJsonPageType.INDEX]},{path:"search.tsx",pageComponentName:"SearchPage",pageTypes:[n.IkasThemeJsonPageType.SEARCH]},{path:"checkout.tsx",pageComponentName:"CheckoutPage",pageTypes:[],isCheckout:!0},{path:"editor.tsx",pageComponentName:"EditorPage",pageTypes:[],isEditor:!0}],Me=function(){function e(){}return e.generate=function(t,n){return i(this,void 0,void 0,(function(){var o;return c(this,(function(s){switch(s.label){case 0:return[4,Oe(r.default.join(n||process.cwd(),"src","components","__generated__"))];case 1:return s.sent(),[4,e.generateAllPageComponentImportsFiles(t,n)];case 2:return(o=s.sent())?[4,e.generateAllComponentImportsFileForEditor(t,n)]:[3,4];case 3:o=s.sent(),s.label=4;case 4:return[2,o]}}))}))},e.generateAllPageComponentImportsFiles=function(t,n){return i(this,void 0,void 0,(function(){var o,r,s,a,i;return c(this,(function(c){switch(c.label){case 0:o=!0,r=0,s=Ge,c.label=1;case 1:return r<s.length?(a=s[r],(i=o)?[4,e.generatePageComponentImportsFileWithInfo(a,t,n)]:[3,3]):[3,5];case 2:i=c.sent(),c.label=3;case 3:o=i,c.label=4;case 4:return r++,[3,1];case 5:return[2,o]}}))}))},e.generatePageComponentImportsFileWithInfo=function(t,n,o){return i(this,void 0,void 0,(function(){var r,s,a,i;return c(this,(function(c){switch(c.label){case 0:if(t.isCheckout||t.isEditor)return[2,!0];c.label=1;case 1:return c.trys.push([1,3,,4]),r=n.components,s=[],t.pageTypes.forEach((function(e){var t=n.pages.filter((function(t){return t.type===e}));t.length&&t.forEach((function(e){var t,n=e.components;(null===(t=e.specifications)||void 0===t?void 0:t.length)&&e.specifications.forEach((function(e){n.push.apply(n,e.components)})),s.push.apply(s,n.map((function(e){return e.componentId}))),n.forEach((function(e){if(r.find((function(t){return t.id===e.componentId}))){var t=De(e.propValues,"componentId");s.push.apply(s,t)}}))}))})),a=r.filter((function(e){return s.includes(e.id)&&"checkout"!==e.id})),[4,e.generateComponentImportsFile(a,t,o)];case 2:return[2,c.sent()];case 3:return i=c.sent(),console.error(i),[2,!1];case 4:return[2]}}))}))},e.generatePageComponentImportsFileWithType=function(t,o,r){if(t!==n.IkasThemeJsonPageType.CHECKOUT){try{var s=Ge.find((function(e){return e.pageTypes.includes(t)}));if(s)return e.generatePageComponentImportsFileWithInfo(s,o,r)}catch(e){console.error(e)}return!1}},e.generateComponentImportsFile=function(e,t,n){try{var o="";return e.filter((function(e){return"checkout"!==e.id})).forEach((function(e,t){o+="import Component".concat(t,' from "src/components/').concat(e.dir,'";\r\n')})),o+="\n const Components = {\n ".concat(e.map((function(e,t){return'"'.concat(e.id,'": Component').concat(t)})),"\n };\n "),o+="\r\n",o+="export default Components;",Le(r.default.join(n||process.cwd(),"src","components","__generated__","pages"),t.path.replace("tsx","ts"),o)}catch(e){return console.error(e),!1}},e.generateAllComponentImportsFileForEditor=function(e,t){return i(this,void 0,void 0,(function(){var n,o,s;return c(this,(function(a){switch(a.label){case 0:return a.trys.push([0,2,,3]),n='import dynamic from "next/dynamic";\r\n',n+='import { IkasEditorComponentLoader } from "@ikas/storefront";\r\n',n+="\r\n",n+="\r\n",(o=e.components.filter((function(e){return"checkout"!==e.id}))).filter((function(e){return"checkout"!==e.id})).forEach((function(e,t){n+="const Component".concat(t,' = dynamic(() => import("../').concat(e.dir,'"), { loading: () => <IkasEditorComponentLoader /> });\r\n')})),n+="\r\n",n+="\nconst Components = {\n ".concat(o.map((function(e,t){return'"'.concat(e.id,'": Component').concat(t)})),"\n};\n"),n+="\r\n",n+="export default Components;",[4,Le(r.default.join(t||process.cwd(),"src","components","__generated__"),"editor.tsx",n)];case 1:return[2,a.sent()];case 2:return s=a.sent(),console.error(s),[2,!1];case 3:return[2]}}))}))},e.generateAllComponentImportsFile=function(e,t){return i(this,void 0,void 0,(function(){var n,o,s;return c(this,(function(a){switch(a.label){case 0:return a.trys.push([0,2,,3]),n="",(o=e.components.filter((function(e){return"checkout"!==e.id}))).filter((function(e){return"checkout"!==e.id})).forEach((function(e,t){n+="import Component".concat(t,' from "../').concat(e.dir,'";\r\n')})),n+="\r\n",n+="\nconst Components = {\n ".concat(o.map((function(e,t){return'"'.concat(e.id,'": Component').concat(t)})),"\n};\n"),n+="\r\n",n+="export default Components;",[4,Le(r.default.join(t||process.cwd(),"src","components","__generated__"),"index.tsx",n)];case 1:return[2,a.sent()];case 2:return s=a.sent(),console.error(s),[2,!1];case 3:return[2]}}))}))},e}(),Ve=function(){function e(){}return e.generate=function(t){return i(this,void 0,void 0,(function(){var n,o,s,a,i,p,u,l,f,h,m;return c(this,(function(c){switch(c.label){case 0:return[4,Oe(r.default.join(t||process.cwd(),"src","pages"),["_app.tsx","_document.tsx","api"])];case 1:c.sent(),n=!0,o=0,s=Ge,c.label=2;case 2:return o<s.length?(a=s[o],(i=n)?[4,e.generatePageWithInfo(a,t)]:[3,4]):[3,6];case 3:i=c.sent(),c.label=4;case 4:n=i,c.label=5;case 5:return o++,[3,2];case 6:return p=Ge.find((function(e){return e.isCheckout})),u=Ge.find((function(e){return e.isEditor})),p?[4,e.generatePageWithInfo(p,t)]:[3,8];case 7:return f=c.sent(),[3,9];case 8:f=!1,c.label=9;case 9:return l=f,u?[4,e.generatePageWithInfo(u,t)]:[3,11];case 10:return m=c.sent(),[3,12];case 11:m=!1,c.label=12;case 12:return h=m,[2,n&&l&&h]}}))}))},e.generatePageWithInfo=function(e,t){return i(this,void 0,void 0,(function(){var n,o,s,a,i,p,u,l,f;return c(this,(function(c){switch(c.label){case 0:return c.trys.push([0,2,,3]),n="",e.isCheckout?n='import { CheckoutPage } from "@ikas/storefront";\nimport { CheckoutPage as CheckoutPageNext } from "@ikas/storefront-next";\n\nexport default CheckoutPage.default;\nexport const getStaticProps = CheckoutPageNext.getStaticProps;\n':e.isEditor?n='import { EditorPage } from "@ikas/storefront";\nimport { EditorPage as EditorPageNext } from "@ikas/storefront-next";\nimport Components from "../components/__generated__/editor";\n\nconst PageComponent = EditorPage.default;\n\nconst Page = (props: any) => {\n return <PageComponent components={Components} {...props} />;\n};\n\nexport default Page;\nexport const getStaticProps = EditorPageNext.getStaticProps;\n':(o=e.pageComponentName+"Next",s="import { ".concat(e.pageComponentName,' } from "@ikas/storefront";\r\n'),a="import { ".concat(e.pageComponentName," as ").concat(o,' } from "@ikas/storefront-next";\r\n'),i='import Components from "src/components/__generated__/pages/'.concat(e.path.replace(".tsx",""),'";\r\n'),p="\nconst PageComponent = ".concat(e.pageComponentName,".default;\n\nconst Page = (props: any) => {\n return <PageComponent components={Components} {...props} />;\n};\n\nexport default Page;\r\n"),u=e.isDynamicSSG?"export const getStaticPaths = ".concat(o,".getStaticPaths;\r\n"):"",l=e.isSSR?"export const getServerSideProps = ".concat(o,".getServerSideProps;\r\n"):"export const getStaticProps = ".concat(o,".getStaticProps;\r\n"),n=s+a+i+p+u+l),[4,Le(r.default.join(t||process.cwd(),"src","pages"),e.path,n)];case 1:return[2,c.sent()];case 2:return f=c.sent(),console.error(f),[2,!1];case 3:return[2]}}))}))},e.generatePageWithType=function(t){return i(this,void 0,void 0,(function(){var n;return c(this,(function(o){switch(o.label){case 0:return(n=Ge.find((function(e){return e.pageTypes.includes(t)})))?[4,e.generatePageWithInfo(n)]:[3,2];case 1:return[2,o.sent()];case 2:return[2,!1]}}))}))},e}(),ze="object"==typeof p&&p&&p.Object===Object&&p,We="object"==typeof self&&self&&self.Object===Object&&self,qe=ze||We||Function("return this")(),Xe=qe.Symbol,Ye=Xe,$e=Object.prototype,Ze=$e.hasOwnProperty,He=$e.toString,Ke=Ye?Ye.toStringTag:void 0;var Qe=function(e){var t=Ze.call(e,Ke),n=e[Ke];try{e[Ke]=void 0;var o=!0}catch(e){}var r=He.call(e);return o&&(t?e[Ke]=n:delete e[Ke]),r},et=Object.prototype.toString;var tt=Qe,nt=function(e){return et.call(e)},ot=Xe?Xe.toStringTag:void 0;var rt=function(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)},st=function(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":ot&&ot in Object(e)?tt(e):nt(e)},at=rt;var it,ct=function(e){if(!at(e))return!1;var t=st(e);return"[object Function]"==t||"[object GeneratorFunction]"==t||"[object AsyncFunction]"==t||"[object Proxy]"==t},pt=qe["__core-js_shared__"],ut=(it=/[^.]+$/.exec(pt&&pt.keys&&pt.keys.IE_PROTO||""))?"Symbol(src)_1."+it:"";var lt=function(e){return!!ut&&ut in e},ft=Function.prototype.toString;var ht=ct,mt=lt,dt=rt,gt=function(e){if(null!=e){try{return ft.call(e)}catch(e){}try{return e+""}catch(e){}}return""},Tt=/^\[object .+?Constructor\]$/,yt=Function.prototype,It=Object.prototype,kt=yt.toString,vt=It.hasOwnProperty,Ct=RegExp("^"+kt.call(vt).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");var _t=function(e,t){return null==e?void 0:e[t]},bt=function(e){return!(!dt(e)||mt(e))&&(ht(e)?Ct:Tt).test(gt(e))},Pt=_t;var xt=function(e,t){var n=Pt(e,t);return bt(n)?n:void 0},Et=xt(Object,"create"),Nt=Et;var St=function(){this.__data__=Nt?Nt(null):{},this.size=0};var Ot=function(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t},Lt=Et,At=Object.prototype.hasOwnProperty;var wt=function(e){var t=this.__data__;if(Lt){var n=t[e];return"__lodash_hash_undefined__"===n?void 0:n}return At.call(t,e)?t[e]:void 0},Dt=Et,Jt=Object.prototype.hasOwnProperty;var Rt=Et;var jt=St,Ut=Ot,Bt=wt,Ft=function(e){var t=this.__data__;return Dt?void 0!==t[e]:Jt.call(t,e)},Gt=function(e,t){var n=this.__data__;return this.size+=this.has(e)?0:1,n[e]=Rt&&void 0===t?"__lodash_hash_undefined__":t,this};function Mt(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var o=e[t];this.set(o[0],o[1])}}Mt.prototype.clear=jt,Mt.prototype.delete=Ut,Mt.prototype.get=Bt,Mt.prototype.has=Ft,Mt.prototype.set=Gt;var Vt=Mt;var zt=function(){this.__data__=[],this.size=0};var Wt=function(e,t){return e===t||e!=e&&t!=t};var qt=function(e,t){for(var n=e.length;n--;)if(Wt(e[n][0],t))return n;return-1},Xt=qt,Yt=Array.prototype.splice;var $t=qt;var Zt=qt;var Ht=qt;var Kt=zt,Qt=function(e){var t=this.__data__,n=Xt(t,e);return!(n<0)&&(n==t.length-1?t.pop():Yt.call(t,n,1),--this.size,!0)},en=function(e){var t=this.__data__,n=$t(t,e);return n<0?void 0:t[n][1]},tn=function(e){return Zt(this.__data__,e)>-1},nn=function(e,t){var n=this.__data__,o=Ht(n,e);return o<0?(++this.size,n.push([e,t])):n[o][1]=t,this};function on(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var o=e[t];this.set(o[0],o[1])}}on.prototype.clear=Kt,on.prototype.delete=Qt,on.prototype.get=en,on.prototype.has=tn,on.prototype.set=nn;var rn=on,sn=xt(qe,"Map"),an=Vt,cn=rn,pn=sn;var un=function(e){var t=typeof e;return"string"==t||"number"==t||"symbol"==t||"boolean"==t?"__proto__"!==e:null===e};var ln=function(e,t){var n=e.__data__;return un(t)?n["string"==typeof t?"string":"hash"]:n.map},fn=ln;var hn=ln;var mn=ln;var dn=ln;var gn=function(){this.size=0,this.__data__={hash:new an,map:new(pn||cn),string:new an}},Tn=function(e){var t=fn(this,e).delete(e);return this.size-=t?1:0,t},yn=function(e){return hn(this,e).get(e)},In=function(e){return mn(this,e).has(e)},kn=function(e,t){var n=dn(this,e),o=n.size;return n.set(e,t),this.size+=n.size==o?0:1,this};function vn(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var o=e[t];this.set(o[0],o[1])}}vn.prototype.clear=gn,vn.prototype.delete=Tn,vn.prototype.get=yn,vn.prototype.has=In,vn.prototype.set=kn;var Cn=vn,_n=function(e){return this.__data__.set(e,"__lodash_hash_undefined__"),this},bn=function(e){return this.__data__.has(e)};function Pn(e){var t=-1,n=null==e?0:e.length;for(this.__data__=new Cn;++t<n;)this.add(e[t])}Pn.prototype.add=Pn.prototype.push=_n,Pn.prototype.has=bn;var xn=Pn;var En=function(e,t,n,o){for(var r=e.length,s=n+(o?1:-1);o?s--:++s<r;)if(t(e[s],s,e))return s;return-1},Nn=function(e){return e!=e},Sn=function(e,t,n){for(var o=n-1,r=e.length;++o<r;)if(e[o]===t)return o;return-1};var On=function(e,t,n){return t==t?Sn(e,t,n):En(e,Nn,n)};var Ln=function(e,t){return!!(null==e?0:e.length)&&On(e,t,0)>-1};var An=function(e,t,n){for(var o=-1,r=null==e?0:e.length;++o<r;)if(n(t,e[o]))return!0;return!1};var wn=function(e,t){return e.has(t)};var Dn=function(e){var t=-1,n=Array(e.size);return e.forEach((function(e){n[++t]=e})),n},Jn=xt(qe,"Set"),Rn=function(){},jn=Jn&&1/Dn(new Jn([,-0]))[1]==1/0?function(e){return new Jn(e)}:Rn,Un=xn,Bn=Ln,Fn=An,Gn=wn,Mn=jn,Vn=Dn;var zn=function(e,t,n){var o=-1,r=Bn,s=e.length,a=!0,i=[],c=i;if(n)a=!1,r=Fn;else if(s>=200){var p=t?null:Mn(e);if(p)return Vn(p);a=!1,r=Gn,c=new Un}else c=t?[]:i;e:for(;++o<s;){var u=e[o],l=t?t(u):u;if(u=n||0!==u?u:0,a&&l==l){for(var f=c.length;f--;)if(c[f]===l)continue e;t&&c.push(l),i.push(u)}else r(c,l,n)||(c!==i&&c.push(l),i.push(u))}return i};var Wn=function(e){return e&&e.length?zn(e):[]},qn=function(){function e(){}return e.generate=function(t,n){return i(this,void 0,void 0,(function(){var o,s,a,i,p,u,l;return c(this,(function(c){switch(c.label){case 0:return[4,Oe(r.default.join(n||process.cwd(),"src","components","__generated__","types"))];case 1:c.sent(),o={content:"",imports:[],internalCustomDatas:[]},c.label=2;case 2:c.trys.push([2,5,,6]),t.customData.forEach((function(n){e.generateAllCustomDataTypes(n,o,t)})),s=0,a=0;do{s=o.internalCustomDatas.length,o.internalCustomDatas.forEach((function(n){e.generateAllCustomDataTypes(n,o,t)})),(a=o.internalCustomDatas.length)!==s&&(o.internalCustomDatas=o.internalCustomDatas.splice(s,a))}while(s!==a);return[4,Xn.generate(t,o)];case 3:return c.sent(),i=r.default.join(n||process.cwd(),"src","components","__generated__"),o.imports=Wn(o.imports),p="import {\r\n",o.imports.forEach((function(e){p+="\t".concat(e,",\r\n")})),u=(p+='} from "@ikas/storefront"\r\n\r\n')+o.content,[4,Le(i,"types.ts",u)];case 4:return[2,c.sent()];case 5:return l=c.sent(),console.log(l),[2,!1];case 6:return[2]}}))}))},e.generateAllCustomDataTypes=function(t,o,r){var s=t.type===n.IkasThemeJsonComponentPropType.ENUM,a="export ".concat(s?"enum":"type"," ").concat(e.generateTypeName(t)).concat(s?"":" = ","{ \r\n"),i="};\r\n\r\n";t.type!==n.IkasThemeJsonComponentPropType.DYNAMIC_LIST&&t.type!==n.IkasThemeJsonComponentPropType.STATIC_LIST||!t.nestedData?t.type===n.IkasThemeJsonComponentPropType.ENUM&&t.enumOptions?(o.content+=a,t.enumOptions.forEach((function(e){var t=e.value;e.value&&!isNaN(parseInt(e.value))&&(t="_"+e.value),o.content+='\t"'.concat(t,'" = "').concat(null==e?void 0:e.value,'",'),o.content+="\r\n"})),o.content+=i):(o.content+=a,t.nestedData&&t.nestedData.forEach((function(t){e.genenateCustomDataType(t,o,r),o.content+="\r\n"})),o.content+=i):e.generateAllCustomDataTypes(t.nestedData[0],o,r)},e.genenateCustomDataType=function(t,o,r){var s=e.getType(t,o,r);t.key&&t.key[0].match(/^\d/)&&(t.key="_"+t.key),o.content+="\t".concat(t.key).concat(t.isRequired?"":"?",": ").concat(s).concat([n.IkasThemeJsonComponentPropType.DYNAMIC_LIST,n.IkasThemeJsonComponentPropType.STATIC_LIST].includes(t.type)?"[]":"").concat(t.type===n.IkasThemeJsonComponentPropType.ENUM?",":";")},e.getType=function(t,o,r){var s="";switch(t.type){case n.IkasThemeJsonComponentPropType.TEXT:case n.IkasThemeJsonComponentPropType.RICH_TEXT:case n.IkasThemeJsonComponentPropType.COLOR:s="string";break;case n.IkasThemeJsonComponentPropType.BOOLEAN:s="boolean";break;case n.IkasThemeJsonComponentPropType.IMAGE:s="IkasImage",o.imports.push(s);break;case n.IkasThemeJsonComponentPropType.IMAGE_LIST:s="IkasImage[]",o.imports.push("IkasImage");break;case n.IkasThemeJsonComponentPropType.LINK:s="IkasNavigationLink",o.imports.push(s);break;case n.IkasThemeJsonComponentPropType.LIST_OF_LINK:s="IkasNavigationLink[]",o.imports.push("IkasNavigationLink");break;case n.IkasThemeJsonComponentPropType.PRODUCT_DETAIL:s="IkasProduct",o.imports.push(s);break;case n.IkasThemeJsonComponentPropType.PRODUCT_LIST:s="IkasProductList",o.imports.push("IkasProductList");break;case n.IkasThemeJsonComponentPropType.PRODUCT_ATTRIBUTE:s="IkasProductAttribute",o.imports.push(s);break;case n.IkasThemeJsonComponentPropType.PRODUCT_ATTRIBUTE_LIST:s="IkasProductAttribute[]",o.imports.push("IkasProductAttribute");break;case n.IkasThemeJsonComponentPropType.BRAND:s="IkasBrand",o.imports.push(s);break;case n.IkasThemeJsonComponentPropType.BRAND_LIST:s="IkasBrandList",o.imports.push(s);break;case n.IkasThemeJsonComponentPropType.CATEGORY:s="IkasCategory",o.imports.push(s);break;case n.IkasThemeJsonComponentPropType.CATEGORY_LIST:s="IkasCategoryList",o.imports.push(s);break;case n.IkasThemeJsonComponentPropType.CUSTOM:var a=r.customData.find((function(e){return e.id===t.customDataId}));a&&(s=e.generateTypeName(a));break;case n.IkasThemeJsonComponentPropType.COMPONENT:s="IkasComponentRenderer",o.imports.push(s);break;case n.IkasThemeJsonComponentPropType.COMPONENT_LIST:s="IkasComponentRenderer[]",o.imports.push("IkasComponentRenderer");break;case n.IkasThemeJsonComponentPropType.BLOG:s="IkasBlog",o.imports.push(s);break;case n.IkasThemeJsonComponentPropType.BLOG_LIST:s="IkasBlogList",o.imports.push(s);break;case n.IkasThemeJsonComponentPropType.BLOG_CATEGORY:s="IkasBlogCategory",o.imports.push(s);break;case n.IkasThemeJsonComponentPropType.BLOG_CATEGORY_LIST:s="IkasBlogCategoryList",o.imports.push(s);break;case n.IkasThemeJsonComponentPropType.RAFFLE:s="IkasRaffle",o.imports.push(s);break;case n.IkasThemeJsonComponentPropType.RAFFLE_LIST:s="IkasRaffleList",o.imports.push(s);break;case n.IkasThemeJsonComponentPropType.SLIDER:s="IkasSlider",o.imports.push(s);break;case n.IkasThemeJsonComponentPropType.ENUM:s=e.generateTypeName(t),o.content.includes("export enum ".concat(s))||o.internalCustomDatas.push(t);break;case n.IkasThemeJsonComponentPropType.OBJECT:s=e.generateTypeName(t);break;case n.IkasThemeJsonComponentPropType.DYNAMIC_LIST:case n.IkasThemeJsonComponentPropType.STATIC_LIST:t.nestedData&&(t.nestedData[0].type===n.IkasThemeJsonComponentPropType.OBJECT||t.nestedData[0].type===n.IkasThemeJsonComponentPropType.ENUM?(s=e.generateTypeName(t.nestedData[0]),o.content.includes("export type ".concat(s))||o.internalCustomDatas.push(t.nestedData[0])):s=e.getType(t.nestedData[0],o,r))}return s},e.generateTypeName=function(e){if(e.typescriptName)return e.typescriptName;var t=e.name||"";return(t=(t=t.replace(/\s/g,"")).replace(/\W/g,""))[0].match(/^\d/)&&(t="_"+t),e.type===n.IkasThemeJsonComponentPropType.ENUM&&(t+="Enum"),t},e}(),Xn=function(){function e(){}return e.generate=function(t,n){return i(this,void 0,void 0,(function(){return c(this,(function(o){return t.components.forEach((function(o){o.props.length>0&&"checkout"!==o.id&&(n.content+="export type ".concat(e.generatePropTypeName(o),"Props = {\n"),o.props.forEach((function(o){n.content+="\t".concat(o.name,": ").concat(e.getType(o,t,n),";\n")})),n.content+="};\r\n\r\n")})),[2]}))}))},e.getType=function(e,t,o){var r="";switch(e.type){case n.IkasThemeJsonComponentPropType.TEXT:case n.IkasThemeJsonComponentPropType.RICH_TEXT:case n.IkasThemeJsonComponentPropType.COLOR:r="string";break;case n.IkasThemeJsonComponentPropType.BOOLEAN:r="boolean";break;case n.IkasThemeJsonComponentPropType.IMAGE:r="IkasImage",o.imports.push(r);break;case n.IkasThemeJsonComponentPropType.IMAGE_LIST:r="IkasImage[]",o.imports.push("IkasImage");break;case n.IkasThemeJsonComponentPropType.LINK:r="IkasNavigationLink",o.imports.push(r);break;case n.IkasThemeJsonComponentPropType.LIST_OF_LINK:r="IkasNavigationLink[]",o.imports.push("IkasNavigationLink");break;case n.IkasThemeJsonComponentPropType.PRODUCT_DETAIL:r="IkasProduct",o.imports.push(r);break;case n.IkasThemeJsonComponentPropType.PRODUCT_LIST:r="IkasProductList",o.imports.push("IkasProductList");break;case n.IkasThemeJsonComponentPropType.PRODUCT_ATTRIBUTE:r="IkasProductAttribute",o.imports.push(r);break;case n.IkasThemeJsonComponentPropType.PRODUCT_ATTRIBUTE_LIST:r="IkasProductAttribute[]",o.imports.push("IkasProductAttribute");break;case n.IkasThemeJsonComponentPropType.BRAND:r="IkasBrand",o.imports.push(r);break;case n.IkasThemeJsonComponentPropType.BRAND_LIST:r="IkasBrandList",o.imports.push(r);break;case n.IkasThemeJsonComponentPropType.CATEGORY:r="IkasCategory",o.imports.push(r);break;case n.IkasThemeJsonComponentPropType.CATEGORY_LIST:r="IkasCategoryList",o.imports.push(r);break;case n.IkasThemeJsonComponentPropType.CUSTOM:var s=t.customData.find((function(t){return t.id===e.customDataId}));s&&(r=qn.getType(s,o,t),s.type!==n.IkasThemeJsonComponentPropType.DYNAMIC_LIST&&s.type!==n.IkasThemeJsonComponentPropType.STATIC_LIST||(r+="[]"));break;case n.IkasThemeJsonComponentPropType.COMPONENT:r="IkasComponentRenderer",o.imports.push(r);break;case n.IkasThemeJsonComponentPropType.COMPONENT_LIST:r="IkasComponentRenderer[]",o.imports.push("IkasComponentRenderer");break;case n.IkasThemeJsonComponentPropType.BLOG:r="IkasBlog",o.imports.push(r);break;case n.IkasThemeJsonComponentPropType.BLOG_LIST:r="IkasBlogList",o.imports.push(r);break;case n.IkasThemeJsonComponentPropType.BLOG_CATEGORY:r="IkasBlogCategory",o.imports.push(r);break;case n.IkasThemeJsonComponentPropType.BLOG_CATEGORY_LIST:r="IkasBlogCategoryList",o.imports.push(r);break;case n.IkasThemeJsonComponentPropType.RAFFLE:r="IkasRaffle",o.imports.push(r);break;case n.IkasThemeJsonComponentPropType.RAFFLE_LIST:r="IkasRaffleList",o.imports.push(r);break;case n.IkasThemeJsonComponentPropType.SLIDER:r="IkasSlider",o.imports.push(r)}return r},e.generatePropTypeName=function(e){if(""!==e.displayName){var t=(e.dir||"").split("-"),n="";return t.forEach((function(e,t){return n+=e.charAt(0).toUpperCase()+e.slice(1)})),n[0].match(/^\d/)&&(n="_"+n),n}},e}();function Yn(e){return i(this,void 0,void 0,(function(){var t,n,o,r,s,a;return c(this,(function(i){switch(i.label){case 0:return[4,Fe.getTheme()];case 1:return(t=i.sent())?[3,3]:[4,Fe.generateInitialThemeJsonFile()];case 2:i.sent(),i.label=3;case 3:return[4,Fe.getTheme()];case 4:return t=i.sent(),[4,Fe.generate(t)];case 5:return(a=i.sent())?[4,Me.generate(t)]:[3,7];case 6:a=i.sent(),i.label=7;case 7:return(s=a)?[4,Ve.generate()]:[3,9];case 8:s=i.sent(),i.label=9;case 9:return(r=s)?[4,we.generate()]:[3,11];case 10:r=i.sent(),i.label=11;case 11:return(o=r)?[4,Be.generate(e)]:[3,13];case 12:o=i.sent(),i.label=13;case 13:return(n=o)?[4,qn.generate(t)]:[3,15];case 14:n=i.sent(),i.label=15;case 15:return[2,n]}}))}))}!function(){i(this,void 0,void 0,(function(){var e,t;return c(this,(function(n){switch(n.label){case 0:return e=[{name:"generate",alias:"g",type:Boolean},{name:"dev",alias:"d",type:Boolean}],(t=Se(e)).generate?[4,Yn(!!t.dev?"dev":"prod")]:[3,2];case 1:n.sent()?console.log("Project files generated successfully!"):console.log("Project files generate failed!"),n.label=2;case 2:return[2]}}))}))}();
|
|
2
|
+
"use strict";var e=require("path"),t=require("fs"),n=require("@ikas/storefront-models");function o(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var r=o(e),s=o(t),a=function(){return a=Object.assign||function(e){for(var t,n=1,o=arguments.length;n<o;n++)for(var r in t=arguments[n])Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e},a.apply(this,arguments)};function i(e,t,n,o){return new(n||(n=Promise))((function(r,s){function a(e){try{c(o.next(e))}catch(e){s(e)}}function i(e){try{c(o.throw(e))}catch(e){s(e)}}function c(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,i)}c((o=o.apply(e,t||[])).next())}))}function c(e,t){var n,o,r,s,a={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return s={next:i(0),throw:i(1),return:i(2)},"function"==typeof Symbol&&(s[Symbol.iterator]=function(){return this}),s;function i(s){return function(i){return function(s){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,o&&(r=2&s[0]?o.return:s[0]?o.throw||((r=o.return)&&r.call(o),0):o.next)&&!(r=r.call(o,s[1])).done)return r;switch(o=0,r&&(s=[2&s[0],r.value]),s[0]){case 0:case 1:r=s;break;case 4:return a.label++,{value:s[1],done:!1};case 5:a.label++,o=s[1],s=[0];continue;case 7:s=a.ops.pop(),a.trys.pop();continue;default:if(!(r=a.trys,(r=r.length>0&&r[r.length-1])||6!==s[0]&&2!==s[0])){a=0;continue}if(3===s[0]&&(!r||s[1]>r[0]&&s[1]<r[3])){a.label=s[1];break}if(6===s[0]&&a.label<r[1]){a.label=r[1],r=s;break}if(r&&a.label<r[2]){a.label=r[2],a.ops.push(s);break}r[2]&&a.ops.pop(),a.trys.pop();continue}s=t.call(e,a)}catch(e){s=[6,e],o=0}finally{n=r=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,i])}}}var p="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},u=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,l=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,f="\\xac\\xb1\\xd7\\xf7\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf\\u2000-\\u206f \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",h="[\\ud800-\\udfff]",m="["+f+"]",d="[\\u0300-\\u036f\\ufe20-\\ufe23\\u20d0-\\u20f0]",g="\\d+",T="[\\u2700-\\u27bf]",y="[a-z\\xdf-\\xf6\\xf8-\\xff]",I="[^\\ud800-\\udfff"+f+g+"\\u2700-\\u27bfa-z\\xdf-\\xf6\\xf8-\\xffA-Z\\xc0-\\xd6\\xd8-\\xde]",k="\\ud83c[\\udffb-\\udfff]",v="[^\\ud800-\\udfff]",C="(?:\\ud83c[\\udde6-\\uddff]){2}",_="[\\ud800-\\udbff][\\udc00-\\udfff]",b="[A-Z\\xc0-\\xd6\\xd8-\\xde]",P="(?:"+y+"|"+I+")",x="(?:"+b+"|"+I+")",E="(?:"+d+"|"+k+")"+"?",N="[\\ufe0e\\ufe0f]?"+E+("(?:\\u200d(?:"+[v,C,_].join("|")+")[\\ufe0e\\ufe0f]?"+E+")*"),S="(?:"+[T,C,_].join("|")+")"+N,O="(?:"+[v+d+"?",d,C,_,h].join("|")+")",L=RegExp("['’]","g"),A=RegExp(d,"g"),w=RegExp(k+"(?="+k+")|"+O+N,"g"),D=RegExp([b+"?"+y+"+(?:['’](?:d|ll|m|re|s|t|ve))?(?="+[m,b,"$"].join("|")+")",x+"+(?:['’](?:D|LL|M|RE|S|T|VE))?(?="+[m,b+P,"$"].join("|")+")",b+"?"+P+"+(?:['’](?:d|ll|m|re|s|t|ve))?",b+"+(?:['’](?:D|LL|M|RE|S|T|VE))?",g,S].join("|"),"g"),J=RegExp("[\\u200d\\ud800-\\udfff\\u0300-\\u036f\\ufe20-\\ufe23\\u20d0-\\u20f0\\ufe0e\\ufe0f]"),R=/[a-z][A-Z]|[A-Z]{2,}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,j="object"==typeof p&&p&&p.Object===Object&&p,U="object"==typeof self&&self&&self.Object===Object&&self,B=j||U||Function("return this")();var F,G=(F={"À":"A","Á":"A","Â":"A","Ã":"A","Ä":"A","Å":"A","à":"a","á":"a","â":"a","ã":"a","ä":"a","å":"a","Ç":"C","ç":"c","Ð":"D","ð":"d","È":"E","É":"E","Ê":"E","Ë":"E","è":"e","é":"e","ê":"e","ë":"e","Ì":"I","Í":"I","Î":"I","Ï":"I","ì":"i","í":"i","î":"i","ï":"i","Ñ":"N","ñ":"n","Ò":"O","Ó":"O","Ô":"O","Õ":"O","Ö":"O","Ø":"O","ò":"o","ó":"o","ô":"o","õ":"o","ö":"o","ø":"o","Ù":"U","Ú":"U","Û":"U","Ü":"U","ù":"u","ú":"u","û":"u","ü":"u","Ý":"Y","ý":"y","ÿ":"y","Æ":"Ae","æ":"ae","Þ":"Th","þ":"th","ß":"ss","Ā":"A","Ă":"A","Ą":"A","ā":"a","ă":"a","ą":"a","Ć":"C","Ĉ":"C","Ċ":"C","Č":"C","ć":"c","ĉ":"c","ċ":"c","č":"c","Ď":"D","Đ":"D","ď":"d","đ":"d","Ē":"E","Ĕ":"E","Ė":"E","Ę":"E","Ě":"E","ē":"e","ĕ":"e","ė":"e","ę":"e","ě":"e","Ĝ":"G","Ğ":"G","Ġ":"G","Ģ":"G","ĝ":"g","ğ":"g","ġ":"g","ģ":"g","Ĥ":"H","Ħ":"H","ĥ":"h","ħ":"h","Ĩ":"I","Ī":"I","Ĭ":"I","Į":"I","İ":"I","ĩ":"i","ī":"i","ĭ":"i","į":"i","ı":"i","Ĵ":"J","ĵ":"j","Ķ":"K","ķ":"k","ĸ":"k","Ĺ":"L","Ļ":"L","Ľ":"L","Ŀ":"L","Ł":"L","ĺ":"l","ļ":"l","ľ":"l","ŀ":"l","ł":"l","Ń":"N","Ņ":"N","Ň":"N","Ŋ":"N","ń":"n","ņ":"n","ň":"n","ŋ":"n","Ō":"O","Ŏ":"O","Ő":"O","ō":"o","ŏ":"o","ő":"o","Ŕ":"R","Ŗ":"R","Ř":"R","ŕ":"r","ŗ":"r","ř":"r","Ś":"S","Ŝ":"S","Ş":"S","Š":"S","ś":"s","ŝ":"s","ş":"s","š":"s","Ţ":"T","Ť":"T","Ŧ":"T","ţ":"t","ť":"t","ŧ":"t","Ũ":"U","Ū":"U","Ŭ":"U","Ů":"U","Ű":"U","Ų":"U","ũ":"u","ū":"u","ŭ":"u","ů":"u","ű":"u","ų":"u","Ŵ":"W","ŵ":"w","Ŷ":"Y","ŷ":"y","Ÿ":"Y","Ź":"Z","Ż":"Z","Ž":"Z","ź":"z","ż":"z","ž":"z","IJ":"IJ","ij":"ij","Œ":"Oe","œ":"oe","ʼn":"'n","ſ":"ss"},function(e){return null==F?void 0:F[e]});function M(e){return J.test(e)}function V(e){return M(e)?function(e){return e.match(w)||[]}(e):function(e){return e.split("")}(e)}var z=Object.prototype.toString,W=B.Symbol,q=W?W.prototype:void 0,X=q?q.toString:void 0;function Y(e){if("string"==typeof e)return e;if(function(e){return"symbol"==typeof e||function(e){return!!e&&"object"==typeof e}(e)&&"[object Symbol]"==z.call(e)}(e))return X?X.call(e):"";var t=e+"";return"0"==t&&1/e==-Infinity?"-0":t}function $(e,t,n){var o=e.length;return n=void 0===n?o:n,!t&&n>=o?e:function(e,t,n){var o=-1,r=e.length;t<0&&(t=-t>r?0:r+t),(n=n>r?r:n)<0&&(n+=r),r=t>n?0:n-t>>>0,t>>>=0;for(var s=Array(r);++o<r;)s[o]=e[o+t];return s}(e,t,n)}function Z(e){return null==e?"":Y(e)}var H,K=(H=function(e,t,n){return t=t.toLowerCase(),e+(n?ee(Z(t).toLowerCase()):t)},function(e){return function(e,t,n,o){var r=-1,s=e?e.length:0;for(o&&s&&(n=e[++r]);++r<s;)n=t(n,e[r],r,e);return n}(function(e,t,n){return e=Z(e),void 0===(t=n?void 0:t)?function(e){return R.test(e)}(e)?function(e){return e.match(D)||[]}(e):function(e){return e.match(u)||[]}(e):e.match(t)||[]}(function(e){return(e=Z(e))&&e.replace(l,G).replace(A,"")}(e).replace(L,"")),H,"")});var Q,ee=(Q="toUpperCase",function(e){var t=M(e=Z(e))?V(e):void 0,n=t?t[0]:e.charAt(0),o=t?$(t,1).join(""):e.slice(1);return n[Q]()+o});var te,ne=(te=K)&&"object"==typeof te&&"default"in te?te.default:te;function oe(e){return Array.isArray(e)?e:void 0===e?[]:function(e){return function(e){return"object"==typeof e&&null!==e}(e)&&"number"==typeof e.length}(e)||e instanceof Set?Array.from(e):[e]}function re(e){return Array.isArray(e)?e:void 0===e?[]:function(e){return function(e){return"object"==typeof e&&null!==e}(e)&&"number"==typeof e.length}(e)?Array.prototype.slice.call(e):[e]}function se(e,t){const n=[],o=re(arguments);return o.splice(0,2),re(e).forEach(((e,r)=>{let s=[];o.forEach((t=>{"function"==typeof t?s=s.concat(t(e)):s.push(t)})),t(e)&&n.push({index:r,replaceWithValue:s})})),n.reverse().forEach((t=>{const n=[t.index,1].concat(t.replaceWithValue);e.splice.apply(e,n)})),e}const ae={short:/^-([^\d-])$/,long:/^--(\S+)/,combinedShort:/^-[^\d-]{2,}$/,optEquals:/^(--\S+?)=(.*)/};class ie extends Array{load(e){if(this.clear(),e&&e!==process.argv)e=oe(e);else{e=process.argv.slice(0);const t=process.execArgv.some(he)?1:2;e.splice(0,t)}e.forEach((e=>this.push(String(e))))}clear(){this.length=0}expandOptionEqualsNotation(){if(this.some((e=>ae.optEquals.test(e)))){const e=[];this.forEach((t=>{const n=t.match(ae.optEquals);n?e.push(n[1],n[2]):e.push(t)})),this.clear(),this.load(e)}}expandGetoptNotation(){this.hasCombinedShortOptions()&&se(this,ae.combinedShort,ce)}hasCombinedShortOptions(){return this.some((e=>ae.combinedShort.test(e)))}static from(e){const t=new this;return t.load(e),t}}function ce(e){return(e=e.slice(1)).split("").map((e=>"-"+e))}function pe(e){return ae.optEquals.test(e)}function ue(e){return(ae.short.test(e)||ae.long.test(e))&&!ae.optEquals.test(e)}function le(e){return ae.short.test(e)?e.match(ae.short)[1]:function(e){return ae.long.test(e)&&!pe(e)}(e)?e.match(ae.long)[1]:pe(e)?e.match(ae.optEquals)[1].replace(/^--/,""):null}function fe(e){return!(ue(e)||ae.combinedShort.test(e)||ae.optEquals.test(e))}function he(e){return["--eval","-e"].indexOf(e)>-1||e.startsWith("--eval=")}function me(e){return"object"==typeof e&&null!==e}function de(e){return void 0!==e}function ge(e){return"function"==typeof e}var Te={isNumber:function(e){return!isNaN(parseFloat(e))&&isFinite(e)},isString:function(e){return"string"==typeof e},isBoolean:function(e){return"boolean"==typeof e},isPlainObject:function(e){return null!==e&&"object"==typeof e&&e.constructor===Object},isArrayLike:function(e){return me(e)&&"number"==typeof e.length},isObject:me,isDefined:de,isFunction:ge,isClass:function(e){return!!ge(e)&&/^class /.test(Function.prototype.toString.call(e))},isPrimitive:function(e){if(null===e)return!0;switch(typeof e){case"string":case"number":case"symbol":case"undefined":case"boolean":return!0;default:return!1}},isPromise:function(e){if(e){const t=de(Promise)&&e instanceof Promise,n=e.then&&"function"==typeof e.then;return!(!t&&!n)}return!1},isIterable:function(e){return!(null===e||!de(e))&&("function"==typeof e[Symbol.iterator]||"function"==typeof e[Symbol.asyncIterator])}};class ye{constructor(e){this.name=e.name,this.type=e.type||String,this.alias=e.alias,this.multiple=e.multiple,this.lazyMultiple=e.lazyMultiple,this.defaultOption=e.defaultOption,this.defaultValue=e.defaultValue,this.group=e.group;for(const t in e)this[t]||(this[t]=e[t])}isBoolean(){return this.type===Boolean||Te.isFunction(this.type)&&"Boolean"===this.type.name}isMultiple(){return this.multiple||this.lazyMultiple}static create(e){return new this(e)}}class Ie extends Array{validate(e){this.some((e=>!e.name))&&ke("INVALID_DEFINITIONS","Invalid option definitions: the `name` property is required on each definition");let t;this.some((e=>e.type&&"function"!=typeof e.type))&&ke("INVALID_DEFINITIONS","Invalid option definitions: the `type` property must be a setter fuction (default: `Boolean`)");this.some((e=>(t=e,Te.isDefined(e.alias)&&Te.isNumber(e.alias))))&&ke("INVALID_DEFINITIONS","Invalid option definition: to avoid ambiguity an alias cannot be numeric [--"+t.name+" alias is -"+t.alias+"]");this.some((e=>(t=e,Te.isDefined(e.alias)&&1!==e.alias.length)))&&ke("INVALID_DEFINITIONS","Invalid option definition: an alias must be a single character");this.some((e=>(t=e,"-"===e.alias)))&&ke("INVALID_DEFINITIONS",'Invalid option definition: an alias cannot be "-"');Ce(this.map((t=>e?t.name.toLowerCase():t.name)))&&ke("INVALID_DEFINITIONS","Two or more option definitions have the same name");Ce(this.map((t=>e&&Te.isDefined(t.alias)?t.alias.toLowerCase():t.alias)))&&ke("INVALID_DEFINITIONS","Two or more option definitions have the same alias");this.filter((e=>!0===e.defaultOption)).length>1&&ke("INVALID_DEFINITIONS","Only one option definition can be the defaultOption");this.some((e=>(t=e,e.isBoolean()&&e.defaultOption)))&&ke("INVALID_DEFINITIONS",`A boolean option ["${t.name}"] can not also be the defaultOption.`)}get(e,t){if(ue(e)){if(ae.short.test(e)){const n=le(e);if(t){const e=n.toLowerCase();return this.find((t=>Te.isDefined(t.alias)&&t.alias.toLowerCase()===e))}return this.find((e=>e.alias===n))}{const n=le(e);if(t){const e=n.toLowerCase();return this.find((t=>t.name.toLowerCase()===e))}return this.find((e=>e.name===n))}}return this.find((t=>t.name===e))}getDefault(){return this.find((e=>!0===e.defaultOption))}isGrouped(){return this.some((e=>e.group))}whereGrouped(){return this.filter(ve)}whereNotGrouped(){return this.filter((e=>!ve(e)))}whereDefaultValueSet(){return this.filter((e=>Te.isDefined(e.defaultValue)))}static from(e,t){if(e instanceof this)return e;const n=super.from(oe(e),(e=>ye.create(e)));return n.validate(t),n}}function ke(e,t){const n=new Error(t);throw n.name=e,n}function ve(e){return oe(e.group).some((e=>e))}function Ce(e){const t={};for(let n=0;n<e.length;n++){const o=e[n];if(t[o])return!0;Te.isDefined(o)&&(t[o]=!0)}}class _e{constructor(e,t){this.options=Object.assign({},t),this.definitions=Ie.from(e,this.options.caseInsensitive),this.argv=ie.from(this.options.argv),this.argv.hasCombinedShortOptions()&&se(this.argv,ae.combinedShort.test.bind(ae.combinedShort),(e=>(e=e.slice(1)).split("").map((t=>({origArg:`-${e}`,arg:"-"+t})))))}*[Symbol.iterator](){const e=this.definitions;let t,n,o,r,s,a=!1,i=!1;for(let c of this.argv){if(Te.isPlainObject(c)&&(s=c.origArg,c=c.arg),i&&this.options.stopAtFirstUnknown){yield{event:"unknown_value",arg:c,name:"_unknown",value:void 0};continue}if(ue(c))t=e.get(c,this.options.caseInsensitive),n=void 0,t?(n=!!t.isBoolean()||null,r="set"):r="unknown_option";else if(pe(c)){const o=c.match(ae.optEquals);t=e.get(o[1],this.options.caseInsensitive),t?t.isBoolean()?(yield{event:"unknown_value",arg:c,name:"_unknown",value:n,def:t},r="set",n=!0):(r="set",n=o[2]):r="unknown_option"}else fe(c)&&(t?(n=c,r="set"):(t=this.definitions.getDefault(),t&&!a?(n=c,r="set"):(r="unknown_value",t=void 0)));o=t?t.name:"_unknown";const p={event:r,arg:c,name:o,value:n,def:t};s&&(p.subArg=c,p.arg=s),yield p,"_unknown"===o&&(i=!0),t&&t.defaultOption&&!t.isMultiple()&&"set"===r&&(a=!0),t&&t.isBoolean()&&(t=void 0),t&&!t.multiple&&Te.isDefined(n)&&null!==n&&(t=void 0),n=void 0,r=void 0,o=void 0,s=void 0}}}const be=new WeakMap;class Pe{constructor(e){this.definition=new ye(e),this.state=null,this.resetToDefault()}get(){return be.get(this)}set(e){this._set(e,"set")}_set(e,t){const n=this.definition;if(n.isMultiple()){if(null!=e){const o=this.get();"default"===this.state&&(o.length=0),o.push(n.type(e)),this.state=t}}else{if(!n.isMultiple()&&"set"===this.state){const t=new Error(`Singular option already set [${this.definition.name}=${this.get()}]`);throw t.name="ALREADY_SET",t.value=e,t.optionName=n.name,t}null==e?be.set(this,e):(be.set(this,n.type(e)),this.state=t)}}resetToDefault(){Te.isDefined(this.definition.defaultValue)?this.definition.isMultiple()?be.set(this,oe(this.definition.defaultValue).slice()):be.set(this,this.definition.defaultValue):this.definition.isMultiple()?be.set(this,[]):be.set(this,null),this.state="default"}static create(e){return(e=new ye(e)).isBoolean()?xe.create(e):new this(e)}}class xe extends Pe{set(e){super.set(!0)}static create(e){return new this(e)}}class Ee extends Map{constructor(e){super(),this.definitions=Ie.from(e),this.set("_unknown",Pe.create({name:"_unknown",multiple:!0}));for(const e of this.definitions.whereDefaultValueSet())this.set(e.name,Pe.create(e))}toObject(e){e=e||{};const t={};for(const n of this){const o=e.camelCase&&"_unknown"!==n[0]?ne(n[0]):n[0],r=n[1];("_unknown"!==o||r.get().length)&&(t[o]=r.get())}return e.skipUnknown&&delete t._unknown,t}}class Ne extends Ee{toObject(e){const t=super.toObject({skipUnknown:e.skipUnknown}),n=super.toObject(e),o=n._unknown;delete n._unknown;const r={_all:n};return o&&o.length&&(r._unknown=o),this.definitions.whereGrouped().forEach((n=>{const o=e.camelCase?ne(n.name):n.name,s=t[n.name];for(const e of oe(n.group))r[e]=r[e]||{},Te.isDefined(s)&&(r[e][o]=s)})),this.definitions.whereNotGrouped().forEach((n=>{const o=e.camelCase?ne(n.name):n.name,s=t[n.name];Te.isDefined(s)&&(r._none||(r._none={}),r._none[o]=s)})),r}}var Se=function(e,t){(t=t||{}).stopAtFirstUnknown&&(t.partial=!0),e=Ie.from(e,t.caseInsensitive);const n=new _e(e,{argv:t.argv,stopAtFirstUnknown:t.stopAtFirstUnknown,caseInsensitive:t.caseInsensitive}),o=new(e.isGrouped()?Ne:Ee)(e);for(const e of n){const n=e.subArg||e.arg;if(!t.partial){if("unknown_value"===e.event){const e=new Error(`Unknown value: ${n}`);throw e.name="UNKNOWN_VALUE",e.value=n,e}if("unknown_option"===e.event){const e=new Error(`Unknown option: ${n}`);throw e.name="UNKNOWN_OPTION",e.optionName=n,e}}let r;o.has(e.name)?r=o.get(e.name):(r=Pe.create(e.def),o.set(e.name,r)),"_unknown"===e.name?r.set(n):r.set(e.value)}return o.toObject({skipUnknown:!t.partial,camelCase:t.camelCase})};function Oe(e,t){return i(this,void 0,void 0,(function(){return c(this,(function(n){try{return s.default.readdirSync(e).forEach((function(n){(null==t?void 0:t.includes(n))||s.default.unlinkSync(r.default.join(e,n))})),[2,!0]}catch(e){return[2,!1]}return[2]}))}))}function Le(e,t,n){var o;return i(this,void 0,void 0,(function(){var a,i,p;return c(this,(function(c){try{return a=e,i=function(e){var t=e.split("/");return t.length>1?{dirParts:t.slice(0,t.length-1),filePart:t[t.length-1]}:{filePart:e}}(t),(null===(o=i.dirParts)||void 0===o?void 0:o.length)&&(a=r.default.join.apply(r.default,function(e,t,n){if(n||2===arguments.length)for(var o,r=0,s=t.length;r<s;r++)!o&&r in t||(o||(o=Array.prototype.slice.call(t,0,r)),o[r]=t[r]);return e.concat(o||Array.prototype.slice.call(t))}([a],i.dirParts,!1))),s.default.existsSync(a)||s.default.mkdirSync(a,{recursive:!0}),p=r.default.join(a,i.filePart),s.default.writeFileSync(p,n),[2,!0]}catch(e){return console.error(e),[2,!1]}return[2]}))}))}var Ae=[{content:'import { IkasLocalThemeAPI } from "@ikas/storefront-next";\n\nexport default IkasLocalThemeAPI.GetComponentDirs.getComponentDirs;\nexport const config = IkasLocalThemeAPI.GetComponentDirs.config;\n',fileName:"getComponentDirs.ts"},{content:'import { IkasLocalThemeAPI } from "@ikas/storefront-next";\n\nexport default IkasLocalThemeAPI.GetTheme.getTheme;\nexport const config = IkasLocalThemeAPI.GetTheme.config;\n',fileName:"getTheme.ts"},{content:'import { IkasLocalThemeAPI } from "@ikas/storefront-next";\n\nexport default IkasLocalThemeAPI.UpdateTheme.updateTheme;\nexport const config = IkasLocalThemeAPI.UpdateTheme.config;\n',fileName:"updateTheme.ts"},{content:'import { IkasLocalThemeAPI } from "@ikas/storefront-next";\n\nexport default IkasLocalThemeAPI.UploadTheme.uploadTheme;\nexport const config = IkasLocalThemeAPI.UploadTheme.config;\n',fileName:"uploadTheme.ts"}],we=function(){function e(){}return e.generate=function(){return i(this,void 0,void 0,(function(){var t,n,o,s,a;return c(this,(function(i){switch(i.label){case 0:return[4,Oe(r.default.join(process.cwd(),"src","pages","api"))];case 1:i.sent(),t=!0,n=0,o=Ae,i.label=2;case 2:return n<o.length?(s=o[n],(a=t)?[4,e.generateAPI(s)]:[3,4]):[3,6];case 3:a=i.sent(),i.label=4;case 4:t=a,i.label=5;case 5:return n++,[3,2];case 6:return[2,t]}}))}))},e.generateAPI=function(e){return Le(r.default.join(process.cwd(),"src","pages","api"),e.fileName,e.content)},e}();function De(e,t){return Object.entries(e||{}).reduce((function(e,n){var o=n[0],r=n[1];return o===t?e.concat(r):"object"==typeof r?e.concat(De(r,t)):e}),[])}var Je={next:"canary",react:"17.0.2","react-dom":"17.0.2",mobx:"^6.1.3",axios:"^0.26.0",lodash:"^4.17.20",archiver:"^5.3.0",cors:"^2.8.5","html-react-parser":"^1.4.0","mobx-react-lite":"^3.1.5","next-transpile-modules":"^9.0.0","@ikas/storefront":"^4.0.0-alpha.4","@ikas/storefront-api":"^4.0.0-alpha.4","@ikas/storefront-assets":"^4.0.0-alpha.4","@ikas/storefront-cmd":"^4.0.0-alpha.4","@ikas/storefront-config":"^4.0.0-alpha.4","@ikas/storefront-model-functions":"^4.0.0-alpha.4","@ikas/storefront-models":"^4.0.0-alpha.4","@ikas/storefront-next":"^4.0.0-alpha.4","@ikas/storefront-providers":"^4.0.0-alpha.4"},Re={"@types/node":"^14.14.6","@types/react":"^17.0.2","@types/react-dom":"^17.0.2","@typescript-eslint/eslint-plugin":"^2.10.0","@typescript-eslint/parser":"^2.10.0",eslint:"^6.6.0","eslint-config-react-app":"^5.2.1","eslint-loader":"3.0.3","eslint-plugin-flowtype":"4.6.0","eslint-plugin-import":"2.20.1","eslint-plugin-jsx-a11y":"6.2.3","eslint-plugin-react":"7.19.0","eslint-plugin-react-hooks":"^1.6.1",sass:"^1.43.4",typescript:"^4.5.2"},je={"@types/react":"17.0.2","@types/react-dom":"17.0.2"},Ue={upgradeDependencies:"yarn upgrade @ikas/storefront @ikas/storefront-api @ikas/storefront-assets @ikas/storefront-cmd @ikas/storefront-config @ikas/storefront-model-functions @ikas/storefront-models @ikas/storefront-next @ikas/storefront-providers",dev:"next dev -p 3333",build:"next build",start:"next start",generate:"ikas --generate","prettier:all":"npx prettier@^2.1 './**/src/**/*.(ts|tsx|css|scss)' --write"},Be=function(){function e(){}return e.generate=function(t){return i(this,void 0,void 0,(function(){var n,o,r,s;return c(this,(function(a){switch(a.label){case 0:return[4,e.generateTsConfig()];case 1:return(s=a.sent())?[4,e.generateBabelRc()]:[3,3];case 2:s=a.sent(),a.label=3;case 3:return(r=s)?[4,e.generateNextConfig()]:[3,5];case 4:r=a.sent(),a.label=5;case 5:return(o=r)?[4,e.generatePackageJson()]:[3,7];case 6:o=a.sent(),a.label=7;case 7:return(n=o)?[4,e.generateEnv(t)]:[3,9];case 8:n=a.sent(),a.label=9;case 9:return[2,n]}}))}))},e.generateTsConfig=function(){return Le(process.cwd(),"tsconfig.json",'{\n "compilerOptions": {\n "target": "esnext",\n "lib": [\n "dom",\n "dom.iterable",\n "esnext"\n ],\n "allowJs": true,\n "skipLibCheck": true,\n "strict": true,\n "forceConsistentCasingInFileNames": true,\n "experimentalDecorators": true,\n "noEmit": true,\n "esModuleInterop": true,\n "module": "esnext",\n "moduleResolution": "node",\n "resolveJsonModule": true,\n "isolatedModules": true,\n "jsx": "preserve",\n "baseUrl": ".",\n "useUnknownInCatchVariables": false,\n "incremental": true\n },\n "typeRoots": [\n "./node_modules/@types"\n ],\n "include": [\n "next-env.d.ts",\n "**/*.ts",\n "**/*.tsx",\n "**/typings/global.d.ts",\n ],\n "exclude": [\n "node_modules",\n "./src/pages/api",\n ]\n}')},e.generateBabelRc=function(){return Le(process.cwd(),".babelrc",'{\n "presets": [\n [\n "next/babel",\n {\n "preset-react": { "throwIfNamespace": false },\n }\n ]\n ],\n "plugins": []\n}')},e.generateNextConfig=function(){return Le(process.cwd(),"next.config.js",'const withTM = require("next-transpile-modules")([\n "@ikas/storefront",\n "@ikas/storefront-api",\n "@ikas/storefront-assets",\n "@ikas/storefront-cmd",\n "@ikas/storefront-config",\n "@ikas/storefront-model-functions",\n "@ikas/storefront-models",\n "@ikas/storefront-next",\n "@ikas/storefront-providers",\n]);\n\nconst config = {\n i18n: {\n defaultLocale: "en",\n locales: ["en"],\n localeDetection: false,\n },\n basePath: process.env.NEXTJS_BASE_PATH || "",\n\n images: {\n deviceSizes: [\n 180, 360, 540, 720, 900, 1080, 1296, 1512, 1728, 1950, 2560, 3840,\n ],\n },\n\n webpack: (config, { buildId, dev, isServer, defaultLoaders, webpack }) => {\n if (!isServer) {\n config.resolve.fallback.fs = false;\n config.resolve.fallback.net = false;\n config.resolve.fallback.encoding = false;\n config.resolve.fallback.crypto = false;\n config.resolve.fallback.assert = false;\n config.resolve.fallback.stream = false;\n config.module.rules = [\n ...config.module.rules,\n {\n test: /@ikas/i,\n sideEffects: false,\n },\n ];\n }\n return config;\n },\n};\n\nmodule.exports = withTM(config);')},e.generatePackageJson=function(){return i(this,void 0,void 0,(function(){var e,t,n,o,i;return c(this,(function(c){switch(c.label){case 0:return c.trys.push([0,3,,4]),e=r.default.join(process.cwd(),"package.json"),(t=s.default.readFileSync(e)).length?(n=JSON.parse(t.toString()),(o=function(e){var t="dev"===e?Re:Je,o="dev"===e?"devDependencies":"dependencies";n[o]&&"object"==typeof n[o]?n[o]=a(a({},n[o]),t):n[o]=t;var r,s=(r=n[o],Object.keys(r).sort().reduce((function(e,t){return e[t]=r[t],e}),{}));n[o]=s})("dev"),o("normal"),n.scripts&&"object"==typeof n.scripts?n.scripts=a(a({},n.scripts),Ue):n.scripts=Ue,n.resolutions=a(a({},n.resolutions),je),[4,Le(e,"",JSON.stringify(n,null,2))]):[3,2];case 1:return[2,c.sent()];case 2:return[3,4];case 3:return i=c.sent(),console.error(i),[2,!1];case 4:return[2]}}))}))},e.generateEnv=function(e){var t="dev"===e?"NEXT_PUBLIC_ENV=local\nNEXT_PUBLIC_BASE_URL=https://api.myikas.dev/api/sf\nNEXT_PUBLIC_IMG_BASE_URL=https://cdn.myikas.dev/\nNEXT_PUBLIC_UPLOAD_GQL_URL=https://api.myikas.dev/api/admin/graphql\nNEXT_PUBLIC_GQL_URL=https://api.myikas.dev/api/sf/graphql\n":"NEXT_PUBLIC_ENV=local\nNEXT_PUBLIC_BASE_URL=https://api.myikas.com/api/sf\nNEXT_PUBLIC_IMG_BASE_URL=https://cdn.myikas.com/\nNEXT_PUBLIC_UPLOAD_GQL_URL=https://api.myikas.com/api/admin/graphql\nNEXT_PUBLIC_GQL_URL=https://api.myikas.com/api/sf/graphql\n";return Le(process.cwd(),".env",t)},e}(),Fe=function(){function e(){}return e.generate=function(e){return Le(r.default.join(process.cwd(),"src","theme.json"),"",JSON.stringify(e,null,2))},e.generateInitialThemeJsonFile=function(){var t={pages:[],components:[],name:"My Theme",customData:[],settings:{colors:[],favicon:{id:null},fontFamily:{name:null,variants:null},stockPreference:n.IkasThemeJsonStockPreference.SHOW_ALL}};return t.pages.push({id:"1",components:[],canonicals:null,description:null,disableIndex:null,name:null,pageTitle:null,slug:null,specifications:[],type:n.IkasThemeJsonPageType.INDEX}),e.generate(t)},e.getTheme=function(){return i(this,void 0,void 0,(function(){var e,t;return c(this,(function(n){try{return e=r.default.join(process.cwd(),"src","theme.json"),[2,(t=s.default.readFileSync(e)).length?JSON.parse(t.toString()):null]}catch(e){console.error(e)}return[2]}))}))},e}(),Ge=[{path:"[slug]/index.tsx",pageComponentName:"SlugPage",pageTypes:[n.IkasThemeJsonPageType.PRODUCT,n.IkasThemeJsonPageType.CATEGORY,n.IkasThemeJsonPageType.BRAND],isDynamicSSG:!0},{path:"account/orders/[id].tsx",pageComponentName:"OrderDetailPage",pageTypes:[n.IkasThemeJsonPageType.ORDER_DETAIL],isSSR:!0},{path:"account/orders/index.tsx",pageComponentName:"OrdersPage",pageTypes:[n.IkasThemeJsonPageType.ORDERS]},{path:"account/addresses.tsx",pageComponentName:"AddressesPage",pageTypes:[n.IkasThemeJsonPageType.ADDRESSES]},{path:"account/favorite-products.tsx",pageComponentName:"FavoriteProductsPage",pageTypes:[n.IkasThemeJsonPageType.FAVORITE_PRODUCTS]},{path:"account/forgot-password.tsx",pageComponentName:"ForgotPasswordPage",pageTypes:[n.IkasThemeJsonPageType.FORGOT_PASSWORD]},{path:"account/index.tsx",pageComponentName:"AccountPage",pageTypes:[n.IkasThemeJsonPageType.ACCOUNT]},{path:"account/login.tsx",pageComponentName:"LoginPage",pageTypes:[n.IkasThemeJsonPageType.LOGIN]},{path:"account/raffles.tsx",pageComponentName:"AccountRafflesPage",pageTypes:[n.IkasThemeJsonPageType.RAFFLE_ACCOUNT]},{path:"account/recover-password.tsx",pageComponentName:"RecoverPasswordPage",pageTypes:[n.IkasThemeJsonPageType.RECOVER_PASSWORD]},{path:"account/register.tsx",pageComponentName:"RegisterPage",pageTypes:[n.IkasThemeJsonPageType.REGISTER]},{path:"blog/[slug].tsx",pageComponentName:"BlogSlugPage",pageTypes:[n.IkasThemeJsonPageType.BLOG,n.IkasThemeJsonPageType.BLOG_CATEGORY],isDynamicSSG:!0},{path:"blog/index.tsx",pageComponentName:"BlogPage",pageTypes:[n.IkasThemeJsonPageType.BLOG_INDEX]},{path:"pages/[slug].tsx",pageComponentName:"CustomPage",pageTypes:[n.IkasThemeJsonPageType.CUSTOM],isDynamicSSG:!0},{path:"raffle/[slug].tsx",pageComponentName:"RafflePage",pageTypes:[n.IkasThemeJsonPageType.RAFFLE_DETAIL],isDynamicSSG:!0},{path:"raffle/index.tsx",pageComponentName:"RafflesPage",pageTypes:[n.IkasThemeJsonPageType.RAFFLE]},{path:"404.tsx",pageComponentName:"NotFoundPage",pageTypes:[n.IkasThemeJsonPageType.NOT_FOUND]},{path:"cart.tsx",pageComponentName:"CartPage",pageTypes:[n.IkasThemeJsonPageType.CART]},{path:"index.tsx",pageComponentName:"IndexPage",pageTypes:[n.IkasThemeJsonPageType.INDEX]},{path:"search.tsx",pageComponentName:"SearchPage",pageTypes:[n.IkasThemeJsonPageType.SEARCH]},{path:"checkout.tsx",pageComponentName:"CheckoutPage",pageTypes:[],isCheckout:!0},{path:"editor.tsx",pageComponentName:"EditorPage",pageTypes:[],isEditor:!0}],Me=function(){function e(){}return e.generate=function(t){return i(this,void 0,void 0,(function(){var n;return c(this,(function(o){switch(o.label){case 0:return[4,Oe(r.default.join(process.cwd(),"src","components","__generated__"))];case 1:return o.sent(),[4,e.generateAllPageComponentImportsFiles(t)];case 2:return(n=o.sent())?[4,e.generateAllComponentImportsFileForEditor(t)]:[3,4];case 3:n=o.sent(),o.label=4;case 4:return[2,n]}}))}))},e.generateAllPageComponentImportsFiles=function(t){return i(this,void 0,void 0,(function(){var n,o,r,s,a;return c(this,(function(i){switch(i.label){case 0:n=!0,o=0,r=Ge,i.label=1;case 1:return o<r.length?(s=r[o],(a=n)?[4,e.generatePageComponentImportsFileWithInfo(s,t)]:[3,3]):[3,5];case 2:a=i.sent(),i.label=3;case 3:n=a,i.label=4;case 4:return o++,[3,1];case 5:return[2,n]}}))}))},e.generatePageComponentImportsFileWithInfo=function(t,n){return i(this,void 0,void 0,(function(){var o,r,s,a;return c(this,(function(i){switch(i.label){case 0:if(t.isCheckout||t.isEditor)return[2,!0];i.label=1;case 1:return i.trys.push([1,3,,4]),o=n.components,r=[],t.pageTypes.forEach((function(e){var t=n.pages.filter((function(t){return t.type===e}));t.length&&t.forEach((function(e){var t,n=e.components;(null===(t=e.specifications)||void 0===t?void 0:t.length)&&e.specifications.forEach((function(e){n.push.apply(n,e.components)})),r.push.apply(r,n.map((function(e){return e.componentId}))),n.forEach((function(e){if(o.find((function(t){return t.id===e.componentId}))){var t=De(e.propValues,"componentId");r.push.apply(r,t)}}))}))})),s=o.filter((function(e){return r.includes(e.id)&&"checkout"!==e.id})),[4,e.generateComponentImportsFile(s,t)];case 2:return[2,i.sent()];case 3:return a=i.sent(),console.error(a),[2,!1];case 4:return[2]}}))}))},e.generatePageComponentImportsFileWithType=function(t,o){if(t!==n.IkasThemeJsonPageType.CHECKOUT){try{var r=Ge.find((function(e){return e.pageTypes.includes(t)}));if(r)return e.generatePageComponentImportsFileWithInfo(r,o)}catch(e){console.error(e)}return!1}},e.generateComponentImportsFile=function(e,t){try{var n="";return e.filter((function(e){return"checkout"!==e.id})).forEach((function(e,t){n+="import Component".concat(t,' from "src/components/').concat(e.dir,'";\r\n')})),n+="\n const Components = {\n ".concat(e.map((function(e,t){return'"'.concat(e.id,'": Component').concat(t)})),"\n };\n "),n+="\r\n",n+="export default Components;",Le(r.default.join(process.cwd(),"src","components","__generated__","pages"),t.path.replace("tsx","ts"),n)}catch(e){return console.error(e),!1}},e.generateAllComponentImportsFileForEditor=function(e){return i(this,void 0,void 0,(function(){var t,n,o;return c(this,(function(s){switch(s.label){case 0:return s.trys.push([0,2,,3]),t='import dynamic from "next/dynamic";\r\n',t+='import { IkasEditorComponentLoader } from "@ikas/storefront";\r\n',t+="\r\n",t+="\r\n",(n=e.components.filter((function(e){return"checkout"!==e.id}))).filter((function(e){return"checkout"!==e.id})).forEach((function(e,n){t+="const Component".concat(n,' = dynamic(() => import("../').concat(e.dir,'"), { loading: () => <IkasEditorComponentLoader /> });\r\n')})),t+="\r\n",t+="\nconst Components = {\n ".concat(n.map((function(e,t){return'"'.concat(e.id,'": Component').concat(t)})),"\n};\n"),t+="\r\n",t+="export default Components;",[4,Le(r.default.join(process.cwd(),"src","components","__generated__"),"editor.tsx",t)];case 1:return[2,s.sent()];case 2:return o=s.sent(),console.error(o),[2,!1];case 3:return[2]}}))}))},e.generateAllComponentImportsFile=function(e){return i(this,void 0,void 0,(function(){var t,n,o;return c(this,(function(s){switch(s.label){case 0:return s.trys.push([0,2,,3]),t="",(n=e.components.filter((function(e){return"checkout"!==e.id}))).filter((function(e){return"checkout"!==e.id})).forEach((function(e,n){t+="import Component".concat(n,' from "../').concat(e.dir,'";\r\n')})),t+="\r\n",t+="\nconst Components = {\n ".concat(n.map((function(e,t){return'"'.concat(e.id,'": Component').concat(t)})),"\n};\n"),t+="\r\n",t+="export default Components;",[4,Le(r.default.join(process.cwd(),"src","components","__generated__"),"index.tsx",t)];case 1:return[2,s.sent()];case 2:return o=s.sent(),console.error(o),[2,!1];case 3:return[2]}}))}))},e}(),Ve=function(){function e(){}return e.generate=function(){return i(this,void 0,void 0,(function(){var t,n,o,s,a,i,p,u,l,f,h;return c(this,(function(c){switch(c.label){case 0:return[4,Oe(r.default.join(process.cwd(),"src","pages"),["_app.tsx","_document.tsx","api"])];case 1:c.sent(),t=!0,n=0,o=Ge,c.label=2;case 2:return n<o.length?(s=o[n],(a=t)?[4,e.generatePageWithInfo(s)]:[3,4]):[3,6];case 3:a=c.sent(),c.label=4;case 4:t=a,c.label=5;case 5:return n++,[3,2];case 6:return i=Ge.find((function(e){return e.isCheckout})),p=Ge.find((function(e){return e.isEditor})),i?[4,e.generatePageWithInfo(i)]:[3,8];case 7:return l=c.sent(),[3,9];case 8:l=!1,c.label=9;case 9:return u=l,p?[4,e.generatePageWithInfo(p)]:[3,11];case 10:return h=c.sent(),[3,12];case 11:h=!1,c.label=12;case 12:return f=h,[2,t&&u&&f]}}))}))},e.generatePageWithInfo=function(e){return i(this,void 0,void 0,(function(){var t,n,o,s,a,i,p,u,l;return c(this,(function(c){switch(c.label){case 0:return c.trys.push([0,2,,3]),t="",e.isCheckout?t='import { CheckoutPage } from "@ikas/storefront";\nimport { CheckoutPage as CheckoutPageNext } from "@ikas/storefront-next";\n\nexport default CheckoutPage.default;\nexport const getStaticProps = CheckoutPageNext.getStaticProps;\n':e.isEditor?t='import { EditorPage } from "@ikas/storefront";\nimport { EditorPage as EditorPageNext } from "@ikas/storefront-next";\nimport Components from "../components/__generated__/editor";\n\nconst PageComponent = EditorPage.default;\n\nconst Page = (props: any) => {\n return <PageComponent components={Components} {...props} />;\n};\n\nexport default Page;\nexport const getStaticProps = EditorPageNext.getStaticProps;\n':(n=e.pageComponentName+"Next",o="import { ".concat(e.pageComponentName,' } from "@ikas/storefront";\r\n'),s="import { ".concat(e.pageComponentName," as ").concat(n,' } from "@ikas/storefront-next";\r\n'),a='import Components from "src/components/__generated__/pages/'.concat(e.path.replace(".tsx",""),'";\r\n'),i="\nconst PageComponent = ".concat(e.pageComponentName,".default;\n\nconst Page = (props: any) => {\n return <PageComponent components={Components} {...props} />;\n};\n\nexport default Page;\r\n"),p=e.isDynamicSSG?"export const getStaticPaths = ".concat(n,".getStaticPaths;\r\n"):"",u=e.isSSR?"export const getServerSideProps = ".concat(n,".getServerSideProps;\r\n"):"export const getStaticProps = ".concat(n,".getStaticProps;\r\n"),t=o+s+a+i+p+u),[4,Le(r.default.join(process.cwd(),"src","pages"),e.path,t)];case 1:return[2,c.sent()];case 2:return l=c.sent(),console.error(l),[2,!1];case 3:return[2]}}))}))},e.generatePageWithType=function(t){return i(this,void 0,void 0,(function(){var n;return c(this,(function(o){switch(o.label){case 0:return(n=Ge.find((function(e){return e.pageTypes.includes(t)})))?[4,e.generatePageWithInfo(n)]:[3,2];case 1:return[2,o.sent()];case 2:return[2,!1]}}))}))},e}(),ze="object"==typeof p&&p&&p.Object===Object&&p,We="object"==typeof self&&self&&self.Object===Object&&self,qe=ze||We||Function("return this")(),Xe=qe.Symbol,Ye=Xe,$e=Object.prototype,Ze=$e.hasOwnProperty,He=$e.toString,Ke=Ye?Ye.toStringTag:void 0;var Qe=function(e){var t=Ze.call(e,Ke),n=e[Ke];try{e[Ke]=void 0;var o=!0}catch(e){}var r=He.call(e);return o&&(t?e[Ke]=n:delete e[Ke]),r},et=Object.prototype.toString;var tt=Qe,nt=function(e){return et.call(e)},ot=Xe?Xe.toStringTag:void 0;var rt=function(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)},st=function(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":ot&&ot in Object(e)?tt(e):nt(e)},at=rt;var it,ct=function(e){if(!at(e))return!1;var t=st(e);return"[object Function]"==t||"[object GeneratorFunction]"==t||"[object AsyncFunction]"==t||"[object Proxy]"==t},pt=qe["__core-js_shared__"],ut=(it=/[^.]+$/.exec(pt&&pt.keys&&pt.keys.IE_PROTO||""))?"Symbol(src)_1."+it:"";var lt=function(e){return!!ut&&ut in e},ft=Function.prototype.toString;var ht=ct,mt=lt,dt=rt,gt=function(e){if(null!=e){try{return ft.call(e)}catch(e){}try{return e+""}catch(e){}}return""},Tt=/^\[object .+?Constructor\]$/,yt=Function.prototype,It=Object.prototype,kt=yt.toString,vt=It.hasOwnProperty,Ct=RegExp("^"+kt.call(vt).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");var _t=function(e,t){return null==e?void 0:e[t]},bt=function(e){return!(!dt(e)||mt(e))&&(ht(e)?Ct:Tt).test(gt(e))},Pt=_t;var xt=function(e,t){var n=Pt(e,t);return bt(n)?n:void 0},Et=xt(Object,"create"),Nt=Et;var St=function(){this.__data__=Nt?Nt(null):{},this.size=0};var Ot=function(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t},Lt=Et,At=Object.prototype.hasOwnProperty;var wt=function(e){var t=this.__data__;if(Lt){var n=t[e];return"__lodash_hash_undefined__"===n?void 0:n}return At.call(t,e)?t[e]:void 0},Dt=Et,Jt=Object.prototype.hasOwnProperty;var Rt=Et;var jt=St,Ut=Ot,Bt=wt,Ft=function(e){var t=this.__data__;return Dt?void 0!==t[e]:Jt.call(t,e)},Gt=function(e,t){var n=this.__data__;return this.size+=this.has(e)?0:1,n[e]=Rt&&void 0===t?"__lodash_hash_undefined__":t,this};function Mt(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var o=e[t];this.set(o[0],o[1])}}Mt.prototype.clear=jt,Mt.prototype.delete=Ut,Mt.prototype.get=Bt,Mt.prototype.has=Ft,Mt.prototype.set=Gt;var Vt=Mt;var zt=function(){this.__data__=[],this.size=0};var Wt=function(e,t){return e===t||e!=e&&t!=t};var qt=function(e,t){for(var n=e.length;n--;)if(Wt(e[n][0],t))return n;return-1},Xt=qt,Yt=Array.prototype.splice;var $t=qt;var Zt=qt;var Ht=qt;var Kt=zt,Qt=function(e){var t=this.__data__,n=Xt(t,e);return!(n<0)&&(n==t.length-1?t.pop():Yt.call(t,n,1),--this.size,!0)},en=function(e){var t=this.__data__,n=$t(t,e);return n<0?void 0:t[n][1]},tn=function(e){return Zt(this.__data__,e)>-1},nn=function(e,t){var n=this.__data__,o=Ht(n,e);return o<0?(++this.size,n.push([e,t])):n[o][1]=t,this};function on(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var o=e[t];this.set(o[0],o[1])}}on.prototype.clear=Kt,on.prototype.delete=Qt,on.prototype.get=en,on.prototype.has=tn,on.prototype.set=nn;var rn=on,sn=xt(qe,"Map"),an=Vt,cn=rn,pn=sn;var un=function(e){var t=typeof e;return"string"==t||"number"==t||"symbol"==t||"boolean"==t?"__proto__"!==e:null===e};var ln=function(e,t){var n=e.__data__;return un(t)?n["string"==typeof t?"string":"hash"]:n.map},fn=ln;var hn=ln;var mn=ln;var dn=ln;var gn=function(){this.size=0,this.__data__={hash:new an,map:new(pn||cn),string:new an}},Tn=function(e){var t=fn(this,e).delete(e);return this.size-=t?1:0,t},yn=function(e){return hn(this,e).get(e)},In=function(e){return mn(this,e).has(e)},kn=function(e,t){var n=dn(this,e),o=n.size;return n.set(e,t),this.size+=n.size==o?0:1,this};function vn(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var o=e[t];this.set(o[0],o[1])}}vn.prototype.clear=gn,vn.prototype.delete=Tn,vn.prototype.get=yn,vn.prototype.has=In,vn.prototype.set=kn;var Cn=vn,_n=function(e){return this.__data__.set(e,"__lodash_hash_undefined__"),this},bn=function(e){return this.__data__.has(e)};function Pn(e){var t=-1,n=null==e?0:e.length;for(this.__data__=new Cn;++t<n;)this.add(e[t])}Pn.prototype.add=Pn.prototype.push=_n,Pn.prototype.has=bn;var xn=Pn;var En=function(e,t,n,o){for(var r=e.length,s=n+(o?1:-1);o?s--:++s<r;)if(t(e[s],s,e))return s;return-1},Nn=function(e){return e!=e},Sn=function(e,t,n){for(var o=n-1,r=e.length;++o<r;)if(e[o]===t)return o;return-1};var On=function(e,t,n){return t==t?Sn(e,t,n):En(e,Nn,n)};var Ln=function(e,t){return!!(null==e?0:e.length)&&On(e,t,0)>-1};var An=function(e,t,n){for(var o=-1,r=null==e?0:e.length;++o<r;)if(n(t,e[o]))return!0;return!1};var wn=function(e,t){return e.has(t)};var Dn=function(e){var t=-1,n=Array(e.size);return e.forEach((function(e){n[++t]=e})),n},Jn=xt(qe,"Set"),Rn=function(){},jn=Jn&&1/Dn(new Jn([,-0]))[1]==1/0?function(e){return new Jn(e)}:Rn,Un=xn,Bn=Ln,Fn=An,Gn=wn,Mn=jn,Vn=Dn;var zn=function(e,t,n){var o=-1,r=Bn,s=e.length,a=!0,i=[],c=i;if(n)a=!1,r=Fn;else if(s>=200){var p=t?null:Mn(e);if(p)return Vn(p);a=!1,r=Gn,c=new Un}else c=t?[]:i;e:for(;++o<s;){var u=e[o],l=t?t(u):u;if(u=n||0!==u?u:0,a&&l==l){for(var f=c.length;f--;)if(c[f]===l)continue e;t&&c.push(l),i.push(u)}else r(c,l,n)||(c!==i&&c.push(l),i.push(u))}return i};var Wn=function(e){return e&&e.length?zn(e):[]},qn=function(){function e(){}return e.generate=function(t){return i(this,void 0,void 0,(function(){var n,o,s,a,i,p,u;return c(this,(function(c){switch(c.label){case 0:return[4,Oe(r.default.join(process.cwd(),"src","components","__generated__","types"))];case 1:c.sent(),n={content:"",imports:[],internalCustomDatas:[]},c.label=2;case 2:c.trys.push([2,5,,6]),t.customData.forEach((function(o){e.generateAllCustomDataTypes(o,n,t)})),o=0,s=0;do{o=n.internalCustomDatas.length,n.internalCustomDatas.forEach((function(o){e.generateAllCustomDataTypes(o,n,t)})),(s=n.internalCustomDatas.length)!==o&&(n.internalCustomDatas=n.internalCustomDatas.splice(o,s))}while(o!==s);return[4,Xn.generate(t,n)];case 3:return c.sent(),a=r.default.join(process.cwd(),"src","components","__generated__"),n.imports=Wn(n.imports),i="import {\r\n",n.imports.forEach((function(e){i+="\t".concat(e,",\r\n")})),p=(i+='} from "@ikas/storefront"\r\n\r\n')+n.content,[4,Le(a,"types.ts",p)];case 4:return[2,c.sent()];case 5:return u=c.sent(),console.log(u),[2,!1];case 6:return[2]}}))}))},e.generateAllCustomDataTypes=function(t,o,r){var s=t.type===n.IkasThemeJsonComponentPropType.ENUM,a="export ".concat(s?"enum":"type"," ").concat(e.generateTypeName(t)).concat(s?"":" = ","{ \r\n"),i="};\r\n\r\n";t.type!==n.IkasThemeJsonComponentPropType.DYNAMIC_LIST&&t.type!==n.IkasThemeJsonComponentPropType.STATIC_LIST||!t.nestedData?t.type===n.IkasThemeJsonComponentPropType.ENUM&&t.enumOptions?(o.content+=a,t.enumOptions.forEach((function(e){var t=e.value;e.value&&!isNaN(parseInt(e.value))&&(t="_"+e.value),o.content+='\t"'.concat(t,'" = "').concat(null==e?void 0:e.value,'",'),o.content+="\r\n"})),o.content+=i):(o.content+=a,t.nestedData&&t.nestedData.forEach((function(t){e.genenateCustomDataType(t,o,r),o.content+="\r\n"})),o.content+=i):e.generateAllCustomDataTypes(t.nestedData[0],o,r)},e.genenateCustomDataType=function(t,o,r){var s=e.getType(t,o,r);t.key&&t.key[0].match(/^\d/)&&(t.key="_"+t.key),o.content+="\t".concat(t.key).concat(t.isRequired?"":"?",": ").concat(s).concat([n.IkasThemeJsonComponentPropType.DYNAMIC_LIST,n.IkasThemeJsonComponentPropType.STATIC_LIST].includes(t.type)?"[]":"").concat(t.type===n.IkasThemeJsonComponentPropType.ENUM?",":";")},e.getType=function(t,o,r){var s="";switch(t.type){case n.IkasThemeJsonComponentPropType.TEXT:case n.IkasThemeJsonComponentPropType.RICH_TEXT:case n.IkasThemeJsonComponentPropType.COLOR:s="string";break;case n.IkasThemeJsonComponentPropType.BOOLEAN:s="boolean";break;case n.IkasThemeJsonComponentPropType.IMAGE:s="IkasImage",o.imports.push(s);break;case n.IkasThemeJsonComponentPropType.IMAGE_LIST:s="IkasImage[]",o.imports.push("IkasImage");break;case n.IkasThemeJsonComponentPropType.LINK:s="IkasNavigationLink",o.imports.push(s);break;case n.IkasThemeJsonComponentPropType.LIST_OF_LINK:s="IkasNavigationLink[]",o.imports.push("IkasNavigationLink");break;case n.IkasThemeJsonComponentPropType.PRODUCT_DETAIL:s="IkasProduct",o.imports.push(s);break;case n.IkasThemeJsonComponentPropType.PRODUCT_LIST:s="IkasProductList",o.imports.push("IkasProductList");break;case n.IkasThemeJsonComponentPropType.PRODUCT_ATTRIBUTE:s="IkasProductAttribute",o.imports.push(s);break;case n.IkasThemeJsonComponentPropType.PRODUCT_ATTRIBUTE_LIST:s="IkasProductAttribute[]",o.imports.push("IkasProductAttribute");break;case n.IkasThemeJsonComponentPropType.BRAND:s="IkasBrand",o.imports.push(s);break;case n.IkasThemeJsonComponentPropType.BRAND_LIST:s="IkasBrandList",o.imports.push(s);break;case n.IkasThemeJsonComponentPropType.CATEGORY:s="IkasCategory",o.imports.push(s);break;case n.IkasThemeJsonComponentPropType.CATEGORY_LIST:s="IkasCategoryList",o.imports.push(s);break;case n.IkasThemeJsonComponentPropType.CUSTOM:var a=r.customData.find((function(e){return e.id===t.customDataId}));a&&(s=e.generateTypeName(a));break;case n.IkasThemeJsonComponentPropType.COMPONENT:s="IkasComponentRenderer",o.imports.push(s);break;case n.IkasThemeJsonComponentPropType.COMPONENT_LIST:s="IkasComponentRenderer[]",o.imports.push("IkasComponentRenderer");break;case n.IkasThemeJsonComponentPropType.BLOG:s="IkasBlog",o.imports.push(s);break;case n.IkasThemeJsonComponentPropType.BLOG_LIST:s="IkasBlogList",o.imports.push(s);break;case n.IkasThemeJsonComponentPropType.BLOG_CATEGORY:s="IkasBlogCategory",o.imports.push(s);break;case n.IkasThemeJsonComponentPropType.BLOG_CATEGORY_LIST:s="IkasBlogCategoryList",o.imports.push(s);break;case n.IkasThemeJsonComponentPropType.RAFFLE:s="IkasRaffle",o.imports.push(s);break;case n.IkasThemeJsonComponentPropType.RAFFLE_LIST:s="IkasRaffleList",o.imports.push(s);break;case n.IkasThemeJsonComponentPropType.SLIDER:s="IkasSlider",o.imports.push(s);break;case n.IkasThemeJsonComponentPropType.ENUM:s=e.generateTypeName(t),o.content.includes("export enum ".concat(s))||o.internalCustomDatas.push(t);break;case n.IkasThemeJsonComponentPropType.OBJECT:s=e.generateTypeName(t);break;case n.IkasThemeJsonComponentPropType.DYNAMIC_LIST:case n.IkasThemeJsonComponentPropType.STATIC_LIST:t.nestedData&&(t.nestedData[0].type===n.IkasThemeJsonComponentPropType.OBJECT||t.nestedData[0].type===n.IkasThemeJsonComponentPropType.ENUM?(s=e.generateTypeName(t.nestedData[0]),o.content.includes("export type ".concat(s))||o.internalCustomDatas.push(t.nestedData[0])):s=e.getType(t.nestedData[0],o,r))}return s},e.generateTypeName=function(e){if(e.typescriptName)return e.typescriptName;var t=e.name||"";return(t=(t=t.replace(/\s/g,"")).replace(/\W/g,""))[0].match(/^\d/)&&(t="_"+t),e.type===n.IkasThemeJsonComponentPropType.ENUM&&(t+="Enum"),t},e}(),Xn=function(){function e(){}return e.generate=function(t,n){return i(this,void 0,void 0,(function(){return c(this,(function(o){return t.components.forEach((function(o){o.props.length>0&&"checkout"!==o.id&&(n.content+="export type ".concat(e.generatePropTypeName(o),"Props = {\n"),o.props.forEach((function(o){n.content+="\t".concat(o.name,": ").concat(e.getType(o,t,n),";\n")})),n.content+="};\r\n\r\n")})),[2]}))}))},e.getType=function(e,t,o){var r="";switch(e.type){case n.IkasThemeJsonComponentPropType.TEXT:case n.IkasThemeJsonComponentPropType.RICH_TEXT:case n.IkasThemeJsonComponentPropType.COLOR:r="string";break;case n.IkasThemeJsonComponentPropType.BOOLEAN:r="boolean";break;case n.IkasThemeJsonComponentPropType.IMAGE:r="IkasImage",o.imports.push(r);break;case n.IkasThemeJsonComponentPropType.IMAGE_LIST:r="IkasImage[]",o.imports.push("IkasImage");break;case n.IkasThemeJsonComponentPropType.LINK:r="IkasNavigationLink",o.imports.push(r);break;case n.IkasThemeJsonComponentPropType.LIST_OF_LINK:r="IkasNavigationLink[]",o.imports.push("IkasNavigationLink");break;case n.IkasThemeJsonComponentPropType.PRODUCT_DETAIL:r="IkasProduct",o.imports.push(r);break;case n.IkasThemeJsonComponentPropType.PRODUCT_LIST:r="IkasProductList",o.imports.push("IkasProductList");break;case n.IkasThemeJsonComponentPropType.PRODUCT_ATTRIBUTE:r="IkasProductAttribute",o.imports.push(r);break;case n.IkasThemeJsonComponentPropType.PRODUCT_ATTRIBUTE_LIST:r="IkasProductAttribute[]",o.imports.push("IkasProductAttribute");break;case n.IkasThemeJsonComponentPropType.BRAND:r="IkasBrand",o.imports.push(r);break;case n.IkasThemeJsonComponentPropType.BRAND_LIST:r="IkasBrandList",o.imports.push(r);break;case n.IkasThemeJsonComponentPropType.CATEGORY:r="IkasCategory",o.imports.push(r);break;case n.IkasThemeJsonComponentPropType.CATEGORY_LIST:r="IkasCategoryList",o.imports.push(r);break;case n.IkasThemeJsonComponentPropType.CUSTOM:var s=t.customData.find((function(t){return t.id===e.customDataId}));s&&(r=qn.getType(s,o,t),s.type!==n.IkasThemeJsonComponentPropType.DYNAMIC_LIST&&s.type!==n.IkasThemeJsonComponentPropType.STATIC_LIST||(r+="[]"));break;case n.IkasThemeJsonComponentPropType.COMPONENT:r="IkasComponentRenderer",o.imports.push(r);break;case n.IkasThemeJsonComponentPropType.COMPONENT_LIST:r="IkasComponentRenderer[]",o.imports.push("IkasComponentRenderer");break;case n.IkasThemeJsonComponentPropType.BLOG:r="IkasBlog",o.imports.push(r);break;case n.IkasThemeJsonComponentPropType.BLOG_LIST:r="IkasBlogList",o.imports.push(r);break;case n.IkasThemeJsonComponentPropType.BLOG_CATEGORY:r="IkasBlogCategory",o.imports.push(r);break;case n.IkasThemeJsonComponentPropType.BLOG_CATEGORY_LIST:r="IkasBlogCategoryList",o.imports.push(r);break;case n.IkasThemeJsonComponentPropType.RAFFLE:r="IkasRaffle",o.imports.push(r);break;case n.IkasThemeJsonComponentPropType.RAFFLE_LIST:r="IkasRaffleList",o.imports.push(r);break;case n.IkasThemeJsonComponentPropType.SLIDER:r="IkasSlider",o.imports.push(r)}return r},e.generatePropTypeName=function(e){if(""!==e.displayName){var t=(e.dir||"").split("-"),n="";return t.forEach((function(e,t){return n+=e.charAt(0).toUpperCase()+e.slice(1)})),n[0].match(/^\d/)&&(n="_"+n),n}},e}();function Yn(e){return i(this,void 0,void 0,(function(){var t,n,o,r,s,a;return c(this,(function(i){switch(i.label){case 0:return[4,Fe.getTheme()];case 1:return(t=i.sent())?[3,3]:[4,Fe.generateInitialThemeJsonFile()];case 2:i.sent(),i.label=3;case 3:return[4,Fe.getTheme()];case 4:return t=i.sent(),[4,Fe.generate(t)];case 5:return(a=i.sent())?[4,Me.generate(t)]:[3,7];case 6:a=i.sent(),i.label=7;case 7:return(s=a)?[4,Ve.generate()]:[3,9];case 8:s=i.sent(),i.label=9;case 9:return(r=s)?[4,we.generate()]:[3,11];case 10:r=i.sent(),i.label=11;case 11:return(o=r)?[4,Be.generate(e)]:[3,13];case 12:o=i.sent(),i.label=13;case 13:return(n=o)?[4,qn.generate(t)]:[3,15];case 14:n=i.sent(),i.label=15;case 15:return[2,n]}}))}))}!function(){i(this,void 0,void 0,(function(){var e,t;return c(this,(function(n){switch(n.label){case 0:return e=[{name:"generate",alias:"g",type:Boolean},{name:"dev",alias:"d",type:Boolean}],(t=Se(e)).generate?[4,Yn(!!t.dev?"dev":"prod")]:[3,2];case 1:n.sent()?console.log("Project files generated successfully!"):console.log("Project files generate failed!"),n.label=2;case 2:return[2]}}))}))}();
|
|
3
3
|
//# sourceMappingURL=ikas.cjs.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ikas/storefront-cmd",
|
|
3
|
-
"version": "4.0.0-alpha.
|
|
3
|
+
"version": "4.0.0-alpha.4",
|
|
4
4
|
"description": "Command line tool for ikas storefront themes.",
|
|
5
5
|
"author": "Umut Ozan Yıldırım",
|
|
6
6
|
"license": "ISC",
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
"lodash": "^4.17.21"
|
|
25
25
|
},
|
|
26
26
|
"devDependencies": {
|
|
27
|
-
"@ikas/storefront-models": "^4.0.0-alpha.
|
|
27
|
+
"@ikas/storefront-models": "^4.0.0-alpha.4",
|
|
28
28
|
"@rollup/plugin-commonjs": "^22.0.0",
|
|
29
29
|
"@rollup/plugin-node-resolve": "^13.3.0",
|
|
30
30
|
"rollup-plugin-typescript2": "^0.32.1",
|
|
@@ -40,6 +40,6 @@
|
|
|
40
40
|
"typescript-transform-paths": "^2.2.2"
|
|
41
41
|
},
|
|
42
42
|
"peerDependencies": {
|
|
43
|
-
"@ikas/storefront-models": "^4.0.0-alpha.
|
|
43
|
+
"@ikas/storefront-models": "^4.0.0-alpha.4"
|
|
44
44
|
}
|
|
45
45
|
}
|
|
@@ -9,32 +9,22 @@ import { CHECKOUT_COMPONENT_ID, PageInfo, PAGE_INFO } from "../pages/info";
|
|
|
9
9
|
import { findAllByKey } from "../../../utils/helper";
|
|
10
10
|
|
|
11
11
|
export class ComponentImportsGenerator {
|
|
12
|
-
static async generate(themeJson: IkasThemeJson
|
|
12
|
+
static async generate(themeJson: IkasThemeJson) {
|
|
13
13
|
await deleteDirContent(
|
|
14
|
-
path.join(
|
|
15
|
-
workingDir || process.cwd(),
|
|
16
|
-
"src",
|
|
17
|
-
"components",
|
|
18
|
-
"__generated__"
|
|
19
|
-
)
|
|
14
|
+
path.join(process.cwd(), "src", "components", "__generated__")
|
|
20
15
|
);
|
|
21
16
|
|
|
22
17
|
return (
|
|
23
18
|
(await ComponentImportsGenerator.generateAllPageComponentImportsFiles(
|
|
24
|
-
themeJson
|
|
25
|
-
workingDir
|
|
19
|
+
themeJson
|
|
26
20
|
)) &&
|
|
27
21
|
(await ComponentImportsGenerator.generateAllComponentImportsFileForEditor(
|
|
28
|
-
themeJson
|
|
29
|
-
workingDir
|
|
22
|
+
themeJson
|
|
30
23
|
))
|
|
31
24
|
);
|
|
32
25
|
}
|
|
33
26
|
|
|
34
|
-
static async generateAllPageComponentImportsFiles(
|
|
35
|
-
themeJson: IkasThemeJson,
|
|
36
|
-
workingDir?: string
|
|
37
|
-
) {
|
|
27
|
+
static async generateAllPageComponentImportsFiles(themeJson: IkasThemeJson) {
|
|
38
28
|
let isSuccess = true;
|
|
39
29
|
|
|
40
30
|
for (const pageInfo of PAGE_INFO) {
|
|
@@ -47,8 +37,7 @@ export class ComponentImportsGenerator {
|
|
|
47
37
|
isSuccess &&
|
|
48
38
|
(await ComponentImportsGenerator.generatePageComponentImportsFileWithInfo(
|
|
49
39
|
pageInfo,
|
|
50
|
-
themeJson
|
|
51
|
-
workingDir
|
|
40
|
+
themeJson
|
|
52
41
|
));
|
|
53
42
|
}
|
|
54
43
|
|
|
@@ -57,8 +46,7 @@ export class ComponentImportsGenerator {
|
|
|
57
46
|
|
|
58
47
|
static async generatePageComponentImportsFileWithInfo(
|
|
59
48
|
pageInfo: PageInfo,
|
|
60
|
-
themeJson: IkasThemeJson
|
|
61
|
-
workingDir?: string
|
|
49
|
+
themeJson: IkasThemeJson
|
|
62
50
|
) {
|
|
63
51
|
if (pageInfo.isCheckout || pageInfo.isEditor) return true;
|
|
64
52
|
|
|
@@ -103,8 +91,7 @@ export class ComponentImportsGenerator {
|
|
|
103
91
|
|
|
104
92
|
return await ComponentImportsGenerator.generateComponentImportsFile(
|
|
105
93
|
componentsInPage,
|
|
106
|
-
pageInfo
|
|
107
|
-
workingDir
|
|
94
|
+
pageInfo
|
|
108
95
|
);
|
|
109
96
|
} catch (err) {
|
|
110
97
|
console.error(err);
|
|
@@ -114,8 +101,7 @@ export class ComponentImportsGenerator {
|
|
|
114
101
|
|
|
115
102
|
static generatePageComponentImportsFileWithType(
|
|
116
103
|
pageType: IkasThemeJsonPageType,
|
|
117
|
-
themeJson: IkasThemeJson
|
|
118
|
-
workingDir?: string
|
|
104
|
+
themeJson: IkasThemeJson
|
|
119
105
|
) {
|
|
120
106
|
if (pageType === IkasThemeJsonPageType.CHECKOUT) return;
|
|
121
107
|
|
|
@@ -124,8 +110,7 @@ export class ComponentImportsGenerator {
|
|
|
124
110
|
if (pageInfo) {
|
|
125
111
|
return ComponentImportsGenerator.generatePageComponentImportsFileWithInfo(
|
|
126
112
|
pageInfo,
|
|
127
|
-
themeJson
|
|
128
|
-
workingDir
|
|
113
|
+
themeJson
|
|
129
114
|
);
|
|
130
115
|
}
|
|
131
116
|
} catch (err) {
|
|
@@ -137,8 +122,7 @@ export class ComponentImportsGenerator {
|
|
|
137
122
|
|
|
138
123
|
static generateComponentImportsFile(
|
|
139
124
|
components: IkasThemeJsonComponent[],
|
|
140
|
-
pageInfo: PageInfo
|
|
141
|
-
workingDir?: string
|
|
125
|
+
pageInfo: PageInfo
|
|
142
126
|
) {
|
|
143
127
|
try {
|
|
144
128
|
let fileStr = "";
|
|
@@ -161,13 +145,7 @@ export class ComponentImportsGenerator {
|
|
|
161
145
|
fileStr += "export default Components;";
|
|
162
146
|
|
|
163
147
|
return createFile(
|
|
164
|
-
path.join(
|
|
165
|
-
workingDir || process.cwd(),
|
|
166
|
-
"src",
|
|
167
|
-
"components",
|
|
168
|
-
"__generated__",
|
|
169
|
-
"pages"
|
|
170
|
-
),
|
|
148
|
+
path.join(process.cwd(), "src", "components", "__generated__", "pages"),
|
|
171
149
|
pageInfo.path.replace("tsx", "ts"),
|
|
172
150
|
fileStr
|
|
173
151
|
);
|
|
@@ -178,8 +156,7 @@ export class ComponentImportsGenerator {
|
|
|
178
156
|
}
|
|
179
157
|
|
|
180
158
|
static async generateAllComponentImportsFileForEditor(
|
|
181
|
-
themeJson: IkasThemeJson
|
|
182
|
-
workingDir?: string
|
|
159
|
+
themeJson: IkasThemeJson
|
|
183
160
|
) {
|
|
184
161
|
try {
|
|
185
162
|
let fileStr = `import dynamic from "next/dynamic";\r\n`;
|
|
@@ -211,7 +188,7 @@ const Components = {
|
|
|
211
188
|
fileStr += "export default Components;";
|
|
212
189
|
|
|
213
190
|
const generatedFolderPath = path.join(
|
|
214
|
-
|
|
191
|
+
process.cwd(),
|
|
215
192
|
"src",
|
|
216
193
|
"components",
|
|
217
194
|
"__generated__"
|
|
@@ -224,10 +201,7 @@ const Components = {
|
|
|
224
201
|
}
|
|
225
202
|
}
|
|
226
203
|
|
|
227
|
-
static async generateAllComponentImportsFile(
|
|
228
|
-
themeJson: IkasThemeJson,
|
|
229
|
-
workingDir?: string
|
|
230
|
-
) {
|
|
204
|
+
static async generateAllComponentImportsFile(themeJson: IkasThemeJson) {
|
|
231
205
|
try {
|
|
232
206
|
let fileStr = ``;
|
|
233
207
|
|
|
@@ -255,7 +229,7 @@ const Components = {
|
|
|
255
229
|
fileStr += "export default Components;";
|
|
256
230
|
|
|
257
231
|
const generatedFolderPath = path.join(
|
|
258
|
-
|
|
232
|
+
process.cwd(),
|
|
259
233
|
"src",
|
|
260
234
|
"components",
|
|
261
235
|
"__generated__"
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export const DEPENDENCIES = {
|
|
2
|
-
next: "
|
|
2
|
+
next: "canary",
|
|
3
3
|
react: "17.0.2",
|
|
4
4
|
"react-dom": "17.0.2",
|
|
5
5
|
mobx: "^6.1.3",
|
|
@@ -10,23 +10,21 @@ export const DEPENDENCIES = {
|
|
|
10
10
|
"html-react-parser": "^1.4.0",
|
|
11
11
|
"mobx-react-lite": "^3.1.5",
|
|
12
12
|
"next-transpile-modules": "^9.0.0",
|
|
13
|
-
"@ikas/storefront": "^4.0.0-alpha.
|
|
14
|
-
"@ikas/storefront-api": "^4.0.0-alpha.
|
|
15
|
-
"@ikas/storefront-assets": "^4.0.0-alpha.
|
|
16
|
-
"@ikas/storefront-cmd": "^4.0.0-alpha.
|
|
17
|
-
"@ikas/storefront-config": "^4.0.0-alpha.
|
|
18
|
-
"@ikas/storefront-model-functions": "^4.0.0-alpha.
|
|
19
|
-
"@ikas/storefront-models": "^4.0.0-alpha.
|
|
20
|
-
"@ikas/storefront-next": "^4.0.0-alpha.
|
|
21
|
-
"@ikas/storefront-providers": "^4.0.0-alpha.
|
|
13
|
+
"@ikas/storefront": "^4.0.0-alpha.4",
|
|
14
|
+
"@ikas/storefront-api": "^4.0.0-alpha.4",
|
|
15
|
+
"@ikas/storefront-assets": "^4.0.0-alpha.4",
|
|
16
|
+
"@ikas/storefront-cmd": "^4.0.0-alpha.4",
|
|
17
|
+
"@ikas/storefront-config": "^4.0.0-alpha.4",
|
|
18
|
+
"@ikas/storefront-model-functions": "^4.0.0-alpha.4",
|
|
19
|
+
"@ikas/storefront-models": "^4.0.0-alpha.4",
|
|
20
|
+
"@ikas/storefront-next": "^4.0.0-alpha.4",
|
|
21
|
+
"@ikas/storefront-providers": "^4.0.0-alpha.4",
|
|
22
22
|
};
|
|
23
23
|
|
|
24
24
|
export const DEV_DEPENDENCIES = {
|
|
25
25
|
"@types/node": "^14.14.6",
|
|
26
26
|
"@types/react": "^17.0.2",
|
|
27
27
|
"@types/react-dom": "^17.0.2",
|
|
28
|
-
"@types/cors": "^2.8.9",
|
|
29
|
-
"@types/archiver": "^5.1.0",
|
|
30
28
|
"@typescript-eslint/eslint-plugin": "^2.10.0",
|
|
31
29
|
"@typescript-eslint/parser": "^2.10.0",
|
|
32
30
|
eslint: "^6.6.0",
|
|
@@ -17,39 +17,32 @@ import {
|
|
|
17
17
|
export type ENV = "dev" | "prod";
|
|
18
18
|
|
|
19
19
|
export class ConfigGenerator {
|
|
20
|
-
static async generate(env: ENV
|
|
20
|
+
static async generate(env: ENV) {
|
|
21
21
|
return (
|
|
22
|
-
(await ConfigGenerator.generateTsConfig(
|
|
23
|
-
(await ConfigGenerator.generateBabelRc(
|
|
24
|
-
(await ConfigGenerator.generateNextConfig(
|
|
25
|
-
(await ConfigGenerator.generatePackageJson(
|
|
26
|
-
(await ConfigGenerator.generateEnv(env
|
|
22
|
+
(await ConfigGenerator.generateTsConfig()) &&
|
|
23
|
+
(await ConfigGenerator.generateBabelRc()) &&
|
|
24
|
+
(await ConfigGenerator.generateNextConfig()) &&
|
|
25
|
+
(await ConfigGenerator.generatePackageJson()) &&
|
|
26
|
+
(await ConfigGenerator.generateEnv(env))
|
|
27
27
|
);
|
|
28
28
|
}
|
|
29
29
|
|
|
30
|
-
static generateTsConfig(
|
|
31
|
-
return createFile(
|
|
30
|
+
static generateTsConfig() {
|
|
31
|
+
return createFile(process.cwd(), "tsconfig.json", TS_CONFIG);
|
|
32
32
|
}
|
|
33
33
|
|
|
34
|
-
static generateBabelRc(
|
|
35
|
-
return createFile(
|
|
34
|
+
static generateBabelRc() {
|
|
35
|
+
return createFile(process.cwd(), ".babelrc", BABEL_RC);
|
|
36
36
|
}
|
|
37
37
|
|
|
38
|
-
static generateNextConfig(
|
|
39
|
-
return createFile(
|
|
40
|
-
workingDir || process.cwd(),
|
|
41
|
-
"next.config.js",
|
|
42
|
-
NEXT_CONFIG
|
|
43
|
-
);
|
|
38
|
+
static generateNextConfig() {
|
|
39
|
+
return createFile(process.cwd(), "next.config.js", NEXT_CONFIG);
|
|
44
40
|
}
|
|
45
41
|
|
|
46
|
-
static async generatePackageJson(
|
|
42
|
+
static async generatePackageJson() {
|
|
47
43
|
try {
|
|
48
44
|
// const fs = await import("fs-extra");
|
|
49
|
-
const packageJsonPath = path.join(
|
|
50
|
-
workingDir || process.cwd(),
|
|
51
|
-
"package.json"
|
|
52
|
-
);
|
|
45
|
+
const packageJsonPath = path.join(process.cwd(), "package.json");
|
|
53
46
|
const packageJsonBuffer = fs.readFileSync(packageJsonPath);
|
|
54
47
|
|
|
55
48
|
if (packageJsonBuffer.length) {
|
|
@@ -106,8 +99,8 @@ export class ConfigGenerator {
|
|
|
106
99
|
}
|
|
107
100
|
}
|
|
108
101
|
|
|
109
|
-
static generateEnv(env: ENV
|
|
102
|
+
static generateEnv(env: ENV) {
|
|
110
103
|
const envFileContent = env === "dev" ? DEV_ENV : PROD_ENV;
|
|
111
|
-
return createFile(
|
|
104
|
+
return createFile(process.cwd(), ".env", envFileContent);
|
|
112
105
|
}
|
|
113
106
|
}
|
|
@@ -9,25 +9,25 @@ import {
|
|
|
9
9
|
} from "./info";
|
|
10
10
|
|
|
11
11
|
export class PageGenerator {
|
|
12
|
-
static async generate(
|
|
13
|
-
const pagesDir = path.join(
|
|
12
|
+
static async generate() {
|
|
13
|
+
const pagesDir = path.join(process.cwd(), "src", "pages");
|
|
14
14
|
await deleteDirContent(pagesDir, ["_app.tsx", "_document.tsx", "api"]);
|
|
15
15
|
|
|
16
16
|
let pagesGenerateSuccess = true;
|
|
17
17
|
for (const pageInfo of PAGE_INFO) {
|
|
18
18
|
pagesGenerateSuccess =
|
|
19
19
|
pagesGenerateSuccess &&
|
|
20
|
-
(await PageGenerator.generatePageWithInfo(pageInfo
|
|
20
|
+
(await PageGenerator.generatePageWithInfo(pageInfo));
|
|
21
21
|
}
|
|
22
22
|
|
|
23
23
|
const checkoutPageInfo = PAGE_INFO.find((pi) => pi.isCheckout);
|
|
24
24
|
const editorPageInfo = PAGE_INFO.find((pi) => pi.isEditor);
|
|
25
25
|
|
|
26
26
|
const checkoutPageGenerateSuccess = checkoutPageInfo
|
|
27
|
-
? await PageGenerator.generatePageWithInfo(checkoutPageInfo
|
|
27
|
+
? await PageGenerator.generatePageWithInfo(checkoutPageInfo)
|
|
28
28
|
: false;
|
|
29
29
|
const editorPageGenerateSuccess = editorPageInfo
|
|
30
|
-
? await PageGenerator.generatePageWithInfo(editorPageInfo
|
|
30
|
+
? await PageGenerator.generatePageWithInfo(editorPageInfo)
|
|
31
31
|
: false;
|
|
32
32
|
|
|
33
33
|
return (
|
|
@@ -37,7 +37,7 @@ export class PageGenerator {
|
|
|
37
37
|
);
|
|
38
38
|
}
|
|
39
39
|
|
|
40
|
-
static async generatePageWithInfo(pageInfo: PageInfo
|
|
40
|
+
static async generatePageWithInfo(pageInfo: PageInfo) {
|
|
41
41
|
try {
|
|
42
42
|
let fileStr = "";
|
|
43
43
|
|
|
@@ -81,7 +81,7 @@ export default Page;\r\n`;
|
|
|
81
81
|
}
|
|
82
82
|
|
|
83
83
|
return await createFile(
|
|
84
|
-
path.join(
|
|
84
|
+
path.join(process.cwd(), "src", "pages"),
|
|
85
85
|
pageInfo.path,
|
|
86
86
|
fileStr
|
|
87
87
|
);
|
|
@@ -16,15 +16,9 @@ type File = {
|
|
|
16
16
|
};
|
|
17
17
|
|
|
18
18
|
export class CustomDataTypesGenerator {
|
|
19
|
-
static async generate(themeJson: IkasThemeJson
|
|
19
|
+
static async generate(themeJson: IkasThemeJson) {
|
|
20
20
|
await deleteDirContent(
|
|
21
|
-
path.join(
|
|
22
|
-
workingDir || process.cwd(),
|
|
23
|
-
"src",
|
|
24
|
-
"components",
|
|
25
|
-
"__generated__",
|
|
26
|
-
"types"
|
|
27
|
-
)
|
|
21
|
+
path.join(process.cwd(), "src", "components", "__generated__", "types")
|
|
28
22
|
);
|
|
29
23
|
const file: File = {
|
|
30
24
|
content: "",
|
|
@@ -66,7 +60,7 @@ export class CustomDataTypesGenerator {
|
|
|
66
60
|
await PropTypeGenarator.generate(themeJson, file);
|
|
67
61
|
|
|
68
62
|
const generatedFolderPath = path.join(
|
|
69
|
-
|
|
63
|
+
process.cwd(),
|
|
70
64
|
"src",
|
|
71
65
|
"components",
|
|
72
66
|
"__generated__"
|
|
@@ -60,7 +60,7 @@ export function shouldDeploy(
|
|
|
60
60
|
|
|
61
61
|
export async function generate(
|
|
62
62
|
themeJsonList: IkasThemeJson[],
|
|
63
|
-
|
|
63
|
+
env: "dev" | "prod"
|
|
64
64
|
) {
|
|
65
65
|
const _themeJsonList = _cloneDeep(themeJsonList);
|
|
66
66
|
const themeJson: IkasThemeJson = {
|
|
@@ -91,9 +91,9 @@ export async function generate(
|
|
|
91
91
|
});
|
|
92
92
|
|
|
93
93
|
return (
|
|
94
|
-
(await ComponentImportsGenerator.generate(themeJson
|
|
95
|
-
(await PageGenerator.generate(
|
|
96
|
-
(await CustomDataTypesGenerator.generate(themeJson
|
|
97
|
-
(await ConfigGenerator.generate(
|
|
94
|
+
(await ComponentImportsGenerator.generate(themeJson)) &&
|
|
95
|
+
(await PageGenerator.generate()) &&
|
|
96
|
+
(await CustomDataTypesGenerator.generate(themeJson)) &&
|
|
97
|
+
(await ConfigGenerator.generate(env))
|
|
98
98
|
);
|
|
99
99
|
}
|