@lightspeed/crane 0.0.1-beta.24 → 0.1.0

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/dist/cli.mjs CHANGED
@@ -1,7 +1,7 @@
1
- import Te from"cac";import p from"node:fs";import u from"node:path";import{fileURLToPath as C}from"node:url";import{red as we,yellow as Oe,green as je}from"kolorist";import{resolve as r,parse as G,dirname as ve,sep as Ce}from"path";import{rename as Le,unlink as De,existsSync as L,writeFileSync as Ne,createReadStream as O}from"fs";import{glob as l}from"glob";import{build as y,defineConfig as g}from"vite";import{builtinModules as _}from"module";import R from"@vitejs/plugin-vue";import b from"vite-tsconfig-paths";import Ae from"vite-plugin-checker";import{viteExternalsPlugin as Se}from"vite-plugin-externals";import Ie from"ajv/dist/2020.js";import ke from"ajv-formats";import{readFile as B}from"fs/promises";import Ge from"axios";import{inc as _e}from"semver";import*as c from"process";import Re from"tinycolor2";function P(e,t){p.statSync(e).isDirectory()?(p.mkdirSync(t,{recursive:!0}),p.readdirSync(e).forEach(o=>{const s=u.resolve(e,o),i=u.resolve(t,o);P(s,i)})):p.copyFileSync(e,t)}function D(e,t,o,s){const i=u.join(e,s?.[o]??o);P(u.join(t,o),i)}const m={error:e=>console.log(we(e)),warn:e=>console.log(Oe(e)),info:e=>console.log(je(e))};async function Be(e){try{const t=e,o=process.cwd(),s=u.join(o,t),i=["templates"],n={_gitignore:".gitignore"};p.existsSync(s)||p.mkdirSync(s);const a=u.resolve(C(import.meta.url),"../..","template");p.readdirSync(a).filter(f=>f!=="package.json").filter(f=>!i.includes(f)).forEach(async f=>D(s,a,f,n));const d=JSON.parse(p.readFileSync(u.join(a,"package.json"),"utf-8"));d.name=e;const E=u.join(s,"package.json");p.writeFileSync(E,`${JSON.stringify(d,null,2)}
2
- `),m.info(`App ${e} created`)}catch(t){m.error(`Error while creating app: ${t.message}`)}}async function Pe(e){try{const t=e,o=process.cwd(),s=u.join(o,"sections",t);p.existsSync(s)||p.mkdirSync(s);const i=u.resolve(C(import.meta.url),"../..","template/sections/block-example");p.readdirSync(i).forEach(async n=>D(s,i,n)),m.info(`Block ${e} created`)}catch(t){m.error(`Error while creating block: ${t.message}`)}}async function Ue(e){try{const t=process.cwd(),o=u.join(t,"templates"),s={"template.ts":`${e}.ts`};p.existsSync(o)||p.mkdirSync(o);const i=u.resolve(C(import.meta.url),"../..","template/templates");p.readdirSync(i).forEach(async n=>D(o,i,n,s)),m.info(`Template descriptor file [${e}.ts] has been created`)}catch(t){m.error(`Error while creating template descriptors: ${t.message}`)}}function T(){const e=process.env.npm_lifecycle_event;return Ae({typescript:!0,vueTsc:!1,eslint:{lintCommand:`eslint --max-warnings=0 "./sections/**/*.{js,ts,vue}" --cache --cache-location "./build/eslintcache/${e}.json"`}})}function xe(e,t){return{plugins:[R(),b(),T(),Se({vue:"EcVue"})],define:{"process.env":{NODE_ENV:"production"}},resolve:{alias:{"@":"/src"}},build:{outDir:`./dist/sections/${e}`,emptyOutDir:!1,rollupOptions:{preserveEntrySignatures:"strict",input:r(process.cwd(),t),output:{validate:!0,entryFileNames:"js/[name].js",chunkFileNames:"js/[name].js",assetFileNames:"assets/[name].[ext]"}}}}}function Xe(e,t){return{plugins:[R(),b()],define:{"process.env":{NODE_ENV:"production"}},resolve:{alias:{"@":"/src"}},ssr:{noExternal:!0},build:{ssr:!0,outDir:`./dist/sections/${e}`,emptyOutDir:!0,rollupOptions:{external:[..._,..._.map(o=>`node:${o}`)],preserveEntrySignatures:"strict",input:r(process.cwd(),t),output:{validate:!0,entryFileNames:"js/[name].js"}}}}}function N(e,t){return{plugins:[b(),T()],resolve:{alias:{"@":"/src"}},build:{outDir:`./dist/sections/${e}`,emptyOutDir:!1,rollupOptions:{preserveEntrySignatures:"strict",input:r(process.cwd(),t),output:{validate:!0,entryFileNames:"js/settings/[name].mjs"}}}}}function Fe(e,t){return{plugins:[b(),T()],resolve:{alias:{"@":"/src"}},build:{outDir:"./dist/template",emptyOutDir:!1,rollupOptions:{preserveEntrySignatures:"strict",input:r(process.cwd(),e),output:{validate:!0,entryFileNames:`js/[name]${t}.mjs`}}}}}function U(e,t){return{plugins:[b(),T()],resolve:{alias:{"@":"/src"}},build:{outDir:`./dist/sections/${e}`,emptyOutDir:!1,rollupOptions:{preserveEntrySignatures:"strict",input:r(process.cwd(),t),output:{validate:!0,entryFileNames:"js/showcases/[name].mjs"}}}}}function qe(e,t){return{plugins:[b(),T()],resolve:{alias:{"@":"/src"}},build:{outDir:`./dist/sections/${e}`,emptyOutDir:!1,rollupOptions:{preserveEntrySignatures:"strict",input:r(process.cwd(),t),output:{validate:!0,assetFileNames:"assets/[name].[ext]"}}}}}const x="https://json-schema.org/draft/2020-12/schema",X="https://lightspeedhq.com/template.schema.json",F="Custom Template",q="A custom template enclosing the necessary custom and default blocks",M="object",z={metadata:{type:"object",properties:{name:{description:"Name of the template",type:"string",minLength:2,maxLength:60},description:{description:"Short description of the template",type:"string",minLength:2,maxLength:150},url:{type:"object",properties:{demo_website:{description:"URL to the demo website",type:"string",format:"uri",pattern:"^(https?|wss?|ftp)://"},cover_image:{description:"URL to the cover image",type:"string",format:"uri",pattern:"^(https?|wss?|ftp)://"}},required:["demo_website","cover_image"]}},required:["name","description","url"]},sections:{description:"List of sections contained by this template",type:"array",items:{type:"object",properties:{type:{description:"Type of the section",type:"string",enum:["custom","default"]}},allOf:[{if:{properties:{type:{const:"default"}}},then:{$ref:"template-default.schema.json#/$defs/default-section"}},{if:{properties:{type:{const:"custom"}}},then:{$ref:"template-custom.schema.json#/$defs/custom-section"}}]},minItems:1,uniqueItems:!1}},K=["metadata","sections"],Me={$schema:x,$id:X,title:F,description:q,type:M,properties:z,required:K},J={__proto__:null,$id:X,$schema:x,default:Me,description:q,properties:z,required:K,title:F,type:M},V="https://json-schema.org/draft/2020-12/schema",W="https://lightspeedhq.com/template-default.schema.json",H="Default Section",Z="Default section for a Custom Template",Q="object",Y={"default-section":{type:"object",properties:{type:{description:"Type of the section",type:"string",enum:["custom","default"]},id:{description:"Identification of the section",type:"string",pattern:"^((header|cover|announcement_bar|slider|special_offer|customer_review|company_info|shipping_payment|location|store|footer)(_\\d{3})?)$"}},required:["type","id"],additionalProperties:!1}},ze={$schema:V,$id:W,title:H,description:Z,type:Q,$defs:Y},Ke={__proto__:null,$defs:Y,$id:W,$schema:V,default:ze,description:Z,title:H,type:Q},ee="https://json-schema.org/draft/2020-12/schema",te="https://lightspeedhq.com/template-custom.schema.json",oe="Custom Section",se="Custom section for a Custom Template",ie="object",ne={"custom-section":{type:"object",properties:{type:{description:"Type of the section",type:"string",enum:["custom","default"]},id:{description:"Identification of the section",type:"string"},content:{type:"object",patternProperties:{".*":{type:"object",properties:{type:{description:"Type of the content configuration element",type:"string",enum:["INPUTBOX","TEXTAREA","BUTTON","IMAGE","TOGGLE","SELECTBOX"]}},allOf:[{if:{properties:{type:{const:"INPUTBOX"}}},then:{$ref:"template-custom-content.schema.json#/$defs/input_box"}},{if:{properties:{type:{const:"TEXTAREA"}}},then:{$ref:"template-custom-content.schema.json#/$defs/text_area"}},{if:{properties:{type:{const:"BUTTON"}}},then:{$ref:"template-custom-content.schema.json#/$defs/button"}},{if:{properties:{type:{const:"IMAGE"}}},then:{$ref:"template-custom-content.schema.json#/$defs/image"}},{if:{properties:{type:{const:"TOGGLE"}}},then:{$ref:"template-custom-content.schema.json#/$defs/toggle"}},{if:{properties:{type:{const:"SELECTBOX"}}},then:{$ref:"template-custom-content.schema.json#/$defs/select_box"}}]}},minProperties:1},design:{type:"object",patternProperties:{".*":{type:"object",properties:{type:{description:"Type of the design configuration element",type:"string",enum:["TEXT","BUTTON","IMAGE","TOGGLE","SELECTBOX","BACKGROUND"]}},allOf:[{if:{properties:{type:{const:"TEXT"}}},then:{$ref:"template-custom-design.schema.json#/$defs/text"}},{if:{properties:{type:{const:"BUTTON"}}},then:{$ref:"template-custom-design.schema.json#/$defs/button"}},{if:{properties:{type:{const:"IMAGE"}}},then:{$ref:"template-custom-design.schema.json#/$defs/image"}},{if:{properties:{type:{const:"TOGGLE"}}},then:{$ref:"template-custom-design.schema.json#/$defs/toggle"}},{if:{properties:{type:{const:"SELECTBOX"}}},then:{$ref:"template-custom-design.schema.json#/$defs/select_box"}},{if:{properties:{type:{const:"BACKGROUND"}}},then:{$ref:"template-custom-design.schema.json#/$defs/background"}}]}},minProperties:1}},required:["type","id"],additionalProperties:!1}},Je={$schema:ee,$id:te,title:oe,description:se,type:ie,$defs:ne},Ve={__proto__:null,$defs:ne,$id:te,$schema:ee,default:Je,description:se,title:oe,type:ie},re="https://json-schema.org/draft/2020-12/schema",ae="https://lightspeedhq.com/template-custom-content.schema.json",ce="Custom Section :: Content Configuration",pe="Content tab configuration of a Custom Section for a Custom Template",le="object",de={input_box:{type:"object",properties:{type:{description:"Type of the content configuration element",type:"string",enum:["INPUTBOX","TEXTAREA","BUTTON","IMAGE","TOGGLE","SELECTBOX"]},label:{description:"Label of the content configuration element",type:"string"},placeholder:{description:"Placeholder of the content configuration element",type:"string"}},required:["type","label","placeholder"],additionalProperties:!1},text_area:{type:"object",properties:{type:{description:"Type of the content configuration element",type:"string",enum:["INPUTBOX","TEXTAREA","BUTTON","IMAGE","TOGGLE","SELECTBOX"]},label:{description:"Label of the content configuration element",type:"string"},placeholder:{description:"Placeholder of the content configuration element",type:"string"}},required:["type","label","placeholder"],additionalProperties:!1},button:{type:"object",properties:{type:{description:"Type of the content configuration element",type:"string",enum:["INPUTBOX","TEXTAREA","BUTTON","IMAGE","TOGGLE","SELECTBOX"]},label:{description:"Label of the content configuration element",type:"string"}},required:["type","label"],additionalProperties:!1},image:{type:"object",properties:{type:{description:"Type of the content configuration element",type:"string",enum:["INPUTBOX","TEXTAREA","BUTTON","IMAGE","TOGGLE","SELECTBOX"]},label:{description:"Label of the content configuration element",type:"string"}},required:["type","label"],additionalProperties:!1},toggle:{type:"object",properties:{type:{description:"Type of the content configuration element",type:"string",enum:["INPUTBOX","TEXTAREA","BUTTON","IMAGE","TOGGLE","SELECTBOX"]},label:{description:"Label of the content configuration element",type:"string"},description:{description:"Description of the content configuration element",type:"string"}},required:["type","label"],additionalProperties:!1},select_box:{type:"object",properties:{type:{description:"Type of the content configuration element",type:"string",enum:["INPUTBOX","TEXTAREA","BUTTON","IMAGE","TOGGLE","SELECTBOX"]},label:{description:"Label of the content configuration element",type:"string"},placeholder:{description:"Placeholder of the content configuration element",type:"string"},description:{description:"Description of the content configuration element",type:"string"},options:{description:"Individual options of the content configuration element",type:"array",items:{type:"object",properties:{value:{description:"Value of the option",type:"string"},label:{description:"Label of the option",type:"string"}},required:["value","label"],additionalProperties:!1},minItems:1}},required:["type","label","placeholder","options"],additionalProperties:!1}},We={$schema:re,$id:ae,title:ce,description:pe,type:le,$defs:de},He={__proto__:null,$defs:de,$id:ae,$schema:re,default:We,description:pe,title:ce,type:le},ue="https://json-schema.org/draft/2020-12/schema",fe="https://lightspeedhq.com/template-custom-design.schema.json",me="Custom Section :: Design Configuration",ye="Design tab configuration of a Custom Section for a Custom Template",ge="object",he={text:{type:"object",properties:{type:{description:"Type of the text",type:"string",enum:["TEXT","BUTTON","IMAGE","TOGGLE","SELECTBOX","BACKGROUND"]},label:{description:"Label of the text",type:"string"},colors:{description:"Color options for the text",type:"array",items:{type:"string",pattern:"^#([a-fA-F0-9]{8}|[a-fA-F0-9]{3})$"},minItems:1,uniqueItems:!0},sizes:{description:"Size options for the text",type:"array",items:{type:"integer",minimum:0,exclusiveMaximum:50},minItems:1,uniqueItems:!0},defaults:{description:"Default values for the text",type:"object",properties:{font:{description:"Default font for the text",type:"string"},size:{description:"Default size for the text",type:"integer",minimum:1,exclusiveMaximum:50},bold:{description:"Default boldness for the text",type:"boolean"},italic:{description:"Default italic style for the text",type:"boolean"},color:{description:"Default color for the text",type:"string",pattern:"^#([a-fA-F0-9]{8}|[a-fA-F0-9]{3})$"}},required:["font","size","bold","italic","color"],additionalProperties:!1}},required:["type","label","colors","sizes","defaults"],additionalProperties:!1},button:{type:"object",properties:{type:{description:"Type of the button",type:"string",enum:["TEXT","BUTTON","IMAGE","TOGGLE","SELECTBOX","BACKGROUND"]},label:{description:"Label of the button",type:"string"},colors:{description:"Color options for the button",type:"array",items:{type:"string",pattern:"^#([a-fA-F0-9]{8}|[a-fA-F0-9]{3})$"},minItems:1,uniqueItems:!0},defaults:{description:"Default values for the button",type:"object",properties:{font:{description:"Default font for the button",type:"string"},size:{description:"Default size for the button",type:"string",enum:["SMALL","MEDIUM","LARGE"]},appearance:{description:"Default appearance for the button",type:"string",enum:["SOLID","OUTLINE","TEXT"]},shape:{description:"Default shape for the button",type:"string",enum:["ROUND_CORNER","RECTANGLE","PILL"]},color:{description:"Default color for the button",type:"string",pattern:"^#([a-fA-F0-9]{8}|[a-fA-F0-9]{3})$"}},required:["font","size","appearance","shape","color"],additionalProperties:!1}},required:["type","label","colors","defaults"],additionalProperties:!1},image:{type:"object",properties:{type:{description:"Type of the image",type:"string",enum:["TEXT","BUTTON","IMAGE","TOGGLE","SELECTBOX","BACKGROUND"]},label:{description:"Label of the image",type:"string"},colors:{description:"Color options for the image",type:"array",items:{type:"string",pattern:"^#([a-fA-F0-9]{8}|[a-fA-F0-9]{3})$"},minItems:1,uniqueItems:!0},defaults:{description:"Default values for the image",type:"object",properties:{overlay:{description:"Default overlay for the image",type:"string",enum:["COLOR","GRADIENT","NONE"]},color:{description:"Default color for the image",type:"string",pattern:"^#([a-fA-F0-9]{8}|[a-fA-F0-9]{3})$"}},required:["overlay","color"],additionalProperties:!1}},required:["type","label","colors","defaults"],additionalProperties:!1},toggle:{type:"object",properties:{type:{description:"Type of the toggle",type:"string",enum:["TEXT","BUTTON","IMAGE","TOGGLE","SELECTBOX","BACKGROUND"]},label:{description:"Label of the toggle",type:"string"},description:{description:"Description of the toggle",type:"string"},defaults:{description:"Default values for the toggle",type:"object",properties:{enabled:{description:"Default enabled status for the toggle",type:"boolean"}},required:["enabled"],additionalProperties:!1}},required:["type","label"],additionalProperties:!1},select_box:{type:"object",properties:{type:{description:"Type of the checkbox",type:"string",enum:["TEXT","BUTTON","IMAGE","TOGGLE","SELECTBOX","BACKGROUND"]},label:{description:"Label of the checkbox",type:"string"},placeholder:{description:"Placeholder of the checkbox",type:"string"},description:{description:"Description of the checkbox",type:"string"},options:{description:"Individual options of the checkbox",type:"array",items:{type:"object",properties:{value:{description:"Value of the option",type:"string"},label:{description:"Label of the option",type:"string"}},required:["value","label"],additionalProperties:!1},minItems:1},defaults:{description:"Default values for the checkbox",type:"object",properties:{value:{description:"Default option for the checkbox",type:"string"}},required:["value"],additionalProperties:!1}},required:["type","label","placeholder","description","options","defaults"],additionalProperties:!1},background:{type:"object",properties:{type:{description:"Type of the background",type:"string",enum:["TEXT","BUTTON","IMAGE","TOGGLE","SELECTBOX","BACKGROUND"]},label:{description:"Label of the background",type:"string"},colors:{description:"Color options for the background",type:"array",items:{type:"string",pattern:"^#([a-fA-F0-9]{8}|[a-fA-F0-9]{3})$"},minItems:1,uniqueItems:!0},defaults:{description:"Default values for the background",type:"object",properties:{style:{description:"Default style for the background",type:"string",enum:["COLOR","GRADIENT"]},color:{description:"Default color style for the background",type:"string"}},required:["style","color"],additionalProperties:!1}},required:["type","label","colors","defaults"],additionalProperties:!1}},Ze={$schema:ue,$id:fe,title:me,description:ye,type:ge,$defs:he},Qe={__proto__:null,$defs:he,$id:fe,$schema:ue,default:Ze,description:ye,title:me,type:ge},w="_temp";async function Ye(){const e=await l("**/server.{js,ts}",{ignore:["node_modules/**","dist/**"]});return Promise.all(e.map(async t=>{const o=ve(t).split(Ce).pop()??"default",s=await l(`**/${o}/client.{js,ts}`,{ignore:["node_modules/**","dist/**"]}),i=await l(`**/${o}/settings/content.{js,ts}`,{ignore:["node_modules/**","dist/**"]}),n=await l(`**/${o}/settings/design.{js,ts}`,{ignore:["node_modules/**","dist/**"]}),a=await l(`**/${o}/settings/translations.{js,ts}`,{ignore:["node_modules/**","dist/**"]}),d=await l(`**/${o}/showcases/*.{js,ts}`,{ignore:["node_modules/**","dist/**","translations.{js,ts}"]}),E=await l(`**/${o}/showcases/translations.{js,ts}`,{ignore:["node_modules/**","dist/**"]}),f=await l(`**/${o}/assets/*`,{ignore:["node_modules/**","dist/**"]});return{name:o,serverEntrypoint:t,clientEntrypoint:s.at(0),contentSettingsEntrypoint:i.at(0),designSettingsEntrypoint:n.at(0),settingsTranslationsEntrypoint:a.at(0),showcasesEntrypoints:d,showcasesTranslationsEntrypoint:E.at(0),assetsEntrypoints:f}}))}async function et(){return{entryPoints:await l("**/templates/**.{js,ts}",{ignore:["node_modules/**","dist/**"]})}}async function A(e,t){try{return(await import(r(process.cwd(),t?`${e}${w}.mjs`:`${e}.mjs`))).default}catch{throw new Error(`File [${e}${w}.mjs] is either invalid or undefined`)}}async function tt(){let e=new Ie({allErrors:!0,schemas:[J,Ke,Ve,He,Qe]});return ke(e),e.compile(J)}async function ot(e,t,o,s){if(e(t)&&s===void 0)new Promise(i=>{Le(`${o}${w}.mjs`,`${o}.mjs`,function(n){n&&i(n)})});else throw new Promise(i=>{De(`${o}${w}.mjs`,function(n){n&&i(n)})}),new Error(`Invalid file [${G(o).name}].
1
+ import Ae from"cac";import d from"node:fs";import f from"node:path";import{fileURLToPath as D}from"node:url";import{red as Ne,yellow as Se,green as j}from"kolorist";import{resolve as r,parse as v,dirname as Ie,sep as Ge}from"path";import{rename as _e,unlink as Re,existsSync as A,writeFileSync as ke,createReadStream as C}from"fs";import{glob as l}from"glob";import{build as h,defineConfig as $}from"vite";import{builtinModules as P}from"module";import U from"@vitejs/plugin-vue";import b from"vite-tsconfig-paths";import Be from"vite-plugin-checker";import{viteExternalsPlugin as Pe}from"vite-plugin-externals";import Ue from"ajv/dist/2020.js";import xe from"ajv-formats";import{readFile as x}from"fs/promises";import Xe from"axios";import{inc as Fe}from"semver";import*as c from"process";import qe from"tinycolor2";import Me from"prompts";function X(e,t){d.statSync(e).isDirectory()?(d.mkdirSync(t,{recursive:!0}),d.readdirSync(e).forEach(o=>{const s=f.resolve(e,o),n=f.resolve(t,o);X(s,n)})):d.copyFileSync(e,t)}function N(e,t,o,s){const n=f.join(e,s?.[o]??o);X(f.join(t,o),n)}const m={error:e=>console.log(Ne(e)),warn:e=>console.log(Se(e)),info:e=>console.log(j(e))},T="_temp";async function F(e){try{const t=e,o=process.cwd(),s=f.join(o,t),n=["templates"],i={_gitignore:".gitignore"};d.existsSync(s)||d.mkdirSync(s);const a=f.resolve(D(import.meta.url),"../..","template");d.readdirSync(a).filter(g=>g!=="package.json").filter(g=>!n.includes(g)).forEach(async g=>N(s,a,g,i));const u=JSON.parse(d.readFileSync(f.join(a,"package.json"),"utf-8"));u.name=e;const y=f.join(s,"package.json");d.writeFileSync(y,`${JSON.stringify(u,null,2)}
2
+ `),m.info(`App ${e} created`)}catch(t){m.error(`Error while creating app: ${t.message}`)}}async function q(e){try{const t=e,o=process.cwd(),s=f.join(o,"sections",t);d.existsSync(s)||d.mkdirSync(s);const n=f.resolve(D(import.meta.url),"../..","template/sections/block-example");d.readdirSync(n).forEach(async i=>N(s,n,i)),m.info(`Section ${e} created`)}catch(t){m.error(`Error while creating block: ${t.message}`)}}async function M(e){try{const t=process.cwd(),o=f.join(t,"templates"),s={"template.ts":`${e}.ts`};d.existsSync(o)||d.mkdirSync(o);const n=f.resolve(D(import.meta.url),"../..","template/templates");d.readdirSync(n).forEach(async i=>N(o,n,i,s)),m.info(`Template descriptor file [${e}.ts] has been created`)}catch(t){m.error(`Error while creating template descriptors: ${t.message}`)}}function O(){const e=process.env.npm_lifecycle_event;return Be({typescript:!0,vueTsc:!1,eslint:{lintCommand:`eslint --max-warnings=0 "./sections/**/*.{js,ts,vue}" --cache --cache-location "./build/eslintcache/${e}.json"`}})}function ze(e,t){return{plugins:[U(),b(),O(),Pe({vue:"EcVue"})],define:{"process.env":{NODE_ENV:"production"}},resolve:{alias:{"@":"/src"}},build:{outDir:`./dist/sections/${e}`,emptyOutDir:!1,rollupOptions:{preserveEntrySignatures:"strict",input:r(process.cwd(),t),output:{validate:!0,entryFileNames:"js/[name].js",chunkFileNames:"js/[name].js",assetFileNames:"assets/[name].[ext]"}}}}}function Ke(e,t){return{plugins:[U(),b()],define:{"process.env":{NODE_ENV:"production"}},resolve:{alias:{"@":"/src"}},ssr:{noExternal:!0},build:{ssr:!0,outDir:`./dist/sections/${e}`,emptyOutDir:!0,rollupOptions:{external:[...P,...P.map(o=>`node:${o}`)],preserveEntrySignatures:"strict",input:r(process.cwd(),t),output:{validate:!0,entryFileNames:"js/[name].js"}}}}}function S(e,t){return{plugins:[b(),O()],resolve:{alias:{"@":"/src"}},build:{outDir:`./dist/sections/${e}`,emptyOutDir:!1,rollupOptions:{preserveEntrySignatures:"strict",input:r(process.cwd(),t),output:{validate:!0,entryFileNames:"js/settings/[name].mjs"}}}}}function Je(e,t){return{plugins:[b(),O()],resolve:{alias:{"@":"/src"}},build:{outDir:"./dist/template",emptyOutDir:!1,rollupOptions:{preserveEntrySignatures:"strict",input:r(process.cwd(),e),output:{validate:!0,entryFileNames:`js/[name]${t}.mjs`}}}}}function z(e,t){return{plugins:[b(),O()],resolve:{alias:{"@":"/src"}},build:{outDir:`./dist/sections/${e}`,emptyOutDir:!1,rollupOptions:{preserveEntrySignatures:"strict",input:r(process.cwd(),t),output:{validate:!0,entryFileNames:"js/showcases/[name].mjs"}}}}}function Ve(e,t){return{plugins:[b(),O()],resolve:{alias:{"@":"/src"}},build:{outDir:`./dist/sections/${e}`,emptyOutDir:!1,rollupOptions:{preserveEntrySignatures:"strict",input:r(process.cwd(),t),output:{validate:!0,assetFileNames:"assets/[name].[ext]"}}}}}const K="https://json-schema.org/draft/2020-12/schema",J="https://lightspeedhq.com/template.schema.json",V="Custom Template",H="A custom template enclosing the necessary custom and default blocks",W="object",Z={metadata:{type:"object",properties:{name:{description:"Name of the template",type:"string",minLength:2,maxLength:60},description:{description:"Short description of the template",type:"string",minLength:2,maxLength:150},url:{type:"object",properties:{demo_website:{description:"URL to the demo website",type:"string",format:"uri",pattern:"^(https?|wss?|ftp)://"},cover_image:{description:"URL to the cover image",type:"string",format:"uri",pattern:"^(https?|wss?|ftp)://"}},required:["demo_website","cover_image"]}},required:["name","description","url"]},sections:{description:"List of sections contained by this template",type:"array",items:{type:"object",properties:{type:{description:"Type of the section",type:"string",enum:["custom","default"]}},allOf:[{if:{properties:{type:{const:"default"}}},then:{$ref:"template-default.schema.json#/$defs/default-section"}},{if:{properties:{type:{const:"custom"}}},then:{$ref:"template-custom.schema.json#/$defs/custom-section"}}]},minItems:1,uniqueItems:!1}},Y=["metadata","sections"],He={$schema:K,$id:J,title:V,description:H,type:W,properties:Z,required:Y},Q={__proto__:null,$id:J,$schema:K,default:He,description:H,properties:Z,required:Y,title:V,type:W},ee="https://json-schema.org/draft/2020-12/schema",te="https://lightspeedhq.com/template-default.schema.json",oe="Default Section",se="Default section for a Custom Template",ne="object",ie={"default-section":{type:"object",properties:{type:{description:"Type of the section",type:"string",enum:["custom","default"]},id:{description:"Identification of the section",type:"string",pattern:"^((header|cover|announcement_bar|slider|special_offer|customer_review|company_info|shipping_payment|location|store|footer)(_\\d{3})?)$"}},required:["type","id"],additionalProperties:!1}},We={$schema:ee,$id:te,title:oe,description:se,type:ne,$defs:ie},Ze={__proto__:null,$defs:ie,$id:te,$schema:ee,default:We,description:se,title:oe,type:ne},re="https://json-schema.org/draft/2020-12/schema",ae="https://lightspeedhq.com/template-custom.schema.json",ce="Custom Section",pe="Custom section for a Custom Template",le="object",de={"custom-section":{type:"object",properties:{type:{description:"Type of the section",type:"string",enum:["custom","default"]},id:{description:"Identification of the section",type:"string"},content:{type:"object",patternProperties:{".*":{type:"object",properties:{type:{description:"Type of the content configuration element",type:"string",enum:["INPUTBOX","TEXTAREA","BUTTON","IMAGE","TOGGLE","SELECTBOX"]}},allOf:[{if:{properties:{type:{const:"INPUTBOX"}}},then:{$ref:"template-custom-content.schema.json#/$defs/input_box"}},{if:{properties:{type:{const:"TEXTAREA"}}},then:{$ref:"template-custom-content.schema.json#/$defs/text_area"}},{if:{properties:{type:{const:"BUTTON"}}},then:{$ref:"template-custom-content.schema.json#/$defs/button"}},{if:{properties:{type:{const:"IMAGE"}}},then:{$ref:"template-custom-content.schema.json#/$defs/image"}},{if:{properties:{type:{const:"TOGGLE"}}},then:{$ref:"template-custom-content.schema.json#/$defs/toggle"}},{if:{properties:{type:{const:"SELECTBOX"}}},then:{$ref:"template-custom-content.schema.json#/$defs/select_box"}}]}},minProperties:1},design:{type:"object",patternProperties:{".*":{type:"object",properties:{type:{description:"Type of the design configuration element",type:"string",enum:["TEXT","BUTTON","IMAGE","TOGGLE","SELECTBOX","BACKGROUND"]}},allOf:[{if:{properties:{type:{const:"TEXT"}}},then:{$ref:"template-custom-design.schema.json#/$defs/text"}},{if:{properties:{type:{const:"BUTTON"}}},then:{$ref:"template-custom-design.schema.json#/$defs/button"}},{if:{properties:{type:{const:"IMAGE"}}},then:{$ref:"template-custom-design.schema.json#/$defs/image"}},{if:{properties:{type:{const:"TOGGLE"}}},then:{$ref:"template-custom-design.schema.json#/$defs/toggle"}},{if:{properties:{type:{const:"SELECTBOX"}}},then:{$ref:"template-custom-design.schema.json#/$defs/select_box"}},{if:{properties:{type:{const:"BACKGROUND"}}},then:{$ref:"template-custom-design.schema.json#/$defs/background"}}]}},minProperties:1}},required:["type","id"],additionalProperties:!1}},Ye={$schema:re,$id:ae,title:ce,description:pe,type:le,$defs:de},Qe={__proto__:null,$defs:de,$id:ae,$schema:re,default:Ye,description:pe,title:ce,type:le},ue="https://json-schema.org/draft/2020-12/schema",fe="https://lightspeedhq.com/template-custom-content.schema.json",me="Custom Section :: Content Configuration",ye="Content tab configuration of a Custom Section for a Custom Template",ge="object",he={input_box:{type:"object",properties:{type:{description:"Type of the content configuration element",type:"string",enum:["INPUTBOX","TEXTAREA","BUTTON","IMAGE","TOGGLE","SELECTBOX"]},label:{description:"Label of the content configuration element",type:"string"},placeholder:{description:"Placeholder of the content configuration element",type:"string"}},required:["type","label","placeholder"],additionalProperties:!1},text_area:{type:"object",properties:{type:{description:"Type of the content configuration element",type:"string",enum:["INPUTBOX","TEXTAREA","BUTTON","IMAGE","TOGGLE","SELECTBOX"]},label:{description:"Label of the content configuration element",type:"string"},placeholder:{description:"Placeholder of the content configuration element",type:"string"}},required:["type","label","placeholder"],additionalProperties:!1},button:{type:"object",properties:{type:{description:"Type of the content configuration element",type:"string",enum:["INPUTBOX","TEXTAREA","BUTTON","IMAGE","TOGGLE","SELECTBOX"]},label:{description:"Label of the content configuration element",type:"string"}},required:["type","label"],additionalProperties:!1},image:{type:"object",properties:{type:{description:"Type of the content configuration element",type:"string",enum:["INPUTBOX","TEXTAREA","BUTTON","IMAGE","TOGGLE","SELECTBOX"]},label:{description:"Label of the content configuration element",type:"string"}},required:["type","label"],additionalProperties:!1},toggle:{type:"object",properties:{type:{description:"Type of the content configuration element",type:"string",enum:["INPUTBOX","TEXTAREA","BUTTON","IMAGE","TOGGLE","SELECTBOX"]},label:{description:"Label of the content configuration element",type:"string"},description:{description:"Description of the content configuration element",type:"string"}},required:["type","label"],additionalProperties:!1},select_box:{type:"object",properties:{type:{description:"Type of the content configuration element",type:"string",enum:["INPUTBOX","TEXTAREA","BUTTON","IMAGE","TOGGLE","SELECTBOX"]},label:{description:"Label of the content configuration element",type:"string"},placeholder:{description:"Placeholder of the content configuration element",type:"string"},description:{description:"Description of the content configuration element",type:"string"},options:{description:"Individual options of the content configuration element",type:"array",items:{type:"object",properties:{value:{description:"Value of the option",type:"string"},label:{description:"Label of the option",type:"string"}},required:["value","label"],additionalProperties:!1},minItems:1}},required:["type","label","placeholder","options"],additionalProperties:!1}},et={$schema:ue,$id:fe,title:me,description:ye,type:ge,$defs:he},tt={__proto__:null,$defs:he,$id:fe,$schema:ue,default:et,description:ye,title:me,type:ge},$e="https://json-schema.org/draft/2020-12/schema",Ee="https://lightspeedhq.com/template-custom-design.schema.json",be="Custom Section :: Design Configuration",Te="Design tab configuration of a Custom Section for a Custom Template",we="object",Oe={text:{type:"object",properties:{type:{description:"Type of the text",type:"string",enum:["TEXT","BUTTON","IMAGE","TOGGLE","SELECTBOX","BACKGROUND"]},label:{description:"Label of the text",type:"string"},colors:{description:"Color options for the text",type:"array",items:{type:"string",pattern:"^#([a-fA-F0-9]{8}|[a-fA-F0-9]{3})$"},minItems:1,uniqueItems:!0},sizes:{description:"Size options for the text",type:"array",items:{type:"integer",minimum:0,exclusiveMaximum:50},minItems:1,uniqueItems:!0},defaults:{description:"Default values for the text",type:"object",properties:{font:{description:"Default font for the text",type:"string"},size:{description:"Default size for the text",type:"integer",minimum:1,exclusiveMaximum:50},bold:{description:"Default boldness for the text",type:"boolean"},italic:{description:"Default italic style for the text",type:"boolean"},color:{description:"Default color for the text",type:"string",pattern:"^#([a-fA-F0-9]{8}|[a-fA-F0-9]{3})$"}},required:["font","size","bold","italic","color"],additionalProperties:!1}},required:["type","label","colors","sizes","defaults"],additionalProperties:!1},button:{type:"object",properties:{type:{description:"Type of the button",type:"string",enum:["TEXT","BUTTON","IMAGE","TOGGLE","SELECTBOX","BACKGROUND"]},label:{description:"Label of the button",type:"string"},colors:{description:"Color options for the button",type:"array",items:{type:"string",pattern:"^#([a-fA-F0-9]{8}|[a-fA-F0-9]{3})$"},minItems:1,uniqueItems:!0},defaults:{description:"Default values for the button",type:"object",properties:{font:{description:"Default font for the button",type:"string"},size:{description:"Default size for the button",type:"string",enum:["SMALL","MEDIUM","LARGE"]},appearance:{description:"Default appearance for the button",type:"string",enum:["SOLID","OUTLINE","TEXT"]},shape:{description:"Default shape for the button",type:"string",enum:["ROUND_CORNER","RECTANGLE","PILL"]},color:{description:"Default color for the button",type:"string",pattern:"^#([a-fA-F0-9]{8}|[a-fA-F0-9]{3})$"}},required:["font","size","appearance","shape","color"],additionalProperties:!1}},required:["type","label","colors","defaults"],additionalProperties:!1},image:{type:"object",properties:{type:{description:"Type of the image",type:"string",enum:["TEXT","BUTTON","IMAGE","TOGGLE","SELECTBOX","BACKGROUND"]},label:{description:"Label of the image",type:"string"},colors:{description:"Color options for the image",type:"array",items:{type:"string",pattern:"^#([a-fA-F0-9]{8}|[a-fA-F0-9]{3})$"},minItems:1,uniqueItems:!0},defaults:{description:"Default values for the image",type:"object",properties:{overlay:{description:"Default overlay for the image",type:"string",enum:["COLOR","GRADIENT","NONE"]},color:{description:"Default color for the image",type:"string",pattern:"^#([a-fA-F0-9]{8}|[a-fA-F0-9]{3})$"}},required:["overlay","color"],additionalProperties:!1}},required:["type","label","colors","defaults"],additionalProperties:!1},toggle:{type:"object",properties:{type:{description:"Type of the toggle",type:"string",enum:["TEXT","BUTTON","IMAGE","TOGGLE","SELECTBOX","BACKGROUND"]},label:{description:"Label of the toggle",type:"string"},description:{description:"Description of the toggle",type:"string"},defaults:{description:"Default values for the toggle",type:"object",properties:{enabled:{description:"Default enabled status for the toggle",type:"boolean"}},required:["enabled"],additionalProperties:!1}},required:["type","label"],additionalProperties:!1},select_box:{type:"object",properties:{type:{description:"Type of the checkbox",type:"string",enum:["TEXT","BUTTON","IMAGE","TOGGLE","SELECTBOX","BACKGROUND"]},label:{description:"Label of the checkbox",type:"string"},placeholder:{description:"Placeholder of the checkbox",type:"string"},description:{description:"Description of the checkbox",type:"string"},options:{description:"Individual options of the checkbox",type:"array",items:{type:"object",properties:{value:{description:"Value of the option",type:"string"},label:{description:"Label of the option",type:"string"}},required:["value","label"],additionalProperties:!1},minItems:1},defaults:{description:"Default values for the checkbox",type:"object",properties:{value:{description:"Default option for the checkbox",type:"string"}},required:["value"],additionalProperties:!1}},required:["type","label","placeholder","description","options","defaults"],additionalProperties:!1},background:{type:"object",properties:{type:{description:"Type of the background",type:"string",enum:["TEXT","BUTTON","IMAGE","TOGGLE","SELECTBOX","BACKGROUND"]},label:{description:"Label of the background",type:"string"},colors:{description:"Color options for the background",type:"array",items:{type:"string",pattern:"^#([a-fA-F0-9]{8}|[a-fA-F0-9]{3})$"},minItems:1,uniqueItems:!0},defaults:{description:"Default values for the background",type:"object",properties:{style:{description:"Default style for the background",type:"string",enum:["COLOR","GRADIENT"]},color:{description:"Default color style for the background",type:"string"}},required:["style","color"],additionalProperties:!1}},required:["type","label","colors","defaults"],additionalProperties:!1}},ot={$schema:$e,$id:Ee,title:be,description:Te,type:we,$defs:Oe},st={__proto__:null,$defs:Oe,$id:Ee,$schema:$e,default:ot,description:Te,title:be,type:we};async function nt(){const e=await l("**/server.{js,ts}",{ignore:["node_modules/**","dist/**"]});return Promise.all(e.map(async t=>{const o=Ie(t).split(Ge).pop()??"default",s=await l(`**/${o}/client.{js,ts}`,{ignore:["node_modules/**","dist/**"]}),n=await l(`**/${o}/settings/content.{js,ts}`,{ignore:["node_modules/**","dist/**"]}),i=await l(`**/${o}/settings/design.{js,ts}`,{ignore:["node_modules/**","dist/**"]}),a=await l(`**/${o}/settings/translations.{js,ts}`,{ignore:["node_modules/**","dist/**"]}),u=await l(`**/${o}/showcases/*.{js,ts}`,{ignore:["node_modules/**","dist/**","translations.{js,ts}"]}),y=await l(`**/${o}/showcases/translations.{js,ts}`,{ignore:["node_modules/**","dist/**"]}),g=await l(`**/${o}/assets/*`,{ignore:["node_modules/**","dist/**"]});return{name:o,serverEntrypoint:t,clientEntrypoint:s.at(0),contentSettingsEntrypoint:n.at(0),designSettingsEntrypoint:i.at(0),settingsTranslationsEntrypoint:a.at(0),showcasesEntrypoints:u,showcasesTranslationsEntrypoint:y.at(0),assetsEntrypoints:g}}))}async function it(){return{entryPoints:await l("**/templates/**.{js,ts}",{ignore:["node_modules/**","dist/**"]})}}async function I(e,t){try{return(await import(r(process.cwd(),t?`${e}${T}.mjs`:`${e}.mjs`))).default}catch{throw new Error(`File [${e}${T}.mjs] is either invalid or undefined`)}}async function rt(){let e=new Ue({allErrors:!0,schemas:[Q,Ze,Qe,tt,st]});return xe(e),e.compile(Q)}async function at(e,t,o,s){if(e(t)&&s===void 0)new Promise(n=>{_e(`${o}${T}.mjs`,`${o}.mjs`,function(i){i&&n(i)})});else throw new Promise(n=>{Re(`${o}${T}.mjs`,function(i){i&&n(i)})}),new Error(`Invalid file [${v(o).name}].
3
3
  Note: Errors regarding failingKeyword: "then" can sometimes be false negatives. Please focus on fixing other errors first!
4
- Errors: ${JSON.stringify([...e.errors??[],...s??[]],null,2)}`)}async function st(e){const t=[];for(const o of e.sections){const s=e.sections.indexOf(o);if(s===0&&o.id!=="header"&&t.push({instancePath:`/sections/${s}/id`,message:"The first section must be a default `header`"}),s===e.sections.length-1&&o.id!=="footer"&&t.push({instancePath:`/sections/${s}/id`,message:"The last section must be a default `footer`"}),o.type==="custom")if(!L(`dist/sections/${o.id}`))t.push({instancePath:`/sections/${s}/id`,message:"Custom section must have a corresponding block defined"});else{if(o.content!==void 0)if(!L(`dist/sections/${o.id}/js/settings/content.mjs`))t.push({instancePath:`/sections/${s}/content`,message:"Content descriptor is overridden, please provide a default descriptor in the block's settings folder"});else{const i=await A(`dist/sections/${o.id}/js/settings/content`,!1),n=new Set(Object.keys(i));Object.keys(o.content).every(a=>n.has(a))||t.push({instancePath:`/sections/${s}/content`,message:"Content descriptor must be a subset of the default content descriptor"})}if(o.design!==void 0)if(!L(`dist/sections/${o.id}/js/settings/design.mjs`))t.push({instancePath:`/sections/${s}/design`,message:"Design descriptor is overridden, please provide a default descriptor in the block's settings folder"});else{const i=await A(`dist/sections/${o.id}/js/settings/design`,!1),n=new Set(Object.keys(i));Object.keys(o.design).every(a=>n.has(a))||t.push({instancePath:`/sections/${s}/design`,message:"Design descriptor must be a subset of the default design descriptor"})}}}return t.length===0?void 0:t}async function it(){try{const e=await Ye();for(const s of e){const{name:i,serverEntrypoint:n,clientEntrypoint:a,contentSettingsEntrypoint:d,designSettingsEntrypoint:E,settingsTranslationsEntrypoint:f,showcasesEntrypoints:S,showcaseTranslationsEntrypoint:I,assetsEntrypoints:k}=s;if(await y({configFile:!1,...g(Xe(i,n))}),a!==void 0&&await y({configFile:!1,...g(xe(i,a))}),d!==void 0&&await y({configFile:!1,...g(N(i,d))}),E!==void 0&&await y({configFile:!1,...g(N(i,E))}),f!==void 0&&await y({configFile:!1,...g(N(i,f))}),S!==void 0)for(const v of S)await y({configFile:!1,...g(U(i,v))});if(I!==void 0&&await y({configFile:!1,...g(U(i,I))}),k!==void 0)for(const v of k)await y({configFile:!1,...g(qe(i,v))})}const t=await tt(),o=await et();for(const s of o.entryPoints){await y({configFile:!1,...g(Fe(s,w))});const i=`dist/template/js/${G(s).name}`,n=await A(i,!0);await ot(t,n,i,await st(n))}m.info("Build successful. For deploy run: npm run deploy")}catch(e){m.error(`Error while building: ${e.message}`)}}function $e(e){if(e!==void 0)return e.startsWith("global.")?{type:"GLOBAL_FONT",font:e}:{type:"PRESET_FONT",font:e}}function h(e){if(e===void 0)return;if(e.startsWith("global."))return{type:"GLOBAL_COLOR",raw:e};const t=Re(e);return{type:"STRUCTURED_COLOR",raw:e,hex:t.toHex8String(),hsl:t.toHsl(),rgba:t.toRgb(),auto:!1}}function nt(e){if(e!==void 0)return typeof e=="string"&&e.startsWith("global.")?{type:"GLOBAL_TEXT_SIZE",size:e}:{type:"NUMERIC_TEXT_SIZE",size:e}}const rt={COLOR:"COLOR",GRADIENT:"GRADIENT"};function at(e){switch(e){case"COLOR":return"solid";case"GRADIENT":return"gradient";default:throw new Error(`Unknown background type: ${e}. Right options: ${Object.keys(rt)}`)}}function ct(e){const t=e.style,o=e.color,s=Array.isArray(o)?o:[o,o];return e.background={type:at(t),solid:{color:h(s.at(0))},gradient:{fromColor:h(s.at(0)),toColor:h(s.at(1))}},e.style=void 0,e.color=void 0,e}const pt={SOLID:"SOLID",OUTLINE:"OUTLINE",TEXT:"TEXT"};function lt(e){switch(e){case"SOLID":return"solid-button";case"OUTLINE":return"outline-button";case"TEXT":return"text-link";default:throw new Error(`Unknown button appearance: ${e}. Right options: ${Object.keys(pt)}`)}}const dt={SMALL:"SMALL",MEDIUM:"MEDIUM",LARGE:"LARGE"};function ut(e){switch(e){case"SMALL":return"small";case"MEDIUM":return"medium";case"LARGE":return"large";default:throw new Error(`Unknown button size: ${e}. Right options: ${Object.keys(dt)}`)}}const ft={ROUND_CORNER:"ROUND_CORNER",RECTANGLE:"RECTANGLE",PILL:"PILL"};function mt(e){switch(e){case"ROUND_CORNER":return"round-corner";case"RECTANGLE":return"rectangle";case"PILL":return"pill";default:throw new Error(`Unknown button shape: ${e}. Right options: ${Object.keys(ft)}`)}}function yt(e){const t=e.appearance;t!==void 0&&(e.appearance=lt(t));const o=e.size;o!==void 0&&(e.size=ut(o));const s=e.shape;s!==void 0&&(e.style=mt(s),e.shape=void 0);const i=e.font;e.font=$e(i);const n=e.color;return e.color=h(n),e}const gt={COLOR:"COLOR",GRADIENT:"GRADIENT",NONE:"NONE"};function ht(e){switch(e){case"COLOR":return"solid";case"GRADIENT":return"gradient";case"NONE":return"none";default:throw new Error(`Unknown image overlay type: ${e}. Right options: ${Object.keys(gt)}`)}}function $t(e){const t=e.overlay,o=e.color,s=Array.isArray(o)?o:[o,o];return e.overlay={type:ht(t),solid:{color:h(s.at(0))},gradient:{fromColor:h(s.at(0)),toColor:h(s.at(1))}},e.color=void 0,e}function Et(e){const t=e.font;e.font=$e(t);const o=e.color;e.color=h(o);const s=e.size;return e.size=nt(s),e}function bt(e){const t=e.color;return e.color=h(t),e}function Tt(e){Object.keys(e).forEach(t=>{const o=e[t],s=o.type;Ee(s,o.defaults)})}function wt(e){Object.keys(e).forEach(t=>{const o=e[t],s=o.type;Ee(s,o)})}function Ee(e,t){switch(e){case"TEXT":{Et(t);break}case"BUTTON":{yt(t);break}case"IMAGE":{$t(t);break}case"BACKGROUND":{ct(t);break}case"COLOR_PICKER":{bt(t);break}case"TOGGLE":case"SELECTBOX":break;default:throw new Error(`Unknown design editor type: ${e}`)}return t}const Ot="https://blockbuster.ecwid.com";async function jt(){const e=await B(r(c.cwd(),"crane.config.json")),t=JSON.parse(e.toString());return{appClientId:t.app_client_id,appSecretKey:btoa(t.app_secret_key)}}async function vt(){const e=await B(r(c.cwd(),"package.json")),t=JSON.parse(e.toString()),o=_e(t.version,"patch");return t.version=o,Ne(r(c.cwd(),"package.json"),`${JSON.stringify(t,null,2)}
5
- `),t.version}async function Ct(e,t){try{const o=(await import(r(c.cwd(),`dist/sections/${e}/js/settings/content.mjs`))).default;return j(o,t),o}catch{throw new Error(`Content descriptor for section [${e}] is either invalid or undefined`)}}async function Lt(e,t){try{const o=(await import(r(c.cwd(),`dist/sections/${e}/js/settings/design.mjs`))).default;return Tt(o),j(o,t),o}catch(o){const s=o;throw new Error(`Design settings is invalid or undefined. Error ${s.stack}`)}}async function Dt(e,t){try{const o=await l("*.mjs",{cwd:r(c.cwd(),`dist/sections/${e}/js/showcases/`),ignore:"**/translations.mjs"});return Promise.all(o.map(async s=>{const i=(await import(r(c.cwd(),`dist/sections/${e}/js/showcases/${s}`))).default;return wt(i.design),j(i,t),i}))}catch(o){throw new Error(`Showcases is invalid or undefined. Error ${o}`)}}async function Nt(e){return await be(`dist/sections/${e}/js/settings/translations.mjs`)}async function At(e){return await be(`dist/sections/${e}/js/showcases/translations.mjs`)}async function be(e){const t=(await import(r(c.cwd(),e))).default;return It(t)}function j(e,t){if(e&&typeof e=="object"){const o=e;for(let s in o){const i=o[s];typeof i=="string"&&i.startsWith("$")&&(o[s]=St(t,i)),typeof i=="object"&&j(i,t)}}}function St(e,t){if(!t)return;const o=e[t];return o===void 0?{en:t}:o}function It(e){const t={};for(let o in e){const s=e[o];for(let i in s){const n=t[i],a=s[i];if(n===void 0){const d={};d[o]=a,t[i]=d}else n[o]=a}}return t}async function kt(){const e=await l("*/",{cwd:r(c.cwd(),"dist/sections/")});return Promise.all(e.map(async t=>{const o=await Nt(t),s=await At(t),i=await Ct(t,o),n=await Lt(t,o),a=await Dt(t,s);return{id:t,name:{en:t},contentEditors:i,designEditors:n,showcases:a}}))}async function Gt(e,t,o,s){const i=(await l("server.js",{cwd:r(c.cwd(),`dist/sections/${s}/js/`)})).at(0);i!==void 0&&await e.post("/api/v1/app/resource/upload",{file:O(r(c.cwd(),`dist/sections/${s}/js/server.js`))},{params:{appClientId:t.appClientId,type:"server_js",version:o,block:s,fileName:i},headers:{"Content-Type":"multipart/form-data",Authorization:`Bearer ${t.appSecretKey}`}})}async function _t(e,t,o,s){(await l("*.js",{cwd:r(c.cwd(),`dist/sections/${s}/js/`),ignore:"**/server.js"})).forEach(async i=>{await e.post("/api/v1/app/resource/upload",{file:O(r(c.cwd(),`dist/sections/${s}/js/${i}`))},{params:{appClientId:t.appClientId,type:"client_js",version:o,block:s,fileName:i},headers:{"Content-Type":"multipart/form-data",Authorization:`Bearer ${t.appSecretKey}`}})})}async function Rt(e,t,o,s){(await l("*",{cwd:r(c.cwd(),`dist/sections/${s}/assets/`)})).forEach(async i=>{await e.post("/api/v1/app/resource/upload",{file:O(r(c.cwd(),`dist/sections/${s}/assets/${i}`))},{params:{appClientId:t.appClientId,type:"assets",version:o,block:s,fileName:i},headers:{"Content-Type":"multipart/form-data",Authorization:`Bearer ${t.appSecretKey}`}})})}async function Bt(e,t,o){(await l("package.json")).at(0)!==void 0&&await e.post("/api/v1/app/resource/upload",{file:O(r(c.cwd(),"package.json"))},{params:{appClientId:t.appClientId,type:"dependencies",version:o},headers:{"Content-Type":"multipart/form-data",Authorization:`Bearer ${t.appSecretKey}`}})}async function Pt(e,t,o,s){for(const i of s)await Gt(e,t,o,i.id),await _t(e,t,o,i.id),await Rt(e,t,o,i.id),await Bt(e,t,o)}async function Ut(e,t,o,s){await e.post("/api/v1/app/manifest",{version:o,name:"Custom Block App",blocks:s},{params:{appClientId:t.appClientId},headers:{Authorization:`Bearer ${t.appSecretKey}`}})}async function xt(e){try{const t=e??Ot,o=Ge.create({baseURL:t}),s=await jt(),i=await vt(),n=await kt();await Pt(o,s,i,n),await Ut(o,s,i,n);const a=n.map(d=>d.id);m.info(`Deploy to ${t} successful
6
- Current app version: ${i}
7
- Deployed blocks: ${a.join(", ")}`)}catch(t){m.error(`Error while deploying: ${t.message}`)}}const Xt="0.0.1-beta.24",$=Te("crane");function Ft(){$.command("create-app <appName>","Create app with custom blocks").action(Be),$.command("create-block <blockName>","Create custom block").action(Pe),$.command("create-template <templateName>","Create custom template descriptor").action(Ue),$.command("build","Build app with custom blocks").action(it),$.command("deploy","Deploy app with custom blocks").option("--url <url>","Custom deploy url").action(e=>xt(e.url)),$.help(),$.version(Xt),$.parse()}try{Ft()}catch{$.outputHelp(),process.exit(1)}
4
+ Errors: ${JSON.stringify([...e.errors??[],...s??[]],null,2)}`)}async function ct(e){const t=[];for(const o of e.sections){const s=e.sections.indexOf(o);if(s===0&&o.id!=="header"&&t.push({instancePath:`/sections/${s}/id`,message:"The first section must be a default `header`"}),s===e.sections.length-1&&o.id!=="footer"&&t.push({instancePath:`/sections/${s}/id`,message:"The last section must be a default `footer`"}),o.type==="custom")if(!A(`dist/sections/${o.id}`))t.push({instancePath:`/sections/${s}/id`,message:"Custom section must have a corresponding block defined"});else{if(o.content!==void 0)if(!A(`dist/sections/${o.id}/js/settings/content.mjs`))t.push({instancePath:`/sections/${s}/content`,message:"Content descriptor is overridden, please provide a default descriptor in the block's settings folder"});else{const n=await I(`dist/sections/${o.id}/js/settings/content`,!1),i=new Set(Object.keys(n));Object.keys(o.content).every(a=>i.has(a))||t.push({instancePath:`/sections/${s}/content`,message:"Content descriptor must be a subset of the default content descriptor"})}if(o.design!==void 0)if(!A(`dist/sections/${o.id}/js/settings/design.mjs`))t.push({instancePath:`/sections/${s}/design`,message:"Design descriptor is overridden, please provide a default descriptor in the block's settings folder"});else{const n=await I(`dist/sections/${o.id}/js/settings/design`,!1),i=new Set(Object.keys(n));Object.keys(o.design).every(a=>i.has(a))||t.push({instancePath:`/sections/${s}/design`,message:"Design descriptor must be a subset of the default design descriptor"})}}}return t.length===0?void 0:t}async function pt(){try{const e=await nt();for(const s of e){const{name:n,serverEntrypoint:i,clientEntrypoint:a,contentSettingsEntrypoint:u,designSettingsEntrypoint:y,settingsTranslationsEntrypoint:g,showcasesEntrypoints:R,showcaseTranslationsEntrypoint:k,assetsEntrypoints:B}=s;if(await h({configFile:!1,...$(Ke(n,i))}),a!==void 0&&await h({configFile:!1,...$(ze(n,a))}),u!==void 0&&await h({configFile:!1,...$(S(n,u))}),y!==void 0&&await h({configFile:!1,...$(S(n,y))}),g!==void 0&&await h({configFile:!1,...$(S(n,g))}),R!==void 0)for(const L of R)await h({configFile:!1,...$(z(n,L))});if(k!==void 0&&await h({configFile:!1,...$(z(n,k))}),B!==void 0)for(const L of B)await h({configFile:!1,...$(Ve(n,L))})}const t=await rt(),o=await it();for(const s of o.entryPoints){await h({configFile:!1,...$(Je(s,T))});const n=`dist/template/js/${v(s).name}`,i=await I(n,!0);await at(t,i,n,await ct(i))}m.info("Build successful. For deploy run: npx @lightspeed/crane@latest deploy")}catch(e){m.error(`Error while building: ${e.message}`)}}function je(e){if(e!==void 0)return e.startsWith("global.")?{type:"GLOBAL_FONT",font:e}:{type:"PRESET_FONT",font:e}}function E(e){if(e===void 0)return;if(e.startsWith("global."))return{type:"GLOBAL_COLOR",raw:e};const t=qe(e);return{type:"STRUCTURED_COLOR",raw:e,hex:t.toHex8String(),hsl:t.toHsl(),rgba:t.toRgb(),auto:!1}}function lt(e){if(e!==void 0)return typeof e=="string"&&e.startsWith("global.")?{type:"GLOBAL_TEXT_SIZE",size:e}:{type:"NUMERIC_TEXT_SIZE",size:e}}const dt={COLOR:"COLOR",GRADIENT:"GRADIENT"};function ut(e){switch(e){case"COLOR":return"solid";case"GRADIENT":return"gradient";default:throw new Error(`Unknown background type: ${e}. Right options: ${Object.keys(dt)}`)}}function ft(e){const t=e.style,o=e.color,s=Array.isArray(o)?o:[o,o];return e.background={type:ut(t),solid:{color:E(s.at(0))},gradient:{fromColor:E(s.at(0)),toColor:E(s.at(1))}},e.style=void 0,e.color=void 0,e}const mt={SOLID:"SOLID",OUTLINE:"OUTLINE",TEXT:"TEXT"};function yt(e){switch(e){case"SOLID":return"solid-button";case"OUTLINE":return"outline-button";case"TEXT":return"text-link";default:throw new Error(`Unknown button appearance: ${e}. Right options: ${Object.keys(mt)}`)}}const gt={SMALL:"SMALL",MEDIUM:"MEDIUM",LARGE:"LARGE"};function ht(e){switch(e){case"SMALL":return"small";case"MEDIUM":return"medium";case"LARGE":return"large";default:throw new Error(`Unknown button size: ${e}. Right options: ${Object.keys(gt)}`)}}const $t={ROUND_CORNER:"ROUND_CORNER",RECTANGLE:"RECTANGLE",PILL:"PILL"};function Et(e){switch(e){case"ROUND_CORNER":return"round-corner";case"RECTANGLE":return"rectangle";case"PILL":return"pill";default:throw new Error(`Unknown button shape: ${e}. Right options: ${Object.keys($t)}`)}}function bt(e){const t=e.appearance;t!==void 0&&(e.appearance=yt(t));const o=e.size;o!==void 0&&(e.size=ht(o));const s=e.shape;s!==void 0&&(e.style=Et(s),e.shape=void 0);const n=e.font;e.font=je(n);const i=e.color;return e.color=E(i),e}const Tt={COLOR:"COLOR",GRADIENT:"GRADIENT",NONE:"NONE"};function wt(e){switch(e){case"COLOR":return"solid";case"GRADIENT":return"gradient";case"NONE":return"none";default:throw new Error(`Unknown image overlay type: ${e}. Right options: ${Object.keys(Tt)}`)}}function Ot(e){const t=e.overlay,o=e.color,s=Array.isArray(o)?o:[o,o];return e.overlay={type:wt(t),solid:{color:E(s.at(0))},gradient:{fromColor:E(s.at(0)),toColor:E(s.at(1))}},e.color=void 0,e}function jt(e){const t=e.font;e.font=je(t);const o=e.color;e.color=E(o);const s=e.size;return e.size=lt(s),e}function vt(e){const t=e.color;return e.color=E(t),e}function ve(e){Object.keys(e).forEach(t=>{const o=e[t],s=o.type;Ce(s,o.defaults)})}function Ct(e){Object.keys(e).forEach(t=>{const o=e[t],s=o.type;Ce(s,o)})}function Ce(e,t){switch(e){case"TEXT":{jt(t);break}case"BUTTON":{bt(t);break}case"IMAGE":{Ot(t);break}case"BACKGROUND":{ft(t);break}case"COLOR_PICKER":{vt(t);break}case"TOGGLE":case"SELECTBOX":break;default:throw new Error(`Unknown design editor type: ${e}`)}return t}const Lt="https://blockbuster.ecwid.com";async function Dt(){const e=await x(r(c.cwd(),"crane.config.json")),t=JSON.parse(e.toString());return{appClientId:t.app_client_id,appSecretKey:btoa(t.app_secret_key)}}async function At(){const e=await x(r(c.cwd(),"package.json")),t=JSON.parse(e.toString()),o=Fe(t.version,"patch");return t.version=o,ke(r(c.cwd(),"package.json"),`${JSON.stringify(t,null,2)}
5
+ `),t.version}async function Nt(e,t){try{const o=(await import(r(c.cwd(),`dist/sections/${e}/js/settings/content.mjs`))).default;return w(o,t),o}catch{throw new Error(`Content descriptor for section [${e}] is either invalid or undefined`)}}async function St(e,t){try{const o=(await import(r(c.cwd(),`dist/sections/${e}/js/settings/design.mjs`))).default;return ve(o),w(o,t),o}catch(o){const s=o;throw new Error(`Design settings is invalid or undefined. Error ${s.stack}`)}}async function It(e,t){try{const o=await l("*.mjs",{cwd:r(c.cwd(),`dist/sections/${e}/js/showcases/`),ignore:"**/translations.mjs"});return Promise.all(o.map(async s=>{const n=(await import(r(c.cwd(),`dist/sections/${e}/js/showcases/${s}`))).default;return Ct(n.design),w(n,t),n}))}catch(o){throw new Error(`Showcases is invalid or undefined. Error ${o}`)}}async function Le(e){return await De(`dist/sections/${e}/js/settings/translations.mjs`)}async function Gt(e){return await De(`dist/sections/${e}/js/showcases/translations.mjs`)}async function De(e){const t=(await import(r(c.cwd(),e))).default;return Rt(t)}function w(e,t){if(e&&typeof e=="object"){const o=e;for(let s in o){const n=o[s];typeof n=="string"&&n.startsWith("$")&&(o[s]=_t(t,n)),typeof n=="object"&&w(n,t)}}}function _t(e,t){if(!t)return;const o=e[t];return o===void 0?{en:t}:o}function Rt(e){const t={};for(let o in e){const s=e[o];for(let n in s){const i=t[n],a=s[n];if(i===void 0){const u={};u[o]=a,t[n]=u}else i[o]=a}}return t}async function kt(){const e=await l("*/",{cwd:r(c.cwd(),"dist/sections/")});return Promise.all(e.map(async t=>{const o=await Le(t),s=await Gt(t),n=await Nt(t,o),i=await St(t,o),a=await It(t,s);return{id:t,name:{en:t},contentEditors:n,designEditors:i,showcases:a}}))}async function Bt(e){try{return(await import(r(c.cwd(),e))).default}catch{throw new Error(`Template descriptor [${e}] is either invalid or undefined`)}}async function Pt(){const e=await l("dist/template/js/**.mjs",{ignore:[`dist/template/js/**${T}.mjs`]});return Promise.all(e.map(async t=>{const o=await Bt(t),s=o.sections.filter(n=>n.type==="custom");for(const n of s){const i=await Le(n.id);n.content!==void 0&&w(n.content,i),n.design!==void 0&&(ve(n.design),w(n.design,i))}return{id:`${v(c.cwd()).name.replace(/[^a-zA-Z0-9]/g,"_")}_${v(t).name}`,descriptor:o}}))}async function Ut(e,t,o,s){const n=(await l("server.js",{cwd:r(c.cwd(),`dist/sections/${s}/js/`)})).at(0);n!==void 0&&await e.post("/api/v1/app/resource/upload",{file:C(r(c.cwd(),`dist/sections/${s}/js/server.js`))},{params:{appClientId:t.appClientId,type:"server_js",version:o,block:s,fileName:n},headers:{"Content-Type":"multipart/form-data",Authorization:`Bearer ${t.appSecretKey}`}})}async function xt(e,t,o,s){(await l("*.js",{cwd:r(c.cwd(),`dist/sections/${s}/js/`),ignore:"**/server.js"})).forEach(async n=>{await e.post("/api/v1/app/resource/upload",{file:C(r(c.cwd(),`dist/sections/${s}/js/${n}`))},{params:{appClientId:t.appClientId,type:"client_js",version:o,block:s,fileName:n},headers:{"Content-Type":"multipart/form-data",Authorization:`Bearer ${t.appSecretKey}`}})})}async function Xt(e,t,o,s){(await l("*",{cwd:r(c.cwd(),`dist/sections/${s}/assets/`)})).forEach(async n=>{await e.post("/api/v1/app/resource/upload",{file:C(r(c.cwd(),`dist/sections/${s}/assets/${n}`))},{params:{appClientId:t.appClientId,type:"assets",version:o,block:s,fileName:n},headers:{"Content-Type":"multipart/form-data",Authorization:`Bearer ${t.appSecretKey}`}})})}async function Ft(e,t,o){(await l("package.json")).at(0)!==void 0&&await e.post("/api/v1/app/resource/upload",{file:C(r(c.cwd(),"package.json"))},{params:{appClientId:t.appClientId,type:"dependencies",version:o},headers:{"Content-Type":"multipart/form-data",Authorization:`Bearer ${t.appSecretKey}`}})}async function qt(e,t,o,s){for(const n of s)await Ut(e,t,o,n.id),await xt(e,t,o,n.id),await Xt(e,t,o,n.id),await Ft(e,t,o)}async function Mt(e,t,o,s,n){await e.post("/api/v1/app/manifest",{version:o,name:"Custom Block App",blocks:s,templates:n},{params:{appClientId:t.appClientId},headers:{Authorization:`Bearer ${t.appSecretKey}`}})}async function zt(e){try{const t=e??Lt,o=Xe.create({baseURL:t}),s=await Dt(),n=await At(),i=await kt(),a=await Pt();await qt(o,s,n,i),await Mt(o,s,n,i,a);const u=i.map(y=>y.id);m.info(`Deploy to ${t} successful
6
+ Current app version: ${n}
7
+ Deployed blocks: ${u.join(", ")}`),a.length>0&&m.info(`Deployed templates: ${a.map(y=>y.id).join(", ")}`)}catch(t){m.error(`Error while deploying: ${t.message}`)}}const Kt="0.1.0",p=Ae("crane");function Jt(){p.command("init","Initialize a new resource in the form of a directory.").option("--app <name>","Creates an app folder inside your current directory.").option("--section <name>","Creates the files necessary for one custom section with the given name, this can be repeated for each section.").option("--template <name>","Creates the directory and files necessary to build a custom template inside your app folder.").action(e=>{if(e.app)return F(e.app);if(e.section)return q(e.section);if(e.template)return M(e.template);p.outputHelp()}),p.command("build","Builds your resource code").action(pt),p.command("deploy","Deploys your resource code into Ecwid"),p.on("command:*",()=>{console.error("Invalid command: %s",p.args.join(" ")),p.outputHelp(),process.exit(1)}),p.on("command:init",()=>{const e=p.options.section,t=p.options.app,o=p.options.template;_(t)?G("app",j("init --app <name>"),F):_(e)?G("section",j("init --section <name>"),q):_(o)&&G("template",j("init --template <name>"),M)}),p.on("command:deploy",()=>zt(p.options.url)),p.help(),p.usage("<action> <resource>"),p.version(Kt),p.parse()}try{Jt()}catch{}async function G(e,t,o){const s=`You can use ${t} to directly specify the name of the ${e}.`;console.log(s);const n=await Me({type:"text",name:"name",message:`Please specify a name for your ${e}:`});if(n.name)return o(n.name);console.log("Please provide a name for the template."),p.outputHelp()}function _(e){return e&&(typeof e!="string"||e.trim().length==0)}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lightspeed/crane",
3
- "version": "0.0.1-beta.24",
3
+ "version": "0.1.0",
4
4
  "type": "module",
5
5
  "bin": "bin/crane.js",
6
6
  "main": "./dist/app.mjs",
@@ -26,29 +26,35 @@
26
26
  "build": "unbuild",
27
27
  "lint": "eslint \"./{src,test}/**/*.{js,ts}\""
28
28
  },
29
+ "engines": {
30
+ "node": ">=20"
31
+ },
29
32
  "devDependencies": {
30
33
  "@types/fs-extra": "^11.0.1",
31
34
  "@types/node": "^20.4.5",
35
+ "typescript": "5.4.5",
32
36
  "unbuild": "^2.0.0",
33
37
  "vite-plugin-dts": "^3.4.0",
34
38
  "vite-plugin-static-copy": "^0.17.0"
35
39
  },
36
40
  "dependencies": {
37
- "@lightspeed/eslint-config-crane": "0.0.1-beta.2",
41
+ "@jridgewell/sourcemap-codec": "^1.4.15",
42
+ "@lightspeed/eslint-config-crane": "0.1.0",
43
+ "@types/prompts": "^2.4.2",
38
44
  "@vitejs/plugin-vue": "^4.1.0",
39
45
  "ajv": "^8.12.0",
40
46
  "ajv-formats": "^2.1.1",
41
47
  "axios": "^1.4.0",
42
48
  "cac": "^6.7.14",
43
- "eslint": "~8.15.0",
49
+ "eslint": "npm:eslint-customized-for-crane@8.57.0",
44
50
  "fs-extra": "^11.1.1",
45
- "glob": "^10.3.3",
51
+ "glob": "^9.3.5",
46
52
  "kolorist": "^1.8.0",
47
53
  "prompts": "^2.4.2",
48
54
  "semver": "^7.5.4",
49
55
  "tinycolor2": "^1.6.0",
50
- "typescript": "^5.3.0",
51
- "vite": "^5.1.0",
56
+ "typescript": "5.4.5",
57
+ "vite": "^5.3.3",
52
58
  "vite-plugin-checker": "^0.6.1",
53
59
  "vite-plugin-externals": "^0.6.2",
54
60
  "vite-tsconfig-paths": "^4.2.0",
@@ -57,5 +63,13 @@
57
63
  },
58
64
  "peerDependencies": {
59
65
  "vue": "^3.4.0"
66
+ },
67
+ "overrides": {
68
+ "eslint": {
69
+ "file-entry-cache": "8.0.0"
70
+ },
71
+ "magic-string": "0.30.10",
72
+ "glob": "^9.3.5",
73
+ "stylus": "^0.63.0"
60
74
  }
61
75
  }
@@ -7,8 +7,18 @@
7
7
  "deploy": "crane build && crane deploy"
8
8
  },
9
9
  "dependencies": {
10
- "@lightspeed/crane": "0.0.1-beta.24",
11
- "@lightspeed/eslint-config-crane": "0.0.1-beta.2",
10
+ "@lightspeed/crane": "0.1.0",
11
+ "@lightspeed/eslint-config-crane": "0.1.0",
12
12
  "vue": "^3.4.0"
13
+ },
14
+ "engines": {
15
+ "node": ">=20"
16
+ },
17
+ "overrides": {
18
+ "eslint": {
19
+ "file-entry-cache": "8.0.0"
20
+ },
21
+ "glob": "^9.3.5",
22
+ "stylus": "^0.63.0"
13
23
  }
14
24
  }
@@ -7,7 +7,7 @@ import {
7
7
  useToggleElementContent,
8
8
  useSelectboxElementContent,
9
9
  } from '@lightspeed/crane';
10
- import { Content } from './type';
10
+ import { Content } from './type.ts';
11
11
 
12
12
  const inputboxContent = useInputboxElementContent<Content>('inputbox');
13
13
  const textareaContent = useTextareaElementContent<Content>('textarea');
@@ -30,6 +30,7 @@ const selectboxContent = useSelectboxElementContent<Content>('selectbox');
30
30
  </h1>
31
31
  </div>
32
32
  <div>
33
+ <!-- eslint-disable vue/html-button-has-type -->
33
34
  <button
34
35
  v-if="buttonContent.hasTitle"
35
36
  @click="buttonContent.performAction"
@@ -1,5 +1,5 @@
1
1
  import { createVueClientApp } from '@lightspeed/crane';
2
2
  import CustomBlock from './CustomBlock.vue';
3
- import { Content, Design } from './type';
3
+ import { Content, Design } from './type.ts';
4
4
 
5
5
  export default createVueClientApp<Content, Design>(CustomBlock);
@@ -1,5 +1,5 @@
1
1
  import { createVueServerApp } from '@lightspeed/crane';
2
2
  import CustomBlock from './CustomBlock.vue';
3
- import { Content, Design } from './type';
3
+ import { Content, Design } from './type.ts';
4
4
 
5
5
  export default createVueServerApp<Content, Design>(CustomBlock);
@@ -1,5 +1,5 @@
1
- import ContentSettings from './settings/content';
2
- import DesignSettings from './settings/design';
1
+ import ContentSettings from './settings/content.ts';
2
+ import DesignSettings from './settings/design.ts';
3
3
 
4
4
  export type Content = InferContentType<typeof ContentSettings>;
5
5
  export type Design = InferDesignType<typeof DesignSettings>;
@@ -26,40 +26,40 @@ export default {
26
26
  content: {
27
27
  inputbox: {
28
28
  type: 'INPUTBOX',
29
- label: '$label.example.label',
30
- placeholder: '$label.example.placeholder'
29
+ label: '$label.inputbox.label',
30
+ placeholder: '$label.inputbox.placeholder',
31
31
  },
32
32
  textarea: {
33
33
  type: 'TEXTAREA',
34
- label: '$label.example.label',
35
- placeholder: '$label.example.placeholder'
34
+ label: '$label.textarea.label',
35
+ placeholder: '$label.textarea.placeholder',
36
36
  },
37
37
  button: {
38
38
  type: 'BUTTON',
39
- label: '$label.example.label'
39
+ label: '$label.button.label',
40
40
  },
41
41
  image: {
42
42
  type: 'IMAGE',
43
- label: '$label.example.label'
43
+ label: '$label.image.label',
44
44
  },
45
45
  toggle: {
46
46
  type: 'TOGGLE',
47
- label: '$label.example.label',
48
- description: '$label.example.description'
47
+ label: '$label.toggle.label',
48
+ description: '$label.toggle.description',
49
49
  },
50
50
  selectbox: {
51
51
  type: 'SELECTBOX',
52
- label: '$label.example.label',
53
- placeholder: '$label.example.placeholder',
54
- description: '$label.example.description',
52
+ label: '$label.selectbox.label',
53
+ placeholder: '$label.selectbox.placeholder',
54
+ description: '$label.selectbox.description',
55
55
  options: [
56
56
  {
57
57
  value: 'one',
58
- label: '$label.example.one.label'
58
+ label: '$label.selectbox.one.label',
59
59
  },
60
60
  {
61
61
  value: 'two',
62
- label: '$label.example.two.label'
62
+ label: '$label.selectbox.two.label',
63
63
  }
64
64
  ]
65
65
  }
@@ -67,7 +67,7 @@ export default {
67
67
  design: {
68
68
  inputbox: {
69
69
  type: 'TEXT',
70
- label: '$label.example.label',
70
+ label: '$label.inputbox.label',
71
71
  colors: ['#FFFFFF66', '#0000004D', '#00000099', '#64C7FF66', '#F9947266', '#C794CD66', '#FFD17466'],
72
72
  sizes: [12, 13, 14, 15, 16, 17, 18, 20],
73
73
  defaults: {
@@ -80,7 +80,7 @@ export default {
80
80
  },
81
81
  textarea: {
82
82
  type: 'TEXT',
83
- label: '$label.example.label',
83
+ label: '$label.textarea.label',
84
84
  colors: ['#FFFFFF66', '#0000004D', '#00000099', '#64C7FF66', '#F9947266', '#C794CD66', '#FFD17466'],
85
85
  sizes: [12, 13, 14, 15, 16, 17, 18, 20],
86
86
  defaults: {
@@ -93,7 +93,7 @@ export default {
93
93
  },
94
94
  button: {
95
95
  type: 'BUTTON',
96
- label: '$label.example.label',
96
+ label: '$label.button.label',
97
97
  colors: ['#FFFFFF66', '#0000004D', '#00000099', '#64C7FF66', '#F9947266', '#C794CD66', '#FFD17466'],
98
98
  defaults: {
99
99
  font: 'global.fontFamily.body',
@@ -105,7 +105,7 @@ export default {
105
105
  },
106
106
  image: {
107
107
  type: 'IMAGE',
108
- label: '$label.example.label',
108
+ label: '$label.image.label',
109
109
  colors: ['#FFFFFF66', '#0000004D', '#00000099', '#64C7FF66', '#F9947266', '#C794CD66', '#FFD17466'],
110
110
  defaults: {
111
111
  overlay: 'COLOR',
@@ -114,25 +114,25 @@ export default {
114
114
  },
115
115
  toggle: {
116
116
  type: 'TOGGLE',
117
- label: '$label.example.label',
118
- description: '$label.example.description',
117
+ label: '$label.toggle.label',
118
+ description: '$label.toggle.description',
119
119
  defaults: {
120
120
  enabled: true
121
121
  }
122
122
  },
123
123
  selectbox: {
124
124
  type: 'SELECTBOX',
125
- label: '$label.example.label',
126
- placeholder: '$label.example.placeholder',
127
- description: '$label.example.description',
125
+ label: '$label.selectbox.label',
126
+ placeholder: '$label.selectbox.placeholder',
127
+ description: '$label.selectbox.description',
128
128
  options: [
129
129
  {
130
130
  value: 'one',
131
- label: '$label.example.one.label'
131
+ label: '$label.selectbox.one.label',
132
132
  },
133
133
  {
134
134
  value: 'two',
135
- label: '$label.example.two.label'
135
+ label: '$label.selectbox.two.label',
136
136
  }
137
137
  ],
138
138
  defaults: {
@@ -141,7 +141,7 @@ export default {
141
141
  },
142
142
  background: {
143
143
  type: 'BACKGROUND',
144
- label: '$label.example.label',
144
+ label: '$label.background.label',
145
145
  colors: ['#FFFFFF66', '#0000004D', '#00000099', '#64C7FF66', '#F9947266', '#C794CD66', '#FFD17466'],
146
146
  defaults: {
147
147
  style: 'COLOR',