@shoplineos/cli 1.4.0 → 1.4.1

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.
@@ -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:()=>E,ENVS:()=>_,TARGETS:()=>n,EXTENSION_LINK_PATH:()=>i,APP_VERSION_MANAGE_LINK_PATH:()=>r,TAGS:()=>p,OPTION_TYPES:()=>c,EXTENSION_NAME_LENGTH_LIMIT:()=>l,MAX_ALL_FILE_SIZE:()=>T,MAX_BLOCKS_FILE_COUNT:()=>N,MAX_BLOCKS_FILE_SIZE:()=>a,MAX_BLOCKS_FILE_SIZE_3:()=>O,SUPPORTED_ASSET_EXTS:()=>I,SUPPORTED_ASSET_EXTS_3:()=>S,SUPPORTED_BUCKETS:()=>m,SUPPORTED_BUCKETS_3:()=>u,SUPPORTED_LOCALE_EXTS:()=>d,EXTENSION_CONFIG_FILE:()=>P,CHECKOUT_UI_CONFIG_FILE:()=>A,POST_PURCHASE_CONFIG_FILE:()=>L,PIXELS_CONFIG_FILE:()=>h,FUNCTION_CONFIG_FILE:()=>x,SHOPPER_CONFIG_FILE:()=>g,ERRORS:()=>U,ALL_TEMPLATES:()=>C,ALL_TEMPLATES_3:()=>F,EXTENSION_TYPES:()=>R,DEFAULT_EXTENSION_TYPE:()=>M,DEFAULT_CHECKOUT_UI_CUSTOMIZER_NAME:()=>v,DEFAULT_CHECKOUT_POST_PURCHASE_NAME:()=>y,DEFAULT_PIXELS_EXTENSION_NAME:()=>D,DEFAULT_SHOPPER_EXTENSION_NAME:()=>X});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,E="shopline-app-extension",_=["dev","test","pre","prod"],n=["section","head","body"],i="app/edit-extension",r="app/version-manage/add",p=["article","aside","div","footer","header","section"],c=["checkbox","radio","select"],l=50,T=10485760,N=25,a=102400,O=102400,I=[".jpg",".js",".css",".png",".svg",".hbs"],S=[".jpg",".js",".css",".png",".svg"],m=["assets","blocks","snippets","locales"],u=["blocks","components","i18n","public","compatibility"],d=[".json"],P=".shopline-cli.yml",A="shopline.ui.customizer.toml",L="shopline.post-purchase.customizer.toml",h="shopline.pixels.extension.toml",x="shopline.function.extension.toml",g="shopline.shopper.extension.toml",U={EXTENSION_NAME_LENGTH_LIMIT:(0,e.getMessage)("extension.create.invalid_name",{limit:l}),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:P}),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",NOT_IN_PARTNER:"NOT_IN_PARTNER"},C=["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","app_proxy"],F=["index","collections_all","collection","product","cart","blog","article","404","search","page","policy","password","gift_card","customers/login","customers/register","customers/account","customers/addresses","customers/orders","customers/order","customers/activate_account","customers/forgot_password","customers/company","app_proxy"],R=[{label:"Theme App Extension",value:s.EExtensionTypes.themeAppExtension},{label:"Checkout UI Customizer",value:s.EExtensionTypes.checkoutUiCustomizer},!1,{label:"Shopline Pixels Extension",value:s.EExtensionTypes.pixelsExtension},{label:"Shopline Shopper Extension",value:s.EExtensionTypes.shopperExtension}].filter(Boolean),M="themeAppExtension",v="checkout-ui-customizer",y="post-purchase-customizer",D="pixels-extension",X="shopper-extension";
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:()=>E,ENVS:()=>_,TARGETS:()=>n,EXTENSION_LINK_PATH:()=>i,APP_VERSION_MANAGE_LINK_PATH:()=>r,TAGS:()=>p,OPTION_TYPES:()=>c,EXTENSION_NAME_LENGTH_LIMIT:()=>l,MAX_ALL_FILE_SIZE:()=>T,MAX_BLOCKS_FILE_COUNT:()=>a,MAX_BLOCKS_FILE_SIZE:()=>N,MAX_BLOCKS_FILE_SIZE_3:()=>O,SUPPORTED_ASSET_EXTS:()=>I,SUPPORTED_ASSET_EXTS_3:()=>m,SUPPORTED_BUCKETS:()=>u,SUPPORTED_BUCKETS_3:()=>S,SUPPORTED_LOCALE_EXTS:()=>P,EXTENSION_CONFIG_FILE:()=>d,CHECKOUT_UI_CONFIG_FILE:()=>A,POST_PURCHASE_CONFIG_FILE:()=>L,PIXELS_CONFIG_FILE:()=>h,FUNCTION_CONFIG_FILE:()=>x,SHOPPER_CONFIG_FILE:()=>g,ERRORS:()=>C,ALL_TEMPLATES:()=>U,ALL_TEMPLATES_3:()=>F,EXTENSION_TYPES:()=>R,DEFAULT_EXTENSION_TYPE:()=>M,DEFAULT_CHECKOUT_UI_CUSTOMIZER_NAME:()=>v,DEFAULT_CHECKOUT_POST_PURCHASE_NAME:()=>y,DEFAULT_PIXELS_EXTENSION_NAME:()=>D,DEFAULT_SHOPPER_EXTENSION_NAME:()=>X});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,E="shopline-app-extension",_=["dev","test","pre","prod"],n=["section","head","body"],i="app/edit-extension",r="app/version-manage/add",p=["article","aside","div","footer","header","section"],c=["checkbox","radio","select"],l=50,T=10485760,a=25,N=102400,O=102400,I=[".jpg",".js",".css",".png",".svg",".hbs"],m=[".jpg",".js",".css",".png",".svg"],u=["assets","blocks","snippets","locales"],S=["blocks","components","i18n","public","compatibility"],P=[".json"],d=".shopline-cli.yml",A="shopline.ui.customizer.toml",L="shopline.post-purchase.customizer.toml",h="shopline.pixels.extension.toml",x="shopline.function.extension.toml",g="shopline.shopper.extension.toml",C={EXTENSION_NAME_LENGTH_LIMIT:(0,e.getMessage)("extension.create.invalid_name",{limit:l}),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:d}),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",NOT_IN_PARTNER:"NOT_IN_PARTNER"},U=["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","app_proxy"],F=["index","collections_all","collection","product","cart","blog","article","404","search","page","policy","password","gift_card","customers/login","customers/register","customers/account","customers/addresses","customers/orders","customers/order","customers/activate_account","customers/forgot_password","customers/company","app_proxy"],R=[{label:"Theme App Extension",value:s.EExtensionTypes.themeAppExtension},{label:"Checkout UI Customizer",value:s.EExtensionTypes.checkoutUiCustomizer},{label:"Post Purchase Customizer",value:s.EExtensionTypes.postPurchaseCustomizer},{label:"Shopline Pixels Extension",value:s.EExtensionTypes.pixelsExtension},{label:"Shopline Shopper Extension",value:s.EExtensionTypes.shopperExtension}].filter(Boolean),M="themeAppExtension",v="checkout-ui-customizer",y="post-purchase-customizer",D="pixels-extension",X="shopper-extension";
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),function(e,t){for(var n in t)Object.defineProperty(e,n,{enumerable:!0,get:t[n]})}(exports,{createEntry:()=>E,beforeCreate:()=>x,getSelectedExtType:()=>y,buildGenerateOptions:()=>g,renderSuccessMessage:()=>m});const e=require("fs-extra"),t=require("../../../utils/ui/ui"),n=require("../env"),r=require("../extension"),i=require("../types"),o=require("../utils"),s=require("../api"),u=require("../generate"),a=require("../../../utils/error"),p=require("../const"),l=require("../../../utils/path"),c=require("../../../utils/output"),f=require("../../../utils/ui/render"),d=require("../functions/info"),h=function(e){return e&&e.__esModule?e:{default:e}}(require("../../../utils/winston"));async function E(e){let t=await x(e),n=await g(t),r=await (0,u.generateExtension)(n);await m(r),h.default.log(`Extension created: ${r.directory}`)}async function x(t){var i;let s=null==t?void 0:t.name,u=null!==(i=null==t?void 0:t.cwd)&&void 0!==i?i:process.cwd(),f=await (0,n.getEnv)();h.default.log(`Current store environment: ${f}`);let d=await y(),E=(0,o.getExtensionName)(s,d);h.default.log(`Current extension name: ${E}`),function(t,n){if(!t)throw new a.AbortError("Please specify an extension name");if(t.length>p.EXTENSION_NAME_LENGTH_LIMIT)throw new a.AbortError(p.ERRORS.EXTENSION_NAME_LENGTH_LIMIT);if((0,e.existsSync)((0,l.joinPath)(n,t)))throw new a.AbortError((0,c.outputContent)`${c.outputToken.cyan(t)} directory already exists.`.value)}(E,u);let x=await (0,r.getSelectedPartner)(),g=await (0,r.getSelectedApp)(x);return{extensionName:E,cwd:u,env:f,partnerInfo:x,appInfo:g,type:d}}async function y(){let e=[];h.default.log("Loading function extension templates..."),e=await (0,s.getFunctionTemplates)(),h.default.log("Choosing extension type to create...");let n=await (0,t.renderSelectPrompt)({message:"What type of extension are you creating?",choices:(0,o.buildExtensionTypeChoice)(e)});return h.default.log(`Current selected extension type: ${n}`),n}async function g(e){let{extensionName:t,appInfo:n,type:r,env:o,cwd:s,partnerInfo:u}=e,a=async()=>{if(r===i.EExtensionTypes.themeAppExtension)return"https://github.com/shoplineos/theme-app-extension-template.git";if(r===i.EExtensionTypes.checkoutUiCustomizer)return"https://github.com/shoplineos/checkout-ui-customizer-template.git";if(r===i.EExtensionTypes.postPurchaseCustomizer)return SL_DEFAULT_POST_PURCHASE_CUSTOMIZER_REPO;if(r===i.EExtensionTypes.pixelsExtension)return"https://github.com/shoplineos/pixels-extension-template.git";if(r===i.EExtensionTypes.shopperExtension)return"https://github.com/shoplineos/shopper-app-template.git";let e=await (0,d.getFunctionInfo)(r);if(e)return e.templateGit},p=await a();return h.default.log(`Current clone url: ${p}`),{name:t,app:{appKey:n.appKey,appSecret:n.appSecret},partnerId:u.id,type:r,cloneUrl:p,env:o,cwd:s}}async function m(e){let{specification:t}=e,n={headline:["Your extension was created in",{filePath:e.directory},{char:"."}],nextSteps:[],reference:[]};t.type===i.EExtensionTypes.checkoutUiCustomizer&&n.nextSteps.push(["To preview this extension along with the rest of the project, run",{command:"sl extension serve"}]),(0,f.renderSuccess)(n)}
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),function(e,t){for(var n in t)Object.defineProperty(e,n,{enumerable:!0,get:t[n]})}(exports,{createEntry:()=>x,beforeCreate:()=>g,getSelectedExtType:()=>E,buildGenerateOptions:()=>y,renderSuccessMessage:()=>m});const e=require("fs-extra"),t=require("../../../utils/ui/ui"),n=require("../env"),r=require("../extension"),i=require("../types"),o=require("../utils"),s=require("../api"),u=require("../generate"),a=require("../../../utils/error"),p=require("../const"),l=require("../../../utils/path"),c=require("../../../utils/output"),h=require("../../../utils/ui/render"),f=require("../functions/info"),d=function(e){return e&&e.__esModule?e:{default:e}}(require("../../../utils/winston"));async function x(e){let t=await g(e),n=await y(t),r=await (0,u.generateExtension)(n);await m(r),d.default.log(`Extension created: ${r.directory}`)}async function g(t){var i;let s=null==t?void 0:t.name,u=null!==(i=null==t?void 0:t.cwd)&&void 0!==i?i:process.cwd(),h=await (0,n.getEnv)();d.default.log(`Current store environment: ${h}`);let f=await E(),x=(0,o.getExtensionName)(s,f);d.default.log(`Current extension name: ${x}`),function(t,n){if(!t)throw new a.AbortError("Please specify an extension name");if(t.length>p.EXTENSION_NAME_LENGTH_LIMIT)throw new a.AbortError(p.ERRORS.EXTENSION_NAME_LENGTH_LIMIT);if((0,e.existsSync)((0,l.joinPath)(n,t)))throw new a.AbortError((0,c.outputContent)`${c.outputToken.cyan(t)} directory already exists.`.value)}(x,u);let g=await (0,r.getSelectedPartner)(),y=await (0,r.getSelectedApp)(g);return{extensionName:x,cwd:u,env:h,partnerInfo:g,appInfo:y,type:f}}async function E(){let e=[];d.default.log("Loading function extension templates..."),e=await (0,s.getFunctionTemplates)(),d.default.log("Choosing extension type to create...");let n=await (0,t.renderSelectPrompt)({message:"What type of extension are you creating?",choices:(0,o.buildExtensionTypeChoice)(e)});return d.default.log(`Current selected extension type: ${n}`),n}async function y(e){let{extensionName:t,appInfo:n,type:r,env:o,cwd:s,partnerInfo:u}=e,a=async()=>{if(r===i.EExtensionTypes.themeAppExtension)return"https://github.com/shoplineos/theme-app-extension-template.git";if(r===i.EExtensionTypes.checkoutUiCustomizer)return"https://github.com/shoplineos/checkout-ui-customizer-template.git";if(r===i.EExtensionTypes.postPurchaseCustomizer)return"https://github.com/shoplineos/post-purchase-customizer-template.git";if(r===i.EExtensionTypes.pixelsExtension)return"https://github.com/shoplineos/pixels-extension-template.git";if(r===i.EExtensionTypes.shopperExtension)return"https://github.com/shoplineos/shopper-app-template.git";let e=await (0,f.getFunctionInfo)(r);if(e)return e.templateGit},p=await a();return d.default.log(`Current clone url: ${p}`),{name:t,app:{appKey:n.appKey,appSecret:n.appSecret},partnerId:u.id,type:r,cloneUrl:p,env:o,cwd:s}}async function m(e){let{specification:t}=e,n={headline:["Your extension was created in",{filePath:e.directory},{char:"."}],nextSteps:[],reference:[]};t.type===i.EExtensionTypes.checkoutUiCustomizer&&n.nextSteps.push(["To preview this extension along with the rest of the project, run",{command:"sl extension serve"}]),(0,h.renderSuccess)(n)}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@shoplineos/cli",
3
- "version": "1.4.0",
3
+ "version": "1.4.1",
4
4
  "description": "A CLI tool to build for the Shopline platform",
5
5
  "bin": {
6
6
  "sl": "./bin/index.js"