@shoplineos/cli 1.2.0 → 1.3.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.
|
@@ -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:()=>
|
|
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:()=>n,TARGETS:()=>_,EXTENSION_LINK_PATH:()=>i,APP_VERSION_MANAGE_LINK_PATH:()=>r,TAGS:()=>p,OPTION_TYPES:()=>l,EXTENSION_NAME_LENGTH_LIMIT:()=>c,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:()=>d,SUPPORTED_LOCALE_EXTS:()=>u,EXTENSION_CONFIG_FILE:()=>L,CHECKOUT_UI_CONFIG_FILE:()=>P,PIXELS_CONFIG_FILE:()=>A,FUNCTION_CONFIG_FILE:()=>h,SHOPPER_CONFIG_FILE:()=>x,ERRORS:()=>g,ALL_TEMPLATES:()=>R,ALL_TEMPLATES_3:()=>U,EXTENSION_TYPES:()=>F,DEFAULT_EXTENSION_TYPE:()=>C,DEFAULT_CHECKOUT_UI_CUSTOMIZER_NAME:()=>M,DEFAULT_PIXELS_EXTENSION_NAME:()=>v,DEFAULT_SHOPPER_EXTENSION_NAME:()=>y});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",n=["dev","test","pre","prod"],_=["section","head","body"],i="app/edit-extension",r="app/version-manage/add",p=["article","aside","div","footer","header","section"],l=["checkbox","radio","select"],c=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"],d=["blocks","components","i18n","public","compatibility"],u=[".json"],L=".shopline-cli.yml",P="shopline.ui.customizer.toml",A="shopline.pixels.extension.toml",h="shopline.function.extension.toml",x="shopline.shopper.extension.toml",g={EXTENSION_NAME_LENGTH_LIMIT:(0,e.getMessage)("extension.create.invalid_name",{limit:c}),ENV_INVALID:(0,e.getMessage)("extension.invalid_env",{envs:n.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:L}),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"},R=["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"],U=["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"],F=[{label:"Theme App Extension",value:s.EExtensionTypes.themeAppExtension},{label:"Checkout UI Customizer",value:s.EExtensionTypes.checkoutUiCustomizer},{label:"Shopline Pixels Extension",value:s.EExtensionTypes.pixelsExtension},{label:"Shopline Shopper Extension",value:s.EExtensionTypes.shopperExtension}].filter(Boolean),C="themeAppExtension",M="checkout-ui-customizer",v="pixels-extension",y="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:()=>x,beforeCreate:()=>g,getSelectedExtType:()=>y,buildGenerateOptions:()=>E,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"),
|
|
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:()=>y,buildGenerateOptions:()=>E,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"),a=require("../generate"),u=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 x(e){let t=await g(e),n=await E(t),r=await (0,a.generateExtension)(n);await m(r),h.default.log(`Extension created: ${r.directory}`)}async function g(t){var i;let s=null==t?void 0:t.name,a=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(),x=(0,o.getExtensionName)(s,d);h.default.log(`Current extension name: ${x}`),function(t,n){if(!t)throw new u.AbortError("Please specify an extension name");if(t.length>p.EXTENSION_NAME_LENGTH_LIMIT)throw new u.AbortError(p.ERRORS.EXTENSION_NAME_LENGTH_LIMIT);if((0,e.existsSync)((0,l.joinPath)(n,t)))throw new u.AbortError((0,c.outputContent)`${c.outputToken.cyan(t)} directory already exists.`.value)}(x,a);let g=await (0,r.getSelectedPartner)(),E=await (0,r.getSelectedApp)(g);return{extensionName:x,cwd:a,env:f,partnerInfo:g,appInfo:E,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 E(e){let{extensionName:t,appInfo:n,type:r,env:o,cwd:s,partnerInfo:a}=e,u=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.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 u();return h.default.log(`Current clone url: ${p}`),{name:t,app:{appKey:n.appKey,appSecret:n.appSecret},partnerId:a.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)}
|