@servicetitan/startup 39.1.0 → 39.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.
Files changed (105) hide show
  1. package/dist/cli/commands/mfe-list.d.ts +0 -2
  2. package/dist/cli/commands/mfe-list.d.ts.map +1 -1
  3. package/dist/cli/commands/mfe-list.js +4 -30
  4. package/dist/cli/commands/mfe-list.js.map +1 -1
  5. package/dist/cli/commands/mfe-package-clean.js +1 -2
  6. package/dist/cli/commands/mfe-package-clean.js.map +1 -1
  7. package/dist/cli/commands/mfe-package-publish.d.ts.map +1 -1
  8. package/dist/cli/commands/mfe-package-publish.js +7 -5
  9. package/dist/cli/commands/mfe-package-publish.js.map +1 -1
  10. package/dist/cli/commands/mfe-package-rollback.d.ts.map +1 -1
  11. package/dist/cli/commands/mfe-package-rollback.js +5 -3
  12. package/dist/cli/commands/mfe-package-rollback.js.map +1 -1
  13. package/dist/cli/commands/mfe-publish.d.ts +1 -0
  14. package/dist/cli/commands/mfe-publish.d.ts.map +1 -1
  15. package/dist/cli/commands/mfe-publish.js +14 -12
  16. package/dist/cli/commands/mfe-publish.js.map +1 -1
  17. package/dist/cli/commands/registry/command-registry.d.ts +13 -4
  18. package/dist/cli/commands/registry/command-registry.d.ts.map +1 -1
  19. package/dist/cli/commands/registry/mfe-list.d.ts +2 -1
  20. package/dist/cli/commands/registry/mfe-list.d.ts.map +1 -1
  21. package/dist/cli/commands/registry/mfe-list.js +3 -1
  22. package/dist/cli/commands/registry/mfe-list.js.map +1 -1
  23. package/dist/cli/commands/registry/mfe-package-clean.d.ts +2 -1
  24. package/dist/cli/commands/registry/mfe-package-clean.d.ts.map +1 -1
  25. package/dist/cli/commands/registry/mfe-package-clean.js +4 -2
  26. package/dist/cli/commands/registry/mfe-package-clean.js.map +1 -1
  27. package/dist/cli/commands/registry/mfe-package-publish.d.ts +2 -1
  28. package/dist/cli/commands/registry/mfe-package-publish.d.ts.map +1 -1
  29. package/dist/cli/commands/registry/mfe-package-publish.js +4 -2
  30. package/dist/cli/commands/registry/mfe-package-publish.js.map +1 -1
  31. package/dist/cli/commands/registry/mfe-package-rollback.d.ts +2 -1
  32. package/dist/cli/commands/registry/mfe-package-rollback.d.ts.map +1 -1
  33. package/dist/cli/commands/registry/mfe-package-rollback.js +4 -2
  34. package/dist/cli/commands/registry/mfe-package-rollback.js.map +1 -1
  35. package/dist/cli/commands/registry/upload-sourcemaps.d.ts +5 -0
  36. package/dist/cli/commands/registry/upload-sourcemaps.d.ts.map +1 -1
  37. package/dist/cli/commands/registry/upload-sourcemaps.js +5 -0
  38. package/dist/cli/commands/registry/upload-sourcemaps.js.map +1 -1
  39. package/dist/cli/commands/review/types.js.map +1 -1
  40. package/dist/cli/commands/upload-sourcemaps.d.ts.map +1 -1
  41. package/dist/cli/commands/upload-sourcemaps.js +4 -7
  42. package/dist/cli/commands/upload-sourcemaps.js.map +1 -1
  43. package/dist/cli/commands/utils/get-mfe-registry.d.ts +4 -0
  44. package/dist/cli/commands/utils/get-mfe-registry.d.ts.map +1 -0
  45. package/dist/cli/commands/utils/get-mfe-registry.js +28 -0
  46. package/dist/cli/commands/utils/get-mfe-registry.js.map +1 -0
  47. package/dist/cli/commands/utils/get-unpkg-host.d.ts +2 -0
  48. package/dist/cli/commands/utils/get-unpkg-host.d.ts.map +1 -0
  49. package/dist/cli/commands/utils/get-unpkg-host.js +18 -0
  50. package/dist/cli/commands/utils/get-unpkg-host.js.map +1 -0
  51. package/dist/cli/commands/utils/index.d.ts +3 -1
  52. package/dist/cli/commands/utils/index.d.ts.map +1 -1
  53. package/dist/cli/commands/utils/index.js +3 -1
  54. package/dist/cli/commands/utils/index.js.map +1 -1
  55. package/dist/cli/commands/utils/login.d.ts +2 -0
  56. package/dist/cli/commands/utils/login.d.ts.map +1 -0
  57. package/dist/cli/commands/utils/login.js +56 -0
  58. package/dist/cli/commands/utils/login.js.map +1 -0
  59. package/dist/cli/commands/utils/purge-cache.d.ts.map +1 -1
  60. package/dist/cli/commands/utils/purge-cache.js +2 -4
  61. package/dist/cli/commands/utils/purge-cache.js.map +1 -1
  62. package/dist/cli/index.js +4 -1
  63. package/dist/cli/index.js.map +1 -1
  64. package/dist/vite/config/base-config.js +1 -1
  65. package/dist/vite/config/base-config.js.map +1 -1
  66. package/dist/vite/config/create-resolve-config.d.ts +1 -2
  67. package/dist/vite/config/create-resolve-config.d.ts.map +1 -1
  68. package/dist/vite/config/create-resolve-config.js +2 -21
  69. package/dist/vite/config/create-resolve-config.js.map +1 -1
  70. package/package.json +21 -22
  71. package/src/cli/commands/__tests__/mfe-list.test.ts +25 -56
  72. package/src/cli/commands/__tests__/mfe-package-clean.test.ts +6 -0
  73. package/src/cli/commands/__tests__/mfe-package-publish.test.ts +52 -47
  74. package/src/cli/commands/__tests__/mfe-package-rollback.test.ts +4 -2
  75. package/src/cli/commands/__tests__/mfe-publish.test.ts +51 -14
  76. package/src/cli/commands/__tests__/upload-sourcemaps.test.ts +27 -13
  77. package/src/cli/commands/mfe-list.ts +7 -36
  78. package/src/cli/commands/mfe-package-clean.ts +2 -2
  79. package/src/cli/commands/mfe-package-publish.ts +10 -8
  80. package/src/cli/commands/mfe-package-rollback.ts +6 -5
  81. package/src/cli/commands/mfe-publish.ts +17 -16
  82. package/src/cli/commands/registry/mfe-list.ts +6 -1
  83. package/src/cli/commands/registry/mfe-package-clean.ts +7 -1
  84. package/src/cli/commands/registry/mfe-package-publish.ts +7 -1
  85. package/src/cli/commands/registry/mfe-package-rollback.ts +4 -2
  86. package/src/cli/commands/registry/upload-sourcemaps.ts +1 -0
  87. package/src/cli/commands/upload-sourcemaps.ts +4 -7
  88. package/src/cli/commands/utils/__tests__/get-mfe-registry.test.ts +24 -0
  89. package/src/cli/commands/utils/__tests__/get-unpkg-host.test.ts +32 -0
  90. package/src/cli/commands/utils/__tests__/login.test.ts +122 -0
  91. package/src/cli/commands/utils/__tests__/purge-cache.test.ts +17 -15
  92. package/src/cli/commands/utils/get-mfe-registry.ts +6 -0
  93. package/src/cli/commands/utils/get-unpkg-host.ts +8 -0
  94. package/src/cli/commands/utils/index.ts +3 -1
  95. package/src/cli/commands/utils/login.ts +38 -0
  96. package/src/cli/commands/utils/purge-cache.ts +2 -5
  97. package/src/cli/index.ts +2 -1
  98. package/src/vite/config/__tests__/create-resolve-config.test.ts +6 -37
  99. package/src/vite/config/base-config.ts +1 -1
  100. package/src/vite/config/create-resolve-config.ts +8 -22
  101. package/dist/cli/commands/utils/constants.d.ts +0 -2
  102. package/dist/cli/commands/utils/constants.d.ts.map +0 -1
  103. package/dist/cli/commands/utils/constants.js +0 -13
  104. package/dist/cli/commands/utils/constants.js.map +0 -1
  105. package/src/cli/commands/utils/constants.ts +0 -1
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/vite/config/base-config.ts"],"sourcesContent":["import type { InlineConfig, Plugin } from 'vite';\nimport {\n bundleConstants,\n defineExposedDependencies,\n defineExposedInstanceDependencies,\n defineWebComponentName,\n getBundleType,\n getCdnPath,\n getProcessEnv,\n} from '../../core';\nimport { omit } from '../../utils';\nimport {\n bundleStatPlugin,\n chainSourceMapsPlugin,\n cleanPlugin,\n cssInjectorPlugin,\n designSystemGuardPlugin,\n devServerRoutingPlugin,\n externalsPlugin,\n htmlPlugin,\n ignoreModulesPlugin,\n istanbulPlugin,\n magicCommentsPlugin,\n metadataPlugin,\n momentLocalesPlugin,\n reactRefreshPlugin,\n styleUrlsPlugin,\n svgrPlugin,\n virtualModulesPlugin,\n} from '../plugins';\nimport { ViteBuildContext } from '../types';\nimport { assetFileNames } from './asset-file-names';\nimport { getCodeSplitting } from './code-splitting';\nimport { createCssConfig } from './create-css-config';\nimport { createFilteringLogger } from './create-filtering-logger';\nimport { createResolveConfig } from './create-resolve-config';\n\nfunction importMetaRemap(\n ...definitions: (Record<string, string> | undefined)[]\n): Record<string, string> {\n const result: Record<string, string> = {};\n\n definitions\n .filter(definition => definition !== undefined)\n .forEach(definition =>\n Object.keys(definition).forEach(item => {\n result[`import.meta.env.${item}`] = definition[item];\n })\n );\n\n return result;\n}\n\nfunction createPlugins(context: ViteBuildContext) {\n const entries: [string, Plugin[] | Plugin | Promise<Plugin> | undefined][] = [\n ['reactRefresh', reactRefreshPlugin(context)],\n ['bundleStat', bundleStatPlugin(context)],\n ['clean', cleanPlugin(context)],\n ['cssInjector', cssInjectorPlugin(context)],\n ['designSystemGuard', designSystemGuardPlugin(context)],\n ['devServerRouting', devServerRoutingPlugin(context)],\n ['externals', externalsPlugin(context)],\n ['html', htmlPlugin(context)],\n ['ignoreModules', ignoreModulesPlugin(context)],\n ['istanbul', istanbulPlugin(context)],\n ['magicComments', magicCommentsPlugin(context)],\n ['metadata', metadataPlugin(context)],\n ['momentLocales', momentLocalesPlugin(context)],\n ['styleUrls', styleUrlsPlugin(context)],\n ['svgr', svgrPlugin(context)],\n ['virtualModules', virtualModulesPlugin(context)],\n ];\n\n return entries\n .filter(\n ([name, plugin]) =>\n plugin && !context.bundlerConfig.omitDefault?.includes(`plugins.${name}`)\n )\n .flatMap(([, plugin]) => plugin);\n}\n\nexport function createBaseConfig(context: ViteBuildContext): InlineConfig {\n const optimizedStartupDependencies = ['@servicetitan/startup-utils', 'react-refresh/runtime'];\n const { isProduction } = context.build;\n const { isWebComponent } = context.package;\n\n let config: InlineConfig = {\n cacheDir: `node_modules/.vite/${getBundleType(context) ?? 'host'}`,\n customLogger: createFilteringLogger(),\n server: {\n // Windows machines can fail to connect to \"localhost\"; bind to a fixed address instead.\n host: '127.0.0.1',\n port: context.bundlerConfig.port ?? (isWebComponent ? 8888 : 8080),\n },\n mode: isProduction ? bundleConstants.mode.production : bundleConstants.mode.development,\n configFile: false,\n oxc: { legalComments: 'none' },\n base: getCdnPath(context) || './', // eslint-disable-line @typescript-eslint/prefer-nullish-coalescing\n css: createCssConfig(isProduction),\n build: {\n /*\n * MFEs render inside shadow DOM — lazy CSS chunks would inject into document.head,\n * leaking styles into the host. Bundling all CSS into one file avoids this.\n */\n cssCodeSplit: !isWebComponent,\n sourcemap: true,\n rolldownOptions: {\n output: { assetFileNames, codeSplitting: getCodeSplitting(context) },\n plugins: [chainSourceMapsPlugin()],\n },\n },\n define: {\n /*\n * Some dependencies assume Node's `global` exists (webpack polyfills this\n * automatically for browser targets; Vite does not).\n */\n global: 'globalThis',\n ...importMetaRemap(\n defineExposedDependencies(context),\n defineExposedInstanceDependencies(context),\n defineWebComponentName(context)\n ),\n ...(getProcessEnv(context) ?? {}),\n },\n resolve: createResolveConfig(context, optimizedStartupDependencies),\n optimizeDeps: {\n include: [\n ...optimizedStartupDependencies,\n 'react/jsx-runtime',\n 'react/jsx-dev-runtime',\n ],\n /*\n * Top-level plugins don't run during dependency pre-bundling, so\n * register ignoreModulesPlugin again here. Without this, missing\n * optional peer dependencies inside pre-bundled packages throw at\n * runtime instead of resolving to an empty module.\n */\n rolldownOptions: {\n plugins: [ignoreModulesPlugin(context)],\n },\n },\n plugins: createPlugins(context),\n };\n\n const omitKeys = context.bundlerConfig.omitDefault?.filter(k => !k.startsWith('plugins.'));\n if (omitKeys?.length) {\n config = omit({ ...config }, omitKeys);\n }\n\n if (context.bundlerConfig.minify.js !== undefined) {\n config.build = { ...config.build, minify: !!context.bundlerConfig.minify.js };\n }\n if (context.bundlerConfig.minify.css !== undefined) {\n config.build = { ...config.build, cssMinify: !!context.bundlerConfig.minify.css };\n }\n\n // Minified output can't be mapped back to source, so skip it when instrumenting.\n if (context.options.codeCoverage) {\n config.build = { ...config.build, minify: false };\n }\n\n return config;\n}\n"],"names":["createBaseConfig","importMetaRemap","definitions","result","filter","definition","undefined","forEach","Object","keys","item","createPlugins","context","entries","reactRefreshPlugin","bundleStatPlugin","cleanPlugin","cssInjectorPlugin","designSystemGuardPlugin","devServerRoutingPlugin","externalsPlugin","htmlPlugin","ignoreModulesPlugin","istanbulPlugin","magicCommentsPlugin","metadataPlugin","momentLocalesPlugin","styleUrlsPlugin","svgrPlugin","virtualModulesPlugin","name","plugin","bundlerConfig","omitDefault","includes","flatMap","getBundleType","getProcessEnv","optimizedStartupDependencies","isProduction","build","isWebComponent","package","config","cacheDir","customLogger","createFilteringLogger","server","host","port","mode","bundleConstants","production","development","configFile","oxc","legalComments","base","getCdnPath","css","createCssConfig","cssCodeSplit","sourcemap","rolldownOptions","output","assetFileNames","codeSplitting","getCodeSplitting","plugins","chainSourceMapsPlugin","define","global","defineExposedDependencies","defineExposedInstanceDependencies","defineWebComponentName","resolve","createResolveConfig","optimizeDeps","include","omitKeys","k","startsWith","length","omit","minify","js","cssMinify","options","codeCoverage"],"mappings":";;;;+BAiFgBA;;;eAAAA;;;sBAxET;uBACc;yBAmBd;gCAEwB;+BACE;iCACD;uCACM;qCACF;AAEpC,SAASC,gBACL,GAAGC,WAAmD;IAEtD,MAAMC,SAAiC,CAAC;IAExCD,YACKE,MAAM,CAACC,CAAAA,aAAcA,eAAeC,WACpCC,OAAO,CAACF,CAAAA,aACLG,OAAOC,IAAI,CAACJ,YAAYE,OAAO,CAACG,CAAAA;YAC5BP,MAAM,CAAC,CAAC,gBAAgB,EAAEO,MAAM,CAAC,GAAGL,UAAU,CAACK,KAAK;QACxD;IAGR,OAAOP;AACX;AAEA,SAASQ,cAAcC,OAAyB;IAC5C,MAAMC,UAAuE;QACzE;YAAC;YAAgBC,IAAAA,2BAAkB,EAACF;SAAS;QAC7C;YAAC;YAAcG,IAAAA,yBAAgB,EAACH;SAAS;QACzC;YAAC;YAASI,IAAAA,oBAAW,EAACJ;SAAS;QAC/B;YAAC;YAAeK,IAAAA,0BAAiB,EAACL;SAAS;QAC3C;YAAC;YAAqBM,IAAAA,gCAAuB,EAACN;SAAS;QACvD;YAAC;YAAoBO,IAAAA,+BAAsB,EAACP;SAAS;QACrD;YAAC;YAAaQ,IAAAA,wBAAe,EAACR;SAAS;QACvC;YAAC;YAAQS,IAAAA,mBAAU,EAACT;SAAS;QAC7B;YAAC;YAAiBU,IAAAA,4BAAmB,EAACV;SAAS;QAC/C;YAAC;YAAYW,IAAAA,uB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AAQoB,aAAa,CAACoD,MAAM,CAACzB,GAAG,KAAKrD,WAAW;QAChDqC,OAAOH,KAAK,GAAG;YAAE,GAAGG,OAAOH,KAAK;YAAE8C,WAAW,CAAC,CAAC1E,QAAQoB,aAAa,CAACoD,MAAM,CAACzB,GAAG;QAAC;IACpF;IAEA,iFAAiF;IACjF,IAAI/C,QAAQ2E,OAAO,CAACC,YAAY,EAAE;QAC9B7C,OAAOH,KAAK,GAAG;YAAE,GAAGG,OAAOH,KAAK;YAAE4C,QAAQ;QAAM;IACpD;IAEA,OAAOzC;AACX"}
1
+ {"version":3,"sources":["../../../src/vite/config/base-config.ts"],"sourcesContent":["import type { InlineConfig, Plugin } from 'vite';\nimport {\n bundleConstants,\n defineExposedDependencies,\n defineExposedInstanceDependencies,\n defineWebComponentName,\n getBundleType,\n getCdnPath,\n getProcessEnv,\n} from '../../core';\nimport { omit } from '../../utils';\nimport {\n bundleStatPlugin,\n chainSourceMapsPlugin,\n cleanPlugin,\n cssInjectorPlugin,\n designSystemGuardPlugin,\n devServerRoutingPlugin,\n externalsPlugin,\n htmlPlugin,\n ignoreModulesPlugin,\n istanbulPlugin,\n magicCommentsPlugin,\n metadataPlugin,\n momentLocalesPlugin,\n reactRefreshPlugin,\n styleUrlsPlugin,\n svgrPlugin,\n virtualModulesPlugin,\n} from '../plugins';\nimport { ViteBuildContext } from '../types';\nimport { assetFileNames } from './asset-file-names';\nimport { getCodeSplitting } from './code-splitting';\nimport { createCssConfig } from './create-css-config';\nimport { createFilteringLogger } from './create-filtering-logger';\nimport { createResolveConfig } from './create-resolve-config';\n\nfunction importMetaRemap(\n ...definitions: (Record<string, string> | undefined)[]\n): Record<string, string> {\n const result: Record<string, string> = {};\n\n definitions\n .filter(definition => definition !== undefined)\n .forEach(definition =>\n Object.keys(definition).forEach(item => {\n result[`import.meta.env.${item}`] = definition[item];\n })\n );\n\n return result;\n}\n\nfunction createPlugins(context: ViteBuildContext) {\n const entries: [string, Plugin[] | Plugin | Promise<Plugin> | undefined][] = [\n ['reactRefresh', reactRefreshPlugin(context)],\n ['bundleStat', bundleStatPlugin(context)],\n ['clean', cleanPlugin(context)],\n ['cssInjector', cssInjectorPlugin(context)],\n ['designSystemGuard', designSystemGuardPlugin(context)],\n ['devServerRouting', devServerRoutingPlugin(context)],\n ['externals', externalsPlugin(context)],\n ['html', htmlPlugin(context)],\n ['ignoreModules', ignoreModulesPlugin(context)],\n ['istanbul', istanbulPlugin(context)],\n ['magicComments', magicCommentsPlugin(context)],\n ['metadata', metadataPlugin(context)],\n ['momentLocales', momentLocalesPlugin(context)],\n ['styleUrls', styleUrlsPlugin(context)],\n ['svgr', svgrPlugin(context)],\n ['virtualModules', virtualModulesPlugin(context)],\n ];\n\n return entries\n .filter(\n ([name, plugin]) =>\n plugin && !context.bundlerConfig.omitDefault?.includes(`plugins.${name}`)\n )\n .flatMap(([, plugin]) => plugin);\n}\n\nexport function createBaseConfig(context: ViteBuildContext): InlineConfig {\n const optimizedStartupDependencies = ['@servicetitan/startup-utils', 'react-refresh/runtime'];\n const { isProduction } = context.build;\n const { isWebComponent } = context.package;\n\n let config: InlineConfig = {\n cacheDir: `node_modules/.vite/${getBundleType(context) ?? 'host'}`,\n customLogger: createFilteringLogger(),\n server: {\n // Windows machines can fail to connect to \"localhost\"; bind to a fixed address instead.\n host: '127.0.0.1',\n port: context.bundlerConfig.port ?? (isWebComponent ? 8888 : 8080),\n },\n mode: isProduction ? bundleConstants.mode.production : bundleConstants.mode.development,\n configFile: false,\n oxc: { legalComments: 'none' },\n base: getCdnPath(context) || './', // eslint-disable-line @typescript-eslint/prefer-nullish-coalescing\n css: createCssConfig(isProduction),\n build: {\n /*\n * MFEs render inside shadow DOM — lazy CSS chunks would inject into document.head,\n * leaking styles into the host. Bundling all CSS into one file avoids this.\n */\n cssCodeSplit: !isWebComponent,\n sourcemap: true,\n rolldownOptions: {\n output: { assetFileNames, codeSplitting: getCodeSplitting(context) },\n plugins: [chainSourceMapsPlugin()],\n },\n },\n define: {\n /*\n * Some dependencies assume Node's `global` exists (webpack polyfills this\n * automatically for browser targets; Vite does not).\n */\n global: 'globalThis',\n ...importMetaRemap(\n defineExposedDependencies(context),\n defineExposedInstanceDependencies(context),\n defineWebComponentName(context)\n ),\n ...(getProcessEnv(context) ?? {}),\n },\n resolve: createResolveConfig(optimizedStartupDependencies),\n optimizeDeps: {\n include: [\n ...optimizedStartupDependencies,\n 'react/jsx-runtime',\n 'react/jsx-dev-runtime',\n ],\n /*\n * Top-level plugins don't run during dependency pre-bundling, so\n * register ignoreModulesPlugin again here. Without this, missing\n * optional peer dependencies inside pre-bundled packages throw at\n * runtime instead of resolving to an empty module.\n */\n rolldownOptions: {\n plugins: [ignoreModulesPlugin(context)],\n },\n },\n plugins: createPlugins(context),\n };\n\n const omitKeys = context.bundlerConfig.omitDefault?.filter(k => !k.startsWith('plugins.'));\n if (omitKeys?.length) {\n config = omit({ ...config }, omitKeys);\n }\n\n if (context.bundlerConfig.minify.js !== undefined) {\n config.build = { ...config.build, minify: !!context.bundlerConfig.minify.js };\n }\n if (context.bundlerConfig.minify.css !== undefined) {\n config.build = { ...config.build, cssMinify: !!context.bundlerConfig.minify.css };\n }\n\n // Minified output can't be mapped back to source, so skip it when instrumenting.\n if (context.options.codeCoverage) {\n config.build = { ...config.build, minify: false };\n }\n\n return config;\n}\n"],"names":["createBaseConfig","importMetaRemap","definitions","result","filter","definition","undefined","forEach","Object","keys","item","createPlugins","context","entries","reactRefreshPlugin","bundleStatPlugin","cleanPlugin","cssInjectorPlugin","designSystemGuardPlugin","devServerRoutingPlugin","externalsPlugin","htmlPlugin","ignoreModulesPlugin","istanbulPlugin","magicCommentsPlugin","metadataPlugin","momentLocalesPlugin","styleUrlsPlugin","svgrPlugin","virtualModulesPlugin","name","plugin","bundlerConfig","omitDefault","includes","flatMap","getBundleType","getProcessEnv","optimizedStartupDependencies","isProduction","build","isWebComponent","package","config","cacheDir","customLogger","createFilteringLogger","server","host","port","mode","bundleConstants","production","development","configFile","oxc","legalComments","base","getCdnPath","css","createCssConfig","cssCodeSplit","sourcemap","rolldownOptions","output","assetFileNames","codeSplitting","getCodeSplitting","plugins","chainSourceMapsPlugin","define","global","defineExposedDependencies","defineExposedInstanceDependencies","defineWebComponentName","resolve","createResolveConfig","optimizeDeps","include","omitKeys","k","startsWith","length","omit","minify","js","cssMinify","options","codeCoverage"],"mappings":";;;;+BAiFgBA;;;eAAAA;;;sBAxET;uBACc;yBAmBd;gCAEwB;+BACE;iCACD;uCACM;qCACF;AAEpC,SAASC,gBACL,GAAGC,WAAmD;IAEtD,MAAMC,SAAiC,CAAC;IAExCD,YACKE,MAAM,CAACC,CAAAA,aAAcA,eAAeC,WACpCC,OAAO,CAACF,CAAAA,aACLG,OAAOC,IAAI,CAACJ,YAAYE,OAAO,CAACG,CAAAA;YAC5BP,MAAM,CAAC,CAAC,gBAAgB,EAAEO,MAAM,CAAC,GAAGL,UAAU,CAACK,KAAK;QACxD;IAGR,OAAOP;AACX;AAEA,SAASQ,cAAcC,OAAyB;IAC5C,MAAMC,UAAuE;QACzE;YAAC;YAAgBC,IAAAA,2BAAkB,EAACF;SAAS;QAC7C;YAAC;YAAcG,IAAAA,yBAAgB,EAACH;SAAS;QACzC;YAAC;YAASI,IAAAA,oBAAW,EAACJ;SAAS;QAC/B;YAAC;YAAeK,IAAAA,0BAAiB,EAACL;SAAS;QAC3C;YAAC;YAAqBM,IAAAA,gCAAuB,EAACN;SAAS;QACvD;YAAC;YAAoBO,IAAAA,+BAAsB,EAACP;SAAS;QACrD;YAAC;YAAaQ,IAAAA,wBAAe,EAACR;SAAS;QACvC;YAAC;YAAQS,IAAAA,mBAAU,EAACT;SAAS;QAC7B;YAAC;YAAiBU,IAAAA,4BAAmB,EAACV;SAAS;QAC/C;YAAC;YAAYW,IAAAA,uBAAc,EAACX;SAAS;QACrC;YAAC;YAAiBY,IAAAA,4BAAmB,EAACZ;SAAS;QAC/C;YAAC;YAAYa,IAAAA,uBAAc,EAACb;SAAS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AW,CAAC,CAAC1E,QAAQoB,aAAa,CAACoD,MAAM,CAACzB,GAAG;QAAC;IACpF;IAEA,iFAAiF;IACjF,IAAI/C,QAAQ2E,OAAO,CAACC,YAAY,EAAE;QAC9B7C,OAAOH,KAAK,GAAG;YAAE,GAAGG,OAAOH,KAAK;YAAE4C,QAAQ;QAAM;IACpD;IAEA,OAAOzC;AACX"}
@@ -1,6 +1,5 @@
1
1
  import type { InlineConfig } from 'vite';
2
- import type { ViteBuildContext } from '../types';
3
2
  type Result = InlineConfig['resolve'];
4
- export declare function createResolveConfig(context: ViteBuildContext, specifiers: string[]): Result;
3
+ export declare function createResolveConfig(specifiers: string[]): Result;
5
4
  export {};
6
5
  //# sourceMappingURL=create-resolve-config.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"create-resolve-config.d.ts","sourceRoot":"","sources":["../../../src/vite/config/create-resolve-config.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,MAAM,CAAC;AAEzC,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;AAEjD,KAAK,MAAM,GAAG,YAAY,CAAC,SAAS,CAAC,CAAC;AAQtC,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,gBAAgB,EAAE,UAAU,EAAE,MAAM,EAAE,GAAG,MAAM,CAW3F"}
1
+ {"version":3,"file":"create-resolve-config.d.ts","sourceRoot":"","sources":["../../../src/vite/config/create-resolve-config.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,MAAM,CAAC;AAGzC,KAAK,MAAM,GAAG,YAAY,CAAC,SAAS,CAAC,CAAC;AAStC,wBAAgB,mBAAmB,CAAC,UAAU,EAAE,MAAM,EAAE,GAAG,MAAM,CAOhE"}
@@ -9,17 +9,10 @@ Object.defineProperty(exports, "createResolveConfig", {
9
9
  }
10
10
  });
11
11
  const _module = require("module");
12
- const _path = /*#__PURE__*/ _interop_require_default(require("path"));
13
12
  const _buildescapedregexp = require("../build-escaped-reg-exp");
14
- function _interop_require_default(obj) {
15
- return obj && obj.__esModule ? obj : {
16
- default: obj
17
- };
18
- }
19
13
  const startupRequire = (0, _module.createRequire)(__filename);
20
- function createResolveConfig(context, specifiers) {
21
- const source = _path.default.resolve(context.package.source);
22
- const alias = specifiers.filter((specifier)=>!isResolvableFrom(specifier, source)).map((specifier)=>({
14
+ function createResolveConfig(specifiers) {
15
+ const alias = specifiers.map((specifier)=>({
23
16
  find: (0, _buildescapedregexp.buildEscapedRegExp)(specifier),
24
17
  replacement: resolveFromStartup(specifier)
25
18
  }));
@@ -27,18 +20,6 @@ function createResolveConfig(context, specifiers) {
27
20
  alias
28
21
  };
29
22
  }
30
- function isResolvableFrom(specifier, source) {
31
- try {
32
- require.resolve(specifier, {
33
- paths: [
34
- source
35
- ]
36
- });
37
- return true;
38
- } catch (unused) {
39
- return false;
40
- }
41
- }
42
23
  function resolveFromStartup(specifier) {
43
24
  try {
44
25
  return startupRequire.resolve(specifier);
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/vite/config/create-resolve-config.ts"],"sourcesContent":["import { createRequire } from 'module';\nimport path from 'path';\nimport type { InlineConfig } from 'vite';\nimport { buildEscapedRegExp } from '../build-escaped-reg-exp';\nimport type { ViteBuildContext } from '../types';\n\ntype Result = InlineConfig['resolve'];\n\nconst startupRequire = createRequire(__filename);\n\n/*\n * Returns a resolver that, when normal resolution fails for a specifier,\n * tries resolving from startup's location.\n */\nexport function createResolveConfig(context: ViteBuildContext, specifiers: string[]): Result {\n const source = path.resolve(context.package.source);\n\n const alias = specifiers\n .filter(specifier => !isResolvableFrom(specifier, source))\n .map(specifier => ({\n find: buildEscapedRegExp(specifier),\n replacement: resolveFromStartup(specifier),\n }));\n\n return { alias };\n}\n\nfunction isResolvableFrom(specifier: string, source: string): boolean {\n try {\n require.resolve(specifier, { paths: [source] });\n return true;\n } catch {\n return false;\n }\n}\n\nfunction resolveFromStartup(specifier: string): string {\n try {\n return startupRequire.resolve(specifier);\n } catch (cause) {\n throw new Error(`[startup] Cannot resolve ${specifier}`, { cause });\n }\n}\n"],"names":["createResolveConfig","startupRequire","createRequire","__filename","context","specifiers","source","path","resolve","package","alias","filter","specifier","isResolvableFrom","map","find","buildEscapedRegExp","replacement","resolveFromStartup","require","paths","cause","Error"],"mappings":";;;;+BAcgBA;;;eAAAA;;;wBAdc;6DACb;oCAEkB;;;;;;AAKnC,MAAMC,iBAAiBC,IAAAA,qBAAa,EAACC;AAM9B,SAASH,oBAAoBI,OAAyB,EAAEC,UAAoB;IAC/E,MAAMC,SAASC,aAAI,CAACC,OAAO,CAACJ,QAAQK,OAAO,CAACH,MAAM;IAElD,MAAMI,QAAQL,WACTM,MAAM,CAACC,CAAAA,YAAa,CAACC,iBAAiBD,WAAWN,SACjDQ,GAAG,CAACF,CAAAA,YAAc,CAAA;YACfG,MAAMC,IAAAA,sCAAkB,EAACJ;YACzBK,aAAaC,mBAAmBN;QACpC,CAAA;IAEJ,OAAO;QAAEF;IAAM;AACnB;AAEA,SAASG,iBAAiBD,SAAiB,EAAEN,MAAc;IACvD,IAAI;QACAa,QAAQX,OAAO,CAACI,WAAW;YAAEQ,OAAO;gBAACd;aAAO;QAAC;QAC7C,OAAO;IACX,EAAE,eAAM;QACJ,OAAO;IACX;AACJ;AAEA,SAASY,mBAAmBN,SAAiB;IACzC,IAAI;QACA,OAAOX,eAAeO,OAAO,CAACI;IAClC,EAAE,OAAOS,OAAO;QACZ,MAAM,IAAIC,MAAM,CAAC,yBAAyB,EAAEV,WAAW,EAAE;YAAES;QAAM;IACrE;AACJ"}
1
+ {"version":3,"sources":["../../../src/vite/config/create-resolve-config.ts"],"sourcesContent":["import { createRequire } from 'module';\nimport type { InlineConfig } from 'vite';\nimport { buildEscapedRegExp } from '../build-escaped-reg-exp';\n\ntype Result = InlineConfig['resolve'];\n\nconst startupRequire = createRequire(__filename);\n\n/*\n * Returns a resolver that resolves from startup's location. Use only for\n * startup's internal dependencies that may not be directly resolvable by\n * consumers using pnpm.\n */\nexport function createResolveConfig(specifiers: string[]): Result {\n const alias = specifiers.map(specifier => ({\n find: buildEscapedRegExp(specifier),\n replacement: resolveFromStartup(specifier),\n }));\n\n return { alias };\n}\n\nfunction resolveFromStartup(specifier: string): string {\n try {\n return startupRequire.resolve(specifier);\n } catch (cause) {\n throw new Error(`[startup] Cannot resolve ${specifier}`, { cause });\n }\n}\n"],"names":["createResolveConfig","startupRequire","createRequire","__filename","specifiers","alias","map","specifier","find","buildEscapedRegExp","replacement","resolveFromStartup","resolve","cause","Error"],"mappings":";;;;+BAagBA;;;eAAAA;;;wBAbc;oCAEK;AAInC,MAAMC,iBAAiBC,IAAAA,qBAAa,EAACC;AAO9B,SAASH,oBAAoBI,UAAoB;IACpD,MAAMC,QAAQD,WAAWE,GAAG,CAACC,CAAAA,YAAc,CAAA;YACvCC,MAAMC,IAAAA,sCAAkB,EAACF;YACzBG,aAAaC,mBAAmBJ;QACpC,CAAA;IAEA,OAAO;QAAEF;IAAM;AACnB;AAEA,SAASM,mBAAmBJ,SAAiB;IACzC,IAAI;QACA,OAAON,eAAeW,OAAO,CAACL;IAClC,EAAE,OAAOM,OAAO;QACZ,MAAM,IAAIC,MAAM,CAAC,yBAAyB,EAAEP,WAAW,EAAE;YAAEM;QAAM;IACrE;AACJ"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@servicetitan/startup",
3
- "version": "39.1.0",
3
+ "version": "39.3.0",
4
4
  "description": "CLI to create multi-package Lerna projects with TypeScript and React",
5
5
  "homepage": "https://docs.st.dev/docs/frontend/uikit/startup",
6
6
  "repository": {
@@ -100,23 +100,23 @@
100
100
  },
101
101
  "dependencies": {
102
102
  "@babel/preset-env": "~7.29.7",
103
- "@jest/core": "~30.4.2",
104
- "@jest/types": "~30.4.1",
103
+ "@jest/core": "~30.5.1",
104
+ "@jest/types": "~30.5.1",
105
105
  "@jsdevtools/coverage-istanbul-loader": "^3.0.5",
106
- "@servicetitan/eslint-config": "39.1.0",
107
- "@servicetitan/install": "39.1.0",
108
- "@servicetitan/startup-utils": "39.1.0",
109
- "@servicetitan/stylelint-config": "39.1.0",
106
+ "@servicetitan/eslint-config": "39.3.0",
107
+ "@servicetitan/install": "39.3.0",
108
+ "@servicetitan/startup-utils": "39.3.0",
109
+ "@servicetitan/stylelint-config": "39.3.0",
110
110
  "@svgr/webpack": "^8.1.0",
111
111
  "@swc/cli": "^0.8.1",
112
- "@swc/core": "1.15.46",
112
+ "@swc/core": "1.16.1",
113
113
  "@types/debug": "^4.1.12",
114
114
  "@types/jest": "~30.0.0",
115
- "@vitest/coverage-v8": "^4.1.10",
115
+ "@vitest/coverage-v8": "^4.1.11",
116
116
  "chalk": "~4.1.2",
117
117
  "cli-table3": "^0.6.5",
118
118
  "cpx2": "9.0.0",
119
- "css-loader": "~7.1.4",
119
+ "css-loader": "~7.1.5",
120
120
  "css-minimizer-webpack-plugin": "^8.0.0",
121
121
  "debug": "^4.4.3",
122
122
  "deepmerge": "~4.3.1",
@@ -128,19 +128,19 @@
128
128
  "html-webpack-plugin": "~5.6.8",
129
129
  "html-webpack-tags-plugin": "^3.0.2",
130
130
  "identity-obj-proxy": "~3.0.0",
131
- "jest": "~30.4.2",
132
- "jest-circus": "~30.4.2",
133
- "jest-environment-jsdom": "~30.4.1",
131
+ "jest": "~30.5.1",
132
+ "jest-circus": "~30.5.1",
133
+ "jest-environment-jsdom": "~30.5.1",
134
134
  "jest-fetch-mock": "~4.2.0",
135
- "js-yaml": "~5.3.0",
135
+ "js-yaml": "~5.4.1",
136
136
  "json5": "^2.2.3",
137
137
  "lerna": "~9.0.7",
138
- "less": "~4.8.1",
138
+ "less": "~4.9.0",
139
139
  "less-loader": "~13.0.0",
140
140
  "less-plugin-npm-import": "~2.1.0",
141
141
  "lodash.kebabcase": "^4.1.1",
142
142
  "lodash.memoize": "^4.1.2",
143
- "magic-string": "^1.1.0",
143
+ "magic-string": "^1.2.3",
144
144
  "memfs": "~4.68.1",
145
145
  "mini-css-extract-plugin": "~2.10.2",
146
146
  "minimizer-webpack-plugin": "^5.6.1",
@@ -148,11 +148,11 @@
148
148
  "multimatch": "~8.0.0",
149
149
  "patch-package": "^8.0.1",
150
150
  "portfinder": "~1.0.38",
151
- "postcss": "~8.5.16",
151
+ "postcss": "~8.5.26",
152
152
  "prettier": "~3.9.6",
153
153
  "react-refresh": "^0.18.0",
154
154
  "sass": "~1.102.0",
155
- "sass-loader": "~17.0.0",
155
+ "sass-loader": "~17.0.1",
156
156
  "semver": "~7.8.5",
157
157
  "source-map-js": "^1.2.1",
158
158
  "source-map-loader": "~5.0.0",
@@ -164,11 +164,11 @@
164
164
  "ts-node": "~10.9.2",
165
165
  "typed-css-modules": "~0.9.1",
166
166
  "typescript": "6.0.3",
167
- "vite": "^8.1.5",
167
+ "vite": "^8.2.2",
168
168
  "vite-bundle-analyzer": "^1.3.9",
169
169
  "vite-plugin-istanbul": "^9.0.1",
170
170
  "vite-plugin-svgr": "^5.2.0",
171
- "vitest": "^4.1.10",
171
+ "vitest": "^4.1.11",
172
172
  "webpack": "~5.108.4",
173
173
  "webpack-assets-manifest": "~6.5.2",
174
174
  "webpack-bundle-analyzer": "^5.3.1",
@@ -202,6 +202,5 @@
202
202
  },
203
203
  "cli": {
204
204
  "webpack": false
205
- },
206
- "gitHead": "a2471578a506e8c40e90956a5c70cc1638bbe9c1"
205
+ }
207
206
  }
@@ -1,16 +1,20 @@
1
- import { npmWhoAmI } from '@servicetitan/install';
1
+ import { isCI, npmWhoAmI } from '@servicetitan/install';
2
2
  import chalk from 'chalk';
3
3
  import Table from 'cli-table3';
4
4
  import { vol } from 'memfs';
5
5
  import path from 'path';
6
- import { createInterface } from 'readline/promises';
7
6
  import { formatRelativeDate, toArray } from '../../../utils';
8
- import { isTTY, npmView, runCommand } from '../../utils';
7
+ import { npmView } from '../../utils';
9
8
  import { MFEList } from '../mfe-list';
10
9
  import { entry } from '../registry/mfe-list';
10
+ import { DEV_MFE_REGISTRY, PROD_MFE_REGISTRY, login } from '../utils';
11
11
 
12
12
  jest.mock('@servicetitan/install');
13
13
  jest.mock('cli-table3');
14
+ jest.mock('../utils', () => ({
15
+ ...jest.requireActual('../utils'),
16
+ login: jest.fn(),
17
+ }));
14
18
  jest.mock('fs', () => require('memfs').fs);
15
19
  jest.mock('readline/promises', () => ({
16
20
  createInterface: jest.fn(),
@@ -30,6 +34,7 @@ describe(`[startup] ${MFEList.name}`, () => {
30
34
  let distTags: Record<string, string>;
31
35
  let time: Record<string, string>;
32
36
  let args: ConstructorParameters<typeof MFEList>[0];
37
+ let ci: boolean;
33
38
 
34
39
  function volFromJSON(overrides: Record<string, any> = {}) {
35
40
  vol.fromJSON({
@@ -58,8 +63,10 @@ describe(`[startup] ${MFEList.name}`, () => {
58
63
  latest: versions[DEFAULT_LIMIT],
59
64
  };
60
65
  args = { _: [] }; // eslint-disable-line @typescript-eslint/naming-convention
66
+ ci = false;
61
67
  jest.clearAllMocks();
62
68
  jest.spyOn(process.stdout, 'write').mockImplementation(jest.fn()); // suppress output
69
+ jest.mocked(isCI).mockImplementation(() => ci);
63
70
  jest.mocked(npmWhoAmI).mockReturnValue('Foo');
64
71
  jest.mocked(npmView).mockImplementation(({ packageName }) => ({
65
72
  'name': packageName,
@@ -357,67 +364,29 @@ describe(`[startup] ${MFEList.name}`, () => {
357
364
  });
358
365
  });
359
366
 
360
- describe('when machine is not authorized', () => {
361
- const readline = { question: jest.fn(), close: jest.fn() };
362
- let answer: string;
363
-
364
- beforeEach(() => {
365
- answer = 'Y';
366
- jest.mocked(readline.question).mockImplementation(() => Promise.resolve(answer));
367
- jest.mocked(createInterface).mockReturnValue(readline as any);
368
- jest.mocked(npmWhoAmI).mockReturnValue(undefined);
369
- jest.mocked(isTTY).mockReturnValue(true);
370
- });
371
-
372
- test('prompts and authorizes machine', async () => {
373
- await subject();
374
-
375
- expect(readline.question).toHaveBeenCalledWith(
376
- expect.stringMatching(/machine is not authorized.*Authorize\? \[Y\/n\]/)
377
- );
378
- expect(readline.close).toHaveBeenCalled();
379
- expect(runCommand).toHaveBeenCalledWith(
380
- 'npx --yes verdaccio-okta-oauth@latest --registry=https://verdaccio.servicetitan.com',
381
- { quiet: true }
382
- );
383
- });
384
-
385
- describe('when user does not answer', () => {
386
- beforeEach(() => (answer = ''));
387
-
388
- test('authorizes machine', async () => {
389
- await subject();
390
-
391
- expect(runCommand).toHaveBeenCalled();
392
- });
393
- });
394
-
395
- describe('when user declines', () => {
396
- beforeEach(() => (answer = 'n'));
367
+ test(`authorizes the machine for ${PROD_MFE_REGISTRY}`, async () => {
368
+ await subject();
397
369
 
398
- test('throws error', async () => {
399
- await expect(subject()).rejects.toThrow(/Not authorized/);
400
- });
401
- });
370
+ expect(login).toHaveBeenCalledWith(PROD_MFE_REGISTRY);
371
+ });
402
372
 
403
- describe('when terminal is not interactive', () => {
404
- beforeEach(() => jest.mocked(isTTY).mockReturnValue(false));
373
+ describe('in CI environment', () => {
374
+ beforeEach(() => (ci = true));
405
375
 
406
- test('skips prompt and throws error', async () => {
407
- await expect(subject()).rejects.toThrow(/machine is not authorized/);
376
+ test('skips authorization', async () => {
377
+ await subject();
408
378
 
409
- expect(readline.question).not.toHaveBeenCalled();
410
- });
379
+ expect(login).not.toHaveBeenCalled();
411
380
  });
381
+ });
412
382
 
413
- describe('with --registry', () => {
414
- beforeEach(() => (args.registry = 'https://verdaccio.st.dev'));
383
+ describe('with --registry', () => {
384
+ beforeEach(() => (args.registry = DEV_MFE_REGISTRY));
415
385
 
416
- test('skips check whether machine is authorized', async () => {
417
- await subject();
386
+ test('authorizes the machine for the specified registry', async () => {
387
+ await subject();
418
388
 
419
- expect(npmWhoAmI).not.toHaveBeenCalled();
420
- });
389
+ expect(login).toHaveBeenCalledWith(args.registry);
421
390
  });
422
391
  });
423
392
  });
@@ -2,6 +2,7 @@ import { fs, vol } from 'memfs';
2
2
  import { isWebComponent, log } from '../../../utils';
3
3
  import { gitGetBranch, npmGetPackageVersionsDetails, npmUnpublish, Version } from '../../utils';
4
4
  import { MFEPackageClean } from '../mfe-package-clean';
5
+ import { getMfeRegistry } from '../utils';
5
6
 
6
7
  jest.mock('fs', () => fs);
7
8
  jest.mock('../../../utils', () => ({
@@ -14,6 +15,10 @@ jest.mock('../../utils', () => ({
14
15
  npmGetPackageVersionsDetails: jest.fn(),
15
16
  npmUnpublish: jest.fn(),
16
17
  }));
18
+ jest.mock('../utils', () => ({
19
+ ...jest.requireActual('../utils'),
20
+ getMfeRegistry: jest.fn(),
21
+ }));
17
22
 
18
23
  const DEFAULT_VERSIONS_TO_KEEP = 5;
19
24
 
@@ -37,6 +42,7 @@ describe(`[startup] ${MFEPackageClean.name}`, () => {
37
42
  versions = getBranchVersions(gitBranch, 10);
38
43
 
39
44
  jest.resetAllMocks();
45
+ jest.mocked(getMfeRegistry).mockImplementation(explicit => explicit ?? registry);
40
46
  jest.mocked(isWebComponent).mockReturnValue(true);
41
47
  jest.mocked(npmGetPackageVersionsDetails).mockImplementation(() => versions);
42
48
  jest.mocked(gitGetBranch).mockImplementation(() => gitBranch);
@@ -12,7 +12,7 @@ import {
12
12
  runCommand,
13
13
  } from '../../utils';
14
14
  import { MFEPackagePublish } from '../mfe-package-publish';
15
- import { purgeCache, ROLLBACK_TAG_SUFFIX } from '../utils';
15
+ import { getMfeRegistry, purgeCache, ROLLBACK_TAG_SUFFIX } from '../utils';
16
16
 
17
17
  jest.mock('fs', () => fs);
18
18
 
@@ -34,11 +34,12 @@ jest.mock('../../utils', () => ({
34
34
  }));
35
35
  jest.mock('../utils', () => ({
36
36
  ...jest.requireActual('../utils'),
37
+ getMfeRegistry: jest.fn(),
37
38
  purgeCache: jest.fn(),
38
39
  }));
39
40
 
40
41
  describe(`[startup] ${MFEPackagePublish.name}`, () => {
41
- const defaultRegistry = 'https://verdaccio.servicetitan.com';
42
+ const registry = 'https://foo.com';
42
43
  const branch = 'master';
43
44
  const tag = 'prod';
44
45
  const rollbackTag = `${tag}${ROLLBACK_TAG_SUFFIX}`;
@@ -53,6 +54,7 @@ describe(`[startup] ${MFEPackagePublish.name}`, () => {
53
54
  beforeEach(() => {
54
55
  args = {};
55
56
  jest.clearAllMocks();
57
+ jest.mocked(getMfeRegistry).mockImplementation(explicit => explicit ?? registry);
56
58
  jest.mocked(isWebComponent).mockReturnValue(true);
57
59
  jest.mocked(gitGetBranch).mockReturnValue(branch);
58
60
  jest.mocked(gitGetCommitHash).mockReturnValue(commitHash);
@@ -103,7 +105,7 @@ describe(`[startup] ${MFEPackagePublish.name}`, () => {
103
105
  test('sets package registry', async () => {
104
106
  await subject();
105
107
 
106
- expect(npmPackageSet).toHaveBeenCalledWith('publishConfig.registry', defaultRegistry);
108
+ expect(npmPackageSet).toHaveBeenCalledWith('publishConfig.registry', registry);
107
109
  });
108
110
 
109
111
  test('adds package version to metadata.json', async () => {
@@ -127,23 +129,53 @@ describe(`[startup] ${MFEPackagePublish.name}`, () => {
127
129
  await subject();
128
130
 
129
131
  expect(runCommand).toHaveBeenCalledWith(
130
- `npx startup upload-sourcemaps --releaseVersion=${buildPackageVersion()}`
132
+ `npx startup upload-sourcemaps --releaseVersion=${buildPackageVersion()} --registry=${registry}`
131
133
  );
132
134
  });
133
135
 
136
+ function itDoesNotUploadSourcemaps() {
137
+ test('does not upload sourcemaps', async () => {
138
+ await subject();
139
+
140
+ expect(runCommand).not.toHaveBeenCalledWith(
141
+ expect.stringContaining('upload-sourcemaps')
142
+ );
143
+ });
144
+ }
145
+
146
+ describe('with "uploadSourcemaps: false"', () => {
147
+ beforeEach(() => (args.uploadSourcemaps = false));
148
+
149
+ itDoesNotUploadSourcemaps();
150
+ });
151
+
152
+ describe('when branch configuration includes "uploadSourcemaps: false"', () => {
153
+ beforeEach(() =>
154
+ vol.fromJSON({
155
+ 'package.json': JSON.stringify({
156
+ name: packageName,
157
+ cli: {
158
+ 'web-component': {
159
+ branches: { [branch]: { uploadSourcemaps: false } },
160
+ },
161
+ },
162
+ }),
163
+ })
164
+ );
165
+
166
+ itDoesNotUploadSourcemaps();
167
+ });
168
+
134
169
  test('purges cache after publishing', async () => {
135
170
  await subject();
136
171
 
137
- expect(purgeCache).toHaveBeenCalledWith({ packageName, tag });
172
+ expect(purgeCache).toHaveBeenCalledWith({ packageName, registry, tag });
138
173
  });
139
174
 
140
175
  test('gets current tagged versions before publishing', async () => {
141
176
  await subject();
142
177
 
143
- expect(npmView).toHaveBeenCalledWith({
144
- packageName,
145
- registry: defaultRegistry,
146
- });
178
+ expect(npmView).toHaveBeenCalledWith({ packageName, registry });
147
179
  });
148
180
 
149
181
  test(`tags previous version with {tag}${ROLLBACK_TAG_SUFFIX}`, async () => {
@@ -151,7 +183,7 @@ describe(`[startup] ${MFEPackagePublish.name}`, () => {
151
183
  expect(npmTagVersion).toHaveBeenCalledWith({
152
184
  packageName,
153
185
  packageVersion: previousVersion,
154
- registry: defaultRegistry,
186
+ registry,
155
187
  tag: rollbackTag,
156
188
  });
157
189
 
@@ -250,31 +282,19 @@ describe(`[startup] ${MFEPackagePublish.name}`, () => {
250
282
  expect(npmTagVersion).not.toHaveBeenCalled();
251
283
  });
252
284
 
253
- test('uploads sourcemaps with "--dry" option', async () => {
254
- await subject();
285
+ describe('with "uploadSourcemaps: true"', () => {
286
+ beforeEach(() => (args.uploadSourcemaps = true));
255
287
 
256
- expect(runCommand).toHaveBeenCalledWith(
257
- `npx startup upload-sourcemaps --dry --releaseVersion=${buildPackageVersion()}`
258
- );
259
- });
260
-
261
- itDoesNotPurgeCache();
262
- });
263
-
264
- function itDoesNotUploadSourcemaps() {
265
- test('does not upload sourcemaps', async () => {
266
- await subject();
288
+ test('uploads sourcemaps with "--dry" option', async () => {
289
+ await subject();
267
290
 
268
- expect(runCommand).not.toHaveBeenCalledWith(
269
- expect.stringContaining('upload-sourcemaps')
270
- );
291
+ expect(runCommand).toHaveBeenCalledWith(
292
+ `npx startup upload-sourcemaps --dry --releaseVersion=${buildPackageVersion()} --registry=${registry}`
293
+ );
294
+ });
271
295
  });
272
- }
273
-
274
- describe('with "uploadSourcemaps: false"', () => {
275
- beforeEach(() => (args.uploadSourcemaps = false));
276
296
 
277
- itDoesNotUploadSourcemaps();
297
+ itDoesNotPurgeCache();
278
298
  });
279
299
 
280
300
  describe('with "purgeCache: false"', () => {
@@ -283,21 +303,6 @@ describe(`[startup] ${MFEPackagePublish.name}`, () => {
283
303
  itDoesNotPurgeCache();
284
304
  });
285
305
 
286
- describe('when branch configuration includes "uploadSourcemaps: false"', () => {
287
- beforeEach(() =>
288
- vol.fromJSON({
289
- 'package.json': JSON.stringify({
290
- name: packageName,
291
- cli: {
292
- 'web-component': { branches: { [branch]: { uploadSourcemaps: false } } },
293
- },
294
- }),
295
- })
296
- );
297
-
298
- itDoesNotUploadSourcemaps();
299
- });
300
-
301
306
  describe('with "trackHistory: false"', () => {
302
307
  beforeEach(() => {
303
308
  args.trackHistory = false;
@@ -484,7 +489,7 @@ describe(`[startup] ${MFEPackagePublish.name}`, () => {
484
489
  expect(npmTagVersion).toHaveBeenCalledWith({
485
490
  packageName,
486
491
  packageVersion: buildPackageVersion(),
487
- registry: defaultRegistry,
492
+ registry,
488
493
  tag,
489
494
  });
490
495
  expect(log.info).toHaveBeenCalledWith(
@@ -1,7 +1,7 @@
1
1
  import { log, readJson } from '../../../utils';
2
2
  import { npmTagVersion, npmView } from '../../utils';
3
3
  import { MFEPackageRollback } from '../mfe-package-rollback';
4
- import { purgeCache } from '../utils';
4
+ import { getMfeRegistry, purgeCache } from '../utils';
5
5
 
6
6
  jest.mock('../../../utils', () => ({
7
7
  ...jest.requireActual('../../../utils'),
@@ -19,6 +19,7 @@ jest.mock('../../utils', () => ({
19
19
  }));
20
20
  jest.mock('../utils', () => ({
21
21
  ...jest.requireActual('../utils'),
22
+ getMfeRegistry: jest.fn(),
22
23
  purgeCache: jest.fn(),
23
24
  }));
24
25
 
@@ -43,6 +44,7 @@ describe(`[startup] ${MFEPackageRollback.name}`, () => {
43
44
  };
44
45
 
45
46
  jest.resetAllMocks();
47
+ jest.mocked(getMfeRegistry).mockImplementation(explicit => explicit ?? registry);
46
48
  jest.mocked(readJson).mockReturnValue({ name: packageName });
47
49
  jest.mocked(npmView).mockReturnValue(packageInfo);
48
50
  jest.mocked(npmTagVersion).mockResolvedValue(undefined);
@@ -106,7 +108,7 @@ describe(`[startup] ${MFEPackageRollback.name}`, () => {
106
108
  test('purges cache after rollback', async () => {
107
109
  await subject();
108
110
 
109
- expect(purgeCache).toHaveBeenCalledWith({ packageName, tag });
111
+ expect(purgeCache).toHaveBeenCalledWith({ packageName, registry, tag });
110
112
  });
111
113
 
112
114
  describe('when package is not found in registry', () => {