@emailmaker/emailmaker 1.0.107-dev.3 → 1.0.107-dev.4
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 +1 -1
- package/cli/dist/lib/cli/project.js +2 -16
- package/cli/dist/lib/config.js +20 -29
- package/cli/dist/lib/local-test.js +3 -19
- package/cli/dist/lib/paths.js +11 -0
- package/cli/dist/lib/resolveNpmSpawn.d.ts +20 -0
- package/cli/dist/lib/resolveNpmSpawn.js +71 -0
- package/cli/dist/lib/template-engine/context/pluginPackageJsonData.js +21 -19
- package/cli/dist/lib/template-engine/context/standVitePackageJsonData.js +7 -8
- package/cli/dist/lib/template-engine/resolveVariantDir.d.ts +5 -1
- package/cli/dist/lib/template-engine/resolveVariantDir.js +22 -0
- package/cli/dist/lib/templates/shared/i18n.js +2 -2
- package/cli/dist/lib/templates/shared/paths.js +3 -4
- package/cli/dist/lib/types/package-config.d.ts +1 -0
- package/cli/lib/cli/project.ts +2 -18
- package/cli/lib/config.ts +19 -30
- package/cli/lib/local-test.ts +3 -22
- package/cli/lib/paths.ts +15 -0
- package/cli/lib/resolveNpmSpawn.ts +72 -0
- package/cli/lib/template-engine/buildStandIndexHtml.test.ts +1 -0
- package/cli/lib/template-engine/context/pluginPackageJsonData.ts +23 -23
- package/cli/lib/template-engine/context/standVitePackageJsonData.ts +7 -12
- package/cli/lib/template-engine/pluginEtaParity.test.ts +1 -0
- package/cli/lib/template-engine/resolveVariantDir.ts +22 -0
- package/cli/lib/template-engine/standAdvancedViteDevHostEta.test.ts +4 -3
- package/cli/lib/template-engine/standWebpackDevHostEta.test.ts +7 -6
- package/cli/lib/templates/shared/i18n.ts +2 -2
- package/cli/lib/templates/shared/paths.ts +3 -4
- package/cli/lib/types/package-config.ts +1 -0
- package/cli/package.json +1 -1
- package/cli/project-templates/plugin/assets/vite/{plugin-build.config.mjs → plugin-build.config.ts} +7 -5
- package/cli/project-templates/plugin/assets/vite/{sandbox-build.config.mjs → sandbox-build.config.ts} +7 -5
- package/cli/project-templates/plugin/assets/webpack/{plugin-build.legacy.module.cjs → plugin-build.legacy.module.ts} +20 -7
- package/cli/project-templates/plugin/assets/webpack/{plugin-build.legacy.umd.cjs → plugin-build.legacy.umd.ts} +20 -7
- package/cli/project-templates/plugin/assets/webpack/{plugin-build.modern.module.cjs → plugin-build.modern.module.ts} +9 -4
- package/cli/project-templates/plugin/assets/webpack/{plugin-build.modern.umd.cjs → plugin-build.modern.umd.ts} +9 -4
- package/cli/project-templates/plugin/assets/webpack/{sandbox-build.config.cjs → sandbox-build.config.ts} +13 -3
- package/cli/project-templates/plugin/bundler-vite/release.html.eta +1 -0
- package/cli/project-templates/plugin/bundler-webpack/public/release.html.eta +1 -0
- package/cli/project-templates/plugin/shared-base/public/demo/product-1.svg +10 -0
- package/cli/project-templates/plugin/shared-base/public/demo/product-2.svg +10 -0
- package/cli/project-templates/plugin/shared-base/scripts/build-runner.ts +22 -0
- package/cli/project-templates/plugin/shared-base/scripts/build-types.ts +17 -0
- package/cli/project-templates/plugin/shared-base/scripts/clean.ts +16 -0
- package/cli/project-templates/plugin/shared-base/scripts/dev-runner.ts +52 -0
- package/cli/project-templates/plugin/shared-base/scripts/npmRun.ts +61 -0
- package/cli/project-templates/plugin/shared-base/scripts/release-runner.ts +18 -0
- package/cli/project-templates/plugin/shared-base/scripts/scriptRuntime.ts +10 -0
- package/cli/project-templates/plugin/shared-base/src/dev/hostApp.tsx.eta +1 -0
- package/cli/project-templates/plugin/shared-base/src/dev-release.tsx.eta +1 -0
- package/cli/project-templates/plugin/shared-base/src/dev.tsx.eta +1 -1
- package/cli/project-templates/shared/partials/plugin-dev-host-app-advanced.eta +93 -0
- package/cli/project-templates/shared/partials/plugin-dev-host-app-minimal.eta +54 -0
- package/cli/project-templates/shared/partials/plugin-dev-tsx-advanced.eta +3 -2
- package/cli/project-templates/shared/partials/plugin-dev-tsx-debug.eta +18 -0
- package/cli/project-templates/shared/partials/plugin-dev-tsx-release.eta +33 -0
- package/cli/project-templates/shared/partials/plugin-dev-tsx-runtime-helpers.eta +8 -8
- package/cli/project-templates/shared/partials/plugin-index-ts.eta +0 -1
- package/cli/project-templates/shared/partials/plugin-vite-dev-host.eta +9 -5
- package/cli/project-templates/shared/partials/plugin-vite-plugin-build.eta +7 -5
- package/cli/project-templates/shared/partials/plugin-vite-release-html.eta +12 -0
- package/cli/project-templates/shared/partials/plugin-vite-sandbox-build.eta +7 -5
- package/cli/project-templates/shared/partials/plugin-webpack-dev-host-legacy.eta +12 -5
- package/cli/project-templates/shared/partials/plugin-webpack-dev-host-modern.eta +13 -6
- package/cli/project-templates/shared/partials/plugin-webpack-release-html.eta +12 -0
- package/cli/project-templates/shared/partials/plugin-webpack-sandbox-build.eta +13 -3
- package/cli/project-templates/shared/partials/plugin-wp-legacy-module.eta +28 -10
- package/cli/project-templates/shared/partials/plugin-wp-legacy-umd.eta +28 -10
- package/cli/project-templates/shared/partials/plugin-wp-modern-module.eta +9 -4
- package/cli/project-templates/shared/partials/plugin-wp-modern-umd.eta +9 -4
- package/cli/project-templates/shared/partials/stand-dev-host-vite-memory.eta +3 -3
- package/cli/project-templates/shared/partials/stand-dev-host-vite-subpath.eta +8 -4
- package/cli/project-templates/shared/partials/stand-dev-host-vite-umd.eta +5 -5
- package/cli/project-templates/shared/partials/stand-dev-host-vite.eta +3 -3
- package/cli/project-templates/shared/partials/stand-dev-host-webpack-subpath.eta +8 -4
- package/cli/project-templates/shared/partials/stand-dev-host-webpack-umd.eta +9 -3
- package/cli/project-templates/shared/partials/stand-dev-host-webpack.eta +8 -4
- package/cli/project-templates/shared/partials/stand-dev-storage-middleware.eta +370 -0
- package/cli/project-templates/shared/stand-vite-base/config/lib/createViteStandConfig.ts +80 -0
- package/cli/project-templates/shared/stand-vite-base/scripts/devStorageMiddleware.ts.eta +1 -0
- package/cli/project-templates/shared/stand-webpack-base/config/lib/{createWebpackStandConfig.cjs → createWebpackStandConfig.ts} +31 -19
- package/cli/project-templates/{stand/advanced/umd/vite/config/lib/umdServeMiddleware.mjs → shared/stand-webpack-base/config/lib/umdServeMiddleware.ts} +19 -11
- package/cli/project-templates/shared/stand-webpack-base/scripts/devStorageMiddleware.ts.eta +1 -0
- package/cli/project-templates/stand/advanced/memory-usage/vite/config/lib/{createMemoryUsageStandConfig.mjs → createMemoryUsageStandConfig.ts} +25 -20
- package/cli/project-templates/stand/advanced/umd/vite/config/lib/umdServeMiddleware.ts +68 -0
- package/cli/project-templates/stand/react-adapter/webpack/README.md.eta +1 -0
- package/cli/project-templates/stand/react-adapter/webpack/config/dev-host.ts.eta +1 -0
- package/cli/project-templates/stand/react-adapter/webpack/package.json.eta +1 -0
- package/cli/project-templates/stand/react-adapter/webpack/public/index.html.eta +1 -0
- package/cli/project-templates/stand/react-adapter/webpack/src/dev/editorConfig.ts.eta +1 -0
- package/cli/project-templates/stand/react-adapter/webpack/src/dev/email.html.eta +1 -0
- package/cli/project-templates/stand/react-adapter/webpack/src/dev/getAuthToken.ts.eta +1 -0
- package/cli/project-templates/stand/react-adapter/webpack/src/dev/oauthCredentials.ts +9 -0
- package/cli/project-templates/stand/react-adapter/webpack/src/dev/storageProvider.ts.eta +1 -0
- package/cli/project-templates/stand/react-adapter/webpack/src/index.tsx.eta +1 -0
- package/cli/scripts/cli-matrix-smoke.ts +19 -10
- package/cli/scripts/verify-global-cli.ts +1 -1
- package/cli/scripts/vite-plugin-version-matrix.ts +299 -0
- package/cli/tsconfig.json +2 -2
- package/emailmaker-core.aa9efbce.js +1 -0
- package/emailmaker-esm.js +788 -153
- package/emailmaker.d.ts +32 -0
- package/emailmaker.js +4 -4
- package/iframe/js/amp.BGJMqoms.js +1 -1
- package/iframe/js/chunk.oX6nCJbK.js +1 -1
- package/iframe/js/iframe-eblock.js +1 -1
- package/iframe/js/iframe.js +1 -1
- package/iframe/js/rules.BSaCN7eK.js +1 -1
- package/iframe/js/sanitize-html.Dy7Uwo8P.js +1 -1
- package/images/integrations/activecampaign.svg +4 -0
- package/images/integrations/bento.svg +9 -0
- package/images/integrations/brevo.svg +7 -0
- package/images/integrations/campaign_monitor.svg +10 -0
- package/images/integrations/constant_contact.svg +24 -0
- package/images/integrations/dotdigital.svg +144 -0
- package/images/integrations/getresponse.svg +23 -0
- package/images/integrations/hubspot.svg +3 -0
- package/images/integrations/klaviyo.svg +10 -0
- package/images/integrations/mailchimp.svg +9 -0
- package/images/integrations/salesforce.svg +20 -0
- package/js/browser-image-compression.js +9 -0
- package/package.json +2 -5
- package/runtime/@ant-design/cssinjs/index.js +1 -1
- package/runtime/@ant-design/icons/index.js +1 -1
- package/runtime/@ant-design/pro-layout/index.js +1 -1
- package/runtime/README.md +13 -13
- package/runtime/antd/index.js +1 -1
- package/runtime/app-core/index.js +1 -2
- package/runtime/classnames/index.js +1 -1
- package/runtime/core/index.js +6 -6
- package/runtime/dayjs/index.js +1 -1
- package/runtime/di/index.js +1 -2
- package/runtime/disposable/index.js +1 -2
- package/runtime/errors-runtime/index.js +1 -2
- package/runtime/guid/index.js +1 -2
- package/runtime/index.js +2 -4
- package/runtime/package.json +2 -3
- package/runtime/prop-types/index.js +1 -1
- package/runtime/react/index.js +1 -1
- package/runtime/react/jsx-dev-runtime/index.js +1 -1
- package/runtime/react/jsx-runtime/index.js +1 -1
- package/runtime/react-dom/client/index.js +1 -1
- package/runtime/react-dom/index.js +1 -1
- package/runtime/react-router-dom/index.js +1 -1
- package/runtime/uuid/index.js +1 -1
- package/static/amd/{8fc2a596.js → 19aeb269.js} +88 -88
- package/static/core/192ec827.js +1 -0
- package/static/core/22c1de2e2.js +1 -0
- package/static/core/24faedf0.js +1 -0
- package/static/core/29231645.js +1 -0
- package/static/core/2a3177fc2.js +1 -0
- package/static/core/346aabd2.js +3 -0
- package/static/core/3b800ed6.js +1 -0
- package/static/core/3e840e90.js +1 -0
- package/static/core/40cc9fd7.js +1 -0
- package/static/core/421bdec22.js +1 -0
- package/static/core/4aaa358b2.js +903 -0
- package/static/core/50ff48bc.js +4 -0
- package/static/core/5282795d2.js +6 -0
- package/static/core/563a283d.js +1 -0
- package/static/core/5d47e095.js +47 -0
- package/static/core/5f574386.js +1 -0
- package/static/core/67a41193.js +1 -0
- package/static/core/698dace4.js +7 -0
- package/static/core/6b648e2d.js +1 -0
- package/static/core/7629adfd.js +1 -0
- package/static/core/7717f2932.js +3 -0
- package/static/core/776cb34a.js +1 -0
- package/static/core/78a1e31e.js +1 -0
- package/static/core/7d56d643.js +1 -0
- package/static/core/841752212.js +40 -0
- package/static/core/8477e97e.js +1 -0
- package/static/core/8756d562.js +1 -0
- package/static/core/91d328d8.js +1 -0
- package/static/core/9270dbb6.js +6 -0
- package/static/core/96371334.js +566 -0
- package/static/core/9b9ddaef2.js +168 -0
- package/static/core/af1da4b4.js +1 -0
- package/static/core/b5096b152.js +471 -0
- package/static/core/bde6775a.js +1 -0
- package/static/core/bf1b888c.js +4 -0
- package/static/core/cec8d739.js +11 -0
- package/static/core/cf45bf332.js +598 -0
- package/static/core/cfac3d32.js +1 -0
- package/static/core/d21c95cf2.js +1 -0
- package/static/core/dbd9ca52.js +1 -0
- package/static/core/dc590181.js +1 -0
- package/static/core/e0039d55.js +1 -0
- package/static/core/e4071c1a.js +4 -0
- package/static/core/ef87b75c.js +41 -0
- package/static/core/f47701f32.js +20 -0
- package/static/core/f83d7ac42.js +3 -0
- package/static/core/fcc67e6b.js +1 -0
- package/static/core/fd40d85c.js +1 -0
- package/static/core/fe638847.js +1 -0
- package/static/esm/{e8401d17.js → 203c9644.js} +3 -3
- package/static/esm/4b679053.js +27 -0
- package/static/esm/{b273a6c2.js → f31a26c6.js} +1 -1
- package/static/runtime/disposable-CD74igiJ.js +1 -0
- package/static/runtime/guid-C0wuVR8v.js +1 -0
- package/vite/index.d.ts +17 -6
- package/vite/index.js +315 -270
- package/vite/pluginDev/index.d.ts +10 -19
- package/vite/pluginDev/index.js +251 -204
- package/webpack/index.d.ts +24 -5
- package/webpack/index.js +168 -144
- package/webpack/pluginDev/index.d.ts +21 -22
- package/webpack/pluginDev/index.js +242 -177
- package/cli/dist/lib/template-engine/buildStandIndexHtml.test.d.ts +0 -2
- package/cli/dist/lib/template-engine/buildStandIndexHtml.test.js +0 -89
- package/cli/dist/lib/template-engine/emitEtaTree.test.d.ts +0 -2
- package/cli/dist/lib/template-engine/emitEtaTree.test.js +0 -34
- package/cli/dist/lib/template-engine/pluginEtaParity.test.d.ts +0 -2
- package/cli/dist/lib/template-engine/pluginEtaParity.test.js +0 -105
- package/cli/dist/lib/template-engine/resolveVariantDir.test.d.ts +0 -2
- package/cli/dist/lib/template-engine/resolveVariantDir.test.js +0 -52
- package/cli/dist/lib/template-engine/standAdvancedViteDevHostEta.test.d.ts +0 -2
- package/cli/dist/lib/template-engine/standAdvancedViteDevHostEta.test.js +0 -67
- package/cli/dist/lib/template-engine/standWebpackDevHostEta.test.d.ts +0 -2
- package/cli/dist/lib/template-engine/standWebpackDevHostEta.test.js +0 -83
- package/cli/dist/lib/template-engine/storageProviderEta.test.d.ts +0 -2
- package/cli/dist/lib/template-engine/storageProviderEta.test.js +0 -26
- package/cli/project-templates/plugin/shared-base/scripts/build-types.cjs +0 -8
- package/cli/project-templates/plugin/shared-base/scripts/clean.cjs +0 -6
- package/cli/project-templates/plugin/shared-base/scripts/dev-runner.cjs +0 -48
- package/cli/project-templates/plugin/shared-base/scripts/release-runner.cjs +0 -63
- package/cli/project-templates/shared/stand-vite-base/config/lib/createViteStandConfig.mjs +0 -80
- package/cli/project-templates/shared/stand-vite-base/scripts/devStorageMiddleware.cjs +0 -235
- package/cli/project-templates/shared/stand-webpack-base/config/lib/umdServeMiddleware.cjs +0 -38
- package/cli/project-templates/shared/stand-webpack-base/scripts/devStorageMiddleware.cjs +0 -235
- package/emailmaker-core.80d62b88.js +0 -569
- package/runtime/_core/app-core/index.js +0 -1
- package/runtime/_core/chunks/app-core-DphKKh8f.js +0 -1
- package/runtime/_core/chunks/chunk-oqAt0Dze.js +0 -1
- package/runtime/_core/chunks/di-BHUzE57z.js +0 -1
- package/runtime/_core/chunks/disposable-PhM3rJkj.js +0 -1
- package/runtime/_core/chunks/errors-runtime-VjCOXaQX.js +0 -1
- package/runtime/_core/chunks/guid-D2-FTZQG.js +0 -1
- package/runtime/_core/di/index.js +0 -1
- package/runtime/_core/disposable/index.js +0 -1
- package/runtime/_core/errors-runtime/index.js +0 -1
- package/runtime/_core/guid/index.js +0 -1
- package/runtime/_core/index.js +0 -1
- package/shared/hostBootstrap.js +0 -47
- package/shared/pluginDevOptions.js +0 -31
- package/shared/runtimeManifest.js +0 -72
- package/shared/stringCase.js +0 -16
- package/static/core/2360f32a.js +0 -3
- package/static/core/2687db56.js +0 -3
- package/static/core/2b250af6.js +0 -1261
- package/static/core/3469930c.js +0 -302
- package/static/core/34ce9042.js +0 -201
- package/static/core/4091ba5b.js +0 -25
- package/static/core/41ce3a6a.js +0 -173
- package/static/core/4ac4908c.js +0 -2213
- package/static/core/519096c1.js +0 -2597
- package/static/core/5fa1772b.js +0 -116550
- package/static/core/61312909.js +0 -3
- package/static/core/62a98c07.js +0 -75301
- package/static/core/6309c0f2.js +0 -3
- package/static/core/68d9f440.js +0 -3
- package/static/core/73b645ab.js +0 -2
- package/static/core/81019351.js +0 -280
- package/static/core/835b37ef.js +0 -591
- package/static/core/91242fb3.js +0 -3
- package/static/core/972b15b0.js +0 -92399
- package/static/core/974ef468.js +0 -493
- package/static/core/a17614422.js +0 -38078
- package/static/core/a2fa7b5b.js +0 -4232
- package/static/core/a513adfd.js +0 -89857
- package/static/core/a7c73a9b.js +0 -3813
- package/static/core/b64c7c90.js +0 -228
- package/static/core/cdc9ba92.js +0 -4711
- package/static/core/d1db685d.js +0 -2193
- package/static/core/d661febc.js +0 -3
- package/static/core/d6d2d2d0.js +0 -23
- package/static/core/df1a1225.js +0 -607
- package/static/core/e5bff179.js +0 -1302
- package/static/core/e5d602f5.js +0 -2
- package/static/core/eb029366.js +0 -1532
- package/static/core/f46c035a.js +0 -2
- package/static/core/f8b9d89a.js +0 -461
- package/static/core/fd897ad7.js +0 -3
- package/static/core/fdd890c7.js +0 -6168
- package/static/esm/29eb18ff.js +0 -164
- package/vite/mime-types.js +0 -179
- package/vite/utils.js +0 -44
- /package/cli/project-templates/plugin/bundler-vite/config/{dev-host.mjs.eta → dev-host.ts.eta} +0 -0
- /package/cli/project-templates/plugin/bundler-vite/config/{plugin-build.mjs.eta → plugin-build.ts.eta} +0 -0
- /package/cli/project-templates/plugin/bundler-vite/config/{sandbox-build.mjs.eta → sandbox-build.ts.eta} +0 -0
- /package/cli/project-templates/plugin/bundler-webpack/config/{dev-host.cjs.eta → dev-host.ts.eta} +0 -0
- /package/cli/project-templates/plugin/bundler-webpack/config/{plugin-build.cjs.eta → plugin-build.ts.eta} +0 -0
- /package/cli/project-templates/plugin/bundler-webpack/config/{sandbox-build.cjs.eta → sandbox-build.ts.eta} +0 -0
- /package/cli/project-templates/stand/advanced/memory-usage/vite/config/{dev-host.mjs.eta → dev-host.ts.eta} +0 -0
- /package/cli/project-templates/stand/advanced/shadow-dom/vite/config/{dev-host.mjs.eta → dev-host.ts.eta} +0 -0
- /package/cli/project-templates/stand/advanced/shadow-dom/webpack/config/{dev-host.cjs.eta → dev-host.ts.eta} +0 -0
- /package/cli/project-templates/stand/advanced/subpath/vite/config/{dev-host.mjs.eta → dev-host.ts.eta} +0 -0
- /package/cli/project-templates/stand/advanced/subpath/webpack/config/{dev-host.cjs.eta → dev-host.ts.eta} +0 -0
- /package/cli/project-templates/stand/advanced/umd/vite/config/{dev-host.mjs.eta → dev-host.ts.eta} +0 -0
- /package/cli/project-templates/stand/advanced/umd/webpack/config/{dev-host.cjs.eta → dev-host.ts.eta} +0 -0
- /package/cli/project-templates/stand/closed-loop/vite/config/{dev-host.mjs.eta → dev-host.ts.eta} +0 -0
- /package/cli/project-templates/stand/closed-loop/webpack/config/{dev-host.cjs.eta → dev-host.ts.eta} +0 -0
- /package/cli/project-templates/stand/oauth/vite/config/{dev-host.mjs.eta → dev-host.ts.eta} +0 -0
- /package/cli/project-templates/stand/oauth/webpack/config/{dev-host.cjs.eta → dev-host.ts.eta} +0 -0
- /package/cli/project-templates/stand/react-adapter/vite/config/{dev-host.mjs.eta → dev-host.ts.eta} +0 -0
- /package/iframe/{iframe-eblock.80d62b88.html → iframe-eblock.aa9efbce.html} +0 -0
- /package/iframe/{iframe.80d62b88.html → iframe.aa9efbce.html} +0 -0
- /package/{runtime/chunks → static/runtime}/DownloadOutlined-a2ZUz7zB.js +0 -0
- /package/{runtime/chunks → static/runtime}/chunk-D-iEO58U.js +0 -0
- /package/{runtime/chunks → static/runtime}/classnames-DBEldvch.js +0 -0
- /package/{runtime/chunks → static/runtime}/client-5XqXGmAI.js +0 -0
- /package/{runtime/chunks → static/runtime}/dayjs.min-CO3mzOeV.js +0 -0
- /package/{runtime/_core/chunks/defineProperty-BGJFuFMq.js → static/runtime/defineProperty-CGNmw-jw.js} +0 -0
- /package/{runtime/chunks → static/runtime}/dist-Cns8cA2n.js +0 -0
- /package/{runtime/chunks → static/runtime}/dist-Ct0xRt3Y.js +0 -0
- /package/{runtime/chunks → static/runtime}/es-0FFT3fCz.js +0 -0
- /package/{runtime/chunks → static/runtime}/es-BwJ3eGbx.js +0 -0
- /package/{runtime/chunks → static/runtime}/es-D8EsVtRL.js +0 -0
- /package/{runtime/chunks → static/runtime}/es-Da4O25Kw.js +0 -0
- /package/{runtime/chunks → static/runtime}/jsx-dev-runtime-V4_MuHNS.js +0 -0
- /package/{runtime/chunks → static/runtime}/jsx-runtime-DBeCoE0b.js +0 -0
- /package/{runtime/chunks → static/runtime}/objectWithoutProperties-Bk0EDksJ.js +0 -0
- /package/{runtime/chunks → static/runtime}/prop-types-DxD5wgQ0.js +0 -0
- /package/{runtime/chunks → static/runtime}/react-TEeeBWTl.js +0 -0
- /package/{runtime/chunks → static/runtime}/react-dom-BKKa1g6U.js +0 -0
package/cli/lib/cli/project.ts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import fs from 'fs';
|
|
2
2
|
import path from 'path';
|
|
3
3
|
import { spawnSync } from 'child_process';
|
|
4
|
-
import { createRequire } from 'module';
|
|
5
4
|
import prompts from 'prompts';
|
|
6
5
|
import {
|
|
7
6
|
loadLocalEnvironment,
|
|
@@ -18,8 +17,8 @@ import type {
|
|
|
18
17
|
ValidatedProjectOptions,
|
|
19
18
|
} from '../types';
|
|
20
19
|
|
|
21
|
-
const requireNode = createRequire(__filename);
|
|
22
20
|
import { createLocalPackageTarballs } from '../local-test';
|
|
21
|
+
import { resolveSpawnCommand } from '../resolveNpmSpawn';
|
|
23
22
|
import { generateFiles } from '../template-engine';
|
|
24
23
|
import { getRuntimeCliMessages } from './runtimeMessages';
|
|
25
24
|
import { normalizeLegacyKind, resolveTargetDir, isStandaloneDemoStand } from './shared';
|
|
@@ -40,21 +39,6 @@ function writeFiles(targetDir: string, files: GeneratedFilesMap): void {
|
|
|
40
39
|
}
|
|
41
40
|
}
|
|
42
41
|
|
|
43
|
-
function resolveCommand(command: string): { executable: string; argsPrefix: string[] } {
|
|
44
|
-
if (process.platform === 'win32' && command === 'npm') {
|
|
45
|
-
const npmPackageJson = requireNode.resolve('npm/package.json');
|
|
46
|
-
return {
|
|
47
|
-
executable: process.execPath,
|
|
48
|
-
argsPrefix: [path.join(path.dirname(npmPackageJson), 'bin', 'npm-cli.js')],
|
|
49
|
-
};
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
return {
|
|
53
|
-
executable: command,
|
|
54
|
-
argsPrefix: [],
|
|
55
|
-
};
|
|
56
|
-
}
|
|
57
|
-
|
|
58
42
|
function createProjectCommandEnv(): NodeJS.ProcessEnv {
|
|
59
43
|
const env: NodeJS.ProcessEnv = { ...process.env };
|
|
60
44
|
for (const key of Object.keys(env)) {
|
|
@@ -87,7 +71,7 @@ function createProjectCommandEnv(): NodeJS.ProcessEnv {
|
|
|
87
71
|
|
|
88
72
|
function runProjectCommand(targetDir: string, command: string, args: string[] = []): void {
|
|
89
73
|
const runtimeMessages = getRuntimeCliMessages();
|
|
90
|
-
const { executable, argsPrefix } =
|
|
74
|
+
const { executable, argsPrefix } = resolveSpawnCommand(command);
|
|
91
75
|
|
|
92
76
|
const result = spawnSync(executable, [...argsPrefix, ...args], {
|
|
93
77
|
cwd: targetDir,
|
package/cli/lib/config.ts
CHANGED
|
@@ -2,14 +2,12 @@ import fs from 'fs';
|
|
|
2
2
|
import path from 'path';
|
|
3
3
|
import dotenv from 'dotenv';
|
|
4
4
|
import { spawnSync } from 'child_process';
|
|
5
|
-
import { createRequire } from 'module';
|
|
6
5
|
import { getBuildToolsRoot } from './paths';
|
|
6
|
+
import { resolveSpawnCommand } from './resolveNpmSpawn';
|
|
7
7
|
import { getRuntimeCliMessages } from './cli/runtimeMessages';
|
|
8
8
|
import type { LocalPublishedNames, PackageConfig, ToolVersions } from './types';
|
|
9
9
|
import { isJsonArray, isJsonObject, parseJsonValue, type JsonValue } from './types/json';
|
|
10
10
|
|
|
11
|
-
const requireNode = createRequire(__filename);
|
|
12
|
-
|
|
13
11
|
const MODE_TO_FILE: Record<string, string> = {
|
|
14
12
|
dev: '.env.dev',
|
|
15
13
|
prod: '.env.prod',
|
|
@@ -27,20 +25,19 @@ const VERSIONS_CONFIG_PATH = path.resolve(getBuildToolsRoot(), 'versions.json');
|
|
|
27
25
|
const DEFAULT_APP_NAME = '$$APP_NAME$$';
|
|
28
26
|
const DEFAULT_ENV_MODE = '$$ENV_MODE$$';
|
|
29
27
|
const DEFAULT_PACKAGE_NAME = '$$PACKAGE_NAME$$';
|
|
30
|
-
const DEFAULT_RUNTIME_PACKAGE = '$$RUNTIME_PACKAGE$$';
|
|
31
28
|
const DEFAULT_UI_KIT_PACKAGE = '$$UIKIT_PACKAGE$$';
|
|
32
29
|
const DEFAULT_EXTENSIONS_API_PACKAGE = '$$EXTENSIONS_API_PACKAGE$$';
|
|
33
30
|
const DEFAULT_EXTENSIONS_REACT_PACKAGE = '$$EXTENSIONS_REACT_PACKAGE$$';
|
|
34
31
|
const DEFAULT_EXTENSIONS_SANDBOX_PACKAGE = '$$EXTENSIONS_SANDBOX_PACKAGE$$';
|
|
35
32
|
const DEFAULT_CLI_PACKAGE = '$$CLI_PACKAGE$$';
|
|
36
33
|
const DEFAULT_VERSION = '$$APP_VERSION$$';
|
|
37
|
-
const DEFAULT_RUNTIME_VERSION = '$$RUNTIME_VERSION$$';
|
|
38
34
|
const DEFAULT_UI_KIT_VERSION = '$$UIKIT_VERSION$$';
|
|
39
35
|
const DEFAULT_OPENAPI_BASE_URL = '$$OPENAPI_BASE_URL$$';
|
|
40
36
|
|
|
41
37
|
const TOOL_VERSIONS: ToolVersions = {
|
|
42
38
|
vite: '^7',
|
|
43
39
|
typescript: '^5',
|
|
40
|
+
tsx: '^4.21.0',
|
|
44
41
|
webpack: '^5',
|
|
45
42
|
webpackCli: '^6',
|
|
46
43
|
webpackDevServer: '^5',
|
|
@@ -59,6 +56,14 @@ function resolveEmbeddedValue(value: string): string {
|
|
|
59
56
|
return value;
|
|
60
57
|
}
|
|
61
58
|
|
|
59
|
+
function getRuntimePackageName(mainPackageName: string): string {
|
|
60
|
+
const normalized = String(mainPackageName || '').replace(/\/+$/, '');
|
|
61
|
+
if (!normalized) {
|
|
62
|
+
throw new Error('[runtime-package] mainPackageName is empty');
|
|
63
|
+
}
|
|
64
|
+
return `${normalized}/runtime`;
|
|
65
|
+
}
|
|
66
|
+
|
|
62
67
|
function loadEnvFile(filePath: string, override: boolean): void {
|
|
63
68
|
if (!fs.existsSync(filePath)) {
|
|
64
69
|
return;
|
|
@@ -144,7 +149,7 @@ function applyVersionsOverlay(envMode: string): void {
|
|
|
144
149
|
}
|
|
145
150
|
|
|
146
151
|
process.env.REACT_APP_VERSION = channelVersions.host;
|
|
147
|
-
process.env.REACT_APP_RUNTIME_VERSION = channelVersions.
|
|
152
|
+
process.env.REACT_APP_RUNTIME_VERSION = channelVersions.host;
|
|
148
153
|
process.env.REACT_APP_UI_KIT_VERSION = channelVersions.uiKit;
|
|
149
154
|
process.env.REACT_APP_EXTENSIONS_API_VERSION = channelVersions.extensionsApi;
|
|
150
155
|
process.env.REACT_APP_EXTENSIONS_REACT_VERSION = channelVersions.extensionsReact;
|
|
@@ -154,21 +159,6 @@ function applyVersionsOverlay(envMode: string): void {
|
|
|
154
159
|
process.env.RELEASE_CHANNEL = releaseChannel;
|
|
155
160
|
}
|
|
156
161
|
|
|
157
|
-
function resolveCommand(command: string): { executable: string; argsPrefix: string[] } {
|
|
158
|
-
if (process.platform === 'win32' && (command === 'npm' || command === 'npx')) {
|
|
159
|
-
const npmPackageJson = requireNode.resolve('npm/package.json');
|
|
160
|
-
return {
|
|
161
|
-
executable: process.execPath,
|
|
162
|
-
argsPrefix: [path.join(path.dirname(npmPackageJson), 'bin', `${command}-cli.js`)],
|
|
163
|
-
};
|
|
164
|
-
}
|
|
165
|
-
|
|
166
|
-
return {
|
|
167
|
-
executable: command,
|
|
168
|
-
argsPrefix: [],
|
|
169
|
-
};
|
|
170
|
-
}
|
|
171
|
-
|
|
172
162
|
function resolveEnvDir(cwd: string, appName: string): string {
|
|
173
163
|
if (!appName) {
|
|
174
164
|
return cwd;
|
|
@@ -248,14 +238,12 @@ function loadLocalEnvironment(options: LoadLocalEnvironmentOptions = {}): void {
|
|
|
248
238
|
function getMissingConfigNames(config: PackageConfig): string[] {
|
|
249
239
|
const requiredFields: [string, string][] = [
|
|
250
240
|
['REACT_APP_PACKAGE_NAME', config.packageName],
|
|
251
|
-
['REACT_APP_RUNTIME_PACKAGE', config.runtimePackageName],
|
|
252
241
|
['REACT_APP_UI_KIT_PACKAGE', config.uiKitPackageName],
|
|
253
242
|
['REACT_APP_EXTENSIONS_API_PACKAGE', config.extensionsApiPackageName],
|
|
254
243
|
['REACT_APP_EXTENSIONS_REACT_PACKAGE', config.extensionsReactPackageName],
|
|
255
244
|
['REACT_APP_EXTENSIONS_SANDBOX_PACKAGE', config.extensionsSandboxPackageName],
|
|
256
245
|
['REACT_APP_CLI_PACKAGE', config.cliPackageName],
|
|
257
246
|
['REACT_APP_VERSION', config.version],
|
|
258
|
-
['REACT_APP_RUNTIME_VERSION', config.runtimeVersion],
|
|
259
247
|
['REACT_APP_UI_KIT_VERSION', config.uiKitVersion],
|
|
260
248
|
];
|
|
261
249
|
|
|
@@ -269,9 +257,11 @@ export interface ResolvePackageConfigOptions {
|
|
|
269
257
|
}
|
|
270
258
|
|
|
271
259
|
function resolvePackageConfig(options: ResolvePackageConfigOptions = {}): PackageConfig {
|
|
260
|
+
const packageName = readEmbeddedProductIdentity('REACT_APP_PACKAGE_NAME', DEFAULT_PACKAGE_NAME);
|
|
261
|
+
const version = readConfiguredValue('REACT_APP_VERSION', DEFAULT_VERSION);
|
|
272
262
|
const config: PackageConfig = {
|
|
273
|
-
packageName
|
|
274
|
-
runtimePackageName:
|
|
263
|
+
packageName,
|
|
264
|
+
runtimePackageName: getRuntimePackageName(packageName),
|
|
275
265
|
uiKitPackageName: readEmbeddedProductIdentity('REACT_APP_UI_KIT_PACKAGE', DEFAULT_UI_KIT_PACKAGE),
|
|
276
266
|
extensionsApiPackageName: readEmbeddedProductIdentity(
|
|
277
267
|
'REACT_APP_EXTENSIONS_API_PACKAGE',
|
|
@@ -286,8 +276,8 @@ function resolvePackageConfig(options: ResolvePackageConfigOptions = {}): Packag
|
|
|
286
276
|
DEFAULT_EXTENSIONS_SANDBOX_PACKAGE,
|
|
287
277
|
),
|
|
288
278
|
cliPackageName: readEmbeddedProductIdentity('REACT_APP_CLI_PACKAGE', DEFAULT_CLI_PACKAGE),
|
|
289
|
-
version
|
|
290
|
-
runtimeVersion:
|
|
279
|
+
version,
|
|
280
|
+
runtimeVersion: version,
|
|
291
281
|
uiKitVersion: readConfiguredValue('REACT_APP_UI_KIT_VERSION', DEFAULT_UI_KIT_VERSION),
|
|
292
282
|
extensionsApiVersion: process.env.REACT_APP_EXTENSIONS_API_VERSION || readConfiguredValue('REACT_APP_VERSION', DEFAULT_VERSION),
|
|
293
283
|
extensionsReactVersion: process.env.REACT_APP_EXTENSIONS_REACT_VERSION || readConfiguredValue('REACT_APP_VERSION', DEFAULT_VERSION),
|
|
@@ -327,7 +317,7 @@ function npmViewVersionToString(parsed: JsonValue): string {
|
|
|
327
317
|
}
|
|
328
318
|
|
|
329
319
|
function readLatestRegistryVersion(packageName: string, distTag = 'latest'): string {
|
|
330
|
-
const { executable, argsPrefix } =
|
|
320
|
+
const { executable, argsPrefix } = resolveSpawnCommand('npm');
|
|
331
321
|
const packageSpec = distTag && distTag !== 'latest'
|
|
332
322
|
? `${packageName}@${distTag}`
|
|
333
323
|
: packageName;
|
|
@@ -382,7 +372,6 @@ function resolveLatestPackageConfig(
|
|
|
382
372
|
};
|
|
383
373
|
|
|
384
374
|
const latestPackageVersion = resolveOrFallback(config.packageName, config.version);
|
|
385
|
-
const latestRuntimeVersion = resolveOrFallback(config.runtimePackageName, config.runtimeVersion);
|
|
386
375
|
const latestUiKitVersion = resolveOrFallback(config.uiKitPackageName, config.uiKitVersion);
|
|
387
376
|
const latestExtensionsApiVersion = resolveOrFallback(config.extensionsApiPackageName, config.version);
|
|
388
377
|
const latestExtensionsReactVersion = resolveOrFallback(config.extensionsReactPackageName, config.version);
|
|
@@ -392,7 +381,7 @@ function resolveLatestPackageConfig(
|
|
|
392
381
|
return {
|
|
393
382
|
...config,
|
|
394
383
|
version: latestPackageVersion,
|
|
395
|
-
runtimeVersion:
|
|
384
|
+
runtimeVersion: latestPackageVersion,
|
|
396
385
|
uiKitVersion: latestUiKitVersion,
|
|
397
386
|
extensionsApiVersion: latestExtensionsApiVersion,
|
|
398
387
|
extensionsReactVersion: latestExtensionsReactVersion,
|
package/cli/lib/local-test.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import fs from 'fs';
|
|
2
2
|
import path from 'path';
|
|
3
3
|
import { spawnSync } from 'child_process';
|
|
4
|
-
import { createRequire } from 'module';
|
|
5
4
|
import { getMonorepoRoot } from './paths';
|
|
5
|
+
import { resolveNpmSpawnCommand } from './resolveNpmSpawn';
|
|
6
6
|
import { getRuntimeCliMessages } from './cli/runtimeMessages';
|
|
7
7
|
import type {
|
|
8
8
|
BuildLocalTestPackagesOptions,
|
|
@@ -14,8 +14,6 @@ import type {
|
|
|
14
14
|
} from './types';
|
|
15
15
|
import { isJsonObject, parseJsonValue } from './types';
|
|
16
16
|
|
|
17
|
-
const requireNode = createRequire(__filename);
|
|
18
|
-
|
|
19
17
|
const PROJECT_ROOT = getMonorepoRoot();
|
|
20
18
|
const DEFAULT_BUILD_DIR = path.resolve(PROJECT_ROOT, 'build');
|
|
21
19
|
|
|
@@ -23,24 +21,9 @@ function ensureDirectory(dirPath: string): void {
|
|
|
23
21
|
fs.mkdirSync(dirPath, { recursive: true });
|
|
24
22
|
}
|
|
25
23
|
|
|
26
|
-
function resolveCommand(command: 'npm' | 'npx'): { executable: string; argsPrefix: string[] } {
|
|
27
|
-
if (process.platform === 'win32' && (command === 'npm' || command === 'npx')) {
|
|
28
|
-
const npmPackageJson = requireNode.resolve('npm/package.json');
|
|
29
|
-
return {
|
|
30
|
-
executable: process.execPath,
|
|
31
|
-
argsPrefix: [path.join(path.dirname(npmPackageJson), 'bin', `${command}-cli.js`)],
|
|
32
|
-
};
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
return {
|
|
36
|
-
executable: command,
|
|
37
|
-
argsPrefix: [],
|
|
38
|
-
};
|
|
39
|
-
}
|
|
40
|
-
|
|
41
24
|
function packPackage(packageDir: string, destinationDir: string): string {
|
|
42
25
|
const runtimeMessages = getRuntimeCliMessages();
|
|
43
|
-
const { executable, argsPrefix } =
|
|
26
|
+
const { executable, argsPrefix } = resolveNpmSpawnCommand('npm');
|
|
44
27
|
const result = spawnSync(executable, [...argsPrefix, 'pack', '--pack-destination', destinationDir], {
|
|
45
28
|
cwd: packageDir,
|
|
46
29
|
encoding: 'utf8',
|
|
@@ -75,7 +58,7 @@ function buildLocalTestPackages(normalizedBuildDir: string, options: BuildLocalT
|
|
|
75
58
|
|
|
76
59
|
const targets = includeUmdBundle ? 'esm,react-adapter,umd' : 'esm,react-adapter';
|
|
77
60
|
console.log(`[cli] ${runtimeMessages.localTestBuildStarting(targets)}`);
|
|
78
|
-
const { executable, argsPrefix } =
|
|
61
|
+
const { executable, argsPrefix } = resolveNpmSpawnCommand('npx');
|
|
79
62
|
const result = spawnSync(
|
|
80
63
|
executable,
|
|
81
64
|
[...argsPrefix, 'tsx', 'build-tools/pipeline.ts', '--targets', targets, '--mode', 'production', '--lint=false', '--type-check=false'],
|
|
@@ -135,11 +118,9 @@ function createLocalPackageTarballs(options: CreateLocalTarballsOptions): LocalP
|
|
|
135
118
|
const packageDirs: Record<string, string> = standOnlyPackages
|
|
136
119
|
? {
|
|
137
120
|
packageName: normalizedBuildDir,
|
|
138
|
-
runtimePackageName: path.resolve(normalizedBuildDir, 'runtime'),
|
|
139
121
|
}
|
|
140
122
|
: {
|
|
141
123
|
packageName: normalizedBuildDir,
|
|
142
|
-
runtimePackageName: path.resolve(normalizedBuildDir, 'runtime'),
|
|
143
124
|
uiKitPackageName: path.resolve(normalizedBuildDir, 'ui-kit'),
|
|
144
125
|
extensionsApiPackageName: path.resolve(normalizedBuildDir, 'extensions/api'),
|
|
145
126
|
extensionsReactPackageName: path.resolve(normalizedBuildDir, 'extensions/react'),
|
package/cli/lib/paths.ts
CHANGED
|
@@ -1,9 +1,24 @@
|
|
|
1
|
+
import fs from 'fs';
|
|
1
2
|
import path from 'path';
|
|
2
3
|
|
|
3
4
|
/**
|
|
4
5
|
* Корень npm-пакета `build-tools/cli` (корректно и из исходников `lib/…`, и из `dist/lib/…` после tsc).
|
|
5
6
|
*/
|
|
6
7
|
export function getCliPackageRoot(): string {
|
|
8
|
+
const candidates = [
|
|
9
|
+
path.resolve(__dirname, '..'),
|
|
10
|
+
path.resolve(__dirname, '..', '..'),
|
|
11
|
+
];
|
|
12
|
+
|
|
13
|
+
for (const candidate of candidates) {
|
|
14
|
+
if (
|
|
15
|
+
fs.existsSync(path.join(candidate, 'package.json'))
|
|
16
|
+
&& fs.existsSync(path.join(candidate, 'project-templates'))
|
|
17
|
+
) {
|
|
18
|
+
return candidate;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
|
|
7
22
|
return path.resolve(__dirname, '..', '..');
|
|
8
23
|
}
|
|
9
24
|
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import fs from 'fs';
|
|
2
|
+
import path from 'path';
|
|
3
|
+
import { createRequire } from 'module';
|
|
4
|
+
|
|
5
|
+
const requireNode = createRequire(__filename);
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Путь к npm-cli.js / npx-cli.js для spawn через node.exe (нужно на Windows без shell).
|
|
9
|
+
* `require.resolve('npm/package.json')` работает только если пакет `npm` в дереве зависимостей;
|
|
10
|
+
* у типичной установки Node он лежит рядом с node.exe (см. fallback).
|
|
11
|
+
*/
|
|
12
|
+
export function findNpmCliJs(command: 'npm' | 'npx'): string | null {
|
|
13
|
+
const binaryName = `${command}-cli.js`;
|
|
14
|
+
|
|
15
|
+
try {
|
|
16
|
+
const npmPackageJson = requireNode.resolve('npm/package.json');
|
|
17
|
+
const p = path.join(path.dirname(npmPackageJson), 'bin', binaryName);
|
|
18
|
+
if (fs.existsSync(p)) {
|
|
19
|
+
return p;
|
|
20
|
+
}
|
|
21
|
+
} catch {
|
|
22
|
+
/* npm не в node_modules CLI-пакета — ищем рядом с текущим node */
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
const binDir = path.dirname(process.execPath);
|
|
26
|
+
const npmRootCandidates = [
|
|
27
|
+
path.join(binDir, 'node_modules', 'npm'),
|
|
28
|
+
path.join(binDir, '..', 'lib', 'node_modules', 'npm'),
|
|
29
|
+
];
|
|
30
|
+
|
|
31
|
+
for (const npmRoot of npmRootCandidates) {
|
|
32
|
+
const p = path.join(npmRoot, 'bin', binaryName);
|
|
33
|
+
if (fs.existsSync(p)) {
|
|
34
|
+
return p;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
return null;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
export type NpmSpawnArgs = { executable: string; argsPrefix: string[] };
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* Запуск npm/npx на Windows без shell: через node.exe и *-cli.js из установки Node.
|
|
45
|
+
* Если путь не найден — откат на имя команды в PATH.
|
|
46
|
+
*/
|
|
47
|
+
export function resolveNpmSpawnCommand(command: 'npm' | 'npx'): NpmSpawnArgs {
|
|
48
|
+
if (process.platform === 'win32' && (command === 'npm' || command === 'npx')) {
|
|
49
|
+
const cliJs = findNpmCliJs(command);
|
|
50
|
+
if (cliJs) {
|
|
51
|
+
return {
|
|
52
|
+
executable: process.execPath,
|
|
53
|
+
argsPrefix: [cliJs],
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
return {
|
|
59
|
+
executable: command,
|
|
60
|
+
argsPrefix: [],
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* Только `npm` / `npx` нормализуются на Windows; остальные команды — как есть.
|
|
66
|
+
*/
|
|
67
|
+
export function resolveSpawnCommand(command: string): NpmSpawnArgs {
|
|
68
|
+
if (command === 'npm' || command === 'npx') {
|
|
69
|
+
return resolveNpmSpawnCommand(command);
|
|
70
|
+
}
|
|
71
|
+
return { executable: command, argsPrefix: [] };
|
|
72
|
+
}
|
|
@@ -20,18 +20,12 @@ function buildPluginPackageJsonData(options: TemplateOptions): Record<string, un
|
|
|
20
20
|
const usesModuleType = pluginFormat !== 'umd';
|
|
21
21
|
|
|
22
22
|
const appPackageVersion = localTarballs ? localTarballs.packageName : packageConfig.version;
|
|
23
|
-
const runtimePackageVersion = localTarballs ? localTarballs.runtimePackageName : packageConfig.runtimeVersion;
|
|
24
23
|
const extensionsApiVersion = localTarballs ? localTarballs.extensionsApiPackageName : packageConfig.extensionsApiVersion;
|
|
25
24
|
const extensionsSandboxVersion = localTarballs ? localTarballs.extensionsSandboxPackageName : packageConfig.extensionsSandboxVersion;
|
|
26
25
|
const extensionsReactVersion = localTarballs?.extensionsReactPackageName || packageConfig.extensionsReactVersion;
|
|
27
26
|
const uiKitVersion = localTarballs?.uiKitPackageName || packageConfig.uiKitVersion;
|
|
28
27
|
|
|
29
28
|
const mainPkgKey = resolveLocalPublishedPackageKey(localPublishedNames, 'packageName', packageConfig.packageName);
|
|
30
|
-
const runtimePkgKey = resolveLocalPublishedPackageKey(
|
|
31
|
-
localPublishedNames,
|
|
32
|
-
'runtimePackageName',
|
|
33
|
-
packageConfig.runtimePackageName,
|
|
34
|
-
);
|
|
35
29
|
const extApiKey = resolveLocalPublishedPackageKey(
|
|
36
30
|
localPublishedNames,
|
|
37
31
|
'extensionsApiPackageName',
|
|
@@ -49,9 +43,11 @@ function buildPluginPackageJsonData(options: TemplateOptions): Record<string, un
|
|
|
49
43
|
);
|
|
50
44
|
const uiKitKey = resolveLocalPublishedPackageKey(localPublishedNames, 'uiKitPackageName', packageConfig.uiKitPackageName);
|
|
51
45
|
|
|
52
|
-
const
|
|
46
|
+
const dependencies = {
|
|
53
47
|
[mainPkgKey]: appPackageVersion,
|
|
54
|
-
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
const peerDependencies = {
|
|
55
51
|
[extApiKey]: extensionsApiVersion,
|
|
56
52
|
[extReactKey]: extensionsReactVersion,
|
|
57
53
|
[extSandboxKey]: extensionsSandboxVersion,
|
|
@@ -62,12 +58,11 @@ function buildPluginPackageJsonData(options: TemplateOptions): Record<string, un
|
|
|
62
58
|
}
|
|
63
59
|
|
|
64
60
|
const devDependencies: Record<string, string> = {
|
|
65
|
-
[mainPkgKey]: appPackageVersion,
|
|
66
|
-
[runtimePkgKey]: runtimePackageVersion,
|
|
67
61
|
[extApiKey]: extensionsApiVersion,
|
|
68
62
|
[extReactKey]: extensionsReactVersion,
|
|
69
63
|
[extSandboxKey]: extensionsSandboxVersion,
|
|
70
64
|
typescript: String(packageConfig.versions.typescript),
|
|
65
|
+
tsx: packageConfig.versions.tsx,
|
|
71
66
|
...LEGACY_REACT_DEPENDENCIES,
|
|
72
67
|
};
|
|
73
68
|
|
|
@@ -88,6 +83,8 @@ function buildPluginPackageJsonData(options: TemplateOptions): Record<string, un
|
|
|
88
83
|
devDependencies['ts-loader'] = packageConfig.versions.tsLoader;
|
|
89
84
|
}
|
|
90
85
|
|
|
86
|
+
const webpackCliCommand = 'tsx ./node_modules/webpack-cli/bin/cli.js';
|
|
87
|
+
|
|
91
88
|
return {
|
|
92
89
|
name: pluginPackageName,
|
|
93
90
|
version: '0.1.0',
|
|
@@ -100,25 +97,28 @@ function buildPluginPackageJsonData(options: TemplateOptions): Record<string, un
|
|
|
100
97
|
scripts:
|
|
101
98
|
bundler === 'vite'
|
|
102
99
|
? {
|
|
103
|
-
start: '
|
|
104
|
-
'start:release': '
|
|
105
|
-
'dev:app':
|
|
100
|
+
start: 'npm run dev:app',
|
|
101
|
+
'start:release': 'tsx ./scripts/release-runner.ts',
|
|
102
|
+
'dev:app': 'tsx ./scripts/dev-runner.ts',
|
|
103
|
+
'dev:host': `vite --config ./${generatedPaths.devConfig}`,
|
|
106
104
|
'dev:sandbox': `vite build --config ./${generatedPaths.sandboxBuildConfig} --watch --mode development`,
|
|
107
|
-
build: '
|
|
108
|
-
'build:types': '
|
|
105
|
+
build: 'tsx ./scripts/build-runner.ts',
|
|
106
|
+
'build:types': 'tsx ./scripts/build-types.ts',
|
|
109
107
|
'build:app': `vite build --config ./${generatedPaths.pluginBuildConfig}`,
|
|
110
108
|
'build:sandbox': `vite build --config ./${generatedPaths.sandboxBuildConfig} --mode production`,
|
|
111
109
|
}
|
|
112
110
|
: {
|
|
113
|
-
start: '
|
|
114
|
-
'start:release': '
|
|
115
|
-
'dev:app':
|
|
116
|
-
'dev:
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
'build:
|
|
120
|
-
'build:
|
|
111
|
+
start: 'npm run dev:app',
|
|
112
|
+
'start:release': 'tsx ./scripts/release-runner.ts',
|
|
113
|
+
'dev:app': 'tsx ./scripts/dev-runner.ts',
|
|
114
|
+
'dev:host': `${webpackCliCommand} serve --config ./${generatedPaths.devConfig} --mode development`,
|
|
115
|
+
'dev:sandbox': `${webpackCliCommand} --config ./${generatedPaths.sandboxBuildConfig} --mode development --watch`,
|
|
116
|
+
build: 'tsx ./scripts/build-runner.ts',
|
|
117
|
+
'build:types': 'tsx ./scripts/build-types.ts',
|
|
118
|
+
'build:app': `${webpackCliCommand} --config ./${generatedPaths.pluginBuildConfig} --mode production`,
|
|
119
|
+
'build:sandbox': `${webpackCliCommand} --config ./${generatedPaths.sandboxBuildConfig} --mode production`,
|
|
121
120
|
},
|
|
121
|
+
dependencies,
|
|
122
122
|
peerDependencies,
|
|
123
123
|
devDependencies,
|
|
124
124
|
};
|
|
@@ -25,19 +25,13 @@ function buildStandVitePackageJsonData(options: TemplateOptions): Record<string,
|
|
|
25
25
|
const isMemoryUsageStand = standMode === 'advanced' && advancedProfile === 'memory-usage';
|
|
26
26
|
|
|
27
27
|
const appPackageVersion = localTarballs?.packageName || packageConfig.version;
|
|
28
|
-
const runtimePackageVersion = localTarballs?.runtimePackageName || packageConfig.runtimeVersion;
|
|
29
28
|
|
|
30
29
|
const mainPkgKey = resolveLocalPublishedPackageKey(localPublishedNames, 'packageName', packageConfig.packageName);
|
|
31
|
-
const runtimePkgKey = resolveLocalPublishedPackageKey(
|
|
32
|
-
localPublishedNames,
|
|
33
|
-
'runtimePackageName',
|
|
34
|
-
packageConfig.runtimePackageName,
|
|
35
|
-
);
|
|
36
30
|
|
|
37
31
|
const devDependencies: Record<string, string> = {
|
|
38
32
|
[mainPkgKey]: appPackageVersion,
|
|
39
|
-
[runtimePkgKey]: runtimePackageVersion,
|
|
40
33
|
typescript: String(packageConfig.versions.typescript),
|
|
34
|
+
tsx: packageConfig.versions.tsx,
|
|
41
35
|
formidable: '^3.5.2',
|
|
42
36
|
...LEGACY_REACT_DEPENDENCIES,
|
|
43
37
|
};
|
|
@@ -59,12 +53,13 @@ function buildStandVitePackageJsonData(options: TemplateOptions): Record<string,
|
|
|
59
53
|
devDependencies['ts-loader'] = packageConfig.versions.tsLoader;
|
|
60
54
|
}
|
|
61
55
|
|
|
56
|
+
const webpackCliCommand = 'tsx ./node_modules/webpack-cli/bin/cli.js';
|
|
62
57
|
const scripts = bundler === 'vite'
|
|
63
58
|
? isMemoryUsageStand
|
|
64
59
|
? {
|
|
65
|
-
start: `cross-env NODE_OPTIONS=--max-old-space-size=
|
|
66
|
-
build: `cross-env NODE_OPTIONS=--max-old-space-size=
|
|
67
|
-
preview: `cross-env NODE_OPTIONS=--max-old-space-size=
|
|
60
|
+
start: `cross-env NODE_OPTIONS=--max-old-space-size=512 vite --config ./${generatedPaths.devConfig}`,
|
|
61
|
+
build: `cross-env NODE_OPTIONS=--max-old-space-size=512 vite build --config ./${generatedPaths.devConfig}`,
|
|
62
|
+
preview: `cross-env NODE_OPTIONS=--max-old-space-size=512 vite preview --config ./${generatedPaths.devConfig}`,
|
|
68
63
|
}
|
|
69
64
|
: {
|
|
70
65
|
start: `vite --config ./${generatedPaths.devConfig}`,
|
|
@@ -72,8 +67,8 @@ function buildStandVitePackageJsonData(options: TemplateOptions): Record<string,
|
|
|
72
67
|
preview: `vite preview --config ./${generatedPaths.devConfig}`,
|
|
73
68
|
}
|
|
74
69
|
: {
|
|
75
|
-
start:
|
|
76
|
-
build:
|
|
70
|
+
start: `${webpackCliCommand} serve --config ./${generatedPaths.devConfig} --mode development`,
|
|
71
|
+
build: `${webpackCliCommand} --config ./${generatedPaths.devConfig} --mode production`,
|
|
77
72
|
};
|
|
78
73
|
|
|
79
74
|
return {
|
|
@@ -123,6 +123,10 @@ function resolveStandReactAdapterViteVariantDir(cliRoot = getCliPackageRoot()) {
|
|
|
123
123
|
return path.join(cliRoot, 'project-templates', 'stand', 'react-adapter', 'vite');
|
|
124
124
|
}
|
|
125
125
|
|
|
126
|
+
function resolveStandReactAdapterWebpackVariantDir(cliRoot = getCliPackageRoot()) {
|
|
127
|
+
return path.join(cliRoot, 'project-templates', 'stand', 'react-adapter', 'webpack');
|
|
128
|
+
}
|
|
129
|
+
|
|
126
130
|
function resolveStandAdvancedViteVariantDir(profile: AdvancedProfile, cliRoot: string = getCliPackageRoot()): string {
|
|
127
131
|
return path.join(cliRoot, 'project-templates', 'stand', 'advanced', profile, 'vite');
|
|
128
132
|
}
|
|
@@ -146,6 +150,13 @@ function shouldUseEtaStandReactAdapterVite(options: StandEtaRoutingInput) {
|
|
|
146
150
|
return getDemoStandMode(options) === 'react-adapter';
|
|
147
151
|
}
|
|
148
152
|
|
|
153
|
+
/** demo-stand react-adapter + webpack */
|
|
154
|
+
function shouldUseEtaStandReactAdapterWebpack(options: StandEtaRoutingInput) {
|
|
155
|
+
if (!isDemoStandKind(options.kind)) return false;
|
|
156
|
+
if (options.bundler !== 'webpack') return false;
|
|
157
|
+
return getDemoStandMode(options) === 'react-adapter';
|
|
158
|
+
}
|
|
159
|
+
|
|
149
160
|
/** advanced + vite (shadow-dom | umd | memory-usage | subpath) */
|
|
150
161
|
function getStandAdvancedViteEtaLayerRoots(templateOptions: StandEtaRoutingInput, cliRoot: string = getCliPackageRoot()): string[] | null {
|
|
151
162
|
if (templateOptions.bundler !== 'vite') return null;
|
|
@@ -191,6 +202,11 @@ function getStandReactAdapterViteEtaLayerRoots(templateOptions: StandEtaRoutingI
|
|
|
191
202
|
return [resolveStandViteBaseLayerDir(cliRoot), resolveStandReactAdapterViteVariantDir(cliRoot)];
|
|
192
203
|
}
|
|
193
204
|
|
|
205
|
+
function getStandReactAdapterWebpackEtaLayerRoots(templateOptions: StandEtaRoutingInput, cliRoot: string = getCliPackageRoot()): string[] | null {
|
|
206
|
+
if (!shouldUseEtaStandReactAdapterWebpack(templateOptions)) return null;
|
|
207
|
+
return [resolveStandWebpackBaseLayerDir(cliRoot), resolveStandReactAdapterWebpackVariantDir(cliRoot)];
|
|
208
|
+
}
|
|
209
|
+
|
|
194
210
|
/** Stand + Eta: простые slug, react-adapter, advanced-ветки. */
|
|
195
211
|
function getStandEtaLayerRoots(templateOptions: StandEtaRoutingInput, cliRoot: string = getCliPackageRoot()): string[] | null {
|
|
196
212
|
const simpleVite = getStandViteEtaLayerRoots(templateOptions, cliRoot);
|
|
@@ -202,6 +218,9 @@ function getStandEtaLayerRoots(templateOptions: StandEtaRoutingInput, cliRoot: s
|
|
|
202
218
|
const reactVite = getStandReactAdapterViteEtaLayerRoots(templateOptions, cliRoot);
|
|
203
219
|
if (reactVite) return reactVite;
|
|
204
220
|
|
|
221
|
+
const reactWebpack = getStandReactAdapterWebpackEtaLayerRoots(templateOptions, cliRoot);
|
|
222
|
+
if (reactWebpack) return reactWebpack;
|
|
223
|
+
|
|
205
224
|
const advVite = getStandAdvancedViteEtaLayerRoots(templateOptions, cliRoot);
|
|
206
225
|
if (advVite) return advVite;
|
|
207
226
|
|
|
@@ -229,10 +248,13 @@ export {
|
|
|
229
248
|
getStandViteEtaLayerRoots,
|
|
230
249
|
getStandWebpackEtaLayerRoots,
|
|
231
250
|
getStandReactAdapterViteEtaLayerRoots,
|
|
251
|
+
getStandReactAdapterWebpackEtaLayerRoots,
|
|
232
252
|
getStandAdvancedViteEtaLayerRoots,
|
|
233
253
|
getStandAdvancedWebpackEtaLayerRoots,
|
|
234
254
|
shouldUseEtaStandReactAdapterVite,
|
|
255
|
+
shouldUseEtaStandReactAdapterWebpack,
|
|
235
256
|
resolveStandReactAdapterViteVariantDir,
|
|
257
|
+
resolveStandReactAdapterWebpackVariantDir,
|
|
236
258
|
resolveStandAdvancedUmdWebpackVariantDir,
|
|
237
259
|
resolveStandAdvancedShadowDomWebpackVariantDir,
|
|
238
260
|
getStandEtaLayerRoots,
|
|
@@ -31,6 +31,7 @@ function mockPackageConfig(): PackageConfig {
|
|
|
31
31
|
uiLanguage: 'en',
|
|
32
32
|
versions: {
|
|
33
33
|
typescript: '5.0.0',
|
|
34
|
+
tsx: '4.21.0',
|
|
34
35
|
vite: '5.0.0',
|
|
35
36
|
webpack: '5.0.0',
|
|
36
37
|
webpackCli: '5.0.0',
|
|
@@ -65,7 +66,7 @@ test('advanced memory-usage vite dev-host uses literal api values', () => {
|
|
|
65
66
|
advancedProfile: 'memory-usage',
|
|
66
67
|
});
|
|
67
68
|
const { files } = generateFiles(options);
|
|
68
|
-
const devHost = utf8(files['config/dev-host.
|
|
69
|
+
const devHost = utf8(files['config/dev-host.ts']);
|
|
69
70
|
assert.match(devHost, /apiBaseUrl: "http:\/\/localhost:3000"/);
|
|
70
71
|
assert.match(devHost, /apiOrigin: "http:\/\/localhost:3000"/);
|
|
71
72
|
assert.match(devHost, /createMemoryUsageStandConfig/);
|
|
@@ -77,7 +78,7 @@ test('advanced umd vite dev-host uses eta middleware setup', () => {
|
|
|
77
78
|
advancedProfile: 'umd',
|
|
78
79
|
});
|
|
79
80
|
const { files } = generateFiles(options);
|
|
80
|
-
const devHost = utf8(files['config/dev-host.
|
|
81
|
+
const devHost = utf8(files['config/dev-host.ts']);
|
|
81
82
|
assert.match(devHost, /createUmdServeMiddleware/);
|
|
82
83
|
assert.match(devHost, /publicPath: "\/MyApp\/"/);
|
|
83
84
|
assert.match(devHost, /apiBaseUrl: "http:\/\/localhost:3000"/);
|
|
@@ -89,7 +90,7 @@ test('advanced subpath vite dev-host contains outputFolder and literal api value
|
|
|
89
90
|
advancedProfile: 'subpath',
|
|
90
91
|
});
|
|
91
92
|
const { files } = generateFiles(options);
|
|
92
|
-
const devHost = utf8(files['config/dev-host.
|
|
93
|
+
const devHost = utf8(files['config/dev-host.ts']);
|
|
93
94
|
assert.match(devHost, /outputFolder: "\/advanced\/subpath\/editor"/);
|
|
94
95
|
assert.match(devHost, /apiBaseUrl: "http:\/\/localhost:3000"/);
|
|
95
96
|
assert.match(devHost, /apiOrigin: "http:\/\/localhost:3000"/);
|