mfeflow 0.4.0 → 0.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (82) hide show
  1. package/README.md +14 -5
  2. package/assets/features/analytics-gtm/feature.json +1 -1
  3. package/assets/features/ci-github/feature.json +1 -1
  4. package/assets/features/env-t3/feature.json +1 -1
  5. package/assets/features/lint-oxlint/feature.json +1 -1
  6. package/assets/features/registry-server/feature.json +128 -0
  7. package/assets/features/registry-server/files/deploy-server.yml +69 -0
  8. package/assets/features/registry-server/files/registry-server.md.eta +52 -0
  9. package/assets/features/registry-server/files/registry-sources.ts +12 -0
  10. package/assets/features/registry-static/feature.json +61 -0
  11. package/assets/features/registry-static/files/deploy.yml +61 -0
  12. package/assets/features/registry-static/files/registry.md.eta +49 -0
  13. package/assets/features/release/feature.json +43 -0
  14. package/assets/features/release/files/changeset-readme.md +7 -0
  15. package/assets/features/release/files/config.json +10 -0
  16. package/assets/features/release/files/releasing.md +21 -0
  17. package/assets/features/testing/feature.json +1 -1
  18. package/assets/features/tsconfig/feature.json +1 -1
  19. package/assets/features/url-factory/feature.json +1 -1
  20. package/assets/templates/monorepo/feature.json +13 -6
  21. package/assets/templates/monorepo/files/remote/{mfe.json.eta → mfeflow.app.json.eta} +1 -0
  22. package/assets/templates/monorepo/files/root/README.md.eta +16 -1
  23. package/assets/templates/monorepo/files/shell/{mfe.json.eta → mfeflow.app.json.eta} +1 -0
  24. package/assets/templates/monorepo/files/shell/rsbuild.config.ts.eta +42 -6
  25. package/assets/templates/monorepo/files/shell/src/assert.ts.eta +37 -0
  26. package/assets/templates/monorepo/files/shell/src/bootstrap.tsx.eta +12 -2
  27. package/assets/templates/monorepo/migrations/0.4.0-app-file.mjs +58 -0
  28. package/assets/templates/polyrepo/feature.json +305 -0
  29. package/assets/templates/polyrepo/files/AGENTS.md.eta +15 -0
  30. package/assets/templates/polyrepo/files/changeset/README.md +5 -0
  31. package/assets/templates/polyrepo/files/changeset/config.json +9 -0
  32. package/assets/templates/polyrepo/files/packages/contracts/package.json.eta +23 -0
  33. package/assets/templates/polyrepo/files/packages/contracts/src/index.ts +11 -0
  34. package/assets/templates/polyrepo/files/packages/contracts/tsconfig.json.eta +5 -0
  35. package/assets/templates/polyrepo/files/packages/tokens/package.json.eta +23 -0
  36. package/assets/templates/polyrepo/files/packages/tokens/src/index.ts +13 -0
  37. package/assets/templates/polyrepo/files/packages/tokens/tsconfig.json.eta +5 -0
  38. package/assets/templates/polyrepo/files/platform/README.md.eta +43 -0
  39. package/assets/templates/polyrepo/files/platform/default.json.eta +27 -0
  40. package/assets/templates/polyrepo/files/remote/README.md.eta +23 -0
  41. package/assets/templates/polyrepo/files/renovate.json.eta +4 -0
  42. package/assets/templates/polyrepo/files/shell/README.md.eta +32 -0
  43. package/assets/templates/polyrepo/files/tsconfig.base.json.eta +13 -0
  44. package/assets/templates/polyrepo/files/workflows/platform-ci.yml +29 -0
  45. package/assets/templates/polyrepo/files/workflows/release.yml +40 -0
  46. package/assets/templates/polyrepo/files/workflows/reusable-ci.yml.eta +50 -0
  47. package/assets/templates/polyrepo/files/workflows/team-ci.yml.eta +12 -0
  48. package/dist/against.d.ts +16 -0
  49. package/dist/catalog.d.ts +8 -0
  50. package/dist/checks/compat.d.ts +12 -0
  51. package/dist/checks/index.d.ts +0 -1
  52. package/dist/checks/singletons.d.ts +2 -5
  53. package/dist/commands/add.d.ts +4 -2
  54. package/dist/commands/adopt.d.ts +54 -0
  55. package/dist/commands/deploy.d.ts +262 -0
  56. package/dist/commands/doctor.d.ts +5 -0
  57. package/dist/commands/init.d.ts +9 -1
  58. package/dist/commands/server-mode.d.ts +210 -0
  59. package/dist/commands/status.d.ts +63 -0
  60. package/dist/commands/team-repo.d.ts +9 -0
  61. package/dist/commands/upgrade.d.ts +66 -0
  62. package/dist/deploy-testing.d.ts +41 -0
  63. package/dist/devregistry.d.ts +4 -5
  64. package/dist/devremotes.d.ts +15 -0
  65. package/dist/exit.d.ts +2 -1
  66. package/dist/glue.d.ts +6 -0
  67. package/dist/hosts.d.ts +25 -0
  68. package/dist/index.d.ts +1 -1
  69. package/dist/index.js +5477 -1643
  70. package/dist/inspect.d.ts +14 -2
  71. package/dist/output.d.ts +214 -7
  72. package/dist/pipeline.d.ts +13 -2
  73. package/dist/polyrepo.d.ts +69 -0
  74. package/dist/publish.d.ts +98 -0
  75. package/dist/runtime.d.ts +10 -1
  76. package/dist/server-client.d.ts +61 -0
  77. package/dist/system.d.ts +2 -0
  78. package/dist/testing.d.ts +82 -0
  79. package/dist/trust.d.ts +4 -0
  80. package/dist/upgrade.d.ts +25 -0
  81. package/dist/write.d.ts +8 -0
  82. package/package.json +5 -4
@@ -0,0 +1,41 @@
1
+ import type { RegistryIndexRemote } from '@mfeflow/contracts';
2
+ import { type DeployResult, type FailureResult, type StatusResult } from './output.js';
3
+ import { type TestRuntime } from './testing.js';
4
+ export declare const BASE_URL = "https://cdn.test";
5
+ interface Ran<T> {
6
+ code: number;
7
+ result: T;
8
+ rt: TestRuntime;
9
+ }
10
+ export interface Fixture {
11
+ root: string;
12
+ site: string;
13
+ cleanup(): Promise<void>;
14
+ /** `mfeflow <argv> --json` against this project and host, for the commands that print a deploy result. */
15
+ run(...argv: string[]): Promise<Ran<DeployResult>>;
16
+ /** The same, for a run that must fail with an error document. */
17
+ fail(...argv: string[]): Promise<Ran<FailureResult>>;
18
+ /** `mfeflow status <argv> --json`. */
19
+ status(...argv: string[]): Promise<Ran<StatusResult>>;
20
+ /** What the host serves for `env`, read straight from disk. */
21
+ served(env: string, remote?: string): Promise<RegistryIndexRemote | undefined>;
22
+ hostTree(): Promise<Record<string, string>>;
23
+ localTree(): Promise<Record<string, string>>;
24
+ }
25
+ /** An object read from JSON text, for tests that poke at it. */
26
+ export declare function parseObject(text: string): Record<string, unknown>;
27
+ export declare function readObject(file: string): Promise<Record<string, unknown>>;
28
+ export declare function failureOf(text: string): FailureResult;
29
+ export declare function statusOf(text: string): StatusResult;
30
+ export declare function deployOf(text: string): DeployResult;
31
+ /** Writes a remote's build: a manifest, an entry and one expose, with content that differs by `marker`. */
32
+ export declare function buildRemote(root: string, name: string, version: string, options?: {
33
+ marker?: string;
34
+ entryBytes?: number;
35
+ reactRange?: string;
36
+ }): Promise<void>;
37
+ export declare function fixture(options?: {
38
+ env?: Record<string, string>;
39
+ configure?: boolean;
40
+ }): Promise<Fixture>;
41
+ export {};
@@ -1,10 +1,9 @@
1
+ import type { RegistryIndex, RegistryIndexRemote } from '@mfeflow/contracts';
1
2
  import type { ProjectView } from './inspect.js';
2
- export interface DevRemote {
3
- name: string;
4
- entry: string;
3
+ export type DevRemote = RegistryIndexRemote & {
5
4
  version: string;
6
- }
7
- export interface DevIndex {
5
+ };
6
+ export interface DevIndex extends RegistryIndex {
8
7
  remotes: DevRemote[];
9
8
  }
10
9
  /** `name=url` flags as a map. A bare origin means its `/mf-manifest.json`. */
@@ -0,0 +1,15 @@
1
+ export interface RemoteSpec {
2
+ name: string;
3
+ port: number;
4
+ }
5
+ /** The dev server of each remote, relative to the shell app: the one place a polyrepo shell reads them from. */
6
+ export declare const DEV_CONFIG = "apps/shell/public/config/runtime-config.dev.json";
7
+ export declare const DEV_CONFIG_IN_APP = "public/config/runtime-config.dev.json";
8
+ /** `runtime-config.dev.json` of the shell: where each remote's dev server is. */
9
+ export declare function devConfigText(remotes: readonly RemoteSpec[]): string;
10
+ /** The `devRemotes` of a shell's dev config; empty when the file or the key is missing. */
11
+ export declare function readDevRemotes(text: string | undefined): Record<string, string>;
12
+ /** `text` with one more remote in `devRemotes`. */
13
+ export declare function withDevRemote(text: string, remote: RemoteSpec): string;
14
+ /** The port of a dev URL like `http://localhost:4311/mf-manifest.json`. */
15
+ export declare function portOf(url: string): number | undefined;
package/dist/exit.d.ts CHANGED
@@ -8,7 +8,8 @@ export declare const EXIT: {
8
8
  readonly feature: 4;
9
9
  readonly build: 5;
10
10
  readonly registry: 6;
11
- readonly upgrade: 7;
11
+ readonly deploy: 7;
12
+ readonly upgrade: 8;
12
13
  readonly cancelled: 130;
13
14
  };
14
15
  /** Raised when the user backs out of a prompt. */
package/dist/glue.d.ts CHANGED
@@ -1,11 +1,15 @@
1
1
  import { type LoadedFeature, type MfeflowProject } from '@mfeflow/core';
2
+ import type { Globals } from './args.js';
2
3
  import type { AssetRoots } from './assets.js';
4
+ import type { Runtime } from './runtime.js';
3
5
  export declare const SHELL_PORT = 4300;
4
6
  export declare const REMOTE_PORT = 4311;
5
7
  export declare function assertAppName(name: string, apps?: MfeflowProject['apps']): void;
6
8
  /** The first free port from `start` upwards. */
7
9
  export declare function freePort(project: Pick<MfeflowProject, 'apps'>, start: number): number;
8
10
  export declare function routeComponent(remote: string): string;
11
+ export declare function portFor(args: Record<string, unknown>, project: Pick<MfeflowProject, 'apps'>, start: number): number;
12
+ export declare function nameFrom(rt: Runtime, globals: Globals, given: string | undefined, what: string): Promise<string>;
9
13
  export declare const REGISTRY_ENVS: readonly ['dev', 'staging', 'prod'];
10
14
  export interface RemoteSpec {
11
15
  name: string;
@@ -18,6 +22,8 @@ export interface GlueOptions {
18
22
  remote: RemoteSpec;
19
23
  /** Write `registry/envs/<env>/<name>.json`. */
20
24
  registry: boolean;
25
+ /** Which environments get an entry (default all). A polyrepo shell has no dev entry: its dev remotes are in config. */
26
+ registryEnvs?: readonly string[];
21
27
  /** Apps (a shell name, or "shell" for every shell) that get a route to the remote. */
22
28
  shells: readonly string[];
23
29
  }
@@ -0,0 +1,25 @@
1
+ import { type RegistryHost } from '@mfeflow/registry/static';
2
+ export type HostSpec = {
3
+ kind: 'file';
4
+ dir: string;
5
+ } | {
6
+ kind: 's3';
7
+ bucket: string;
8
+ prefix: string;
9
+ };
10
+ /** `file:<dir>` or `s3://<bucket>[/prefix]`. A folder is resolved against `cwd`. */
11
+ export declare function parseHostSpec(spec: string, cwd: string): HostSpec;
12
+ /** The host as shown to people and in `--json`: never an endpoint or a credential. */
13
+ export declare function describeHost(host: HostSpec): string;
14
+ type Env = Readonly<Record<string, string | undefined>>;
15
+ /** The secret values the environment holds, so no message can echo them. */
16
+ export declare function secretsOf(env: Env): string[];
17
+ export declare function redact(text: string, secrets: readonly string[]): string;
18
+ export interface OpenOptions {
19
+ env: Env;
20
+ /** For tests: stands in for the network. */
21
+ fetch?: typeof fetch;
22
+ }
23
+ /** Opens the host. S3 settings and credentials come from the environment only. */
24
+ export declare function openHost(spec: HostSpec, options: OpenOptions): Promise<RegistryHost>;
25
+ export {};
package/dist/index.d.ts CHANGED
@@ -2,7 +2,7 @@ export { main } from './cli.js';
2
2
  export { COMMANDS } from './cli.js';
3
3
  export { EXIT, exitCodeFor } from './exit.js';
4
4
  export { validateResult } from './output.js';
5
- export type { AddResult, BudgetResult, DevResult, CliResult, FailureResult, FeatureInfo, FeaturesResult, InitResult, PlanReport, RegistryEntryInfo, RegistryResult, RegistryStatus, ReportResult, } from './output.js';
5
+ export type { AddResult, AdoptResult, BudgetResult, DevResult, DeployResult, CliResult, FailureResult, FeatureInfo, FeaturesResult, InitResult, PlanReport, RegistryEntryInfo, RegistryResult, RegistryStatus, ReportResult, StatusResult, UpgradeFileReport, UpgradeResult, } from './output.js';
6
6
  export { realRuntime, type Runtime } from './runtime.js';
7
7
  export type { Io } from './io.js';
8
8
  export type { Prompter } from './prompter.js';