@speedkit/cli 2.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.
- package/README.md +775 -0
- package/bin/dev +18 -0
- package/bin/dev.cmd +3 -0
- package/bin/run +4 -0
- package/bin/run.cmd +3 -0
- package/dist/commands/airports_iata.json +1 -0
- package/dist/commands/build-parameter-query.d.ts +15 -0
- package/dist/commands/build-parameter-query.js +95 -0
- package/dist/commands/build-prewarm-query.d.ts +15 -0
- package/dist/commands/build-prewarm-query.js +69 -0
- package/dist/commands/deploy.d.ts +17 -0
- package/dist/commands/deploy.js +39 -0
- package/dist/commands/document-handler.d.ts +16 -0
- package/dist/commands/document-handler.js +36 -0
- package/dist/commands/find-pops.d.ts +17 -0
- package/dist/commands/find-pops.js +84 -0
- package/dist/commands/generate-customer-config.d.ts +10 -0
- package/dist/commands/generate-customer-config.js +29 -0
- package/dist/commands/generate-pop-config.d.ts +27 -0
- package/dist/commands/generate-pop-config.js +231 -0
- package/dist/commands/login.d.ts +10 -0
- package/dist/commands/login.js +35 -0
- package/dist/commands/onboarding.d.ts +16 -0
- package/dist/commands/onboarding.js +25 -0
- package/dist/commands/param-diff.d.ts +16 -0
- package/dist/commands/param-diff.js +111 -0
- package/dist/commands/pop-prewarm.d.ts +17 -0
- package/dist/commands/pop-prewarm.js +80 -0
- package/dist/commands/prewarm.d.ts +40 -0
- package/dist/commands/prewarm.js +127 -0
- package/dist/commands/pull.d.ts +14 -0
- package/dist/commands/pull.js +24 -0
- package/dist/commands/wpt-launcher.d.ts +21 -0
- package/dist/commands/wpt-launcher.js +79 -0
- package/dist/helpers/CustomerConfig.d.ts +51 -0
- package/dist/helpers/CustomerConfig.js +150 -0
- package/dist/helpers/build-query-helper.d.ts +32 -0
- package/dist/helpers/build-query-helper.js +216 -0
- package/dist/helpers/cli-config.d.ts +22 -0
- package/dist/helpers/cli-config.js +85 -0
- package/dist/helpers/file-helper.d.ts +8 -0
- package/dist/helpers/file-helper.js +63 -0
- package/dist/helpers/get-parsed-config.d.ts +11 -0
- package/dist/helpers/get-parsed-config.js +63 -0
- package/dist/helpers/getChromePath.d.ts +7 -0
- package/dist/helpers/getChromePath.js +27 -0
- package/dist/helpers/isDirectory.d.ts +1 -0
- package/dist/helpers/isDirectory.js +17 -0
- package/dist/helpers/isExecutable.d.ts +1 -0
- package/dist/helpers/isExecutable.js +15 -0
- package/dist/helpers/isFile.d.ts +1 -0
- package/dist/helpers/isFile.js +17 -0
- package/dist/helpers/logging-helper.d.ts +12 -0
- package/dist/helpers/logging-helper.js +27 -0
- package/dist/helpers/normalize.d.ts +40 -0
- package/dist/helpers/normalize.js +112 -0
- package/dist/helpers/race.d.ts +1 -0
- package/dist/helpers/race.js +16 -0
- package/dist/helpers/safe.d.ts +10 -0
- package/dist/helpers/safe.js +34 -0
- package/dist/helpers/scrape.d.ts +1 -0
- package/dist/helpers/scrape.js +11 -0
- package/dist/helpers/speedKitRuleToRegExp.d.ts +1 -0
- package/dist/helpers/speedKitRuleToRegExp.js +10 -0
- package/dist/helpers/watchFiles.d.ts +1 -0
- package/dist/helpers/watchFiles.js +20 -0
- package/dist/models/cli-parameters.d.ts +73 -0
- package/dist/models/cli-parameters.js +82 -0
- package/dist/models/files.d.ts +20 -0
- package/dist/models/files.js +23 -0
- package/dist/models/install.d.ts +24 -0
- package/dist/models/install.js +2 -0
- package/dist/services/athena-service.d.ts +30 -0
- package/dist/services/athena-service.js +139 -0
- package/dist/services/bundler/bundle-service-factory.d.ts +4 -0
- package/dist/services/bundler/bundle-service-factory.js +10 -0
- package/dist/services/bundler/bundle-service.d.ts +25 -0
- package/dist/services/bundler/bundle-service.js +84 -0
- package/dist/services/bundler/index.d.ts +2 -0
- package/dist/services/bundler/index.js +5 -0
- package/dist/services/cli/cli-service-factory.d.ts +5 -0
- package/dist/services/cli/cli-service-factory.js +14 -0
- package/dist/services/cli/cli-service-model.d.ts +27 -0
- package/dist/services/cli/cli-service-model.js +9 -0
- package/dist/services/cli/cli-service.d.ts +37 -0
- package/dist/services/cli/cli-service.js +123 -0
- package/dist/services/cli/error/cli-type-error.d.ts +3 -0
- package/dist/services/cli/error/cli-type-error.js +7 -0
- package/dist/services/cli/hooks.d.ts +11 -0
- package/dist/services/cli/hooks.js +33 -0
- package/dist/services/cli/index.d.ts +3 -0
- package/dist/services/cli/index.js +6 -0
- package/dist/services/config-api/client.d.ts +16 -0
- package/dist/services/config-api/client.js +54 -0
- package/dist/services/config-api/config-api-service.d.ts +16 -0
- package/dist/services/config-api/config-api-service.js +56 -0
- package/dist/services/config-api/context/config-api-context.d.ts +5 -0
- package/dist/services/config-api/context/config-api-context.js +9 -0
- package/dist/services/config-api/error/json-response-error.d.ts +2 -0
- package/dist/services/config-api/error/json-response-error.js +5 -0
- package/dist/services/config-api/error/login-error.d.ts +5 -0
- package/dist/services/config-api/error/login-error.js +12 -0
- package/dist/services/config-api/factory/config-api-service-factory.d.ts +10 -0
- package/dist/services/config-api/factory/config-api-service-factory.js +38 -0
- package/dist/services/config-api/factory/entity-manager-factory.d.ts +5 -0
- package/dist/services/config-api/factory/entity-manager-factory.js +21 -0
- package/dist/services/config-api/interface/config-api-context-interface.d.ts +4 -0
- package/dist/services/config-api/interface/config-api-context-interface.js +2 -0
- package/dist/services/config-api/interface/request-extension-interface.d.ts +5 -0
- package/dist/services/config-api/interface/request-extension-interface.js +2 -0
- package/dist/services/config-api-service.d.ts +18 -0
- package/dist/services/config-api-service.js +96 -0
- package/dist/services/context/app-context.d.ts +1 -0
- package/dist/services/context/app-context.js +2 -0
- package/dist/services/context/error/context-runtime-error.d.ts +3 -0
- package/dist/services/context/error/context-runtime-error.js +7 -0
- package/dist/services/context/interface/context-interface.d.ts +2 -0
- package/dist/services/context/interface/context-interface.js +2 -0
- package/dist/services/customer-config/customer-config-service-context.d.ts +5 -0
- package/dist/services/customer-config/customer-config-service-context.js +15 -0
- package/dist/services/customer-config/customer-config-service-factory.d.ts +8 -0
- package/dist/services/customer-config/customer-config-service-factory.js +24 -0
- package/dist/services/customer-config/customer-config-service-model.d.ts +39 -0
- package/dist/services/customer-config/customer-config-service-model.js +23 -0
- package/dist/services/customer-config/customer-config-service.d.ts +27 -0
- package/dist/services/customer-config/customer-config-service.js +263 -0
- package/dist/services/customer-config/index.d.ts +4 -0
- package/dist/services/customer-config/index.js +7 -0
- package/dist/services/customer-config/templates/config_SpeedKit.js.hbs +351 -0
- package/dist/services/customer-config/templates/config_customer.js.hbs +75 -0
- package/dist/services/customer-config/templates/config_documentHandler.js.hbs +162 -0
- package/dist/services/customer-config/templates/config_dynamicBlocks.es6.hbs +263 -0
- package/dist/services/customer-config/templates/config_dynamicStyles.css.hbs +116 -0
- package/dist/services/customer-config/templates/config_loadHandler.js.hbs +394 -0
- package/dist/services/customer-config/templates/deploymentDetection.es6.hbs +262 -0
- package/dist/services/customer-config/templates/downtimeDetection.js.hbs +110 -0
- package/dist/services/deploy/builder/install-resource-builder.d.ts +14 -0
- package/dist/services/deploy/builder/install-resource-builder.js +48 -0
- package/dist/services/deploy/checks/post-deploy/revalidated-module-check.d.ts +11 -0
- package/dist/services/deploy/checks/post-deploy/revalidated-module-check.js +30 -0
- package/dist/services/deploy/checks/post-deploy/save-files-check.d.ts +9 -0
- package/dist/services/deploy/checks/post-deploy/save-files-check.js +25 -0
- package/dist/services/deploy/context/deploy-context.d.ts +12 -0
- package/dist/services/deploy/context/deploy-context.js +26 -0
- package/dist/services/deploy/deploy-service-factory.d.ts +15 -0
- package/dist/services/deploy/deploy-service-factory.js +68 -0
- package/dist/services/deploy/deploy-service.d.ts +17 -0
- package/dist/services/deploy/deploy-service.js +63 -0
- package/dist/services/deploy/error/create-find-temp-directory-error.d.ts +4 -0
- package/dist/services/deploy/error/create-find-temp-directory-error.js +10 -0
- package/dist/services/deploy/error/deploy-app-error.d.ts +2 -0
- package/dist/services/deploy/error/deploy-app-error.js +5 -0
- package/dist/services/deploy/error/no-active-installation-error.d.ts +4 -0
- package/dist/services/deploy/error/no-active-installation-error.js +10 -0
- package/dist/services/deploy/handler/customer-config-handler.d.ts +21 -0
- package/dist/services/deploy/handler/customer-config-handler.js +85 -0
- package/dist/services/deploy/handler/install-resource-handler.d.ts +25 -0
- package/dist/services/deploy/handler/install-resource-handler.js +104 -0
- package/dist/services/deploy/handler/install-resource-modifier/deleted-file-check.d.ts +13 -0
- package/dist/services/deploy/handler/install-resource-modifier/deleted-file-check.js +51 -0
- package/dist/services/deploy/handler/module-handler.d.ts +14 -0
- package/dist/services/deploy/handler/module-handler.js +81 -0
- package/dist/services/deploy/handler/module-modifier/deployment-detection-modifier.d.ts +9 -0
- package/dist/services/deploy/handler/module-modifier/deployment-detection-modifier.js +24 -0
- package/dist/services/deploy/handler/server-config-handler.d.ts +12 -0
- package/dist/services/deploy/handler/server-config-handler.js +63 -0
- package/dist/services/deploy/interface/deploy-handler-interface.d.ts +6 -0
- package/dist/services/deploy/interface/deploy-handler-interface.js +2 -0
- package/dist/services/deploy/interface/install-configs.d.ts +11 -0
- package/dist/services/deploy/interface/install-configs.js +2 -0
- package/dist/services/deploy/interface/install-resource-processor-interface.d.ts +5 -0
- package/dist/services/deploy/interface/install-resource-processor-interface.js +2 -0
- package/dist/services/deploy/interface/install.d.ts +14 -0
- package/dist/services/deploy/interface/install.js +2 -0
- package/dist/services/deploy/interface/post-deploy-check-interface.d.ts +3 -0
- package/dist/services/deploy/interface/post-deploy-check-interface.js +2 -0
- package/dist/services/deploy/interface/runtime-modifier.d.ts +6 -0
- package/dist/services/deploy/interface/runtime-modifier.js +2 -0
- package/dist/services/deploy/interface/validate-origins-response.d.ts +4 -0
- package/dist/services/deploy/interface/validate-origins-response.js +2 -0
- package/dist/services/diff/diff-model.d.ts +5 -0
- package/dist/services/diff/diff-model.js +12 -0
- package/dist/services/diff/diff-service-factory.d.ts +7 -0
- package/dist/services/diff/diff-service-factory.js +20 -0
- package/dist/services/diff/diff-service.d.ts +34 -0
- package/dist/services/diff/diff-service.js +134 -0
- package/dist/services/diff/index.d.ts +3 -0
- package/dist/services/diff/index.js +6 -0
- package/dist/services/diff-service.d.ts +24 -0
- package/dist/services/diff-service.js +112 -0
- package/dist/services/document-handler-runtime/context/document-handler-runtime-context.d.ts +23 -0
- package/dist/services/document-handler-runtime/context/document-handler-runtime-context.js +41 -0
- package/dist/services/document-handler-runtime/document-handler-runtime-service.d.ts +32 -0
- package/dist/services/document-handler-runtime/document-handler-runtime-service.js +220 -0
- package/dist/services/document-handler-runtime/document-handler-server.d.ts +42 -0
- package/dist/services/document-handler-runtime/document-handler-server.js +225 -0
- package/dist/services/document-handler-runtime/error/handler/required-file-not-found-handler.d.ts +6 -0
- package/dist/services/document-handler-runtime/error/handler/required-file-not-found-handler.js +14 -0
- package/dist/services/document-handler-runtime/error/required-file-not-found-error.d.ts +3 -0
- package/dist/services/document-handler-runtime/error/required-file-not-found-error.js +7 -0
- package/dist/services/document-handler-runtime/factory/document-handler-runtime-service-factory.d.ts +24 -0
- package/dist/services/document-handler-runtime/factory/document-handler-runtime-service-factory.js +106 -0
- package/dist/services/document-handler-runtime/interface/document-handler-runtime-config-interface.d.ts +3 -0
- package/dist/services/document-handler-runtime/interface/document-handler-runtime-config-interface.js +6 -0
- package/dist/services/document-handler-runtime/interface/template-context-interface.d.ts +3 -0
- package/dist/services/document-handler-runtime/interface/template-context-interface.js +2 -0
- package/dist/services/document-handler-runtime/interface/template-interface.d.ts +6 -0
- package/dist/services/document-handler-runtime/interface/template-interface.js +2 -0
- package/dist/services/document-handler-runtime/interface/template-param-interface.d.ts +4 -0
- package/dist/services/document-handler-runtime/interface/template-param-interface.js +2 -0
- package/dist/services/document-handler-runtime/templates/abstract-template.d.ts +9 -0
- package/dist/services/document-handler-runtime/templates/abstract-template.js +18 -0
- package/dist/services/document-handler-runtime/templates/database-mock.d.ts +6 -0
- package/dist/services/document-handler-runtime/templates/database-mock.js +111 -0
- package/dist/services/document-handler-runtime/templates/execute-document-handler.d.ts +6 -0
- package/dist/services/document-handler-runtime/templates/execute-document-handler.js +76 -0
- package/dist/services/document-handler-runtime/templates/orestes-mock.d.ts +9 -0
- package/dist/services/document-handler-runtime/templates/orestes-mock.js +168 -0
- package/dist/services/document-handler-runtime/templates/package-json.d.ts +8 -0
- package/dist/services/document-handler-runtime/templates/package-json.js +21 -0
- package/dist/services/document-handler-runtime/templates/test.d.ts +6 -0
- package/dist/services/document-handler-runtime/templates/test.js +63 -0
- package/dist/services/error-handling/abstract/abstract-async-error-handling-factory.d.ts +6 -0
- package/dist/services/error-handling/abstract/abstract-async-error-handling-factory.js +19 -0
- package/dist/services/error-handling/abstract/abstract-async-error-handling-service.d.ts +6 -0
- package/dist/services/error-handling/abstract/abstract-async-error-handling-service.js +18 -0
- package/dist/services/error-handling/abstract/abstract-error-handling-factory.d.ts +6 -0
- package/dist/services/error-handling/abstract/abstract-error-handling-factory.js +19 -0
- package/dist/services/error-handling/abstract/abstract-error-handling-service.d.ts +6 -0
- package/dist/services/error-handling/abstract/abstract-error-handling-service.js +19 -0
- package/dist/services/error-handling/error/application-error.d.ts +5 -0
- package/dist/services/error-handling/error/application-error.js +11 -0
- package/dist/services/error-handling/error/handler/default-error-handler.d.ts +5 -0
- package/dist/services/error-handling/error/handler/default-error-handler.js +13 -0
- package/dist/services/error-handling/error-handling-service.d.ts +7 -0
- package/dist/services/error-handling/error-handling-service.js +27 -0
- package/dist/services/error-handling/factory/error-handling-factory.d.ts +8 -0
- package/dist/services/error-handling/factory/error-handling-factory.js +21 -0
- package/dist/services/error-handling/interface/error-context-interface.d.ts +6 -0
- package/dist/services/error-handling/interface/error-context-interface.js +2 -0
- package/dist/services/error-handling/interface/error-handler-interface.d.ts +5 -0
- package/dist/services/error-handling/interface/error-handler-interface.js +2 -0
- package/dist/services/error-handling/interface/error-handling-factory-interface.d.ts +8 -0
- package/dist/services/error-handling/interface/error-handling-factory-interface.js +2 -0
- package/dist/services/error-handling/interface/error-handling-service-interface.d.ts +8 -0
- package/dist/services/error-handling/interface/error-handling-service-interface.js +2 -0
- package/dist/services/integration-api/context/integration-api-context.d.ts +9 -0
- package/dist/services/integration-api/context/integration-api-context.js +20 -0
- package/dist/services/integration-api/error/customer-config-error.d.ts +2 -0
- package/dist/services/integration-api/error/customer-config-error.js +5 -0
- package/dist/services/integration-api/error/customer-config-legacy-error.d.ts +3 -0
- package/dist/services/integration-api/error/customer-config-legacy-error.js +7 -0
- package/dist/services/integration-api/error/handler/customer-config-handler.d.ts +5 -0
- package/dist/services/integration-api/error/handler/customer-config-handler.js +19 -0
- package/dist/services/integration-api/error/handler/customer-config-legacy-handler.d.ts +6 -0
- package/dist/services/integration-api/error/handler/customer-config-legacy-handler.js +24 -0
- package/dist/services/integration-api/error/handler/origin-handler.d.ts +6 -0
- package/dist/services/integration-api/error/handler/origin-handler.js +22 -0
- package/dist/services/integration-api/error/load-customer-error.d.ts +4 -0
- package/dist/services/integration-api/error/load-customer-error.js +10 -0
- package/dist/services/integration-api/error/mandatory-file-missing-error.d.ts +3 -0
- package/dist/services/integration-api/error/mandatory-file-missing-error.js +8 -0
- package/dist/services/integration-api/error/origin-error.d.ts +3 -0
- package/dist/services/integration-api/error/origin-error.js +7 -0
- package/dist/services/integration-api/external/external-file-reader.d.ts +4 -0
- package/dist/services/integration-api/external/external-file-reader.js +17 -0
- package/dist/services/integration-api/factory/integration-api-service-factory.d.ts +13 -0
- package/dist/services/integration-api/factory/integration-api-service-factory.js +55 -0
- package/dist/services/integration-api/file-list.d.ts +18 -0
- package/dist/services/integration-api/file-list.js +79 -0
- package/dist/services/integration-api/file-reader.d.ts +15 -0
- package/dist/services/integration-api/file-reader.js +97 -0
- package/dist/services/integration-api/file-writer.d.ts +9 -0
- package/dist/services/integration-api/file-writer.js +27 -0
- package/dist/services/integration-api/handler/customer-config-handler.d.ts +16 -0
- package/dist/services/integration-api/handler/customer-config-handler.js +55 -0
- package/dist/services/integration-api/handler/file-handler.d.ts +9 -0
- package/dist/services/integration-api/handler/file-handler.js +20 -0
- package/dist/services/integration-api/handler/install-resource-handler.d.ts +33 -0
- package/dist/services/integration-api/handler/install-resource-handler.js +67 -0
- package/dist/services/integration-api/handler/module-handler.d.ts +12 -0
- package/dist/services/integration-api/handler/module-handler.js +20 -0
- package/dist/services/integration-api/handler/server-config-handler.d.ts +8 -0
- package/dist/services/integration-api/handler/server-config-handler.js +21 -0
- package/dist/services/integration-api/integration-api-model.d.ts +89 -0
- package/dist/services/integration-api/integration-api-model.js +2 -0
- package/dist/services/integration-api/integration-api-service.d.ts +21 -0
- package/dist/services/integration-api/integration-api-service.js +76 -0
- package/dist/services/integration-api/struct/customer-config-file.d.ts +10 -0
- package/dist/services/integration-api/struct/customer-config-file.js +32 -0
- package/dist/services/integration-api/struct/customer-config.d.ts +22 -0
- package/dist/services/integration-api/struct/customer-config.js +67 -0
- package/dist/services/integration-api/struct/file.d.ts +19 -0
- package/dist/services/integration-api/struct/file.js +61 -0
- package/dist/services/integration-api/struct/install-resource-file.d.ts +6 -0
- package/dist/services/integration-api/struct/install-resource-file.js +12 -0
- package/dist/services/integration-api/struct/module-file.d.ts +5 -0
- package/dist/services/integration-api/struct/module-file.js +10 -0
- package/dist/services/integration-api/struct/ro-file.d.ts +13 -0
- package/dist/services/integration-api/struct/ro-file.js +26 -0
- package/dist/services/integration-api/struct/server-config-file.d.ts +9 -0
- package/dist/services/integration-api/struct/server-config-file.js +22 -0
- package/dist/services/integration-api/struct/virtual-file.d.ts +14 -0
- package/dist/services/integration-api/struct/virtual-file.js +28 -0
- package/dist/services/integration-api/validator/customer-config-validator.d.ts +5 -0
- package/dist/services/integration-api/validator/customer-config-validator.js +23 -0
- package/dist/services/integration-api/validator/mandatory-files-validator.d.ts +7 -0
- package/dist/services/integration-api/validator/mandatory-files-validator.js +39 -0
- package/dist/services/integration-api/virtual/external-recipe.d.ts +9 -0
- package/dist/services/integration-api/virtual/external-recipe.js +19 -0
- package/dist/services/integration-api/virtual/virtual-file-handler.d.ts +7 -0
- package/dist/services/integration-api/virtual/virtual-file-handler.js +38 -0
- package/dist/services/onboarding/browser/abort-response.d.ts +5 -0
- package/dist/services/onboarding/browser/abort-response.js +10 -0
- package/dist/services/onboarding/browser/baqend-response.d.ts +12 -0
- package/dist/services/onboarding/browser/baqend-response.js +52 -0
- package/dist/services/onboarding/browser/origin-response.d.ts +8 -0
- package/dist/services/onboarding/browser/origin-response.js +20 -0
- package/dist/services/onboarding/config-renderer/install-file-recipe.d.ts +7 -0
- package/dist/services/onboarding/config-renderer/install-file-recipe.js +13 -0
- package/dist/services/onboarding/config-renderer/speed-kit-install-context.d.ts +22 -0
- package/dist/services/onboarding/config-renderer/speed-kit-install-context.js +78 -0
- package/dist/services/onboarding/dashboard/athena-service.d.ts +11 -0
- package/dist/services/onboarding/dashboard/athena-service.js +70 -0
- package/dist/services/onboarding/dashboard/frontend-dist/assets/index-87b53ed4.css +1 -0
- package/dist/services/onboarding/dashboard/frontend-dist/assets/main-274b5625.js +9 -0
- package/dist/services/onboarding/dashboard/frontend-dist/index.html +18 -0
- package/dist/services/onboarding/dashboard/index.d.ts +16 -0
- package/dist/services/onboarding/dashboard/index.js +78 -0
- package/dist/services/onboarding/dashboard/param-query-builder.d.ts +9 -0
- package/dist/services/onboarding/dashboard/param-query-builder.js +67 -0
- package/dist/services/onboarding/dashboard/request-diff-service.d.ts +11 -0
- package/dist/services/onboarding/dashboard/request-diff-service.js +59 -0
- package/dist/services/onboarding/error/vm-error.d.ts +2 -0
- package/dist/services/onboarding/error/vm-error.js +6 -0
- package/dist/services/onboarding/fetch-event-handler.d.ts +19 -0
- package/dist/services/onboarding/fetch-event-handler.js +155 -0
- package/dist/services/onboarding/fetch-events/customer-domain-document-response.d.ts +24 -0
- package/dist/services/onboarding/fetch-events/customer-domain-document-response.js +118 -0
- package/dist/services/onboarding/fetch-events/customer-service-worker-js.d.ts +14 -0
- package/dist/services/onboarding/fetch-events/customer-service-worker-js.js +30 -0
- package/dist/services/onboarding/fetch-events/dashboard-request.d.ts +15 -0
- package/dist/services/onboarding/fetch-events/dashboard-request.js +29 -0
- package/dist/services/onboarding/fetch-events/speed-kit-asset-request.d.ts +26 -0
- package/dist/services/onboarding/fetch-events/speed-kit-asset-request.js +138 -0
- package/dist/services/onboarding/fetch-events/speed-kit-install-html.d.ts +15 -0
- package/dist/services/onboarding/fetch-events/speed-kit-install-html.js +49 -0
- package/dist/services/onboarding/fetch-events/speed-kit-install-js.d.ts +22 -0
- package/dist/services/onboarding/fetch-events/speed-kit-install-js.js +62 -0
- package/dist/services/onboarding/fetch-events/speed-kit-rum-pi-request.d.ts +21 -0
- package/dist/services/onboarding/fetch-events/speed-kit-rum-pi-request.js +43 -0
- package/dist/services/onboarding/fetch-events/speed-kit-service-worker-js.d.ts +17 -0
- package/dist/services/onboarding/fetch-events/speed-kit-service-worker-js.js +27 -0
- package/dist/services/onboarding/file-events/fileWatcher.d.ts +28 -0
- package/dist/services/onboarding/file-events/fileWatcher.js +133 -0
- package/dist/services/onboarding/index.d.ts +3 -0
- package/dist/services/onboarding/index.js +8 -0
- package/dist/services/onboarding/onboarding-model.d.ts +30 -0
- package/dist/services/onboarding/onboarding-model.js +53 -0
- package/dist/services/onboarding/onboarding-service-factory.d.ts +16 -0
- package/dist/services/onboarding/onboarding-service-factory.js +163 -0
- package/dist/services/onboarding/onboarding-service.d.ts +31 -0
- package/dist/services/onboarding/onboarding-service.js +130 -0
- package/dist/services/onboarding/request-cache/cache.d.ts +15 -0
- package/dist/services/onboarding/request-cache/cache.js +32 -0
- package/dist/services/onboarding/templates/install-speed-kit-html-template.d.ts +4 -0
- package/dist/services/onboarding/templates/install-speed-kit-html-template.js +264 -0
- package/dist/services/onboarding/templates/install-speed-kit-js-template.d.ts +4 -0
- package/dist/services/onboarding/templates/install-speed-kit-js-template.js +41 -0
- package/dist/services/onboarding/todo-collector.d.ts +18 -0
- package/dist/services/onboarding/todo-collector.js +48 -0
- package/dist/services/prewarm-service.d.ts +5 -0
- package/dist/services/prewarm-service.js +57 -0
- package/dist/services/pull/index.d.ts +3 -0
- package/dist/services/pull/index.js +6 -0
- package/dist/services/pull/pull-service-factory.d.ts +12 -0
- package/dist/services/pull/pull-service-factory.js +44 -0
- package/dist/services/pull/pull-service-model.d.ts +43 -0
- package/dist/services/pull/pull-service-model.js +27 -0
- package/dist/services/pull/pull-service.d.ts +18 -0
- package/dist/services/pull/pull-service.js +106 -0
- package/dist/templates/pops.js +97 -0
- package/dist/templates/speedKit.Revalidated.js +86 -0
- package/oclif.manifest.json +700 -0
- package/package.json +128 -0
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const tslib_1 = require("tslib");
|
|
4
|
+
const config_api_service_1 = tslib_1.__importDefault(require("../config-api-service"));
|
|
5
|
+
const client_1 = tslib_1.__importDefault(require("../client"));
|
|
6
|
+
const entity_manager_factory_1 = tslib_1.__importDefault(require("./entity-manager-factory"));
|
|
7
|
+
const context_runtime_error_1 = tslib_1.__importDefault(require("../../context/error/context-runtime-error"));
|
|
8
|
+
const node_fs_1 = require("node:fs");
|
|
9
|
+
const os_1 = tslib_1.__importDefault(require("os"));
|
|
10
|
+
const path_1 = tslib_1.__importDefault(require("path"));
|
|
11
|
+
class ConfigApiServiceFactory {
|
|
12
|
+
context;
|
|
13
|
+
service = undefined;
|
|
14
|
+
constructor(context) {
|
|
15
|
+
this.context = context;
|
|
16
|
+
}
|
|
17
|
+
getService() {
|
|
18
|
+
if (!(this.service instanceof config_api_service_1.default)) {
|
|
19
|
+
this.buildService();
|
|
20
|
+
}
|
|
21
|
+
return this.service;
|
|
22
|
+
}
|
|
23
|
+
buildService() {
|
|
24
|
+
if (!this.context.app) {
|
|
25
|
+
throw new context_runtime_error_1.default({ message: 'app is undefined' });
|
|
26
|
+
}
|
|
27
|
+
this.createLoginTokenFileIfNotExists();
|
|
28
|
+
const entityManagerFactory = new entity_manager_factory_1.default();
|
|
29
|
+
const client = new client_1.default(this.context.app, entityManagerFactory);
|
|
30
|
+
this.service = new config_api_service_1.default(this.context.app, client);
|
|
31
|
+
}
|
|
32
|
+
createLoginTokenFileIfNotExists() {
|
|
33
|
+
if (!(0, node_fs_1.existsSync)(path_1.default.resolve(os_1.default.homedir(), ".baqend"))) {
|
|
34
|
+
(0, node_fs_1.writeFileSync)(path_1.default.resolve(os_1.default.homedir(), ".baqend"), "{}");
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
exports.default = ConfigApiServiceFactory;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const tslib_1 = require("tslib");
|
|
4
|
+
const cli_1 = require("baqend/cli");
|
|
5
|
+
const login_error_1 = tslib_1.__importDefault(require("../error/login-error"));
|
|
6
|
+
class EntityManagerFactory {
|
|
7
|
+
EntityManager;
|
|
8
|
+
async getEntityManager(app) {
|
|
9
|
+
if (this.EntityManager) {
|
|
10
|
+
return this.EntityManager;
|
|
11
|
+
}
|
|
12
|
+
try {
|
|
13
|
+
this.EntityManager = await cli_1.account.login({ app });
|
|
14
|
+
return this.EntityManager;
|
|
15
|
+
}
|
|
16
|
+
catch (e) {
|
|
17
|
+
throw new login_error_1.default(app);
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
exports.default = EntityManagerFactory;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { EntityManager } from 'baqend';
|
|
2
|
+
import Install from '../models/install';
|
|
3
|
+
export default class ConfigApiService {
|
|
4
|
+
private db;
|
|
5
|
+
private readonly app;
|
|
6
|
+
private readonly requestInit;
|
|
7
|
+
constructor(db: EntityManager, app: string);
|
|
8
|
+
fetchActiveInstall(configName: string): Promise<Install | null>;
|
|
9
|
+
activateInstall(install: Install): Promise<Install>;
|
|
10
|
+
updateInstall(install: Install): Promise<Install | null>;
|
|
11
|
+
createNewInstall(domain: string, origins: string[]): Promise<Install>;
|
|
12
|
+
cloneInstall(install: Install): Promise<Install>;
|
|
13
|
+
getRemoteModule(moduleName: string): Promise<string>;
|
|
14
|
+
saveRemoteModule(moduleCode: string, moduleName: string): Promise<string>;
|
|
15
|
+
getRemoteServerConfig(): Promise<string>;
|
|
16
|
+
saveRemoteServerConfig(localPath: string, configurationVersion: string): Promise<void>;
|
|
17
|
+
fetchAndGetBody(url: string, requestInit?: {}): Promise<any>;
|
|
18
|
+
}
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const tslib_1 = require("tslib");
|
|
4
|
+
const fs = tslib_1.__importStar(require("fs-extra"));
|
|
5
|
+
const fetch = require('node-fetch');
|
|
6
|
+
const https = require('https');
|
|
7
|
+
const agent = new https.Agent({
|
|
8
|
+
rejectUnauthorized: false,
|
|
9
|
+
keepAlive: true,
|
|
10
|
+
});
|
|
11
|
+
/* eslint-disable no-console */
|
|
12
|
+
class ConfigApiService {
|
|
13
|
+
db;
|
|
14
|
+
app;
|
|
15
|
+
requestInit;
|
|
16
|
+
constructor(db, app) {
|
|
17
|
+
this.db = db;
|
|
18
|
+
this.app = app;
|
|
19
|
+
this.requestInit = {
|
|
20
|
+
agent,
|
|
21
|
+
method: 'GET',
|
|
22
|
+
headers: {
|
|
23
|
+
Host: `${this.app}.app.baqend.com`,
|
|
24
|
+
authorization: `BAT ${this.db.token}`,
|
|
25
|
+
'Content-Type': 'application/json;charset=UTF-8',
|
|
26
|
+
},
|
|
27
|
+
timeout: 10000,
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
async fetchActiveInstall(configName) {
|
|
31
|
+
const urlPath = `https://${this.app}.app.baqend.com/v1/speedkit/installation?domain=${configName}&status=active`;
|
|
32
|
+
const body = await this.fetchAndGetBody(urlPath);
|
|
33
|
+
return body[0];
|
|
34
|
+
}
|
|
35
|
+
async activateInstall(install) {
|
|
36
|
+
const activateUrl = `https://${this.app}.app.baqend.com/v1/speedkit/installation/${install.domain}/${install.configVersion}/activate`;
|
|
37
|
+
const postInit = Object.assign({}, this.requestInit, { body: '{}', method: 'POST' });
|
|
38
|
+
return (await this.fetchAndGetBody(activateUrl, postInit));
|
|
39
|
+
}
|
|
40
|
+
// Update live version with the osk local body
|
|
41
|
+
async updateInstall(install) {
|
|
42
|
+
const postInit = Object.assign({}, this.requestInit, { body: JSON.stringify(install), method: 'PUT' });
|
|
43
|
+
const updateUrl = `https://${this.app}.app.baqend.com/v1/speedkit/installation/${install.domain}/${install.configVersion}`;
|
|
44
|
+
return (await this.fetchAndGetBody(updateUrl, postInit));
|
|
45
|
+
}
|
|
46
|
+
async createNewInstall(domain, origins) {
|
|
47
|
+
const postInit = Object.assign({}, this.requestInit, { body: `{origins: ${JSON.stringify(origins)}}`, method: 'POST' });
|
|
48
|
+
const updateUrl = `https://${this.app}.app.baqend.com/v1/speedkit/installation/${domain}`;
|
|
49
|
+
const body = await this.fetchAndGetBody(updateUrl, postInit);
|
|
50
|
+
return body;
|
|
51
|
+
}
|
|
52
|
+
async cloneInstall(install) {
|
|
53
|
+
const postInit = Object.assign({}, this.requestInit, { body: '{}', method: 'POST' });
|
|
54
|
+
const cloneUrl = `https://${this.app}.app.baqend.com/v1/speedkit/installation/${install.domain}/${install.configVersion}/clone`;
|
|
55
|
+
const body = await this.fetchAndGetBody(cloneUrl, postInit);
|
|
56
|
+
return body;
|
|
57
|
+
}
|
|
58
|
+
async getRemoteModule(moduleName) {
|
|
59
|
+
return await this.db.code.loadCode(moduleName, 'module');
|
|
60
|
+
}
|
|
61
|
+
async saveRemoteModule(moduleCode, moduleName) {
|
|
62
|
+
return await this.db.code.saveCode(moduleName, 'module', moduleCode);
|
|
63
|
+
}
|
|
64
|
+
async getRemoteServerConfig() {
|
|
65
|
+
const urlPath = `https://${this.app}.app.baqend.com/v1/config`;
|
|
66
|
+
const body = await this.fetchAndGetBody(urlPath);
|
|
67
|
+
return JSON.stringify(body, null, '\t');
|
|
68
|
+
}
|
|
69
|
+
async saveRemoteServerConfig(localPath, configurationVersion) {
|
|
70
|
+
const localServerConfigContent = fs.readFileSync(localPath, 'utf-8');
|
|
71
|
+
const localServerConfig = JSON.parse(localServerConfigContent);
|
|
72
|
+
localServerConfig.revision.version = configurationVersion;
|
|
73
|
+
const urlPath = `https://${this.app}.app.baqend.com/v1/config`;
|
|
74
|
+
const putInit = Object.assign({}, this.requestInit, {
|
|
75
|
+
body: JSON.stringify(localServerConfig),
|
|
76
|
+
method: 'PUT',
|
|
77
|
+
headers: {
|
|
78
|
+
Host: `${this.app}.app.baqend.com`,
|
|
79
|
+
// Origin: "origin",
|
|
80
|
+
authorization: `BAT ${this.db.token}`,
|
|
81
|
+
'Content-Type': 'application/json',
|
|
82
|
+
'If-Match': configurationVersion,
|
|
83
|
+
},
|
|
84
|
+
});
|
|
85
|
+
await this.fetchAndGetBody(urlPath, putInit);
|
|
86
|
+
}
|
|
87
|
+
async fetchAndGetBody(url, requestInit = this.requestInit) {
|
|
88
|
+
const res = await fetch(url, requestInit);
|
|
89
|
+
const body = await res.json();
|
|
90
|
+
if (res.status !== 200) {
|
|
91
|
+
throw new Error(body.message);
|
|
92
|
+
}
|
|
93
|
+
return body;
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
exports.default = ConfigApiService;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const tslib_1 = require("tslib");
|
|
4
|
+
const application_error_1 = tslib_1.__importDefault(require("../../error-handling/error/application-error"));
|
|
5
|
+
class ContextRuntimeError extends application_error_1.default {
|
|
6
|
+
}
|
|
7
|
+
exports.default = ContextRuntimeError;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CustomerConfigServiceContext = void 0;
|
|
4
|
+
const cli_parameters_1 = require("../../models/cli-parameters");
|
|
5
|
+
class CustomerConfigServiceContext {
|
|
6
|
+
appName;
|
|
7
|
+
customersDir;
|
|
8
|
+
constructor(appName = '', customersDir = cli_parameters_1.CLIParametersExample.CustomersDir) {
|
|
9
|
+
this.appName = appName;
|
|
10
|
+
this.customersDir = customersDir;
|
|
11
|
+
this.appName = appName;
|
|
12
|
+
this.customersDir = customersDir;
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
exports.CustomerConfigServiceContext = CustomerConfigServiceContext;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { CustomerConfigService, CustomerConfigServiceContext } from ".";
|
|
2
|
+
export declare class CustomerConfigServiceFactory {
|
|
3
|
+
private readonly context;
|
|
4
|
+
private service?;
|
|
5
|
+
constructor(context: CustomerConfigServiceContext);
|
|
6
|
+
buildService(): Promise<CustomerConfigService>;
|
|
7
|
+
private build;
|
|
8
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CustomerConfigServiceFactory = void 0;
|
|
4
|
+
const cli_1 = require("../cli");
|
|
5
|
+
const _1 = require(".");
|
|
6
|
+
class CustomerConfigServiceFactory {
|
|
7
|
+
context;
|
|
8
|
+
service;
|
|
9
|
+
constructor(context) {
|
|
10
|
+
this.context = context;
|
|
11
|
+
}
|
|
12
|
+
async buildService() {
|
|
13
|
+
if (!(this.service instanceof _1.CustomerConfigService)) {
|
|
14
|
+
await this.build();
|
|
15
|
+
}
|
|
16
|
+
return this.service;
|
|
17
|
+
}
|
|
18
|
+
async build() {
|
|
19
|
+
const context = this.context;
|
|
20
|
+
const cliService = new cli_1.CliServiceFactory().getService();
|
|
21
|
+
this.service = new _1.CustomerConfigService(context, cliService);
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
exports.CustomerConfigServiceFactory = CustomerConfigServiceFactory;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
export declare enum DirectoryOverwriteOption {
|
|
2
|
+
NEW_NAME = "Choose a new directory name",
|
|
3
|
+
OVERWRITE_FILE_WISE = "Keep and overwrite file-wise (ask)",
|
|
4
|
+
OVERWRITE_COMPLETELY = "Empty and create new"
|
|
5
|
+
}
|
|
6
|
+
export declare enum ShopSystem {
|
|
7
|
+
OTHER = "None of the below-mentioned",
|
|
8
|
+
SHOPIFY = "Shopify",
|
|
9
|
+
SHOPWARE = "Shopware",
|
|
10
|
+
SALESFORCE = "Salesforce Commerce Cloud",
|
|
11
|
+
PLENTYMARKETS = "Plentymarkets"
|
|
12
|
+
}
|
|
13
|
+
export declare enum EnvironmentType {
|
|
14
|
+
PRODUCTION = "production",
|
|
15
|
+
STAGING = "staging",
|
|
16
|
+
TEST = "test"
|
|
17
|
+
}
|
|
18
|
+
export interface EnvironmentConfig {
|
|
19
|
+
host?: string;
|
|
20
|
+
forceInstall?: boolean;
|
|
21
|
+
}
|
|
22
|
+
export interface CustomerConfigSettings {
|
|
23
|
+
appName?: string;
|
|
24
|
+
production?: EnvironmentConfig;
|
|
25
|
+
staging?: EnvironmentConfig;
|
|
26
|
+
includeServiceWorker?: string;
|
|
27
|
+
activateImageOptimisation?: boolean;
|
|
28
|
+
removeLazyLoading?: boolean;
|
|
29
|
+
addPreRendering?: boolean;
|
|
30
|
+
activateRumTracking?: boolean;
|
|
31
|
+
useGATracking?: boolean;
|
|
32
|
+
withGoogleOptimize?: boolean;
|
|
33
|
+
activateCfRocketLoaderWorkaround?: boolean;
|
|
34
|
+
isShopify?: boolean;
|
|
35
|
+
isShopware?: boolean;
|
|
36
|
+
isSalesforce?: boolean;
|
|
37
|
+
isPlentymarkets?: boolean;
|
|
38
|
+
shopifyId?: string;
|
|
39
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.EnvironmentType = exports.ShopSystem = exports.DirectoryOverwriteOption = void 0;
|
|
4
|
+
var DirectoryOverwriteOption;
|
|
5
|
+
(function (DirectoryOverwriteOption) {
|
|
6
|
+
DirectoryOverwriteOption["NEW_NAME"] = "Choose a new directory name";
|
|
7
|
+
DirectoryOverwriteOption["OVERWRITE_FILE_WISE"] = "Keep and overwrite file-wise (ask)";
|
|
8
|
+
DirectoryOverwriteOption["OVERWRITE_COMPLETELY"] = "Empty and create new";
|
|
9
|
+
})(DirectoryOverwriteOption || (exports.DirectoryOverwriteOption = DirectoryOverwriteOption = {}));
|
|
10
|
+
var ShopSystem;
|
|
11
|
+
(function (ShopSystem) {
|
|
12
|
+
ShopSystem["OTHER"] = "None of the below-mentioned";
|
|
13
|
+
ShopSystem["SHOPIFY"] = "Shopify";
|
|
14
|
+
ShopSystem["SHOPWARE"] = "Shopware";
|
|
15
|
+
ShopSystem["SALESFORCE"] = "Salesforce Commerce Cloud";
|
|
16
|
+
ShopSystem["PLENTYMARKETS"] = "Plentymarkets";
|
|
17
|
+
})(ShopSystem || (exports.ShopSystem = ShopSystem = {}));
|
|
18
|
+
var EnvironmentType;
|
|
19
|
+
(function (EnvironmentType) {
|
|
20
|
+
EnvironmentType["PRODUCTION"] = "production";
|
|
21
|
+
EnvironmentType["STAGING"] = "staging";
|
|
22
|
+
EnvironmentType["TEST"] = "test";
|
|
23
|
+
})(EnvironmentType || (exports.EnvironmentType = EnvironmentType = {}));
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { CliService } from "../cli";
|
|
2
|
+
import { CustomerConfigServiceContext } from "./customer-config-service-context";
|
|
3
|
+
import { CustomerConfigSettings } from "./customer-config-service-model";
|
|
4
|
+
export declare class CustomerConfigService {
|
|
5
|
+
private context;
|
|
6
|
+
private cli;
|
|
7
|
+
private _appName;
|
|
8
|
+
private _outputDirPath;
|
|
9
|
+
private get appName();
|
|
10
|
+
private set appName(value);
|
|
11
|
+
private set outputDirPath(value);
|
|
12
|
+
private get outputDirPath();
|
|
13
|
+
private templates;
|
|
14
|
+
constructor(context: CustomerConfigServiceContext, cli: CliService);
|
|
15
|
+
private getOutputDirPath;
|
|
16
|
+
private getHandlebarsOutputFileName;
|
|
17
|
+
private getPathWithChangedDir;
|
|
18
|
+
private isDirNotEmpty;
|
|
19
|
+
private selectOutputDirectory;
|
|
20
|
+
private compileHandlebarsFiles;
|
|
21
|
+
private getEnvironmentConfig;
|
|
22
|
+
private shouldFileBeOverwritten;
|
|
23
|
+
private downloadAndSaveFile;
|
|
24
|
+
private getConfigSettings;
|
|
25
|
+
handleDocumentHandler({ addPreRendering }: CustomerConfigSettings): Promise<void>;
|
|
26
|
+
generateConfig(): Promise<void>;
|
|
27
|
+
}
|
|
@@ -0,0 +1,263 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CustomerConfigService = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const fs = tslib_1.__importStar(require("fs"));
|
|
6
|
+
const path = tslib_1.__importStar(require("path"));
|
|
7
|
+
const Handlebars = tslib_1.__importStar(require("handlebars"));
|
|
8
|
+
const axios_1 = tslib_1.__importDefault(require("axios"));
|
|
9
|
+
const cli_1 = require("../cli");
|
|
10
|
+
const customer_config_service_model_1 = require("./customer-config-service-model");
|
|
11
|
+
class CustomerConfigService {
|
|
12
|
+
context;
|
|
13
|
+
cli;
|
|
14
|
+
_appName;
|
|
15
|
+
_outputDirPath;
|
|
16
|
+
get appName() {
|
|
17
|
+
return this._appName;
|
|
18
|
+
}
|
|
19
|
+
set appName(newName) {
|
|
20
|
+
this._appName = newName;
|
|
21
|
+
this.outputDirPath = this.getOutputDirPath(newName);
|
|
22
|
+
}
|
|
23
|
+
set outputDirPath(newPath) {
|
|
24
|
+
this._outputDirPath = newPath;
|
|
25
|
+
}
|
|
26
|
+
get outputDirPath() {
|
|
27
|
+
return this._outputDirPath;
|
|
28
|
+
}
|
|
29
|
+
templates = [
|
|
30
|
+
'config_customer.js.hbs',
|
|
31
|
+
'config_documentHandler.js.hbs',
|
|
32
|
+
'config_dynamicBlocks.es6.hbs',
|
|
33
|
+
'config_dynamicStyles.css.hbs',
|
|
34
|
+
'config_loadHandler.js.hbs',
|
|
35
|
+
'config_SpeedKit.js.hbs'
|
|
36
|
+
];
|
|
37
|
+
constructor(context, cli) {
|
|
38
|
+
this.context = context;
|
|
39
|
+
const { appName } = this.context;
|
|
40
|
+
this.appName = appName;
|
|
41
|
+
this.cli = cli;
|
|
42
|
+
}
|
|
43
|
+
getOutputDirPath(dirName = '') {
|
|
44
|
+
return path.join(process.cwd(), this.context.customersDir, dirName);
|
|
45
|
+
}
|
|
46
|
+
getHandlebarsOutputFileName(fileName) {
|
|
47
|
+
return fileName.replace('.hbs', '');
|
|
48
|
+
}
|
|
49
|
+
getPathWithChangedDir(dirPath, newDir) {
|
|
50
|
+
return path.join(path.dirname(dirPath), newDir);
|
|
51
|
+
}
|
|
52
|
+
isDirNotEmpty(dirPath) {
|
|
53
|
+
return fs.existsSync(dirPath) && fs.readdirSync(dirPath).length > 0;
|
|
54
|
+
}
|
|
55
|
+
async selectOutputDirectory(dirPath) {
|
|
56
|
+
// protect output directory if already existing and not empty:
|
|
57
|
+
if (this.isDirNotEmpty(dirPath)) {
|
|
58
|
+
this.cli.spacer();
|
|
59
|
+
const selectedDirectoryOverwriteOption = await this.cli.select(`Output directory ${dirPath} is not empty. How to proceed?`, Object.values(customer_config_service_model_1.DirectoryOverwriteOption).map(option => ({ name: option, value: option })));
|
|
60
|
+
switch (selectedDirectoryOverwriteOption) {
|
|
61
|
+
case customer_config_service_model_1.DirectoryOverwriteOption.OVERWRITE_COMPLETELY:
|
|
62
|
+
fs.rmSync(dirPath, { recursive: true, force: true });
|
|
63
|
+
fs.mkdirSync(dirPath, { recursive: true });
|
|
64
|
+
break;
|
|
65
|
+
case customer_config_service_model_1.DirectoryOverwriteOption.NEW_NAME:
|
|
66
|
+
const dirName = path.basename(dirPath);
|
|
67
|
+
let proposedNewDirName;
|
|
68
|
+
const regExFollowingNumber = /-(\d+)$/;
|
|
69
|
+
const match = dirName.match(regExFollowingNumber);
|
|
70
|
+
if (match && match.length > 1) {
|
|
71
|
+
const numberAtTheEndOfDirName = Number(match[1]);
|
|
72
|
+
proposedNewDirName = dirName.replace(regExFollowingNumber, `-${String(numberAtTheEndOfDirName + 1)}`);
|
|
73
|
+
}
|
|
74
|
+
else {
|
|
75
|
+
proposedNewDirName = `${dirName}-2`;
|
|
76
|
+
}
|
|
77
|
+
const newDirName = await this.cli.prompt(`Please enter new output directory name:`, {
|
|
78
|
+
defaultAnswer: proposedNewDirName
|
|
79
|
+
});
|
|
80
|
+
return this.selectOutputDirectory(this.getPathWithChangedDir(dirPath, newDirName));
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
return dirPath;
|
|
84
|
+
}
|
|
85
|
+
async compileHandlebarsFiles(configSettings) {
|
|
86
|
+
// overwriting protection for output directory:
|
|
87
|
+
this.outputDirPath = await this.selectOutputDirectory(this.outputDirPath);
|
|
88
|
+
this.cli.spacer();
|
|
89
|
+
// write files:
|
|
90
|
+
for (const templateFile of this.templates) {
|
|
91
|
+
const outputFileName = this.getHandlebarsOutputFileName(templateFile);
|
|
92
|
+
this.cli.startAction(`Adding ${outputFileName}`);
|
|
93
|
+
try {
|
|
94
|
+
const outputFilePath = path.join(this.outputDirPath, outputFileName);
|
|
95
|
+
if (!await this.shouldFileBeOverwritten(outputFilePath)) {
|
|
96
|
+
this.cli.endAction(cli_1.CliActionStatus.SKIPPED);
|
|
97
|
+
continue;
|
|
98
|
+
}
|
|
99
|
+
const filePath = path.join(__dirname, './templates', templateFile);
|
|
100
|
+
const content = fs.readFileSync(filePath, 'utf8');
|
|
101
|
+
const template = Handlebars.compile(content);
|
|
102
|
+
const result = template(configSettings);
|
|
103
|
+
fs.mkdirSync(path.dirname(outputFilePath), { recursive: true });
|
|
104
|
+
fs.writeFileSync(outputFilePath, result);
|
|
105
|
+
this.cli.endAction(cli_1.CliActionStatus.COMPLETED);
|
|
106
|
+
}
|
|
107
|
+
catch (error) {
|
|
108
|
+
this.cli.endAction(cli_1.CliActionStatus.FAILED);
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
this.cli.spacer();
|
|
112
|
+
}
|
|
113
|
+
async getEnvironmentConfig(environmentType, defaultHost) {
|
|
114
|
+
const host = await this.cli.prompt(`Enter ${environmentType.toUpperCase()} Host (without https://):`, {
|
|
115
|
+
defaultAnswer: defaultHost
|
|
116
|
+
});
|
|
117
|
+
const forceInstall = !(await this.cli.confirm(`Is the install.js already present on ${environmentType.toUpperCase()}?`, false));
|
|
118
|
+
return {
|
|
119
|
+
host,
|
|
120
|
+
forceInstall
|
|
121
|
+
};
|
|
122
|
+
}
|
|
123
|
+
async shouldFileBeOverwritten(outputFilePath) {
|
|
124
|
+
if (fs.existsSync(outputFilePath)) {
|
|
125
|
+
const overwrite = await this.cli.confirm(`File ${path.basename(outputFilePath)} already exists. Overwrite?`);
|
|
126
|
+
if (!overwrite)
|
|
127
|
+
return false;
|
|
128
|
+
}
|
|
129
|
+
return true;
|
|
130
|
+
}
|
|
131
|
+
async downloadAndSaveFile(url, outputFilePath) {
|
|
132
|
+
this.cli.startAction(`Adding ${path.basename(outputFilePath)}`);
|
|
133
|
+
try {
|
|
134
|
+
if (!await this.shouldFileBeOverwritten(outputFilePath)) {
|
|
135
|
+
this.cli.endAction(cli_1.CliActionStatus.SKIPPED);
|
|
136
|
+
return;
|
|
137
|
+
}
|
|
138
|
+
const response = await axios_1.default.get(url, { responseType: 'text' });
|
|
139
|
+
const date = new Date();
|
|
140
|
+
const day = String(date.getDate()).padStart(2, '0');
|
|
141
|
+
const month = String(date.getMonth() + 1).padStart(2, '0'); // Months are 0-indexed
|
|
142
|
+
const year = date.getFullYear();
|
|
143
|
+
const time = date.toLocaleTimeString('de-DE');
|
|
144
|
+
const formattedDate = `${day}.${month}.${year}, ${time}`;
|
|
145
|
+
// Add timestamp banner to the file
|
|
146
|
+
const banner = `/**\n * Downloaded from:\n * ${url}\n * \n * Date: ${formattedDate}\n */\n\n`;
|
|
147
|
+
const contentWithBanner = banner + response.data;
|
|
148
|
+
fs.writeFileSync(outputFilePath, contentWithBanner);
|
|
149
|
+
this.cli.endAction(cli_1.CliActionStatus.COMPLETED);
|
|
150
|
+
}
|
|
151
|
+
catch (error) {
|
|
152
|
+
this.cli.endAction(cli_1.CliActionStatus.FAILED);
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
async getConfigSettings() {
|
|
156
|
+
let { production, staging, includeServiceWorker, activateImageOptimisation, removeLazyLoading, addPreRendering, activateRumTracking, useGATracking, withGoogleOptimize, activateCfRocketLoaderWorkaround, isShopify, isShopware, isSalesforce, isPlentymarkets, shopifyId } = {};
|
|
157
|
+
this.appName = await this.cli.prompt(`Enter SK App Name:`, {
|
|
158
|
+
validator: (input) => /^[a-z0-9]+(?:-[a-z0-9]+)*$/.test(input) ? '' : 'No valid kebab-case',
|
|
159
|
+
defaultAnswer: this.appName
|
|
160
|
+
});
|
|
161
|
+
const selectedShopSystem = await this.cli.select('Which Shop System is in use?', Object.values(customer_config_service_model_1.ShopSystem).map(option => ({ name: option, value: option })));
|
|
162
|
+
switch (selectedShopSystem) {
|
|
163
|
+
case customer_config_service_model_1.ShopSystem.SHOPIFY:
|
|
164
|
+
isShopify = true;
|
|
165
|
+
break;
|
|
166
|
+
case customer_config_service_model_1.ShopSystem.SHOPWARE:
|
|
167
|
+
isShopware = true;
|
|
168
|
+
break;
|
|
169
|
+
case customer_config_service_model_1.ShopSystem.SALESFORCE:
|
|
170
|
+
isSalesforce = true;
|
|
171
|
+
break;
|
|
172
|
+
case customer_config_service_model_1.ShopSystem.PLENTYMARKETS:
|
|
173
|
+
isPlentymarkets = true;
|
|
174
|
+
}
|
|
175
|
+
production = await this.getEnvironmentConfig(customer_config_service_model_1.EnvironmentType.PRODUCTION, `www.${this.appName}.de`);
|
|
176
|
+
if (isShopify) {
|
|
177
|
+
shopifyId = await this.cli.prompt(`Enter Shopify ID:`, { defaultAnswer: this.appName });
|
|
178
|
+
}
|
|
179
|
+
else {
|
|
180
|
+
const withStaging = await this.cli.confirm(`Add Config for ${customer_config_service_model_1.EnvironmentType.STAGING.toUpperCase()} Environment?`, false);
|
|
181
|
+
if (withStaging) {
|
|
182
|
+
staging = await this.getEnvironmentConfig(customer_config_service_model_1.EnvironmentType.STAGING, production.host.replace('www', 'stg'));
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
if (await this.cli.confirm('Is there a Service Worker which needs to be included?', false)) {
|
|
186
|
+
includeServiceWorker = await this.cli.prompt('Enter path of Service Worker to be included:', { defaultAnswer: '/sw.js' });
|
|
187
|
+
}
|
|
188
|
+
activateImageOptimisation = await this.cli.confirm('Activate Image Optimisation?', false);
|
|
189
|
+
removeLazyLoading = await this.cli.confirm('Remove Lazy-Loading?');
|
|
190
|
+
addPreRendering = await this.cli.confirm('Add Pre-Rendering? This requires a set-up Lambda function to work. Also requires a DOM-based DocumentHandler.', false);
|
|
191
|
+
activateRumTracking = await this.cli.confirm('Activate RUM Tracking?');
|
|
192
|
+
if (activateRumTracking) {
|
|
193
|
+
if (!isShopify) {
|
|
194
|
+
useGATracking = await this.cli.confirm('Add Tracking based on Google Analytics\' DataLayer?');
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
withGoogleOptimize = await this.cli.confirm('Is Google Optimize being used?', false);
|
|
198
|
+
if (isShopify) {
|
|
199
|
+
activateCfRocketLoaderWorkaround = true;
|
|
200
|
+
}
|
|
201
|
+
else {
|
|
202
|
+
activateCfRocketLoaderWorkaround = await this.cli.confirm('Activate Workaround for Cloudflare\'s Rocket Loader?', false);
|
|
203
|
+
}
|
|
204
|
+
return {
|
|
205
|
+
appName: this.appName,
|
|
206
|
+
production,
|
|
207
|
+
staging,
|
|
208
|
+
includeServiceWorker,
|
|
209
|
+
activateImageOptimisation,
|
|
210
|
+
removeLazyLoading,
|
|
211
|
+
addPreRendering,
|
|
212
|
+
activateRumTracking,
|
|
213
|
+
useGATracking,
|
|
214
|
+
withGoogleOptimize,
|
|
215
|
+
activateCfRocketLoaderWorkaround,
|
|
216
|
+
isShopify,
|
|
217
|
+
isShopware,
|
|
218
|
+
isSalesforce,
|
|
219
|
+
isPlentymarkets,
|
|
220
|
+
shopifyId
|
|
221
|
+
};
|
|
222
|
+
}
|
|
223
|
+
async handleDocumentHandler({ addPreRendering }) {
|
|
224
|
+
/*
|
|
225
|
+
TODO:
|
|
226
|
+
remove this custom DocumentHandler handling as soon as the DOM-parsing DocumentHandler has been released
|
|
227
|
+
and can be controlled/activated by the DocumentHandler Config properly
|
|
228
|
+
*/
|
|
229
|
+
if (addPreRendering) {
|
|
230
|
+
const documentHandlerBranchName = 'dom-parser/develop';
|
|
231
|
+
const customDocumentHandlerOutputPath = path.join(this.outputDirPath, 'custom_documentHandler.js');
|
|
232
|
+
this.cli.writeWarning(`
|
|
233
|
+
⚠️ MANUAL ACTION NEEDED ⚠️
|
|
234
|
+
|
|
235
|
+
Your config needs the DOM-parsing DocumentHandler which has not been publicly released yet.
|
|
236
|
+
|
|
237
|
+
Working Branch: ${this.cli.codeStyle(documentHandlerBranchName)} (https://gitlab.orestes.info/baqend/document-handler/-/tree/${documentHandlerBranchName})
|
|
238
|
+
|
|
239
|
+
Please add it to your newly created config directory manually:
|
|
240
|
+
|
|
241
|
+
1. ${this.cli.codeStyle(`git clone -b ${documentHandlerBranchName} git@vm.orestes.info:baqend/document-handler.git`)}
|
|
242
|
+
2. ${this.cli.codeStyle(`cd ./document-handler`)}
|
|
243
|
+
3. ${this.cli.codeStyle(`npm ci && npm run build`)}
|
|
244
|
+
4. ${this.cli.codeStyle(`cp ./dist/DocumentHandler.js ${customDocumentHandlerOutputPath}`)}
|
|
245
|
+
`);
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
async generateConfig() {
|
|
249
|
+
this.cli.write('\nLet\'s generate a config...\n');
|
|
250
|
+
const configSettings = await this.getConfigSettings();
|
|
251
|
+
if (configSettings.isSalesforce) {
|
|
252
|
+
this.templates.push('deploymentDetection.es6.hbs');
|
|
253
|
+
}
|
|
254
|
+
const addDowntimeDetection = await this.cli.confirm('Add Downtime Detection?', false);
|
|
255
|
+
if (addDowntimeDetection) {
|
|
256
|
+
this.templates.push('downtimeDetection.js.hbs');
|
|
257
|
+
}
|
|
258
|
+
await this.compileHandlebarsFiles(configSettings);
|
|
259
|
+
await this.handleDocumentHandler(configSettings);
|
|
260
|
+
this.cli.writeSuccess('\nConfig generation completed 👏\n');
|
|
261
|
+
}
|
|
262
|
+
}
|
|
263
|
+
exports.CustomerConfigService = CustomerConfigService;
|