@shoplineos/cli 1.0.0-beta.0 → 1.0.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.
@@ -6,4 +6,4 @@
6
6
  }
7
7
  })();
8
8
  </script>
9
- <script src="/socket-client.js"></script>`,d=null==o?void 0:null===(s=o.data)||void 0===s?void 0:s.replace(/(<\/body>)/,`${l}$1`);e.status=200,e.body=d}catch(r){let t=null==r?void 0:null===(o=r.response)||void 0===o?void 0:o.status;if(!t){console.log(r),e.body=r;return}if(t.toString().startsWith(30)){e.status=t;let i=null==r?void 0:null===(l=r.response)||void 0===l?void 0:null===(d=l.headers)||void 0===d?void 0:d["set-cookie"];i&&e.set("set-cookie",i);let s=null==r?void 0:null===(n=r.response)||void 0===n?void 0:null===(a=n.headers)||void 0===a?void 0:a.location;if(s){let t=s.replace(this.storeUrl,this.localUrl);e.redirect(t);return}e.body=""}}}),e.use(d.routes()).use(d.allowedMethods()),e.listen(this.port,async()=>{let e=await (0,g.startThemeService)({mode:this.mode,cwd:this.cwd,sse:this.streams,includeFilter:this.includeFilter,ignoreFilter:this.ignoreFilter,editorSync:this.editorSync});this.previewQuery.themeId=null==e?void 0:e.themeId,this.printInfo()}),e}printInfo(){let{storeUrl:t}=this,{themeId:r}=this.previewQuery,i=`${t}/admin/theme/editor/editing/Home?themeId=${r}&dev_mode=1`,s=`${t}/?${e.default.stringify({...this.previewQuery,dev_mode:1})}`,{localUrl:o}=this,l=(0,v.getRelativePath)(this.cwd);console.log((0,h.getMessage)("theme.serve.serving",{path:l||"."})),console.log(),console.log((0,h.getMessage)("theme.serve.print_theme_id",{theme_id:r})),console.log(),console.log((0,h.getMessage)("core.context.open_url",{url:o})),console.log(),console.log((0,h.getMessage)("theme.serve.customize_or_preview",{editor_url:i,preview_url:s}))}static getRequestBody(t,r){if(t.includes("multipart/form-data")){let e=new d.default;for(let t in r)Object.prototype.hasOwnProperty.call(r,t)&&e.append(t,r[t]);return{body:e,headers:e.getHeaders()}}if(t.includes("application/x-www-form-urlencoded")){let t=e.default.stringify(r);return{body:t,headers:{"Content-Type":"application/x-www-form-urlencoded"}}}return{body:r,headers:{}}}get localUrl(){return`http://127.0.0.1:${this.port}`}constructor({port:e,liveReload:t,path:r,themeEditorSync:i},s){super("theme:serve"),f(this,"cwd",void 0),f(this,"port",void 0),f(this,"previewQuery",void 0),f(this,"storeUrl",void 0),f(this,"mode",void 0),f(this,"streams",void 0),f(this,"includeFilter",void 0),f(this,"ignoreFilter",void 0),f(this,"editorSync",void 0),this.cwd=r,this.port=e,this.storeUrl=c.default.currentStore,this.mode=t,this.streams=new a.SSEQueue,this.ignoreFilter=s.ignore,this.includeFilter=s.include,this.editorSync=i,this.previewQuery={preview:1,themeId:""},this.start()}}
9
+ <script src="/socket-client.js"></script>`,d=null==o?void 0:null===(s=o.data)||void 0===s?void 0:s.replace(/(<\/body>)/,`${l}$1`);e.status=200,e.body=d}catch(r){let t=null==r?void 0:null===(o=r.response)||void 0===o?void 0:o.status;if(!t){console.log(r),e.body=r;return}if(t.toString().startsWith(30)){e.status=t;let i=null==r?void 0:null===(l=r.response)||void 0===l?void 0:null===(d=l.headers)||void 0===d?void 0:d["set-cookie"];i&&e.set("set-cookie",i);let s=null==r?void 0:null===(n=r.response)||void 0===n?void 0:null===(a=n.headers)||void 0===a?void 0:a.location;if(s){let t=s.replace(this.storeUrl,this.localUrl);e.redirect(t);return}e.body=""}}}),e.use(d.routes()).use(d.allowedMethods()),e.listen(this.port,async()=>{let e=await (0,g.startThemeService)({mode:this.mode,cwd:this.cwd,sse:this.streams,includeFilter:this.includeFilter,ignoreFilter:this.ignoreFilter,editorSync:this.editorSync});this.previewQuery.themeId=null==e?void 0:e.themeId,this.printInfo()}),e}printInfo(){let{storeUrl:t}=this,{themeId:r}=this.previewQuery,i=`${t}/admin/theme-editor/editing/Home?themeId=${r}&dev_mode=1`,s=`${t}/?${e.default.stringify({...this.previewQuery,dev_mode:1})}`,{localUrl:o}=this,l=(0,v.getRelativePath)(this.cwd);console.log((0,h.getMessage)("theme.serve.serving",{path:l||"."})),console.log(),console.log((0,h.getMessage)("theme.serve.print_theme_id",{theme_id:r})),console.log(),console.log((0,h.getMessage)("core.context.open_url",{url:o})),console.log(),console.log((0,h.getMessage)("theme.serve.customize_or_preview",{editor_url:i,preview_url:s}))}static getRequestBody(t,r){if(t.includes("multipart/form-data")){let e=new d.default;for(let t in r)Object.prototype.hasOwnProperty.call(r,t)&&e.append(t,r[t]);return{body:e,headers:e.getHeaders()}}if(t.includes("application/x-www-form-urlencoded")){let t=e.default.stringify(r);return{body:t,headers:{"Content-Type":"application/x-www-form-urlencoded"}}}return{body:r,headers:{}}}get localUrl(){return`http://127.0.0.1:${this.port}`}constructor({port:e,liveReload:t,path:r,themeEditorSync:i},s){super("theme:serve"),f(this,"cwd",void 0),f(this,"port",void 0),f(this,"previewQuery",void 0),f(this,"storeUrl",void 0),f(this,"mode",void 0),f(this,"streams",void 0),f(this,"includeFilter",void 0),f(this,"ignoreFilter",void 0),f(this,"editorSync",void 0),this.cwd=r,this.port=e,this.storeUrl=c.default.currentStore,this.mode=t,this.streams=new a.SSEQueue,this.ignoreFilter=s.ignore,this.includeFilter=s.include,this.editorSync=i,this.previewQuery={preview:1,themeId:""},this.start()}}
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),function(e,s){for(var o in s)Object.defineProperty(e,o,{enumerable:!0,get:s[o]})}(exports,{EXTENSION_ENDPOINTS:()=>o,DEFAULT_EXTENSION_ENDPOINT:()=>t,DEFAULT_EXTENSION_NAME:()=>r,ENVS:()=>c,TARGETS:()=>_,EXTENSION_LINK_PATH:()=>E,TAGS:()=>i,OPTION_TYPES:()=>n,EXTENSION_NAME_LENGTH_LIMIT:()=>a,MAX_ALL_FILE_SIZE:()=>l,MAX_BLOCKS_FILE_COUNT:()=>T,MAX_BLOCKS_FILE_SIZE:()=>p,MAX_BLOCKS_FILE_SIZE_3:()=>u,SUPPORTED_ASSET_EXTS:()=>N,SUPPORTED_ASSET_EXTS_3:()=>m,SUPPORTED_BUCKETS:()=>d,SUPPORTED_BUCKETS_3:()=>O,SUPPORTED_LOCALE_EXTS:()=>I,EXTENSION_CONFIG_FILE:()=>S,CHECKOUT_UI_CONFIG_FILE:()=>L,FUNCTION_CONFIG_FILE:()=>g,ERRORS:()=>A,ALL_TEMPLATES:()=>P,ALL_TEMPLATES_3:()=>h,EXTENSION_TYPES:()=>U,DEFAULT_EXTENSION_TYPE:()=>M,DEFAULT_CHECKOUT_UI_CUSTOMIZER_NAME:()=>v});const e=require("../../utils/messages"),s=require("./types"),o={dev:"https://devcenter.myshoplinedev.com",test:"https://opendoc.myshoplinestg.com",pre:"https://devcenter-pre.myshopline.com",prod:"https://developer.myshopline.com"},t=o.prod,r="shopline-app-extension",c=["dev","test","pre","prod"],_=["section","head","body"],E="app/edit-extension",i=["article","aside","div","footer","header","section"],n=["checkbox","radio","select"],a=50,l=10485760,T=25,p=102400,u=102400,N=[".jpg",".js",".css",".png",".svg",".hbs"],m=[".jpg",".js",".css",".png",".svg"],d=["assets","blocks","snippets","locales"],O=["blocks","components","i18n","public","compatibility"],I=[".json"],S=".shopline-cli.yml",L="shopline.ui.customizer.toml",g="shopline.function.extension.toml",A={EXTENSION_NAME_LENGTH_LIMIT:(0,e.getMessage)("extension.create.invalid_name",{limit:a}),ENV_INVALID:(0,e.getMessage)("extension.invalid_env",{envs:c.join(", ")}),ENV_FILE_NOT_FOUND:(0,e.getMessage)("extension.no_env_file"),SHOPLINE_CONFIG_NOT_FOUND:(0,e.getMessage)("extension.no_config_file",{config_name:S}),UNSUPPORTED_PROJECT_TYPE:(0,e.getMessage)("extension.invalid_type"),REPEAT_DIR_NAME:"The theme app extension directory already exists. Please rename or use another name.",INVALID_INTERPOLATION:"must be of the form {{ apps.metafields.<namespace>.<key>.value }}",PARTNER_INFO_NOT_COMPLETE:"PARTNER_INFO_NOT_COMPLETE",USER_NOT_LOGIN:"USER_NOT_LOGIN"},P=["index","collections_all","collection","products/detail","cart","blogs/list","blogs/detail","404","products/search","page","customers/login","customers/register","customers/account","customers/reset_password","customers/addresses","customers/order/list","customers/order/detail","password"],h=["index","collections_all","collection","product","cart","blog","article","404","search","page","policy","password","gift_card","customers/login","customers/register","customers/account","customers/reset_password","customers/addresses","customers/order/list","customers/orders","customers/order/detail","customers/order","customers/activate_account","customers/message","customers/forgot_password","customers/company","customers/logout","customers/bind_account","customers/unsub","customers/unsub_feedback"],U=[{label:"Theme App Extension",value:s.EExtensionTypes.themeAppExtension}];U.push({label:"checkout ui customizer",value:s.EExtensionTypes.checkoutUiCustomizer});const M="themeAppExtension",v="checkout-ui-customizer";
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),function(e,s){for(var o in s)Object.defineProperty(e,o,{enumerable:!0,get:s[o]})}(exports,{EXTENSION_ENDPOINTS:()=>o,DEFAULT_EXTENSION_ENDPOINT:()=>t,DEFAULT_EXTENSION_NAME:()=>r,ENVS:()=>_,TARGETS:()=>c,EXTENSION_LINK_PATH:()=>E,TAGS:()=>n,OPTION_TYPES:()=>i,EXTENSION_NAME_LENGTH_LIMIT:()=>a,MAX_ALL_FILE_SIZE:()=>l,MAX_BLOCKS_FILE_COUNT:()=>T,MAX_BLOCKS_FILE_SIZE:()=>p,MAX_BLOCKS_FILE_SIZE_3:()=>u,SUPPORTED_ASSET_EXTS:()=>N,SUPPORTED_ASSET_EXTS_3:()=>m,SUPPORTED_BUCKETS:()=>d,SUPPORTED_BUCKETS_3:()=>O,SUPPORTED_LOCALE_EXTS:()=>I,EXTENSION_CONFIG_FILE:()=>S,CHECKOUT_UI_CONFIG_FILE:()=>L,FUNCTION_CONFIG_FILE:()=>g,ERRORS:()=>A,ALL_TEMPLATES:()=>P,ALL_TEMPLATES_3:()=>h,EXTENSION_TYPES:()=>U,DEFAULT_EXTENSION_TYPE:()=>C,DEFAULT_CHECKOUT_UI_CUSTOMIZER_NAME:()=>M});const e=require("../../utils/messages"),s=require("./types"),o={dev:"https://devcenter.myshoplinedev.com",test:"https://opendoc.myshoplinestg.com",pre:"https://devcenter-pre.myshopline.com",prod:"https://developer.myshopline.com"},t=o.prod,r="shopline-app-extension",_=["dev","test","pre","prod"],c=["section","head","body"],E="app/edit-extension",n=["article","aside","div","footer","header","section"],i=["checkbox","radio","select"],a=50,l=10485760,T=25,p=102400,u=102400,N=[".jpg",".js",".css",".png",".svg",".hbs"],m=[".jpg",".js",".css",".png",".svg"],d=["assets","blocks","snippets","locales"],O=["blocks","components","i18n","public","compatibility"],I=[".json"],S=".shopline-cli.yml",L="shopline.ui.customizer.toml",g="shopline.function.extension.toml",A={EXTENSION_NAME_LENGTH_LIMIT:(0,e.getMessage)("extension.create.invalid_name",{limit:a}),ENV_INVALID:(0,e.getMessage)("extension.invalid_env",{envs:_.join(", ")}),ENV_FILE_NOT_FOUND:(0,e.getMessage)("extension.no_env_file"),SHOPLINE_CONFIG_NOT_FOUND:(0,e.getMessage)("extension.no_config_file",{config_name:S}),UNSUPPORTED_PROJECT_TYPE:(0,e.getMessage)("extension.invalid_type"),REPEAT_DIR_NAME:"The theme app extension directory already exists. Please rename or use another name.",INVALID_INTERPOLATION:"must be of the form {{ apps.metafields.<namespace>.<key>.value }}",PARTNER_INFO_NOT_COMPLETE:"PARTNER_INFO_NOT_COMPLETE",USER_NOT_LOGIN:"USER_NOT_LOGIN"},P=["index","collections_all","collection","products/detail","cart","blogs/list","blogs/detail","404","products/search","page","customers/login","customers/register","customers/account","customers/reset_password","customers/addresses","customers/order/list","customers/order/detail","password"],h=["index","collections_all","collection","product","cart","blog","article","404","search","page","policy","password","gift_card","customers/login","customers/register","customers/account","customers/reset_password","customers/addresses","customers/order/list","customers/orders","customers/order/detail","customers/order","customers/activate_account","customers/message","customers/forgot_password","customers/company","customers/logout","customers/bind_account","customers/unsub","customers/unsub_feedback"],U=[{label:"Theme App Extension",value:s.EExtensionTypes.themeAppExtension}];U.push({label:"Checkout UI Customizer",value:s.EExtensionTypes.checkoutUiCustomizer});const C="themeAppExtension",M="checkout-ui-customizer";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@shoplineos/cli",
3
- "version": "1.0.0-beta.0",
3
+ "version": "1.0.0",
4
4
  "description": "A CLI tool to build for the Shopline platform",
5
5
  "bin": {
6
6
  "sl": "./bin/index.js"