@bleedingdev/modern-js-create 3.5.0-ultramodern.30 → 3.5.0-ultramodern.32
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/dist/cjs/cli/flags.cjs +326 -0
- package/dist/cjs/cli/help.cjs +106 -0
- package/dist/cjs/cli/package-source.cjs +186 -0
- package/dist/cjs/cli/project-setup.cjs +138 -0
- package/dist/cjs/cli/prompts.cjs +118 -0
- package/dist/cjs/index.cjs +24 -581
- package/dist/cjs/ultramodern-tooling/commands/cloudflare-output-verify.cjs +132 -0
- package/dist/cjs/ultramodern-tooling/commands/context.cjs +131 -0
- package/dist/cjs/ultramodern-tooling/commands/mf-types.cjs +55 -0
- package/dist/cjs/ultramodern-tooling/commands/migrate-strict-effect/api-metadata.cjs +158 -0
- package/dist/cjs/ultramodern-tooling/commands/migrate-strict-effect/declaration-patches.cjs +49 -0
- package/dist/cjs/ultramodern-tooling/commands/migrate-strict-effect/dependency-usage.cjs +87 -0
- package/dist/cjs/ultramodern-tooling/commands/migrate-strict-effect/generated-artifacts-backend-federation.cjs +58 -0
- package/dist/cjs/ultramodern-tooling/commands/migrate-strict-effect/generated-artifacts-build-identity.cjs +62 -0
- package/dist/cjs/ultramodern-tooling/commands/migrate-strict-effect/generated-artifacts-modern-configs.cjs +60 -0
- package/dist/cjs/ultramodern-tooling/commands/migrate-strict-effect/generated-artifacts-oxfmt.cjs +132 -0
- package/dist/cjs/ultramodern-tooling/commands/migrate-strict-effect/generated-artifacts-removal.cjs +67 -0
- package/dist/cjs/ultramodern-tooling/commands/migrate-strict-effect/generated-artifacts-typescript.cjs +93 -0
- package/dist/cjs/ultramodern-tooling/commands/migrate-strict-effect/generated-artifacts-zerops.cjs +60 -0
- package/dist/cjs/ultramodern-tooling/commands/migrate-strict-effect/generated-artifacts.cjs +67 -0
- package/dist/cjs/ultramodern-tooling/commands/migrate-strict-effect/generated-patches.cjs +67 -0
- package/dist/cjs/ultramodern-tooling/commands/migrate-strict-effect/help.cjs +54 -0
- package/dist/cjs/ultramodern-tooling/commands/migrate-strict-effect/install.cjs +52 -0
- package/dist/cjs/ultramodern-tooling/commands/migrate-strict-effect/io.cjs +133 -0
- package/dist/cjs/ultramodern-tooling/commands/migrate-strict-effect/package-cohort.cjs +219 -0
- package/dist/cjs/ultramodern-tooling/commands/migrate-strict-effect/package-source.cjs +76 -0
- package/dist/cjs/ultramodern-tooling/commands/migrate-strict-effect/pnpm-policy.cjs +131 -0
- package/dist/cjs/ultramodern-tooling/commands/migrate-strict-effect/pnpm-yaml.cjs +161 -0
- package/dist/cjs/ultramodern-tooling/commands/migrate-strict-effect/policy-constants.cjs +88 -0
- package/dist/cjs/ultramodern-tooling/commands/migrate-strict-effect.cjs +149 -0
- package/dist/cjs/ultramodern-tooling/commands/options.cjs +59 -0
- package/dist/cjs/ultramodern-tooling/commands/routes-generate.cjs +122 -0
- package/dist/cjs/ultramodern-tooling/commands/skills.cjs +49 -0
- package/dist/cjs/ultramodern-tooling/commands/sync-delivery-unit.cjs +40 -0
- package/dist/cjs/ultramodern-tooling/commands/validate.cjs +49 -0
- package/dist/cjs/ultramodern-tooling/commands.cjs +17 -1165
- package/dist/cjs/ultramodern-tooling/config/constants.cjs +48 -0
- package/dist/cjs/ultramodern-tooling/config/index.cjs +104 -0
- package/dist/cjs/ultramodern-tooling/config/json.cjs +61 -0
- package/dist/cjs/ultramodern-tooling/config/load.cjs +62 -0
- package/dist/cjs/ultramodern-tooling/config/metadata.cjs +92 -0
- package/dist/cjs/ultramodern-tooling/config/normalize.cjs +160 -0
- package/dist/cjs/ultramodern-tooling/config/synthesize.cjs +157 -0
- package/dist/cjs/ultramodern-tooling/config/types.cjs +18 -0
- package/dist/cjs/ultramodern-tooling/config.cjs +23 -274
- package/dist/cjs/ultramodern-workspace/add-vertical/constants.cjs +52 -0
- package/dist/cjs/ultramodern-workspace/add-vertical/execute.cjs +156 -0
- package/dist/cjs/ultramodern-workspace/add-vertical/plan.cjs +246 -0
- package/dist/cjs/ultramodern-workspace/add-vertical/preflight.cjs +198 -0
- package/dist/cjs/ultramodern-workspace/add-vertical/shell-files.cjs +116 -0
- package/dist/cjs/ultramodern-workspace/add-vertical/topology.cjs +133 -0
- package/dist/cjs/ultramodern-workspace/add-vertical/workspace-state.cjs +107 -0
- package/dist/cjs/ultramodern-workspace/add-vertical.cjs +22 -596
- package/dist/cjs/ultramodern-workspace/api/checkout-cart.cjs +145 -0
- package/dist/cjs/ultramodern-workspace/api/client.cjs +218 -0
- package/dist/cjs/ultramodern-workspace/api/contracts.cjs +222 -0
- package/dist/cjs/ultramodern-workspace/api/names.cjs +98 -0
- package/dist/cjs/ultramodern-workspace/api/service.cjs +220 -0
- package/dist/cjs/ultramodern-workspace/api/shared.cjs +252 -0
- package/dist/cjs/ultramodern-workspace/api.cjs +27 -1046
- package/dist/cjs/ultramodern-workspace/app-files.cjs +3 -18
- package/dist/cjs/ultramodern-workspace/backend-federation.cjs +38 -24
- package/dist/cjs/ultramodern-workspace/bridge-config/cli.cjs +71 -0
- package/dist/cjs/ultramodern-workspace/bridge-config/defaults.cjs +43 -0
- package/dist/cjs/ultramodern-workspace/bridge-config/gates.cjs +93 -0
- package/dist/cjs/ultramodern-workspace/bridge-config/index.cjs +60 -0
- package/dist/cjs/ultramodern-workspace/bridge-config/normalize.cjs +68 -0
- package/dist/cjs/ultramodern-workspace/bridge-config/schema.cjs +78 -0
- package/dist/cjs/ultramodern-workspace/bridge-config/shared.cjs +110 -0
- package/dist/cjs/ultramodern-workspace/bridge-config/validation.cjs +68 -0
- package/dist/cjs/ultramodern-workspace/bridge-config/workspace-packages.cjs +108 -0
- package/dist/cjs/ultramodern-workspace/bridge-config.cjs +32 -297
- package/dist/cjs/ultramodern-workspace/delivery-unit-sync.cjs +22 -20
- package/dist/cjs/ultramodern-workspace/delivery-unit.cjs +7 -20
- package/dist/cjs/ultramodern-workspace/demo-components.cjs +47 -189
- package/dist/cjs/ultramodern-workspace/descriptors.cjs +12 -1
- package/dist/cjs/ultramodern-workspace/effect-diagnostics.cjs +114 -0
- package/dist/cjs/ultramodern-workspace/fs-io.cjs +24 -2
- package/dist/cjs/ultramodern-workspace/index.cjs +4 -0
- package/dist/cjs/ultramodern-workspace/mf-validation/constants.cjs +69 -0
- package/dist/cjs/ultramodern-workspace/mf-validation/discovery.cjs +77 -0
- package/dist/cjs/ultramodern-workspace/mf-validation/inspect.cjs +92 -0
- package/dist/cjs/ultramodern-workspace/mf-validation/object-literal.cjs +203 -0
- package/dist/cjs/ultramodern-workspace/mf-validation/path-utils.cjs +171 -0
- package/dist/cjs/ultramodern-workspace/mf-validation/syntax.cjs +228 -0
- package/dist/cjs/ultramodern-workspace/mf-validation/types.cjs +18 -0
- package/dist/cjs/ultramodern-workspace/mf-validation/validate.cjs +112 -0
- package/dist/cjs/ultramodern-workspace/mf-validation.cjs +6 -529
- package/dist/cjs/ultramodern-workspace/module-federation/config.cjs +251 -0
- package/dist/cjs/ultramodern-workspace/module-federation/index.cjs +73 -0
- package/dist/cjs/ultramodern-workspace/module-federation/reexport-module.cjs +73 -0
- package/dist/cjs/ultramodern-workspace/module-federation/remote-refs.cjs +105 -0
- package/dist/cjs/ultramodern-workspace/module-federation/shared-config.cjs +53 -0
- package/dist/cjs/ultramodern-workspace/module-federation.cjs +14 -584
- package/dist/cjs/ultramodern-workspace/package-json.cjs +13 -229
- package/dist/cjs/ultramodern-workspace/routes.cjs +8 -142
- package/dist/cjs/ultramodern-workspace/shared-patches.cjs +44 -0
- package/dist/cjs/ultramodern-workspace/tsconfigs.cjs +199 -0
- package/dist/cjs/ultramodern-workspace/workspace-script-plan.cjs +2 -2
- package/dist/cjs/ultramodern-workspace/write-app.cjs +128 -0
- package/dist/cjs/ultramodern-workspace/write-workspace.cjs +4 -61
- package/dist/cjs/ultramodern-workspace/zerops.cjs +13 -10
- package/dist/esm/cli/flags.js +228 -0
- package/dist/esm/cli/help.js +65 -0
- package/dist/esm/cli/package-source.js +119 -0
- package/dist/esm/cli/project-setup.js +81 -0
- package/dist/esm/cli/prompts.js +63 -0
- package/dist/esm/index.js +6 -559
- package/dist/esm/ultramodern-tooling/commands/cloudflare-output-verify.js +84 -0
- package/dist/esm/ultramodern-tooling/commands/context.js +66 -0
- package/dist/esm/ultramodern-tooling/commands/mf-types.js +17 -0
- package/dist/esm/ultramodern-tooling/commands/migrate-strict-effect/api-metadata.js +106 -0
- package/dist/esm/ultramodern-tooling/commands/migrate-strict-effect/declaration-patches.js +11 -0
- package/dist/esm/ultramodern-tooling/commands/migrate-strict-effect/dependency-usage.js +38 -0
- package/dist/esm/ultramodern-tooling/commands/migrate-strict-effect/generated-artifacts-backend-federation.js +10 -0
- package/dist/esm/ultramodern-tooling/commands/migrate-strict-effect/generated-artifacts-build-identity.js +14 -0
- package/dist/esm/ultramodern-tooling/commands/migrate-strict-effect/generated-artifacts-modern-configs.js +12 -0
- package/dist/esm/ultramodern-tooling/commands/migrate-strict-effect/generated-artifacts-oxfmt.js +83 -0
- package/dist/esm/ultramodern-tooling/commands/migrate-strict-effect/generated-artifacts-removal.js +16 -0
- package/dist/esm/ultramodern-tooling/commands/migrate-strict-effect/generated-artifacts-typescript.js +44 -0
- package/dist/esm/ultramodern-tooling/commands/migrate-strict-effect/generated-artifacts-zerops.js +12 -0
- package/dist/esm/ultramodern-tooling/commands/migrate-strict-effect/generated-artifacts.js +7 -0
- package/dist/esm/ultramodern-tooling/commands/migrate-strict-effect/generated-patches.js +15 -0
- package/dist/esm/ultramodern-tooling/commands/migrate-strict-effect/help.js +16 -0
- package/dist/esm/ultramodern-tooling/commands/migrate-strict-effect/install.js +14 -0
- package/dist/esm/ultramodern-tooling/commands/migrate-strict-effect/io.js +69 -0
- package/dist/esm/ultramodern-tooling/commands/migrate-strict-effect/package-cohort.js +175 -0
- package/dist/esm/ultramodern-tooling/commands/migrate-strict-effect/package-source.js +38 -0
- package/dist/esm/ultramodern-tooling/commands/migrate-strict-effect/pnpm-policy.js +76 -0
- package/dist/esm/ultramodern-tooling/commands/migrate-strict-effect/pnpm-yaml.js +105 -0
- package/dist/esm/ultramodern-tooling/commands/migrate-strict-effect/policy-constants.js +16 -0
- package/dist/esm/ultramodern-tooling/commands/migrate-strict-effect.js +100 -0
- package/dist/esm/ultramodern-tooling/commands/options.js +18 -0
- package/dist/esm/ultramodern-tooling/commands/routes-generate.js +74 -0
- package/dist/esm/ultramodern-tooling/commands/skills.js +11 -0
- package/dist/esm/ultramodern-tooling/commands/sync-delivery-unit.js +1 -0
- package/dist/esm/ultramodern-tooling/commands/validate.js +11 -0
- package/dist/esm/ultramodern-tooling/commands.js +9 -1152
- package/dist/esm/ultramodern-tooling/config/constants.js +4 -0
- package/dist/esm/ultramodern-tooling/config/index.js +7 -0
- package/dist/esm/ultramodern-tooling/config/json.js +10 -0
- package/dist/esm/ultramodern-tooling/config/load.js +13 -0
- package/dist/esm/ultramodern-tooling/config/metadata.js +37 -0
- package/dist/esm/ultramodern-tooling/config/normalize.js +106 -0
- package/dist/esm/ultramodern-tooling/config/synthesize.js +108 -0
- package/dist/esm/ultramodern-tooling/config/types.js +0 -0
- package/dist/esm/ultramodern-tooling/config.js +1 -255
- package/dist/esm/ultramodern-workspace/add-vertical/constants.js +5 -0
- package/dist/esm/ultramodern-workspace/add-vertical/execute.js +108 -0
- package/dist/esm/ultramodern-workspace/add-vertical/plan.js +184 -0
- package/dist/esm/ultramodern-workspace/add-vertical/preflight.js +122 -0
- package/dist/esm/ultramodern-workspace/add-vertical/shell-files.js +59 -0
- package/dist/esm/ultramodern-workspace/add-vertical/topology.js +89 -0
- package/dist/esm/ultramodern-workspace/add-vertical/workspace-state.js +43 -0
- package/dist/esm/ultramodern-workspace/add-vertical.js +6 -569
- package/dist/esm/ultramodern-workspace/api/checkout-cart.js +86 -0
- package/dist/esm/ultramodern-workspace/api/client.js +177 -0
- package/dist/esm/ultramodern-workspace/api/contracts.js +172 -0
- package/dist/esm/ultramodern-workspace/api/names.js +33 -0
- package/dist/esm/ultramodern-workspace/api/service.js +179 -0
- package/dist/esm/ultramodern-workspace/api/shared.js +208 -0
- package/dist/esm/ultramodern-workspace/api.js +5 -1025
- package/dist/esm/ultramodern-workspace/app-files.js +3 -18
- package/dist/esm/ultramodern-workspace/backend-federation.js +27 -13
- package/dist/esm/ultramodern-workspace/bridge-config/cli.js +30 -0
- package/dist/esm/ultramodern-workspace/bridge-config/defaults.js +5 -0
- package/dist/esm/ultramodern-workspace/bridge-config/gates.js +52 -0
- package/dist/esm/ultramodern-workspace/bridge-config/index.js +3 -0
- package/dist/esm/ultramodern-workspace/bridge-config/normalize.js +30 -0
- package/dist/esm/ultramodern-workspace/bridge-config/schema.js +31 -0
- package/dist/esm/ultramodern-workspace/bridge-config/shared.js +51 -0
- package/dist/esm/ultramodern-workspace/bridge-config/validation.js +27 -0
- package/dist/esm/ultramodern-workspace/bridge-config/workspace-packages.js +67 -0
- package/dist/esm/ultramodern-workspace/bridge-config.js +1 -270
- package/dist/esm/ultramodern-workspace/delivery-unit-sync.js +23 -21
- package/dist/esm/ultramodern-workspace/delivery-unit.js +6 -16
- package/dist/esm/ultramodern-workspace/demo-components.js +47 -189
- package/dist/esm/ultramodern-workspace/descriptors.js +12 -1
- package/dist/esm/ultramodern-workspace/effect-diagnostics.js +76 -0
- package/dist/esm/ultramodern-workspace/fs-io.js +24 -2
- package/dist/esm/ultramodern-workspace/index.js +1 -0
- package/dist/esm/ultramodern-workspace/mf-validation/constants.js +19 -0
- package/dist/esm/ultramodern-workspace/mf-validation/discovery.js +28 -0
- package/dist/esm/ultramodern-workspace/mf-validation/inspect.js +45 -0
- package/dist/esm/ultramodern-workspace/mf-validation/object-literal.js +144 -0
- package/dist/esm/ultramodern-workspace/mf-validation/path-utils.js +89 -0
- package/dist/esm/ultramodern-workspace/mf-validation/syntax.js +154 -0
- package/dist/esm/ultramodern-workspace/mf-validation/types.js +0 -0
- package/dist/esm/ultramodern-workspace/mf-validation/validate.js +57 -0
- package/dist/esm/ultramodern-workspace/mf-validation.js +3 -516
- package/dist/esm/ultramodern-workspace/module-federation/config.js +204 -0
- package/dist/esm/ultramodern-workspace/module-federation/index.js +4 -0
- package/dist/esm/ultramodern-workspace/module-federation/reexport-module.js +29 -0
- package/dist/esm/ultramodern-workspace/module-federation/remote-refs.js +64 -0
- package/dist/esm/ultramodern-workspace/module-federation/shared-config.js +12 -0
- package/dist/esm/ultramodern-workspace/module-federation.js +2 -576
- package/dist/esm/ultramodern-workspace/package-json.js +7 -210
- package/dist/esm/ultramodern-workspace/routes.js +8 -142
- package/dist/esm/ultramodern-workspace/shared-patches.js +6 -0
- package/dist/esm/ultramodern-workspace/tsconfigs.js +136 -0
- package/dist/esm/ultramodern-workspace/workspace-script-plan.js +2 -2
- package/dist/esm/ultramodern-workspace/write-app.js +90 -0
- package/dist/esm/ultramodern-workspace/write-workspace.js +4 -61
- package/dist/esm/ultramodern-workspace/zerops.js +13 -10
- package/dist/esm-node/cli/flags.js +229 -0
- package/dist/esm-node/cli/help.js +66 -0
- package/dist/esm-node/cli/package-source.js +120 -0
- package/dist/esm-node/cli/project-setup.js +82 -0
- package/dist/esm-node/cli/prompts.js +64 -0
- package/dist/esm-node/index.js +6 -559
- package/dist/esm-node/ultramodern-tooling/commands/cloudflare-output-verify.js +85 -0
- package/dist/esm-node/ultramodern-tooling/commands/context.js +67 -0
- package/dist/esm-node/ultramodern-tooling/commands/mf-types.js +18 -0
- package/dist/esm-node/ultramodern-tooling/commands/migrate-strict-effect/api-metadata.js +107 -0
- package/dist/esm-node/ultramodern-tooling/commands/migrate-strict-effect/declaration-patches.js +12 -0
- package/dist/esm-node/ultramodern-tooling/commands/migrate-strict-effect/dependency-usage.js +39 -0
- package/dist/esm-node/ultramodern-tooling/commands/migrate-strict-effect/generated-artifacts-backend-federation.js +11 -0
- package/dist/esm-node/ultramodern-tooling/commands/migrate-strict-effect/generated-artifacts-build-identity.js +15 -0
- package/dist/esm-node/ultramodern-tooling/commands/migrate-strict-effect/generated-artifacts-modern-configs.js +13 -0
- package/dist/esm-node/ultramodern-tooling/commands/migrate-strict-effect/generated-artifacts-oxfmt.js +84 -0
- package/dist/esm-node/ultramodern-tooling/commands/migrate-strict-effect/generated-artifacts-removal.js +17 -0
- package/dist/esm-node/ultramodern-tooling/commands/migrate-strict-effect/generated-artifacts-typescript.js +45 -0
- package/dist/esm-node/ultramodern-tooling/commands/migrate-strict-effect/generated-artifacts-zerops.js +13 -0
- package/dist/esm-node/ultramodern-tooling/commands/migrate-strict-effect/generated-artifacts.js +8 -0
- package/dist/esm-node/ultramodern-tooling/commands/migrate-strict-effect/generated-patches.js +16 -0
- package/dist/esm-node/ultramodern-tooling/commands/migrate-strict-effect/help.js +17 -0
- package/dist/esm-node/ultramodern-tooling/commands/migrate-strict-effect/install.js +15 -0
- package/dist/esm-node/ultramodern-tooling/commands/migrate-strict-effect/io.js +70 -0
- package/dist/esm-node/ultramodern-tooling/commands/migrate-strict-effect/package-cohort.js +176 -0
- package/dist/esm-node/ultramodern-tooling/commands/migrate-strict-effect/package-source.js +39 -0
- package/dist/esm-node/ultramodern-tooling/commands/migrate-strict-effect/pnpm-policy.js +77 -0
- package/dist/esm-node/ultramodern-tooling/commands/migrate-strict-effect/pnpm-yaml.js +106 -0
- package/dist/esm-node/ultramodern-tooling/commands/migrate-strict-effect/policy-constants.js +17 -0
- package/dist/esm-node/ultramodern-tooling/commands/migrate-strict-effect.js +101 -0
- package/dist/esm-node/ultramodern-tooling/commands/options.js +19 -0
- package/dist/esm-node/ultramodern-tooling/commands/routes-generate.js +75 -0
- package/dist/esm-node/ultramodern-tooling/commands/skills.js +12 -0
- package/dist/esm-node/ultramodern-tooling/commands/sync-delivery-unit.js +2 -0
- package/dist/esm-node/ultramodern-tooling/commands/validate.js +12 -0
- package/dist/esm-node/ultramodern-tooling/commands.js +9 -1152
- package/dist/esm-node/ultramodern-tooling/config/constants.js +5 -0
- package/dist/esm-node/ultramodern-tooling/config/index.js +8 -0
- package/dist/esm-node/ultramodern-tooling/config/json.js +11 -0
- package/dist/esm-node/ultramodern-tooling/config/load.js +14 -0
- package/dist/esm-node/ultramodern-tooling/config/metadata.js +38 -0
- package/dist/esm-node/ultramodern-tooling/config/normalize.js +107 -0
- package/dist/esm-node/ultramodern-tooling/config/synthesize.js +109 -0
- package/dist/esm-node/ultramodern-tooling/config/types.js +1 -0
- package/dist/esm-node/ultramodern-tooling/config.js +1 -255
- package/dist/esm-node/ultramodern-workspace/add-vertical/constants.js +6 -0
- package/dist/esm-node/ultramodern-workspace/add-vertical/execute.js +109 -0
- package/dist/esm-node/ultramodern-workspace/add-vertical/plan.js +185 -0
- package/dist/esm-node/ultramodern-workspace/add-vertical/preflight.js +123 -0
- package/dist/esm-node/ultramodern-workspace/add-vertical/shell-files.js +60 -0
- package/dist/esm-node/ultramodern-workspace/add-vertical/topology.js +90 -0
- package/dist/esm-node/ultramodern-workspace/add-vertical/workspace-state.js +44 -0
- package/dist/esm-node/ultramodern-workspace/add-vertical.js +6 -569
- package/dist/esm-node/ultramodern-workspace/api/checkout-cart.js +87 -0
- package/dist/esm-node/ultramodern-workspace/api/client.js +178 -0
- package/dist/esm-node/ultramodern-workspace/api/contracts.js +173 -0
- package/dist/esm-node/ultramodern-workspace/api/names.js +34 -0
- package/dist/esm-node/ultramodern-workspace/api/service.js +180 -0
- package/dist/esm-node/ultramodern-workspace/api/shared.js +209 -0
- package/dist/esm-node/ultramodern-workspace/api.js +5 -1025
- package/dist/esm-node/ultramodern-workspace/app-files.js +3 -18
- package/dist/esm-node/ultramodern-workspace/backend-federation.js +27 -13
- package/dist/esm-node/ultramodern-workspace/bridge-config/cli.js +31 -0
- package/dist/esm-node/ultramodern-workspace/bridge-config/defaults.js +6 -0
- package/dist/esm-node/ultramodern-workspace/bridge-config/gates.js +53 -0
- package/dist/esm-node/ultramodern-workspace/bridge-config/index.js +4 -0
- package/dist/esm-node/ultramodern-workspace/bridge-config/normalize.js +31 -0
- package/dist/esm-node/ultramodern-workspace/bridge-config/schema.js +32 -0
- package/dist/esm-node/ultramodern-workspace/bridge-config/shared.js +52 -0
- package/dist/esm-node/ultramodern-workspace/bridge-config/validation.js +28 -0
- package/dist/esm-node/ultramodern-workspace/bridge-config/workspace-packages.js +68 -0
- package/dist/esm-node/ultramodern-workspace/bridge-config.js +1 -270
- package/dist/esm-node/ultramodern-workspace/delivery-unit-sync.js +23 -21
- package/dist/esm-node/ultramodern-workspace/delivery-unit.js +6 -16
- package/dist/esm-node/ultramodern-workspace/demo-components.js +47 -189
- package/dist/esm-node/ultramodern-workspace/descriptors.js +12 -1
- package/dist/esm-node/ultramodern-workspace/effect-diagnostics.js +77 -0
- package/dist/esm-node/ultramodern-workspace/fs-io.js +24 -2
- package/dist/esm-node/ultramodern-workspace/index.js +1 -0
- package/dist/esm-node/ultramodern-workspace/mf-validation/constants.js +20 -0
- package/dist/esm-node/ultramodern-workspace/mf-validation/discovery.js +29 -0
- package/dist/esm-node/ultramodern-workspace/mf-validation/inspect.js +46 -0
- package/dist/esm-node/ultramodern-workspace/mf-validation/object-literal.js +145 -0
- package/dist/esm-node/ultramodern-workspace/mf-validation/path-utils.js +90 -0
- package/dist/esm-node/ultramodern-workspace/mf-validation/syntax.js +155 -0
- package/dist/esm-node/ultramodern-workspace/mf-validation/types.js +1 -0
- package/dist/esm-node/ultramodern-workspace/mf-validation/validate.js +58 -0
- package/dist/esm-node/ultramodern-workspace/mf-validation.js +3 -516
- package/dist/esm-node/ultramodern-workspace/module-federation/config.js +205 -0
- package/dist/esm-node/ultramodern-workspace/module-federation/index.js +5 -0
- package/dist/esm-node/ultramodern-workspace/module-federation/reexport-module.js +30 -0
- package/dist/esm-node/ultramodern-workspace/module-federation/remote-refs.js +65 -0
- package/dist/esm-node/ultramodern-workspace/module-federation/shared-config.js +13 -0
- package/dist/esm-node/ultramodern-workspace/module-federation.js +2 -576
- package/dist/esm-node/ultramodern-workspace/package-json.js +7 -210
- package/dist/esm-node/ultramodern-workspace/routes.js +8 -142
- package/dist/esm-node/ultramodern-workspace/shared-patches.js +7 -0
- package/dist/esm-node/ultramodern-workspace/tsconfigs.js +137 -0
- package/dist/esm-node/ultramodern-workspace/workspace-script-plan.js +2 -2
- package/dist/esm-node/ultramodern-workspace/write-app.js +91 -0
- package/dist/esm-node/ultramodern-workspace/write-workspace.js +4 -61
- package/dist/esm-node/ultramodern-workspace/zerops.js +13 -10
- package/dist/types/cli/flags.d.ts +30 -0
- package/dist/types/cli/help.d.ts +2 -0
- package/dist/types/cli/package-source.d.ts +15 -0
- package/dist/types/cli/project-setup.d.ts +8 -0
- package/dist/types/cli/prompts.d.ts +6 -0
- package/dist/types/ultramodern-tooling/commands/cloudflare-output-verify.d.ts +2 -0
- package/dist/types/ultramodern-tooling/commands/context.d.ts +11 -0
- package/dist/types/ultramodern-tooling/commands/mf-types.d.ts +2 -0
- package/dist/types/ultramodern-tooling/commands/migrate-strict-effect/api-metadata.d.ts +4 -0
- package/dist/types/ultramodern-tooling/commands/migrate-strict-effect/declaration-patches.d.ts +4 -0
- package/dist/types/ultramodern-tooling/commands/migrate-strict-effect/dependency-usage.d.ts +1 -0
- package/dist/types/ultramodern-tooling/commands/migrate-strict-effect/generated-artifacts-backend-federation.d.ts +3 -0
- package/dist/types/ultramodern-tooling/commands/migrate-strict-effect/generated-artifacts-build-identity.d.ts +3 -0
- package/dist/types/ultramodern-tooling/commands/migrate-strict-effect/generated-artifacts-modern-configs.d.ts +3 -0
- package/dist/types/ultramodern-tooling/commands/migrate-strict-effect/generated-artifacts-oxfmt.d.ts +2 -0
- package/dist/types/ultramodern-tooling/commands/migrate-strict-effect/generated-artifacts-removal.d.ts +4 -0
- package/dist/types/ultramodern-tooling/commands/migrate-strict-effect/generated-artifacts-typescript.d.ts +3 -0
- package/dist/types/ultramodern-tooling/commands/migrate-strict-effect/generated-artifacts-zerops.d.ts +3 -0
- package/dist/types/ultramodern-tooling/commands/migrate-strict-effect/generated-artifacts.d.ts +7 -0
- package/dist/types/ultramodern-tooling/commands/migrate-strict-effect/generated-patches.d.ts +3 -0
- package/dist/types/ultramodern-tooling/commands/migrate-strict-effect/help.d.ts +1 -0
- package/dist/types/ultramodern-tooling/commands/migrate-strict-effect/install.d.ts +2 -0
- package/dist/types/ultramodern-tooling/commands/migrate-strict-effect/io.d.ts +14 -0
- package/dist/types/ultramodern-tooling/commands/migrate-strict-effect/package-cohort.d.ts +9 -0
- package/dist/types/ultramodern-tooling/commands/migrate-strict-effect/package-source.d.ts +3 -0
- package/dist/types/ultramodern-tooling/commands/migrate-strict-effect/pnpm-policy.d.ts +4 -0
- package/dist/types/ultramodern-tooling/commands/migrate-strict-effect/pnpm-yaml.d.ts +25 -0
- package/dist/types/ultramodern-tooling/commands/migrate-strict-effect/policy-constants.d.ts +9 -0
- package/dist/types/ultramodern-tooling/commands/migrate-strict-effect.d.ts +2 -0
- package/dist/types/ultramodern-tooling/commands/options.d.ts +2 -0
- package/dist/types/ultramodern-tooling/commands/routes-generate.d.ts +2 -0
- package/dist/types/ultramodern-tooling/commands/skills.d.ts +2 -0
- package/dist/types/ultramodern-tooling/commands/sync-delivery-unit.d.ts +1 -0
- package/dist/types/ultramodern-tooling/commands/validate.d.ts +2 -0
- package/dist/types/ultramodern-tooling/config/constants.d.ts +3 -0
- package/dist/types/ultramodern-tooling/config/index.d.ts +7 -0
- package/dist/types/ultramodern-tooling/config/json.d.ts +2 -0
- package/dist/types/ultramodern-tooling/config/load.d.ts +2 -0
- package/dist/types/ultramodern-tooling/config/metadata.d.ts +4 -0
- package/dist/types/ultramodern-tooling/config/normalize.d.ts +5 -0
- package/dist/types/ultramodern-tooling/config/synthesize.d.ts +5 -0
- package/dist/types/ultramodern-tooling/config/types.d.ts +41 -0
- package/dist/types/ultramodern-tooling/config.d.ts +1 -49
- package/dist/types/ultramodern-workspace/add-vertical/constants.d.ts +4 -0
- package/dist/types/ultramodern-workspace/add-vertical/execute.d.ts +2 -0
- package/dist/types/ultramodern-workspace/add-vertical/plan.d.ts +7 -0
- package/dist/types/ultramodern-workspace/add-vertical/preflight.d.ts +28 -0
- package/dist/types/ultramodern-workspace/add-vertical/shell-files.d.ts +6 -0
- package/dist/types/ultramodern-workspace/add-vertical/topology.d.ts +9 -0
- package/dist/types/ultramodern-workspace/add-vertical/workspace-state.d.ts +8 -0
- package/dist/types/ultramodern-workspace/add-vertical.d.ts +7 -39
- package/dist/types/ultramodern-workspace/api/checkout-cart.d.ts +33 -0
- package/dist/types/ultramodern-workspace/api/client.d.ts +6 -0
- package/dist/types/ultramodern-workspace/api/contracts.d.ts +15 -0
- package/dist/types/ultramodern-workspace/api/names.d.ts +41 -0
- package/dist/types/ultramodern-workspace/api/service.d.ts +6 -0
- package/dist/types/ultramodern-workspace/api/shared.d.ts +10 -0
- package/dist/types/ultramodern-workspace/api.d.ts +5 -74
- package/dist/types/ultramodern-workspace/backend-federation.d.ts +2 -2
- package/dist/types/ultramodern-workspace/bridge-config/cli.d.ts +3 -0
- package/dist/types/ultramodern-workspace/bridge-config/defaults.d.ts +1 -0
- package/dist/types/ultramodern-workspace/bridge-config/gates.d.ts +3 -0
- package/dist/types/ultramodern-workspace/bridge-config/index.d.ts +4 -0
- package/dist/types/ultramodern-workspace/bridge-config/normalize.d.ts +2 -0
- package/dist/types/ultramodern-workspace/bridge-config/schema.d.ts +61 -0
- package/dist/types/ultramodern-workspace/bridge-config/shared.d.ts +12 -0
- package/dist/types/ultramodern-workspace/bridge-config/validation.d.ts +3 -0
- package/dist/types/ultramodern-workspace/bridge-config/workspace-packages.d.ts +3 -0
- package/dist/types/ultramodern-workspace/bridge-config.d.ts +1 -64
- package/dist/types/ultramodern-workspace/delivery-unit.d.ts +2 -21
- package/dist/types/ultramodern-workspace/effect-diagnostics.d.ts +1 -0
- package/dist/types/ultramodern-workspace/index.d.ts +1 -0
- package/dist/types/ultramodern-workspace/mf-validation/constants.d.ts +5 -0
- package/dist/types/ultramodern-workspace/mf-validation/discovery.d.ts +2 -0
- package/dist/types/ultramodern-workspace/mf-validation/inspect.d.ts +5 -0
- package/dist/types/ultramodern-workspace/mf-validation/object-literal.d.ts +9 -0
- package/dist/types/ultramodern-workspace/mf-validation/path-utils.d.ts +13 -0
- package/dist/types/ultramodern-workspace/mf-validation/syntax.d.ts +14 -0
- package/dist/types/ultramodern-workspace/mf-validation/types.d.ts +33 -0
- package/dist/types/ultramodern-workspace/mf-validation/validate.d.ts +4 -0
- package/dist/types/ultramodern-workspace/mf-validation.d.ts +4 -27
- package/dist/types/ultramodern-workspace/module-federation/config.d.ts +5 -0
- package/dist/types/ultramodern-workspace/module-federation/index.d.ts +4 -0
- package/dist/types/ultramodern-workspace/module-federation/reexport-module.d.ts +4 -0
- package/dist/types/ultramodern-workspace/module-federation/remote-refs.d.ts +3 -0
- package/dist/types/ultramodern-workspace/module-federation/shared-config.d.ts +2 -0
- package/dist/types/ultramodern-workspace/module-federation.d.ts +1 -11
- package/dist/types/ultramodern-workspace/package-json.d.ts +1 -13
- package/dist/types/ultramodern-workspace/shared-patches.d.ts +2 -0
- package/dist/types/ultramodern-workspace/tsconfigs.d.ts +13 -0
- package/dist/types/ultramodern-workspace/workspace-validation-contract.d.ts +1 -1
- package/dist/types/ultramodern-workspace/write-app.d.ts +3 -0
- package/dist/types/ultramodern-workspace/write-workspace.d.ts +2 -1
- package/package.json +4 -3
- package/templates/workspace/apps/modern.config.shared-module-federation.ts.handlebars +37 -0
- package/templates/workspace/apps/modern.config.ts.handlebars +252 -0
- package/templates/workspace/apps/shared/src/routes/ultramodern-jsonld.ts.handlebars +119 -0
- package/templates/workspace/apps/shared/src/routes/ultramodern-route-metadata.ts.handlebars +21 -0
- package/templates/workspace/apps/shell-super-app/src/routes/[lang]/page.tsx.handlebars +49 -0
- package/templates/workspace/apps/shell-super-app/src/routes/vertical-components.helpers.tsx.handlebars +79 -0
- package/templates/workspace/apps/shell-super-app/src/routes/vertical-components.imports.tsx.handlebars +11 -0
- package/templates/workspace/apps/shell-super-app/src/routes/vertical-components.tsx.handlebars +46 -0
- package/templates/workspace/packages/shared-design-tokens/tokens.css.handlebars +7 -0
- package/templates/workspace/postcss.config.mjs.handlebars +5 -0
- package/templates/workspace/tailwind.config.ts.handlebars +3 -0
- package/templates/workspace/verticals/server/checkout-cart-handlers.ts.handlebars +49 -0
- package/templates/workspace/verticals/server/checkout-cart-state.ts.handlebars +23 -0
- package/templates/workspace/verticals/shared/api.checkout-cart-contract-fields.ts.handlebars +1 -0
- package/templates/workspace/verticals/shared/api.checkout-cart-endpoints.ts.handlebars +23 -0
- package/templates/workspace/verticals/shared/api.checkout-cart-operation-contexts.ts.handlebars +25 -0
- package/templates/workspace/verticals/shared/api.checkout-cart-schemas.ts.handlebars +48 -0
- package/templates/workspace/verticals/src/api/checkout-cart-client-exports.ts.handlebars +70 -0
- package/templates/workspace-scripts/generate-node-backend-federation.mjs +29 -0
- package/templates/workspace-scripts/proof-node-backend-federation.mjs +31 -0
- package/templates/workspace-scripts/validate-ultramodern-workspace.mjs.handlebars +74 -40
|
@@ -1,1157 +1,14 @@
|
|
|
1
1
|
import "node:module";
|
|
2
|
-
import { spawnSync } from "node:child_process";
|
|
3
|
-
import node_fs from "node:fs";
|
|
4
|
-
import node_os from "node:os";
|
|
5
2
|
import node_path from "node:path";
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
import { GENERATED_TOOLING_COMMANDS, generatedToolingCommandList, generatedToolingCommands } from "../ultramodern-workspace/tooling-command-catalog.js";
|
|
16
|
-
import { DRIZZLE_ORM_VERSION, EFFECT_TSGO_VERSION, EFFECT_VERSION, EFFECT_VITEST_VERSION, MODULE_FEDERATION_VERSION, OXFMT_VERSION, OXLINT_VERSION, TYPESCRIPT_NATIVE_PREVIEW_VERSION, WRANGLER_VERSION, ZEPHYR_AGENT_VERSION, ZEPHYR_RSPACK_PLUGIN_VERSION } from "../ultramodern-workspace/versions.js";
|
|
17
|
-
import { createWorkspaceAppPackageScripts, createWorkspaceRootPackageScripts } from "../ultramodern-workspace/workspace-script-plan.js";
|
|
18
|
-
import { createWorkspaceValidationScript, createZeropsRuntimeMaterializationScript, migratedWorkspaceScriptArtifacts, migratedWorkspaceScriptBasenames } from "../ultramodern-workspace/workspace-scripts.js";
|
|
19
|
-
import { createZeropsYaml } from "../ultramodern-workspace/zerops.js";
|
|
20
|
-
import { normalizeCompactUltramodernConfig, readUltramodernConfig, synthesizeCompactUltramodernConfig, workspaceAppsFromToolingConfig } from "./config.js";
|
|
21
|
-
const commands_dirname = node_path.dirname(fileURLToPath(import.meta.url));
|
|
22
|
-
const createPackageRoot = resolveCreatePackageRoot(commands_dirname);
|
|
23
|
-
function printHelp() {
|
|
24
|
-
const commands = [
|
|
25
|
-
...generatedToolingCommandList().map((command)=>` ${command}`),
|
|
26
|
-
' skills install',
|
|
27
|
-
' skills check'
|
|
28
|
-
].join('\n');
|
|
29
|
-
process.stdout.write(`Usage:
|
|
30
|
-
modern-js-create ultramodern <command> [args]
|
|
31
|
-
|
|
32
|
-
Commands:
|
|
33
|
-
${commands}
|
|
34
|
-
`);
|
|
35
|
-
}
|
|
36
|
-
function spawnNodeScript(relativeScriptPath, args, context, options = {}) {
|
|
37
|
-
const scriptPath = node_path.join(createPackageRoot, relativeScriptPath);
|
|
38
|
-
const result = spawnSync(process.execPath, [
|
|
39
|
-
scriptPath,
|
|
40
|
-
...args
|
|
41
|
-
], {
|
|
42
|
-
cwd: options.cwd ?? context.workspaceRoot,
|
|
43
|
-
env: {
|
|
44
|
-
...process.env,
|
|
45
|
-
ULTRAMODERN_WORKSPACE_ROOT: context.workspaceRoot
|
|
46
|
-
},
|
|
47
|
-
stdio: 'inherit'
|
|
48
|
-
});
|
|
49
|
-
if (result.error) throw result.error;
|
|
50
|
-
return result.status ?? 1;
|
|
51
|
-
}
|
|
52
|
-
function runTemplateBackedToolingCommand(command, args, context) {
|
|
53
|
-
const toolingCommand = generatedToolingCommands.find((candidate)=>candidate.command === command);
|
|
54
|
-
if (!toolingCommand?.templatePath) return;
|
|
55
|
-
return spawnNodeScript(toolingCommand.templatePath, args, context, {
|
|
56
|
-
cwd: 'invocation' === toolingCommand.cwd ? context.invocationCwd : context.workspaceRoot
|
|
57
|
-
});
|
|
58
|
-
}
|
|
59
|
-
function runRenderedModule(source, context) {
|
|
60
|
-
const tempDir = node_fs.mkdtempSync(node_path.join(node_os.tmpdir(), 'ultramodern-tool-'));
|
|
61
|
-
const tempFile = node_path.join(tempDir, 'command.mjs');
|
|
62
|
-
try {
|
|
63
|
-
node_fs.writeFileSync(tempFile, source, 'utf-8');
|
|
64
|
-
const result = spawnSync(process.execPath, [
|
|
65
|
-
tempFile
|
|
66
|
-
], {
|
|
67
|
-
cwd: context.workspaceRoot,
|
|
68
|
-
stdio: 'inherit'
|
|
69
|
-
});
|
|
70
|
-
if (result.error) throw result.error;
|
|
71
|
-
return result.status ?? 1;
|
|
72
|
-
} finally{
|
|
73
|
-
node_fs.rmSync(tempDir, {
|
|
74
|
-
force: true,
|
|
75
|
-
recursive: true
|
|
76
|
-
});
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
function runValidate(context) {
|
|
80
|
-
const config = readUltramodernConfig(context.workspaceRoot);
|
|
81
|
-
const apps = workspaceAppsFromToolingConfig(config);
|
|
82
|
-
const remotes = apps.filter((app)=>'shell' !== app.kind);
|
|
83
|
-
const source = createWorkspaceValidationScript(config.workspace.packageScope, config.features.tailwind, remotes);
|
|
84
|
-
return runRenderedModule(source, context);
|
|
85
|
-
}
|
|
86
|
-
function runMfTypes(args, context) {
|
|
87
|
-
if (args.includes('--help') || args.includes('-h')) {
|
|
88
|
-
process.stdout.write(`Usage:
|
|
89
|
-
modern-js-create ultramodern mf-types [app-dir...]
|
|
90
|
-
|
|
91
|
-
Checks real Module Federation config files and DTS archives for exposed apps.
|
|
92
|
-
`);
|
|
93
|
-
return 0;
|
|
94
|
-
}
|
|
95
|
-
validateModuleFederationTypes({
|
|
96
|
-
workspaceRoot: context.workspaceRoot,
|
|
97
|
-
appDirs: args.length > 0 ? args : void 0
|
|
98
|
-
});
|
|
99
|
-
return 0;
|
|
100
|
-
}
|
|
101
|
-
const modernPackageNames = new Set([
|
|
102
|
-
...ULTRAMODERN_SINGLE_APP_MODERN_PACKAGES,
|
|
103
|
-
...ULTRAMODERN_WORKSPACE_MODERN_PACKAGES
|
|
104
|
-
]);
|
|
105
|
-
function createMigrationIo(workspaceRoot, dryRun) {
|
|
106
|
-
const plan = [];
|
|
107
|
-
const rel = (p)=>(node_path.relative(workspaceRoot, p) || node_path.basename(p)).split(node_path.sep).join('/');
|
|
108
|
-
return {
|
|
109
|
-
workspaceRoot,
|
|
110
|
-
dryRun,
|
|
111
|
-
plan,
|
|
112
|
-
write (filePath, content) {
|
|
113
|
-
if (node_fs.existsSync(filePath) && node_fs.readFileSync(filePath, 'utf-8') === content) return false;
|
|
114
|
-
if (dryRun) {
|
|
115
|
-
plan.push(`[dry-run] would write ${rel(filePath)}`);
|
|
116
|
-
return true;
|
|
117
|
-
}
|
|
118
|
-
node_fs.mkdirSync(node_path.dirname(filePath), {
|
|
119
|
-
recursive: true
|
|
120
|
-
});
|
|
121
|
-
node_fs.writeFileSync(filePath, content, 'utf-8');
|
|
122
|
-
return true;
|
|
123
|
-
},
|
|
124
|
-
remove (filePath) {
|
|
125
|
-
if (!node_fs.existsSync(filePath)) return false;
|
|
126
|
-
if (dryRun) {
|
|
127
|
-
plan.push(`[dry-run] would delete ${rel(filePath)}`);
|
|
128
|
-
return true;
|
|
129
|
-
}
|
|
130
|
-
node_fs.rmSync(filePath);
|
|
131
|
-
return true;
|
|
132
|
-
},
|
|
133
|
-
log (message) {
|
|
134
|
-
if (dryRun) plan.push(`[dry-run] ${message}`);
|
|
135
|
-
else process.stdout.write(`[ultramodern] ${message}\n`);
|
|
136
|
-
}
|
|
137
|
-
};
|
|
138
|
-
}
|
|
139
|
-
function readJsonFile(filePath) {
|
|
140
|
-
return JSON.parse(node_fs.readFileSync(filePath, 'utf-8'));
|
|
141
|
-
}
|
|
142
|
-
function writeJsonFile(io, filePath, value) {
|
|
143
|
-
return io.write(filePath, `${JSON.stringify(value, null, 2)}\n`);
|
|
144
|
-
}
|
|
145
|
-
function readOption(args, name) {
|
|
146
|
-
const prefix = `${name}=`;
|
|
147
|
-
const inline = args.find((arg)=>arg.startsWith(prefix));
|
|
148
|
-
if (inline) {
|
|
149
|
-
const value = inline.slice(prefix.length);
|
|
150
|
-
if (!value) throw new Error(`${name} needs a value.`);
|
|
151
|
-
return value;
|
|
152
|
-
}
|
|
153
|
-
const index = args.indexOf(name);
|
|
154
|
-
if (-1 === index) return;
|
|
155
|
-
const value = args[index + 1];
|
|
156
|
-
if (!value || value.startsWith('--')) throw new Error(`${name} needs a value.`);
|
|
157
|
-
return value;
|
|
158
|
-
}
|
|
159
|
-
function hasFlag(args, name) {
|
|
160
|
-
return args.includes(name);
|
|
161
|
-
}
|
|
162
|
-
function listWorkspacePackageFiles(workspaceRoot) {
|
|
163
|
-
const packageFiles = [
|
|
164
|
-
'package.json'
|
|
165
|
-
];
|
|
166
|
-
for (const directory of [
|
|
167
|
-
'apps',
|
|
168
|
-
'verticals',
|
|
169
|
-
'packages'
|
|
170
|
-
]){
|
|
171
|
-
const absoluteDirectory = node_path.join(workspaceRoot, directory);
|
|
172
|
-
if (node_fs.existsSync(absoluteDirectory)) for (const entry of node_fs.readdirSync(absoluteDirectory, {
|
|
173
|
-
withFileTypes: true
|
|
174
|
-
})){
|
|
175
|
-
if (!entry.isDirectory()) continue;
|
|
176
|
-
const packageFile = `${directory}/${entry.name}/package.json`;
|
|
177
|
-
if (node_fs.existsSync(node_path.join(workspaceRoot, packageFile))) packageFiles.push(packageFile);
|
|
178
|
-
}
|
|
179
|
-
}
|
|
180
|
-
return packageFiles;
|
|
181
|
-
}
|
|
182
|
-
function updateModernDependencies(packageJson, packageSource) {
|
|
183
|
-
let changed = false;
|
|
184
|
-
for (const section of [
|
|
185
|
-
'dependencies',
|
|
186
|
-
'devDependencies',
|
|
187
|
-
'peerDependencies',
|
|
188
|
-
'optionalDependencies'
|
|
189
|
-
]){
|
|
190
|
-
const dependencies = packageJson[section];
|
|
191
|
-
if (!(!dependencies || 'object' != typeof dependencies || Array.isArray(dependencies))) for (const packageName of Object.keys(dependencies)){
|
|
192
|
-
if (!modernPackageNames.has(packageName)) continue;
|
|
193
|
-
const nextSpecifier = modernPackageSpecifier(packageName, packageSource);
|
|
194
|
-
if (dependencies[packageName] !== nextSpecifier) {
|
|
195
|
-
dependencies[packageName] = nextSpecifier;
|
|
196
|
-
changed = true;
|
|
197
|
-
}
|
|
198
|
-
}
|
|
199
|
-
}
|
|
200
|
-
return changed;
|
|
201
|
-
}
|
|
202
|
-
const generatedToolingDependencyPins = new Map([
|
|
203
|
-
[
|
|
204
|
-
'@effect/tsgo',
|
|
205
|
-
EFFECT_TSGO_VERSION
|
|
206
|
-
],
|
|
207
|
-
[
|
|
208
|
-
"@typescript/native-preview",
|
|
209
|
-
TYPESCRIPT_NATIVE_PREVIEW_VERSION
|
|
210
|
-
],
|
|
211
|
-
[
|
|
212
|
-
'oxfmt',
|
|
213
|
-
OXFMT_VERSION
|
|
214
|
-
],
|
|
215
|
-
[
|
|
216
|
-
'oxlint',
|
|
217
|
-
OXLINT_VERSION
|
|
218
|
-
],
|
|
219
|
-
[
|
|
220
|
-
'wrangler',
|
|
221
|
-
WRANGLER_VERSION
|
|
222
|
-
],
|
|
223
|
-
[
|
|
224
|
-
'zephyr-agent',
|
|
225
|
-
ZEPHYR_AGENT_VERSION
|
|
226
|
-
],
|
|
227
|
-
[
|
|
228
|
-
'zephyr-rspack-plugin',
|
|
229
|
-
ZEPHYR_RSPACK_PLUGIN_VERSION
|
|
230
|
-
]
|
|
231
|
-
]);
|
|
232
|
-
const strictEffectPackageVersionPolicyExclusions = [
|
|
233
|
-
`effect@${EFFECT_VERSION}`,
|
|
234
|
-
`@effect/opentelemetry@${EFFECT_VERSION}`
|
|
235
|
-
];
|
|
236
|
-
const moduleFederationModernJsPatchPath = `patches/@module-federation__modern-js-v3@${MODULE_FEDERATION_VERSION}.patch`;
|
|
237
|
-
const moduleFederationModernJsPatchSourcePath = node_path.join(createPackageRoot, 'template-workspace', moduleFederationModernJsPatchPath);
|
|
238
|
-
const moduleFederationBridgeReactPatchPath = `patches/@module-federation__bridge-react@${MODULE_FEDERATION_VERSION}.patch`;
|
|
239
|
-
const moduleFederationBridgeReactPatchSourcePath = node_path.join(createPackageRoot, 'template-workspace', moduleFederationBridgeReactPatchPath);
|
|
240
|
-
const effectDeclarationPatchPath = 'patches/effect-schema-error-type-id.patch';
|
|
241
|
-
const effectDeclarationPatchSourcePath = node_path.join(createPackageRoot, 'template-workspace', effectDeclarationPatchPath);
|
|
242
|
-
const drizzleOrmDeclarationPatchPath = 'patches/drizzle-orm-ts7-strict-declarations.patch';
|
|
243
|
-
const drizzleOrmDeclarationPatchSourcePath = node_path.join(createPackageRoot, 'template-workspace', drizzleOrmDeclarationPatchPath);
|
|
244
|
-
function updateGeneratedToolingDependencies(packageJson) {
|
|
245
|
-
let changed = false;
|
|
246
|
-
for (const section of [
|
|
247
|
-
'dependencies',
|
|
248
|
-
'devDependencies',
|
|
249
|
-
'peerDependencies',
|
|
250
|
-
'optionalDependencies'
|
|
251
|
-
]){
|
|
252
|
-
const dependencies = packageJson[section];
|
|
253
|
-
if (!(!dependencies || 'object' != typeof dependencies || Array.isArray(dependencies))) {
|
|
254
|
-
for (const [packageName, version] of generatedToolingDependencyPins)if (Object.prototype.hasOwnProperty.call(dependencies, packageName) && dependencies[packageName] !== version) {
|
|
255
|
-
dependencies[packageName] = version;
|
|
256
|
-
changed = true;
|
|
257
|
-
}
|
|
258
|
-
}
|
|
259
|
-
}
|
|
260
|
-
return changed;
|
|
261
|
-
}
|
|
262
|
-
const cloudflareModernDeployCommand = 'ULTRAMODERN_ZEPHYR=false MODERNJS_DEPLOY=cloudflare modern deploy';
|
|
263
|
-
const cloudflareModernDeploySkipBuildCommand = `${cloudflareModernDeployCommand} --skip-build`;
|
|
264
|
-
const cloudflareWranglerDeployCommand = 'wrangler deploy --config .output/wrangler.json';
|
|
265
|
-
const cloudflareWranglerDeployInvalidSkipBuildCommand = `${cloudflareWranglerDeployCommand} --skip-build`;
|
|
266
|
-
function removeStaleBackendFederationCommandSegments(command) {
|
|
267
|
-
return command.replace(/\s+&&\s+node\s+\S*scripts\/generate-node-backend-federation\.m[ct]s(?:\s+--app\s+\S+)?(?:\s+--target\s+\S+)?(?=\s+&&|$)/gu, '');
|
|
268
|
-
}
|
|
269
|
-
const SHELL_ONLY_OMITTED_ROOT_SCRIPTS = [
|
|
270
|
-
'node:backend-federation:generate',
|
|
271
|
-
'node:proof',
|
|
272
|
-
'zerops:materialize'
|
|
273
|
-
];
|
|
274
|
-
const splitScriptSegments = (command)=>command.split('&&').map((segment)=>segment.trim()).filter((segment)=>segment.length > 0);
|
|
275
|
-
const scriptSegmentTarget = (segment)=>segment.replace(/^pnpm\s+/u, '').split(/\s+/u)[0] ?? segment;
|
|
276
|
-
const FRAMEWORK_CHECK_TARGETS = new Set([
|
|
277
|
-
'format:check',
|
|
278
|
-
'lint',
|
|
279
|
-
'typecheck',
|
|
280
|
-
'skills:check',
|
|
281
|
-
'i18n:boundaries',
|
|
282
|
-
'api:check',
|
|
283
|
-
'contract:check',
|
|
284
|
-
'node:backend-federation:generate',
|
|
285
|
-
'node:proof',
|
|
286
|
-
'performance:readiness',
|
|
287
|
-
'bridge:check'
|
|
288
|
-
]);
|
|
289
|
-
function mergeAggregateCheckScript(consumer, framework) {
|
|
290
|
-
const frameworkSegments = splitScriptSegments(framework);
|
|
291
|
-
const consumerExtras = splitScriptSegments(consumer).filter((segment)=>!FRAMEWORK_CHECK_TARGETS.has(scriptSegmentTarget(segment)));
|
|
292
|
-
return [
|
|
293
|
-
...consumerExtras,
|
|
294
|
-
...frameworkSegments
|
|
295
|
-
].join(' && ');
|
|
296
|
-
}
|
|
297
|
-
function rewriteMigratedScriptReferences(scripts) {
|
|
298
|
-
let changed = false;
|
|
299
|
-
const pattern = new RegExp(`(scripts/(?:${migratedWorkspaceScriptBasenames.join('|')}))\\.mjs`, 'gu');
|
|
300
|
-
for (const [name, value] of Object.entries(scripts)){
|
|
301
|
-
if ('string' != typeof value) continue;
|
|
302
|
-
const next = value.replace(pattern, '$1.mts');
|
|
303
|
-
if (next !== value) {
|
|
304
|
-
scripts[name] = next;
|
|
305
|
-
changed = true;
|
|
306
|
-
}
|
|
307
|
-
}
|
|
308
|
-
return changed;
|
|
309
|
-
}
|
|
310
|
-
function updateGeneratedPackageScripts(packageJson, options = {}) {
|
|
311
|
-
const scripts = packageJson.scripts;
|
|
312
|
-
if (!scripts || 'object' != typeof scripts || Array.isArray(scripts)) return false;
|
|
313
|
-
let changed = false;
|
|
314
|
-
const apps = options.apps ?? [];
|
|
315
|
-
const shellOnly = options.shellOnly ?? false;
|
|
316
|
-
const app = apps.find((candidate)=>`${candidate.directory}/package.json` === options.relativePackageFile);
|
|
317
|
-
const isRootPackage = 'package.json' === options.relativePackageFile;
|
|
318
|
-
const expectedScripts = isRootPackage ? createWorkspaceRootPackageScripts(apps.filter((candidate)=>'shell' !== candidate.kind)) : app ? createWorkspaceAppPackageScripts(app) : void 0;
|
|
319
|
-
if (expectedScripts) for (const [name, value] of Object.entries(expectedScripts)){
|
|
320
|
-
if (isRootPackage && shellOnly && SHELL_ONLY_OMITTED_ROOT_SCRIPTS.includes(name)) {
|
|
321
|
-
if (name in scripts) {
|
|
322
|
-
delete scripts[name];
|
|
323
|
-
changed = true;
|
|
324
|
-
}
|
|
325
|
-
continue;
|
|
326
|
-
}
|
|
327
|
-
const nextValue = 'check' === name && 'string' == typeof scripts[name] ? mergeAggregateCheckScript(scripts[name], value) : value;
|
|
328
|
-
if (scripts[name] !== nextValue) {
|
|
329
|
-
scripts[name] = nextValue;
|
|
330
|
-
changed = true;
|
|
331
|
-
}
|
|
332
|
-
}
|
|
333
|
-
if (rewriteMigratedScriptReferences(scripts)) changed = true;
|
|
334
|
-
const build = scripts.build;
|
|
335
|
-
if ('string' == typeof build) {
|
|
336
|
-
const nextBuild = removeStaleBackendFederationCommandSegments(build);
|
|
337
|
-
if (nextBuild !== build) {
|
|
338
|
-
scripts.build = nextBuild;
|
|
339
|
-
changed = true;
|
|
340
|
-
}
|
|
341
|
-
}
|
|
342
|
-
const cloudflareBuild = scripts['cloudflare:build'];
|
|
343
|
-
if ('string' == typeof cloudflareBuild) {
|
|
344
|
-
let nextCloudflareBuild = removeStaleBackendFederationCommandSegments(cloudflareBuild);
|
|
345
|
-
if (nextCloudflareBuild.includes(cloudflareModernDeployCommand) && !nextCloudflareBuild.includes(cloudflareModernDeploySkipBuildCommand)) nextCloudflareBuild = nextCloudflareBuild.replace(cloudflareModernDeployCommand, cloudflareModernDeploySkipBuildCommand);
|
|
346
|
-
nextCloudflareBuild = nextCloudflareBuild.replace(/ && node \S*scripts\/generate-public-surface-assets\.m[ct]s --app [^&]+ --target dist(?= && ULTRAMODERN_ZEPHYR=false MODERNJS_DEPLOY=cloudflare modern deploy --skip-build)/u, '');
|
|
347
|
-
nextCloudflareBuild = nextCloudflareBuild.replace(/ && node \S*scripts\/verify-cloudflare-output\.m[ct]s(?: --app [^&]+)?/u, '');
|
|
348
|
-
if (nextCloudflareBuild !== cloudflareBuild) {
|
|
349
|
-
scripts['cloudflare:build'] = nextCloudflareBuild;
|
|
350
|
-
changed = true;
|
|
351
|
-
}
|
|
352
|
-
}
|
|
353
|
-
const cloudflareDeploy = scripts['cloudflare:deploy'];
|
|
354
|
-
if ('string' == typeof cloudflareDeploy && cloudflareDeploy.includes(cloudflareWranglerDeployInvalidSkipBuildCommand)) {
|
|
355
|
-
scripts['cloudflare:deploy'] = cloudflareDeploy.replace(cloudflareWranglerDeployInvalidSkipBuildCommand, cloudflareWranglerDeployCommand);
|
|
356
|
-
changed = true;
|
|
357
|
-
}
|
|
358
|
-
return changed;
|
|
359
|
-
}
|
|
360
|
-
function normalizeStrictEffectApiMetadata(value) {
|
|
361
|
-
let changed = false;
|
|
362
|
-
const backendFederation = value.backendFederation;
|
|
363
|
-
if (backendFederation && 'object' == typeof backendFederation && !Array.isArray(backendFederation) && Object.hasOwn(backendFederation, 'entry')) {
|
|
364
|
-
delete backendFederation.entry;
|
|
365
|
-
changed = true;
|
|
366
|
-
}
|
|
367
|
-
const api = value.api;
|
|
368
|
-
if (!api || 'object' != typeof api || Array.isArray(api)) return changed;
|
|
369
|
-
if (void 0 !== api.backendFederation) {
|
|
370
|
-
delete api.backendFederation;
|
|
371
|
-
changed = true;
|
|
372
|
-
}
|
|
373
|
-
const oldEffect = api.effect;
|
|
374
|
-
if (oldEffect && 'object' == typeof oldEffect && !Array.isArray(oldEffect)) {
|
|
375
|
-
if (void 0 === api.stem && 'string' == typeof oldEffect.stem) {
|
|
376
|
-
api.stem = oldEffect.stem;
|
|
377
|
-
changed = true;
|
|
378
|
-
}
|
|
379
|
-
if (void 0 === api.prefix && 'string' == typeof oldEffect.prefix) {
|
|
380
|
-
api.prefix = oldEffect.prefix;
|
|
381
|
-
changed = true;
|
|
382
|
-
}
|
|
383
|
-
if (void 0 === api.consumedBy && Array.isArray(oldEffect.consumedBy)) {
|
|
384
|
-
api.consumedBy = oldEffect.consumedBy;
|
|
385
|
-
changed = true;
|
|
386
|
-
}
|
|
387
|
-
delete api.effect;
|
|
388
|
-
changed = true;
|
|
389
|
-
}
|
|
390
|
-
if (void 0 !== api.runtime && 'effect' !== api.runtime) {
|
|
391
|
-
api.runtime = 'effect';
|
|
392
|
-
changed = true;
|
|
393
|
-
}
|
|
394
|
-
if (api.bff && 'object' == typeof api.bff && !Array.isArray(api.bff)) {
|
|
395
|
-
if (true !== api.bff.strictEffectApproach) {
|
|
396
|
-
api.bff.strictEffectApproach = true;
|
|
397
|
-
changed = true;
|
|
398
|
-
}
|
|
399
|
-
}
|
|
400
|
-
if ('string' == typeof value.path) {
|
|
401
|
-
const directServerEntry = `${value.path}/api/index.ts`;
|
|
402
|
-
if ('string' == typeof api.serverEntry && /\/api\/effect\/index\.[cm]?[jt]sx?$/u.test(api.serverEntry)) {
|
|
403
|
-
api.serverEntry = directServerEntry;
|
|
404
|
-
changed = true;
|
|
405
|
-
}
|
|
406
|
-
if (api.contract && 'object' == typeof api.contract && !Array.isArray(api.contract)) {
|
|
407
|
-
if ('./shared/effect/api' === api.contract.export) {
|
|
408
|
-
api.contract.export = './api';
|
|
409
|
-
changed = true;
|
|
410
|
-
}
|
|
411
|
-
if ('string' == typeof api.contract.path && /\/shared\/effect\/api\.[cm]?[jt]sx?$/u.test(api.contract.path)) {
|
|
412
|
-
api.contract.path = `${value.path}/shared/api.ts`;
|
|
413
|
-
changed = true;
|
|
414
|
-
}
|
|
415
|
-
}
|
|
416
|
-
if (api.client && 'object' == typeof api.client && !Array.isArray(api.client)) {
|
|
417
|
-
if ('./effect/client' === api.client.export) {
|
|
418
|
-
api.client.export = './api/client';
|
|
419
|
-
changed = true;
|
|
420
|
-
}
|
|
421
|
-
if ('string' == typeof api.client.path && /\/src\/effect\/[^/]+-client\.[cm]?ts$/u.test(api.client.path)) {
|
|
422
|
-
const basename = node_path.basename(api.client.path);
|
|
423
|
-
api.client.path = `${value.path}/src/api/${basename}`;
|
|
424
|
-
changed = true;
|
|
425
|
-
}
|
|
426
|
-
}
|
|
427
|
-
if (void 0 === api.serverEntry && 'effect' === api.runtime) {
|
|
428
|
-
api.serverEntry = directServerEntry;
|
|
429
|
-
changed = true;
|
|
430
|
-
}
|
|
431
|
-
}
|
|
432
|
-
return changed;
|
|
433
|
-
}
|
|
434
|
-
function removeGeneratedFileIfExists(io, relativePath) {
|
|
435
|
-
return io.remove(node_path.join(io.workspaceRoot, relativePath));
|
|
436
|
-
}
|
|
437
|
-
function removeStaleBackendFederationArtifacts(io, config) {
|
|
438
|
-
let changed = false;
|
|
439
|
-
for (const relativePath of [
|
|
440
|
-
"scripts/generate-node-backend-federation.mts",
|
|
441
|
-
"scripts/proof-node-backend-federation.mts",
|
|
442
|
-
"scripts/verify-cloudflare-output.mts"
|
|
443
|
-
])changed = removeGeneratedFileIfExists(io, relativePath) || changed;
|
|
444
|
-
for (const app of workspaceAppsFromToolingConfig(config))changed = removeGeneratedFileIfExists(io, node_path.join(app.directory, 'api/backend-federation.ts')) || changed;
|
|
445
|
-
return changed;
|
|
446
|
-
}
|
|
447
|
-
function updateGeneratedZeropsArtifacts(io, config) {
|
|
448
|
-
const apps = workspaceAppsFromToolingConfig(config);
|
|
449
|
-
let changed = writeTextIfChanged(io, node_path.join(io.workspaceRoot, 'zerops.yaml'), `${createZeropsYaml(config.workspace.packageScope, apps)}\n`);
|
|
450
|
-
changed = writeTextIfChanged(io, node_path.join(io.workspaceRoot, "scripts/materialize-zerops-runtime.mjs"), createZeropsRuntimeMaterializationScript()) || changed;
|
|
451
|
-
return changed;
|
|
452
|
-
}
|
|
453
|
-
function updateGeneratedBuildIdentityModules(io, config) {
|
|
454
|
-
let changed = false;
|
|
455
|
-
for (const app of workspaceAppsFromToolingConfig(config)){
|
|
456
|
-
changed = writeTextIfChanged(io, node_path.join(io.workspaceRoot, app.directory, 'src/ultramodern-build.ts'), createUltramodernBuildReexportModule()) || changed;
|
|
457
|
-
changed = writeTextIfChanged(io, node_path.join(io.workspaceRoot, app.directory, 'shared/ultramodern-build.ts'), createUltramodernBuildModule(config.workspace.packageScope, app)) || changed;
|
|
458
|
-
}
|
|
459
|
-
return changed;
|
|
460
|
-
}
|
|
461
|
-
function updateGeneratedBackendFederationContractFiles(io, config) {
|
|
462
|
-
let changed = false;
|
|
463
|
-
for (const app of workspaceAppsFromToolingConfig(config))if (app.api) changed = writeTextIfChanged(io, node_path.join(io.workspaceRoot, app.directory, 'api/backend-federation.ts'), createBackendFederationContractFile(app)) || changed;
|
|
464
|
-
return changed;
|
|
465
|
-
}
|
|
466
|
-
function replaceYamlLine(source, pattern, replacement) {
|
|
467
|
-
const updated = source.replace(pattern, replacement);
|
|
468
|
-
return {
|
|
469
|
-
source: updated,
|
|
470
|
-
changed: updated !== source
|
|
471
|
-
};
|
|
472
|
-
}
|
|
473
|
-
function ensureYamlListItem(source, key, item) {
|
|
474
|
-
const itemLine = ` - '${item}'`;
|
|
475
|
-
const headerPattern = new RegExp(`^${key}:\\n(?:(?: - .+\\n)*)`, 'mu');
|
|
476
|
-
const header = source.match(headerPattern);
|
|
477
|
-
if (header) {
|
|
478
|
-
if (header[0].split('\n').includes(itemLine)) return {
|
|
479
|
-
source,
|
|
480
|
-
changed: false
|
|
481
|
-
};
|
|
482
|
-
return {
|
|
483
|
-
source: source.replace(headerPattern, `${header[0]}${itemLine}\n`),
|
|
484
|
-
changed: true
|
|
485
|
-
};
|
|
486
|
-
}
|
|
487
|
-
const block = `${key}:\n${itemLine}\n`;
|
|
488
|
-
const afterTrustPolicyIgnore = source.replace(/^(trustPolicyIgnoreAfter: .+\n)/mu, `$1${block}`);
|
|
489
|
-
if (afterTrustPolicyIgnore !== source) return {
|
|
490
|
-
source: afterTrustPolicyIgnore,
|
|
491
|
-
changed: true
|
|
492
|
-
};
|
|
493
|
-
return {
|
|
494
|
-
source: `${source.trimEnd()}\n${block}`,
|
|
495
|
-
changed: true
|
|
496
|
-
};
|
|
497
|
-
}
|
|
498
|
-
function yamlEntryPattern(entryKey, scalar = false) {
|
|
499
|
-
const bareKey = entryKey.replace(/^['"]|['"]$/gu, '');
|
|
500
|
-
if (scalar) {
|
|
501
|
-
const esc = bareKey.replace(/[.*+?^${}()|[\]\\]/gu, '\\$&');
|
|
502
|
-
return new RegExp(`^ {2}(?:'${esc}'|"${esc}"|${esc}): .+$`, 'gmu');
|
|
503
|
-
}
|
|
504
|
-
const packageName = bareKey.includes('@') ? bareKey.slice(0, bareKey.lastIndexOf('@')) : bareKey;
|
|
505
|
-
const esc = packageName.replace(/[.*+?^${}()|[\]\\]/gu, '\\$&');
|
|
506
|
-
return new RegExp(`^ {2}(?:'${esc}@[^']+'|"${esc}@[^"]+"|${esc}@[^:'"\\s]+): .+$`, 'gmu');
|
|
507
|
-
}
|
|
508
|
-
function upsertYamlEntry(source, key, entryLine, pattern) {
|
|
509
|
-
const linePattern = new RegExp(pattern.source, 'u');
|
|
510
|
-
const lines = source.split('\n');
|
|
511
|
-
let seen = false;
|
|
512
|
-
let changed = false;
|
|
513
|
-
const out = [];
|
|
514
|
-
for (const line of lines)if (linePattern.test(line)) {
|
|
515
|
-
if (seen) {
|
|
516
|
-
changed = true;
|
|
517
|
-
continue;
|
|
518
|
-
}
|
|
519
|
-
seen = true;
|
|
520
|
-
if (line !== entryLine) changed = true;
|
|
521
|
-
out.push(entryLine);
|
|
522
|
-
} else out.push(line);
|
|
523
|
-
if (seen) return {
|
|
524
|
-
source: out.join('\n'),
|
|
525
|
-
changed
|
|
526
|
-
};
|
|
527
|
-
const headerPattern = new RegExp(`^${key}:\\n(?:(?: .+\\n)*)`, 'mu');
|
|
528
|
-
const header = source.match(headerPattern);
|
|
529
|
-
if (header) {
|
|
530
|
-
if (header[0].split('\n').includes(entryLine)) return {
|
|
531
|
-
source,
|
|
532
|
-
changed: false
|
|
533
|
-
};
|
|
534
|
-
return {
|
|
535
|
-
source: source.replace(headerPattern, `${header[0]}${entryLine}\n`),
|
|
536
|
-
changed: true
|
|
537
|
-
};
|
|
538
|
-
}
|
|
539
|
-
return {
|
|
540
|
-
source: `${source.trimEnd()}\n${key}:\n${entryLine}\n`,
|
|
541
|
-
changed: true
|
|
542
|
-
};
|
|
543
|
-
}
|
|
544
|
-
function ensureYamlMapEntry(source, key, entryKey, value) {
|
|
545
|
-
return upsertYamlEntry(source, key, ` '${entryKey}': ${value}`, yamlEntryPattern(entryKey));
|
|
546
|
-
}
|
|
547
|
-
function ensureYamlScalarMapEntry(source, key, entryKey, value) {
|
|
548
|
-
return upsertYamlEntry(source, key, ` ${entryKey}: ${value}`, yamlEntryPattern(entryKey, true));
|
|
549
|
-
}
|
|
550
|
-
function removeYamlMapEntry(source, entryKey) {
|
|
551
|
-
const linePattern = new RegExp(yamlEntryPattern(entryKey).source, 'u');
|
|
552
|
-
const lines = source.split('\n');
|
|
553
|
-
let changed = false;
|
|
554
|
-
const out = [];
|
|
555
|
-
for (const line of lines){
|
|
556
|
-
if (linePattern.test(line)) {
|
|
557
|
-
changed = true;
|
|
558
|
-
continue;
|
|
559
|
-
}
|
|
560
|
-
out.push(line);
|
|
561
|
-
}
|
|
562
|
-
return changed ? {
|
|
563
|
-
source: out.join('\n'),
|
|
564
|
-
changed
|
|
565
|
-
} : {
|
|
566
|
-
source,
|
|
567
|
-
changed
|
|
568
|
-
};
|
|
569
|
-
}
|
|
570
|
-
function ensureGeneratedPatchFile(io, relativePatchPath, sourcePatchPath) {
|
|
571
|
-
const targetPath = node_path.join(io.workspaceRoot, relativePatchPath);
|
|
572
|
-
const patch = node_fs.readFileSync(sourcePatchPath, 'utf-8');
|
|
573
|
-
return io.write(targetPath, patch);
|
|
574
|
-
}
|
|
575
|
-
function removeGeneratedPatchFileIfUnchanged(io, relativePatchPath, sourcePatchPath) {
|
|
576
|
-
const targetPath = node_path.join(io.workspaceRoot, relativePatchPath);
|
|
577
|
-
if (!node_fs.existsSync(targetPath)) return false;
|
|
578
|
-
const patch = node_fs.readFileSync(sourcePatchPath, 'utf-8');
|
|
579
|
-
if (node_fs.readFileSync(targetPath, 'utf-8') !== patch) return false;
|
|
580
|
-
return io.remove(targetPath);
|
|
581
|
-
}
|
|
582
|
-
function workspaceUsesDependency(workspaceRoot, packageName) {
|
|
583
|
-
const packageJsonPaths = [
|
|
584
|
-
node_path.join(workspaceRoot, 'package.json')
|
|
585
|
-
];
|
|
586
|
-
for (const workspaceDir of [
|
|
587
|
-
'apps',
|
|
588
|
-
'verticals',
|
|
589
|
-
'packages'
|
|
590
|
-
]){
|
|
591
|
-
const absoluteWorkspaceDir = node_path.join(workspaceRoot, workspaceDir);
|
|
592
|
-
if (node_fs.existsSync(absoluteWorkspaceDir)) for (const entry of node_fs.readdirSync(absoluteWorkspaceDir, {
|
|
593
|
-
withFileTypes: true
|
|
594
|
-
})){
|
|
595
|
-
if (!entry.isDirectory()) continue;
|
|
596
|
-
const packageJsonPath = node_path.join(absoluteWorkspaceDir, entry.name, 'package.json');
|
|
597
|
-
if (node_fs.existsSync(packageJsonPath)) packageJsonPaths.push(packageJsonPath);
|
|
598
|
-
}
|
|
599
|
-
}
|
|
600
|
-
for (const packageJsonPath of packageJsonPaths){
|
|
601
|
-
const packageJson = JSON.parse(node_fs.readFileSync(packageJsonPath, 'utf-8'));
|
|
602
|
-
for (const field of [
|
|
603
|
-
'dependencies',
|
|
604
|
-
'devDependencies',
|
|
605
|
-
'peerDependencies',
|
|
606
|
-
'optionalDependencies'
|
|
607
|
-
]){
|
|
608
|
-
const dependencies = packageJson[field];
|
|
609
|
-
if (dependencies && 'object' == typeof dependencies) {
|
|
610
|
-
if (Object.prototype.hasOwnProperty.call(dependencies, packageName)) return true;
|
|
611
|
-
for (const specifier of Object.values(dependencies))if ('string' == typeof specifier && specifier.startsWith(`npm:${packageName}@`)) return true;
|
|
612
|
-
}
|
|
613
|
-
}
|
|
614
|
-
}
|
|
615
|
-
return false;
|
|
616
|
-
}
|
|
617
|
-
function ensureGeneratedDeclarationPatches(io, options) {
|
|
618
|
-
let changed = false;
|
|
619
|
-
changed = ensureGeneratedPatchFile(io, moduleFederationModernJsPatchPath, moduleFederationModernJsPatchSourcePath) || changed;
|
|
620
|
-
changed = ensureGeneratedPatchFile(io, moduleFederationBridgeReactPatchPath, moduleFederationBridgeReactPatchSourcePath) || changed;
|
|
621
|
-
changed = ensureGeneratedPatchFile(io, effectDeclarationPatchPath, effectDeclarationPatchSourcePath) || changed;
|
|
622
|
-
changed = options.includeDrizzleOrmPatch ? ensureGeneratedPatchFile(io, drizzleOrmDeclarationPatchPath, drizzleOrmDeclarationPatchSourcePath) || changed : removeGeneratedPatchFileIfUnchanged(io, drizzleOrmDeclarationPatchPath, drizzleOrmDeclarationPatchSourcePath) || changed;
|
|
623
|
-
return changed;
|
|
624
|
-
}
|
|
625
|
-
function updateGeneratedPnpmWorkspacePolicy(io) {
|
|
626
|
-
const workspaceFile = node_path.join(io.workspaceRoot, 'pnpm-workspace.yaml');
|
|
627
|
-
if (!node_fs.existsSync(workspaceFile)) return false;
|
|
628
|
-
let source = node_fs.readFileSync(workspaceFile, 'utf-8');
|
|
629
|
-
let changed = false;
|
|
630
|
-
const usesDrizzleOrm = workspaceUsesDependency(io.workspaceRoot, 'drizzle-orm');
|
|
631
|
-
const replacements = [
|
|
632
|
-
[
|
|
633
|
-
/^ {4}'@effect\/vitest>effect': .+$/mu,
|
|
634
|
-
` '@effect/vitest>effect': '${EFFECT_VERSION}'`
|
|
635
|
-
]
|
|
636
|
-
];
|
|
637
|
-
for (const [pattern, replacement] of replacements){
|
|
638
|
-
const result = replaceYamlLine(source, pattern, replacement);
|
|
639
|
-
source = result.source;
|
|
640
|
-
changed = result.changed || changed;
|
|
641
|
-
}
|
|
642
|
-
for (const [entryKey, version] of [
|
|
643
|
-
[
|
|
644
|
-
"'@effect/opentelemetry'",
|
|
645
|
-
EFFECT_VERSION
|
|
646
|
-
],
|
|
647
|
-
[
|
|
648
|
-
"'@effect/vitest'",
|
|
649
|
-
EFFECT_VITEST_VERSION
|
|
650
|
-
],
|
|
651
|
-
[
|
|
652
|
-
'effect',
|
|
653
|
-
EFFECT_VERSION
|
|
654
|
-
]
|
|
655
|
-
]){
|
|
656
|
-
const result = ensureYamlScalarMapEntry(source, 'overrides', entryKey, version);
|
|
657
|
-
source = result.source;
|
|
658
|
-
changed = result.changed || changed;
|
|
659
|
-
}
|
|
660
|
-
const parcelWatcherBuildPolicy = ensureYamlScalarMapEntry(source, 'allowBuilds', "'@parcel/watcher'", 'true');
|
|
661
|
-
source = parcelWatcherBuildPolicy.source;
|
|
662
|
-
changed = parcelWatcherBuildPolicy.changed || changed;
|
|
663
|
-
for (const item of strictEffectPackageVersionPolicyExclusions){
|
|
664
|
-
const packageName = item.slice(0, item.lastIndexOf('@'));
|
|
665
|
-
const escapedPackageName = packageName.replace(/[.*+?^${}()|[\]\\]/gu, '\\$&');
|
|
666
|
-
const currentVersion = replaceYamlLine(source, new RegExp(`^ {2}- '${escapedPackageName}@[^']+'$`, 'gmu'), ` - '${item}'`);
|
|
667
|
-
source = currentVersion.source;
|
|
668
|
-
changed = currentVersion.changed || changed;
|
|
669
|
-
for (const policyKey of [
|
|
670
|
-
'minimumReleaseAgeExclude',
|
|
671
|
-
'trustPolicyExclude'
|
|
672
|
-
]){
|
|
673
|
-
const policyExclude = ensureYamlListItem(source, policyKey, item);
|
|
674
|
-
source = policyExclude.source;
|
|
675
|
-
changed = policyExclude.changed || changed;
|
|
676
|
-
}
|
|
677
|
-
}
|
|
678
|
-
const effectPatch = ensureYamlMapEntry(source, 'patchedDependencies', `effect@${EFFECT_VERSION}`, effectDeclarationPatchPath);
|
|
679
|
-
source = effectPatch.source;
|
|
680
|
-
changed = effectPatch.changed || changed;
|
|
681
|
-
const moduleFederationModernJsPatch = ensureYamlMapEntry(source, 'patchedDependencies', `@module-federation/modern-js-v3@${MODULE_FEDERATION_VERSION}`, moduleFederationModernJsPatchPath);
|
|
682
|
-
source = moduleFederationModernJsPatch.source;
|
|
683
|
-
changed = moduleFederationModernJsPatch.changed || changed;
|
|
684
|
-
const moduleFederationBridgeReactPatch = ensureYamlMapEntry(source, 'patchedDependencies', `@module-federation/bridge-react@${MODULE_FEDERATION_VERSION}`, moduleFederationBridgeReactPatchPath);
|
|
685
|
-
source = moduleFederationBridgeReactPatch.source;
|
|
686
|
-
changed = moduleFederationBridgeReactPatch.changed || changed;
|
|
687
|
-
const drizzleOrmPatch = usesDrizzleOrm ? ensureYamlMapEntry(source, 'patchedDependencies', `drizzle-orm@${DRIZZLE_ORM_VERSION}`, drizzleOrmDeclarationPatchPath) : removeYamlMapEntry(source, `drizzle-orm@${DRIZZLE_ORM_VERSION}`);
|
|
688
|
-
source = drizzleOrmPatch.source;
|
|
689
|
-
changed = drizzleOrmPatch.changed || changed;
|
|
690
|
-
if (changed) io.write(workspaceFile, source);
|
|
691
|
-
return changed;
|
|
692
|
-
}
|
|
693
|
-
function updateUltramodernConfig(io, config, packageSource) {
|
|
694
|
-
const configPath = node_path.join(io.workspaceRoot, '.modernjs/ultramodern.json');
|
|
695
|
-
config.packageSource = {
|
|
696
|
-
strategy: packageSource.strategy,
|
|
697
|
-
modernPackageVersion: packageSource.modernPackageVersion,
|
|
698
|
-
...packageSource.registry ? {
|
|
699
|
-
registry: packageSource.registry
|
|
700
|
-
} : {},
|
|
701
|
-
...packageSource.aliasScope ? {
|
|
702
|
-
aliasScope: packageSource.aliasScope
|
|
703
|
-
} : {},
|
|
704
|
-
...packageSource.aliasPackageNamePrefix ? {
|
|
705
|
-
aliasPackageNamePrefix: packageSource.aliasPackageNamePrefix
|
|
706
|
-
} : {}
|
|
707
|
-
};
|
|
708
|
-
if (config.generator && 'object' == typeof config.generator && !Array.isArray(config.generator) && 'string' == typeof config.generator.version) config.generator.version = packageSource.modernPackageVersion;
|
|
709
|
-
for (const app of config.topology?.apps ?? [])if (app && 'object' == typeof app && !Array.isArray(app)) normalizeStrictEffectApiMetadata(app);
|
|
710
|
-
writeJsonFile(io, configPath, config);
|
|
711
|
-
}
|
|
712
|
-
function writeJsonIfChanged(io, filePath, value) {
|
|
713
|
-
return io.write(filePath, `${JSON.stringify(value, null, 2)}\n`);
|
|
714
|
-
}
|
|
715
|
-
function writeTextIfChanged(io, filePath, value) {
|
|
716
|
-
return io.write(filePath, value);
|
|
717
|
-
}
|
|
718
|
-
function ensureGeneratedIgnoreRules(io) {
|
|
719
|
-
const gitignorePath = node_path.join(io.workspaceRoot, '.gitignore');
|
|
720
|
-
const existing = node_fs.existsSync(gitignorePath) ? node_fs.readFileSync(gitignorePath, 'utf-8') : '';
|
|
721
|
-
const lines = 0 === existing.trimEnd().length ? [] : existing.trimEnd().split(/\r?\n/u);
|
|
722
|
-
let changed = false;
|
|
723
|
-
for (const rule of [
|
|
724
|
-
'.mf/',
|
|
725
|
-
'**/.mf/',
|
|
726
|
-
'dist-cloudflare/',
|
|
727
|
-
'.output/',
|
|
728
|
-
'**/.output/',
|
|
729
|
-
'.modern-js/',
|
|
730
|
-
'**/.modern-js/'
|
|
731
|
-
])if (!lines.includes(rule)) {
|
|
732
|
-
lines.push(rule);
|
|
733
|
-
changed = true;
|
|
734
|
-
}
|
|
735
|
-
if (!changed) return false;
|
|
736
|
-
return io.write(gitignorePath, `${lines.join('\n')}\n`);
|
|
737
|
-
}
|
|
738
|
-
function updateGeneratedTypeScriptSurfaces(io, config) {
|
|
739
|
-
let changed = false;
|
|
740
|
-
const apps = workspaceAppsFromToolingConfig(config);
|
|
741
|
-
const remotes = apps.filter((app)=>'shell' !== app.kind);
|
|
742
|
-
changed = writeJsonIfChanged(io, node_path.join(io.workspaceRoot, 'tsconfig.base.json'), createTsConfigBase()) || changed;
|
|
743
|
-
changed = ensureGeneratedIgnoreRules(io) || changed;
|
|
744
|
-
for (const sharedPackage of [
|
|
745
|
-
'packages/shared-contracts',
|
|
746
|
-
'packages/shared-design-tokens'
|
|
747
|
-
])changed = writeJsonIfChanged(io, node_path.join(io.workspaceRoot, sharedPackage, 'tsconfig.json'), createSharedPackageTsConfig(sharedPackage)) || changed;
|
|
748
|
-
for (const app of apps){
|
|
749
|
-
changed = writeJsonIfChanged(io, node_path.join(io.workspaceRoot, app.directory, 'tsconfig.json'), createAppTsConfig(app, remotes)) || changed;
|
|
750
|
-
changed = writeJsonIfChanged(io, node_path.join(io.workspaceRoot, app.directory, 'tsconfig.mf-types.json'), createAppMfTypesTsConfig(app)) || changed;
|
|
751
|
-
changed = writeTextIfChanged(io, node_path.join(io.workspaceRoot, app.directory, 'src/modern-app-env.d.ts'), createAppEnvDts(app, remotes)) || changed;
|
|
752
|
-
}
|
|
753
|
-
return changed;
|
|
754
|
-
}
|
|
755
|
-
function updateGeneratedModernConfigs(io, config) {
|
|
756
|
-
let changed = false;
|
|
757
|
-
const apps = workspaceAppsFromToolingConfig(config);
|
|
758
|
-
const remotes = apps.filter((app)=>'shell' !== app.kind);
|
|
759
|
-
for (const app of apps)changed = writeTextIfChanged(io, node_path.join(io.workspaceRoot, app.directory, 'modern.config.ts'), createAppModernConfig(config.workspace.packageScope, app, remotes)) || changed;
|
|
760
|
-
return changed;
|
|
761
|
-
}
|
|
762
|
-
function ensureGeneratedOxfmtIgnorePatterns(io) {
|
|
763
|
-
const configPath = node_path.join(io.workspaceRoot, 'oxfmt.config.ts');
|
|
764
|
-
if (!node_fs.existsSync(configPath)) return false;
|
|
765
|
-
const source = node_fs.readFileSync(configPath, 'utf-8');
|
|
766
|
-
const requiredPatterns = [
|
|
767
|
-
'.modernjs',
|
|
768
|
-
'.output',
|
|
769
|
-
'**/modern-tanstack/**',
|
|
770
|
-
'**/routeTree.gen.*'
|
|
771
|
-
];
|
|
772
|
-
const warnUnparseable = ()=>{
|
|
773
|
-
const message = `Could not update oxfmt.config.ts ignorePatterns automatically; add these entries manually: ${requiredPatterns.join(', ')}.`;
|
|
774
|
-
if (io.dryRun) io.log(message);
|
|
775
|
-
else process.stderr.write(`[ultramodern] ${message}\n`);
|
|
776
|
-
};
|
|
777
|
-
const anchor = source.indexOf('ignorePatterns:');
|
|
778
|
-
if (-1 === anchor) {
|
|
779
|
-
warnUnparseable();
|
|
780
|
-
return false;
|
|
781
|
-
}
|
|
782
|
-
const openBracket = source.indexOf('[', anchor);
|
|
783
|
-
if (-1 === openBracket) {
|
|
784
|
-
warnUnparseable();
|
|
785
|
-
return false;
|
|
786
|
-
}
|
|
787
|
-
let depth = 0;
|
|
788
|
-
let closeBracket = -1;
|
|
789
|
-
let stringQuote;
|
|
790
|
-
for(let index = openBracket; index < source.length; index += 1){
|
|
791
|
-
const char = source[index];
|
|
792
|
-
if (stringQuote) {
|
|
793
|
-
if ('\\' === char) index += 1;
|
|
794
|
-
else if (char === stringQuote) stringQuote = void 0;
|
|
795
|
-
continue;
|
|
796
|
-
}
|
|
797
|
-
if ("'" === char || '"' === char || '`' === char) stringQuote = char;
|
|
798
|
-
else if ('[' === char) depth += 1;
|
|
799
|
-
else if (']' === char) {
|
|
800
|
-
depth -= 1;
|
|
801
|
-
if (0 === depth) {
|
|
802
|
-
closeBracket = index;
|
|
803
|
-
break;
|
|
804
|
-
}
|
|
805
|
-
}
|
|
806
|
-
}
|
|
807
|
-
if (-1 === closeBracket) {
|
|
808
|
-
warnUnparseable();
|
|
809
|
-
return false;
|
|
810
|
-
}
|
|
811
|
-
const body = source.slice(openBracket + 1, closeBracket);
|
|
812
|
-
if (body.includes('...')) {
|
|
813
|
-
warnUnparseable();
|
|
814
|
-
return false;
|
|
815
|
-
}
|
|
816
|
-
const literalPattern = /(['"`])((?:\\.|(?!\1).)*)\1/g;
|
|
817
|
-
const existing = new Set();
|
|
818
|
-
for (const match of body.matchAll(literalPattern))existing.add(match[2]);
|
|
819
|
-
const missing = requiredPatterns.filter((pattern)=>!existing.has(pattern));
|
|
820
|
-
if (0 === missing.length) return false;
|
|
821
|
-
const bodyLines = body.split('\n');
|
|
822
|
-
let indent = ' ';
|
|
823
|
-
let quote = "'";
|
|
824
|
-
for(let index = bodyLines.length - 1; index >= 0; index -= 1){
|
|
825
|
-
const literal = bodyLines[index].match(/^(\s*)(['"`])/u);
|
|
826
|
-
if (literal) {
|
|
827
|
-
indent = literal[1];
|
|
828
|
-
quote = literal[2];
|
|
829
|
-
break;
|
|
830
|
-
}
|
|
831
|
-
}
|
|
832
|
-
const head = source.slice(0, closeBracket);
|
|
833
|
-
const rest = source.slice(closeBracket);
|
|
834
|
-
const tailMatch = head.match(/(\r?\n[ \t]*)$/u);
|
|
835
|
-
const tail = tailMatch ? tailMatch[1] : '\n';
|
|
836
|
-
let bodyContent = tailMatch ? head.slice(0, head.length - tail.length) : head;
|
|
837
|
-
if (!/[[,]\s*$/u.test(bodyContent)) bodyContent = `${bodyContent},`;
|
|
838
|
-
const insertionLines = missing.map((pattern)=>`${indent}${quote}${pattern}${quote},`).join('\n');
|
|
839
|
-
const nextSource = `${bodyContent}\n${insertionLines}${tail}${rest}`;
|
|
840
|
-
return io.write(configPath, nextSource);
|
|
841
|
-
}
|
|
842
|
-
function updateReferenceTopology(io) {
|
|
843
|
-
const topologyPath = node_path.join(io.workspaceRoot, 'topology/reference-topology.json');
|
|
844
|
-
if (!node_fs.existsSync(topologyPath)) return false;
|
|
845
|
-
const topology = readJsonFile(topologyPath);
|
|
846
|
-
let changed = false;
|
|
847
|
-
for (const vertical of topology.verticals ?? [])if (vertical && 'object' == typeof vertical && !Array.isArray(vertical)) changed = normalizeStrictEffectApiMetadata(vertical) || changed;
|
|
848
|
-
if (changed) writeJsonFile(io, topologyPath, topology);
|
|
849
|
-
return changed;
|
|
850
|
-
}
|
|
851
|
-
function createMigrationPackageSource(args, current) {
|
|
852
|
-
const strategy = hasFlag(args, '--workspace') ? 'workspace' : 'install';
|
|
853
|
-
const registry = readOption(args, '--registry') ?? readOption(args, '--ultramodern-package-registry');
|
|
854
|
-
const explicitAliasScope = readOption(args, '--alias-scope') ?? readOption(args, '--ultramodern-package-scope');
|
|
855
|
-
const aliasScope = explicitAliasScope ?? ('install' === strategy && void 0 === registry ? current.packageSource?.aliasScope ?? BLEEDINGDEV_PACKAGE_SCOPE : current.packageSource?.aliasScope);
|
|
856
|
-
const aliasPackageNamePrefix = readOption(args, '--alias-package-name-prefix') ?? readOption(args, '--ultramodern-package-name-prefix') ?? current.packageSource?.aliasPackageNamePrefix ?? (aliasScope ? BLEEDINGDEV_PACKAGE_NAME_PREFIX : void 0);
|
|
857
|
-
if ('workspace' === strategy) return {
|
|
858
|
-
strategy,
|
|
859
|
-
modernPackageVersion: WORKSPACE_PACKAGE_VERSION,
|
|
860
|
-
...registry ? {
|
|
861
|
-
registry
|
|
862
|
-
} : {},
|
|
863
|
-
...aliasScope ? {
|
|
864
|
-
aliasScope
|
|
865
|
-
} : {},
|
|
866
|
-
...aliasPackageNamePrefix ? {
|
|
867
|
-
aliasPackageNamePrefix
|
|
868
|
-
} : {}
|
|
869
|
-
};
|
|
870
|
-
const version = readOption(args, '--version') ?? readOption(args, '--ultramodern-package-version') ?? current.packageSource?.modernPackageVersion;
|
|
871
|
-
if (!version || version === WORKSPACE_PACKAGE_VERSION) throw new Error('migrate-strict-effect needs --version <published-ultramodern-version> for install package source.');
|
|
872
|
-
return {
|
|
873
|
-
strategy,
|
|
874
|
-
modernPackageVersion: version,
|
|
875
|
-
...registry ? {
|
|
876
|
-
registry
|
|
877
|
-
} : {},
|
|
878
|
-
...aliasScope ? {
|
|
879
|
-
aliasScope
|
|
880
|
-
} : {},
|
|
881
|
-
...aliasPackageNamePrefix ? {
|
|
882
|
-
aliasPackageNamePrefix
|
|
883
|
-
} : {}
|
|
884
|
-
};
|
|
885
|
-
}
|
|
886
|
-
function runPnpmLockfileRefresh(context) {
|
|
887
|
-
const result = spawnSync('pnpm', [
|
|
888
|
-
'install',
|
|
889
|
-
'--lockfile-only',
|
|
890
|
-
"--ignore-scripts"
|
|
891
|
-
], {
|
|
892
|
-
cwd: context.workspaceRoot,
|
|
893
|
-
stdio: 'inherit'
|
|
894
|
-
});
|
|
895
|
-
if (result.error) throw result.error;
|
|
896
|
-
return result.status ?? 1;
|
|
897
|
-
}
|
|
898
|
-
function runMigrateStrictEffect(args, context) {
|
|
899
|
-
if (args.includes('--help') || args.includes('-h')) {
|
|
900
|
-
process.stdout.write(`Usage:
|
|
901
|
-
modern-js-create ultramodern migrate-strict-effect --version <version> [--dry-run] [--skip-install]
|
|
902
|
-
|
|
903
|
-
Updates generated UltraModern package-source metadata, Modern package aliases,
|
|
904
|
-
framework-owned toolchain pins, direct Effect API topology metadata, strict
|
|
905
|
-
Effect pnpm overrides/trust policy, framework-owned TypeScript config
|
|
906
|
-
surfaces, and the pnpm lockfile. Source code still has to pass pnpm api:check
|
|
907
|
-
and pnpm contract:check.
|
|
908
|
-
|
|
909
|
-
When the compact config is absent but legacy UltraModern 3.2 metadata is
|
|
910
|
-
present, the compact config is synthesized from it first. Shell-only
|
|
911
|
-
workspaces skip the backend-federation and Zerops runtime stages. Pass
|
|
912
|
-
--dry-run to print the planned filesystem changes without writing anything
|
|
913
|
-
(implies --skip-install).
|
|
914
|
-
`);
|
|
915
|
-
return 0;
|
|
916
|
-
}
|
|
917
|
-
const dryRun = hasFlag(args, '--dry-run');
|
|
918
|
-
const skipInstall = dryRun || hasFlag(args, '--skip-install');
|
|
919
|
-
const io = createMigrationIo(context.workspaceRoot, dryRun);
|
|
920
|
-
const compactPath = node_path.join(io.workspaceRoot, '.modernjs/ultramodern.json');
|
|
921
|
-
let raw;
|
|
922
|
-
if (node_fs.existsSync(compactPath)) raw = readJsonFile(compactPath);
|
|
923
|
-
else {
|
|
924
|
-
const synthesized = synthesizeCompactUltramodernConfig(io.workspaceRoot);
|
|
925
|
-
if (!synthesized) throw new Error("Missing .modernjs/ultramodern.json and no legacy UltraModern metadata (.modernjs/ultramodern-generated-contract.json) was found to synthesize it from.");
|
|
926
|
-
raw = synthesized.compact;
|
|
927
|
-
io.write(compactPath, `${JSON.stringify(raw, null, 2)}\n`);
|
|
928
|
-
io.log(`Synthesized .modernjs/ultramodern.json from legacy metadata: ${synthesized.sources.join(', ')}.`);
|
|
929
|
-
if (synthesized.missing.length > 0) io.log(`Legacy metadata not found (using defaults): ${synthesized.missing.join(', ')}.`);
|
|
930
|
-
}
|
|
931
|
-
const current = normalizeCompactUltramodernConfig(io.workspaceRoot, raw);
|
|
932
|
-
const packageSource = createMigrationPackageSource(args, current);
|
|
933
|
-
updateUltramodernConfig(io, raw, packageSource);
|
|
934
|
-
updateReferenceTopology(io);
|
|
935
|
-
const migrated = normalizeCompactUltramodernConfig(io.workspaceRoot, raw);
|
|
936
|
-
const migratedApps = workspaceAppsFromToolingConfig(migrated);
|
|
937
|
-
const shellOnly = !migrated.topology.apps.some((app)=>app.api);
|
|
938
|
-
if (shellOnly) {
|
|
939
|
-
io.log('Shell-only workspace: skipping backend-federation and Zerops runtime stages.');
|
|
940
|
-
for (const relativePath of [
|
|
941
|
-
"scripts/generate-node-backend-federation.mts",
|
|
942
|
-
"scripts/generate-node-backend-federation.mjs",
|
|
943
|
-
"scripts/proof-node-backend-federation.mts",
|
|
944
|
-
"scripts/proof-node-backend-federation.mjs",
|
|
945
|
-
"scripts/materialize-zerops-runtime.mjs",
|
|
946
|
-
'zerops.yaml'
|
|
947
|
-
])removeGeneratedFileIfExists(io, relativePath);
|
|
948
|
-
} else {
|
|
949
|
-
removeStaleBackendFederationArtifacts(io, migrated);
|
|
950
|
-
updateGeneratedZeropsArtifacts(io, migrated);
|
|
951
|
-
updateGeneratedBackendFederationContractFiles(io, migrated);
|
|
952
|
-
}
|
|
953
|
-
for (const artifact of migratedWorkspaceScriptArtifacts({
|
|
954
|
-
shellOnly
|
|
955
|
-
})){
|
|
956
|
-
if (artifact.legacyPath) io.remove(node_path.join(io.workspaceRoot, artifact.legacyPath));
|
|
957
|
-
io.write(node_path.join(io.workspaceRoot, artifact.relativePath), artifact.content);
|
|
958
|
-
}
|
|
959
|
-
updateGeneratedBuildIdentityModules(io, migrated);
|
|
960
|
-
updateGeneratedTypeScriptSurfaces(io, migrated);
|
|
961
|
-
updateGeneratedModernConfigs(io, migrated);
|
|
962
|
-
for (const relativePackageFile of listWorkspacePackageFiles(io.workspaceRoot)){
|
|
963
|
-
const packageFile = node_path.join(io.workspaceRoot, relativePackageFile);
|
|
964
|
-
const packageJson = readJsonFile(packageFile);
|
|
965
|
-
if ('package.json' === relativePackageFile) {
|
|
966
|
-
packageJson.modernjs ??= {};
|
|
967
|
-
packageJson.modernjs.packageSource = {
|
|
968
|
-
strategy: packageSource.strategy,
|
|
969
|
-
config: './.modernjs/ultramodern.json'
|
|
970
|
-
};
|
|
971
|
-
}
|
|
972
|
-
updateModernDependencies(packageJson, packageSource);
|
|
973
|
-
updateGeneratedToolingDependencies(packageJson);
|
|
974
|
-
updateGeneratedPackageScripts(packageJson, {
|
|
975
|
-
relativePackageFile,
|
|
976
|
-
apps: migratedApps,
|
|
977
|
-
shellOnly
|
|
978
|
-
});
|
|
979
|
-
writeJsonFile(io, packageFile, packageJson);
|
|
980
|
-
}
|
|
981
|
-
updateGeneratedPnpmWorkspacePolicy(io);
|
|
982
|
-
ensureGeneratedDeclarationPatches(io, {
|
|
983
|
-
includeDrizzleOrmPatch: workspaceUsesDependency(io.workspaceRoot, 'drizzle-orm')
|
|
984
|
-
});
|
|
985
|
-
ensureGeneratedOxfmtIgnorePatterns(io);
|
|
986
|
-
if (!skipInstall) {
|
|
987
|
-
const status = runPnpmLockfileRefresh(context);
|
|
988
|
-
if (0 !== status) return status;
|
|
989
|
-
}
|
|
990
|
-
if (dryRun) {
|
|
991
|
-
for (const line of io.plan)process.stdout.write(`${line}\n`);
|
|
992
|
-
process.stdout.write(`[dry-run] migrate-strict-effect would migrate UltraModern strict Effect metadata to ${packageSource.modernPackageVersion}.\n`);
|
|
993
|
-
return 0;
|
|
994
|
-
}
|
|
995
|
-
process.stdout.write(`UltraModern strict Effect metadata migrated to ${packageSource.modernPackageVersion}. Run pnpm api:check && pnpm contract:check next.\n`);
|
|
996
|
-
return 0;
|
|
997
|
-
}
|
|
998
|
-
function runSkills(args, context) {
|
|
999
|
-
const [subcommand, ...rest] = args;
|
|
1000
|
-
if ('install' === subcommand) return spawnNodeScript("template-workspace/scripts/bootstrap-agent-skills.mjs", rest, context);
|
|
1001
|
-
if ('check' === subcommand) return spawnNodeScript("template-workspace/scripts/bootstrap-agent-skills.mjs", [
|
|
1002
|
-
'--check',
|
|
1003
|
-
...rest
|
|
1004
|
-
], context);
|
|
1005
|
-
throw new Error('Usage: modern-js-create ultramodern skills <install|check>');
|
|
1006
|
-
}
|
|
1007
|
-
const resolveCloudflareOutputVerifyTargets = (args, context)=>{
|
|
1008
|
-
const outputDirectory = readOption(args, '--output');
|
|
1009
|
-
const appId = readOption(args, '--app');
|
|
1010
|
-
if (outputDirectory && appId) throw new Error('Use either --app or --output, not both.');
|
|
1011
|
-
const targets = outputDirectory ? [
|
|
1012
|
-
{
|
|
1013
|
-
label: outputDirectory,
|
|
1014
|
-
outputDirectory: node_path.resolve(context.invocationCwd, outputDirectory)
|
|
1015
|
-
}
|
|
1016
|
-
] : workspaceAppsFromToolingConfig(readUltramodernConfig(context.workspaceRoot)).filter((app)=>!appId || app.id === appId).map((app)=>({
|
|
1017
|
-
label: app.id,
|
|
1018
|
-
outputDirectory: node_path.join(context.workspaceRoot, app.directory, '.output')
|
|
1019
|
-
}));
|
|
1020
|
-
if (0 === targets.length) throw new Error(`No generated UltraModern app matched ${appId}.`);
|
|
1021
|
-
return targets;
|
|
1022
|
-
};
|
|
1023
|
-
const renderCloudflareOutputVerifyModule = ({ workspaceRoot, targets, scanRoots, importWorker })=>`
|
|
1024
|
-
import { createRequire } from 'node:module';
|
|
1025
|
-
import path from 'node:path';
|
|
1026
|
-
|
|
1027
|
-
const workspaceRoot = ${JSON.stringify(workspaceRoot)};
|
|
1028
|
-
const targets = ${JSON.stringify(targets, null, 2)};
|
|
1029
|
-
const scanRoots = ${JSON.stringify(scanRoots)};
|
|
1030
|
-
const verifierRequire = createRequire(path.join(workspaceRoot, 'package.json'));
|
|
1031
|
-
const {
|
|
1032
|
-
verifyCloudflareOutput,
|
|
1033
|
-
verifyCloudflareOutputMutationPolicy,
|
|
1034
|
-
} = verifierRequire('@modern-js/app-tools/cloudflare-output-verifier');
|
|
1035
|
-
|
|
1036
|
-
let failed = false;
|
|
1037
|
-
for (const target of targets) {
|
|
1038
|
-
const result = await verifyCloudflareOutput({
|
|
1039
|
-
outputDirectory: target.outputDirectory,
|
|
1040
|
-
importWorker: ${JSON.stringify(importWorker)},
|
|
1041
|
-
});
|
|
1042
|
-
if (result.ok) {
|
|
1043
|
-
console.log(\`[ultramodern] Cloudflare output verified: \${target.label}\`);
|
|
1044
|
-
} else {
|
|
1045
|
-
failed = true;
|
|
1046
|
-
console.error(\`[ultramodern] Cloudflare output failed: \${target.label}\`);
|
|
1047
|
-
for (const issue of result.issues) {
|
|
1048
|
-
console.error(\`- \${issue.code}: \${issue.message}\${issue.path ? \` (\${issue.path})\` : ''}\`);
|
|
1049
|
-
}
|
|
1050
|
-
}
|
|
1051
|
-
}
|
|
1052
|
-
|
|
1053
|
-
if (scanRoots.length > 0) {
|
|
1054
|
-
const policyResult = await verifyCloudflareOutputMutationPolicy({ scanRoots });
|
|
1055
|
-
if (!policyResult.ok) {
|
|
1056
|
-
failed = true;
|
|
1057
|
-
console.error('[ultramodern] generated-output mutation policy failed');
|
|
1058
|
-
for (const issue of policyResult.issues) {
|
|
1059
|
-
console.error(\`- \${issue.code}: \${issue.message}\${issue.path ? \` (\${issue.path})\` : ''}\`);
|
|
1060
|
-
}
|
|
1061
|
-
}
|
|
1062
|
-
}
|
|
1063
|
-
|
|
1064
|
-
process.exit(failed ? 1 : 0);
|
|
1065
|
-
`;
|
|
1066
|
-
function runCloudflareOutputVerify(args, context) {
|
|
1067
|
-
if (args.includes('--help') || args.includes('-h')) {
|
|
1068
|
-
process.stdout.write(`Usage:
|
|
1069
|
-
modern-js-create ultramodern cloudflare-output-verify [--app <id> | --output <dir>] [--no-import-worker] [--no-source-scan]
|
|
1070
|
-
|
|
1071
|
-
Verifies generated Cloudflare output against the UltraModern worker contract.
|
|
1072
|
-
Without --app or --output, every generated workspace app is verified.
|
|
1073
|
-
`);
|
|
1074
|
-
return 0;
|
|
1075
|
-
}
|
|
1076
|
-
const source = renderCloudflareOutputVerifyModule({
|
|
1077
|
-
workspaceRoot: context.workspaceRoot,
|
|
1078
|
-
targets: resolveCloudflareOutputVerifyTargets(args, context),
|
|
1079
|
-
scanRoots: hasFlag(args, '--no-source-scan') ? [] : [
|
|
1080
|
-
context.workspaceRoot
|
|
1081
|
-
],
|
|
1082
|
-
importWorker: !hasFlag(args, '--no-import-worker')
|
|
1083
|
-
});
|
|
1084
|
-
return runRenderedModule(source, context);
|
|
1085
|
-
}
|
|
1086
|
-
const resolveRoutesGenerateTargets = (args, context)=>{
|
|
1087
|
-
const appId = readOption(args, '--app');
|
|
1088
|
-
const targets = workspaceAppsFromToolingConfig(readUltramodernConfig(context.workspaceRoot)).filter((app)=>!appId || app.id === appId).map((app)=>({
|
|
1089
|
-
label: app.id,
|
|
1090
|
-
appDirectory: node_path.join(context.workspaceRoot, app.directory)
|
|
1091
|
-
}));
|
|
1092
|
-
if (0 === targets.length) throw new Error(`No generated UltraModern app matched ${appId ?? '<any>'}.`);
|
|
1093
|
-
return targets;
|
|
1094
|
-
};
|
|
1095
|
-
const renderRoutesGenerateModule = ({ workspaceRoot, targets })=>`
|
|
1096
|
-
import { createRequire } from 'node:module';
|
|
1097
|
-
import path from 'node:path';
|
|
1098
|
-
import { pathToFileURL } from 'node:url';
|
|
1099
|
-
|
|
1100
|
-
const workspaceRoot = ${JSON.stringify(workspaceRoot)};
|
|
1101
|
-
const targets = ${JSON.stringify(targets, null, 2)};
|
|
1102
|
-
const appRequire = createRequire(path.join(workspaceRoot, 'package.json'));
|
|
1103
|
-
const pluginUrl = pathToFileURL(
|
|
1104
|
-
appRequire.resolve('@modern-js/plugin-tanstack'),
|
|
1105
|
-
).href;
|
|
1106
|
-
const { generateTanstackRouteArtifacts } = await import(pluginUrl);
|
|
1107
|
-
|
|
1108
|
-
let failed = false;
|
|
1109
|
-
// Sequential — the app-tools cli singleton is not re-entrant.
|
|
1110
|
-
for (const target of targets) {
|
|
1111
|
-
try {
|
|
1112
|
-
await generateTanstackRouteArtifacts({ appDirectory: target.appDirectory });
|
|
1113
|
-
console.log(\`[ultramodern] TanStack route artifacts generated: \${target.label}\`);
|
|
1114
|
-
} catch (error) {
|
|
1115
|
-
failed = true;
|
|
1116
|
-
console.error(\`[ultramodern] TanStack route generation failed: \${target.label}\`);
|
|
1117
|
-
// Print the full underlying failure, including the cause chain. The
|
|
1118
|
-
// route-generate crash is often an opaque node error thrown deep inside
|
|
1119
|
-
// app-tools/plugin (e.g. a path TypeError), so surfacing only
|
|
1120
|
-
// \`error.message\` swallows the stack that points at the real culprit.
|
|
1121
|
-
let current = error;
|
|
1122
|
-
let depth = 0;
|
|
1123
|
-
while (current) {
|
|
1124
|
-
const label = depth === 0 ? '-' : ' caused by:';
|
|
1125
|
-
const detail =
|
|
1126
|
-
current instanceof Error
|
|
1127
|
-
? current.stack ?? \`\${current.name}: \${current.message}\`
|
|
1128
|
-
: String(current);
|
|
1129
|
-
console.error(\`\${label} \${detail}\`);
|
|
1130
|
-
current = current instanceof Error ? current.cause : undefined;
|
|
1131
|
-
depth += 1;
|
|
1132
|
-
}
|
|
1133
|
-
}
|
|
1134
|
-
}
|
|
1135
|
-
|
|
1136
|
-
process.exit(failed ? 1 : 0);
|
|
1137
|
-
`;
|
|
1138
|
-
function runRoutesGenerate(args, context) {
|
|
1139
|
-
if (args.includes('--help') || args.includes('-h')) {
|
|
1140
|
-
process.stdout.write(`Usage:
|
|
1141
|
-
modern-js-create ultramodern routes-generate [--app <id>]
|
|
1142
|
-
|
|
1143
|
-
Regenerates TanStack route artifacts (router.gen.ts, register.gen.d.ts) for
|
|
1144
|
-
generated UltraModern apps without running dev or build. Without --app, every
|
|
1145
|
-
generated workspace app is regenerated.
|
|
1146
|
-
`);
|
|
1147
|
-
return 0;
|
|
1148
|
-
}
|
|
1149
|
-
const source = renderRoutesGenerateModule({
|
|
1150
|
-
workspaceRoot: context.workspaceRoot,
|
|
1151
|
-
targets: resolveRoutesGenerateTargets(args, context)
|
|
1152
|
-
});
|
|
1153
|
-
return runRenderedModule(source, context);
|
|
1154
|
-
}
|
|
3
|
+
import { GENERATED_TOOLING_COMMANDS } from "../ultramodern-workspace/tooling-command-catalog.js";
|
|
4
|
+
import { runCloudflareOutputVerify } from "./commands/cloudflare-output-verify.js";
|
|
5
|
+
import { printHelp, runTemplateBackedToolingCommand } from "./commands/context.js";
|
|
6
|
+
import { runMfTypes } from "./commands/mf-types.js";
|
|
7
|
+
import { runMigrateStrictEffect } from "./commands/migrate-strict-effect.js";
|
|
8
|
+
import { runRoutesGenerate } from "./commands/routes-generate.js";
|
|
9
|
+
import { runSkills } from "./commands/skills.js";
|
|
10
|
+
import { runSyncDeliveryUnit } from "./commands/sync-delivery-unit.js";
|
|
11
|
+
import { runValidate } from "./commands/validate.js";
|
|
1155
12
|
async function runUltramodernToolingCli(args, workspaceRoot = process.env.ULTRAMODERN_WORKSPACE_ROOT ?? process.cwd()) {
|
|
1156
13
|
try {
|
|
1157
14
|
const [command, ...rest] = args;
|