@fougere/cli 0.11.0-alpha.0 → 0.12.0-alpha.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.
@@ -36,7 +36,7 @@ export default class ServeCommand {
36
36
  // the same way rather than the first one being special.
37
37
  const conventions = await installLoader(root, watching);
38
38
 
39
- let hosted = await bootApp(root, { fronds: [frond], topology: false });
39
+ let hosted = await bootApp(root, { only: [frond], topology: false });
40
40
  if (!hosted.fronds.some((f) => f.name === frond)) {
41
41
  this.ui.error(`Frond '${frond}' introuvable dans ce projet.`);
42
42
  return;
@@ -64,7 +64,7 @@ export default class ServeCommand {
64
64
  const started = Date.now();
65
65
  let next: App;
66
66
  try {
67
- next = await bootApp(root, { fronds: [frond], topology: false });
67
+ next = await bootApp(root, { only: [frond], topology: false });
68
68
  } catch (error) {
69
69
  // The previous app keeps serving: a dev loop that dies on a typo is worse than
70
70
  // one that holds the last state which booted.
@@ -12,6 +12,7 @@ import ProjectScan from '../services/ProjectScan.js';
12
12
  import { statSync } from 'node:fs';
13
13
  import { dirname, join } from 'node:path';
14
14
  import { FACADE_OUT, DEFAULT_OUT } from './BuildHandler.js';
15
+ import { remotesOf } from '@fougere/core/node';
15
16
 
16
17
  export interface CheckResult {
17
18
  fronds: number;
@@ -46,7 +47,7 @@ export default class CheckHandler {
46
47
  // migration, seed or adapter mount is needed for a global semantic check.
47
48
  const model = resolveEffectiveOperations(fronds, {
48
49
  diagnostics,
49
- remotes: config.remotes,
50
+ remotes: remotesOf(config),
50
51
  adapters: config.adapters,
51
52
  });
52
53
  const findings: Diagnostic[] = [...model.diagnostics];
@@ -1,6 +1,7 @@
1
1
  import { createHttpTransport } from '@fougere/transport-http/client';
2
2
  import type { CallPage, CallRecord } from '@fougere/core';
3
3
  import ProjectScan from '../services/ProjectScan.js';
4
+ import { remotesOf } from '@fougere/core/node';
4
5
 
5
6
  /**
6
7
  * Where an app answers in development — Nuxt, Next and the site all sit there, so it is a
@@ -80,7 +81,7 @@ export default class DevtoolsHandler {
80
81
  private async addresses(root?: string): Promise<{ url: string; frond?: string }[]> {
81
82
  const { config } = await this.projectScan.at(root);
82
83
  const here = local();
83
- const remotes = Object.entries(config.remotes ?? {})
84
+ const remotes = Object.entries(remotesOf(config))
84
85
  .map(([frond, url]) => ({ url: trimmed(url), frond }));
85
86
 
86
87
  return [{ url: here }, ...remotes.filter((one) => one.url !== here)];
@@ -6,6 +6,7 @@ import {
6
6
  import { relative } from 'node:path';
7
7
  import ProjectScan from '../services/ProjectScan.js';
8
8
  import { ANONYMOUS_SCHEMA_NAME, lowerFirst, type SchemaView } from '@fougere/schema';
9
+ import { remotesOf } from '@fougere/core/node';
9
10
 
10
11
  type Cardinality = NonNullable<OperationContract['cardinality']>;
11
12
  type Binding = EffectiveOperation['binding'][number];
@@ -91,7 +92,7 @@ export default class ExplainHandler {
91
92
  /** The names this project serves — the list `explain` used to spell in a refusal only. */
92
93
  async list(input: { root?: string }): Promise<ExplainListing> {
93
94
  const { scan, model } = await this.modelOf(input.root);
94
- const remotes = scan.config.remotes ?? {};
95
+ const remotes = remotesOf(scan.config);
95
96
  const counted = new Map<string, number>();
96
97
  for (const operation of model.operations) {
97
98
  const frond = operation.placement.frond;
@@ -115,7 +116,7 @@ export default class ExplainHandler {
115
116
  scan,
116
117
  model: resolveEffectiveOperations(scan.fronds, {
117
118
  diagnostics: scan.diagnostics,
118
- remotes: scan.config.remotes,
119
+ remotes: remotesOf(scan.config),
119
120
  adapters: scan.config.adapters,
120
121
  }),
121
122
  };
@@ -3,6 +3,7 @@ import {
3
3
  type DeclaredTopology, type EntityNode, type DomainCluster, type FrondDescriptor,
4
4
  } from '@fougere/core';
5
5
  import ProjectScan from '../services/ProjectScan.js';
6
+ import { remotesOf } from '@fougere/core/node';
6
7
 
7
8
  export interface GraphResult {
8
9
  fronds: FrondDescriptor[];
@@ -25,7 +26,7 @@ export default class GraphHandler {
25
26
 
26
27
  return {
27
28
  fronds,
28
- declared: declaredTopologyOf({ fronds, remotes: config.remotes ?? {} }),
29
+ declared: declaredTopologyOf({ fronds, remotes: remotesOf(config) }),
29
30
  nodes,
30
31
  clusters,
31
32
  totalEntities: nodes.size,
@@ -2,6 +2,7 @@ import { loadScript, reachableOps } from '@fougere/testing';
2
2
  import { writeFile } from 'node:fs/promises';
3
3
  import { join } from 'node:path';
4
4
  import ProjectScan from '../services/ProjectScan.js';
5
+ import { remotesOf } from '@fougere/core/node';
5
6
 
6
7
  export interface LoadScenario {
7
8
  /** Where it was written, or `null` when it was only printed. */
@@ -27,7 +28,7 @@ export default class LoadHandler {
27
28
  const facade = input.facade?.trim() || undefined;
28
29
  // The topology statement travels with it: an op that crosses a process is not held to the
29
30
  // same figure as one that never leaves, and `remotes:` is what says which is which.
30
- const remotes = config.remotes ?? {};
31
+ const remotes = remotesOf(config);
31
32
  const script = loadScript({ fronds }, { ...(facade ? { facade } : {}), remotes });
32
33
 
33
34
  const file = input.out === undefined ? join(root, 'load.js') : input.out || null;
@@ -1,6 +1,6 @@
1
1
  import { type FougereConfig, type ScanResult } from '@fougere/core';
2
2
  import { scanProject, frondAliases } from '@fougere/compiler';
3
- import { resolveConventions } from '@fougere/core';
3
+ import { nested, resolveConventions } from '@fougere/core';
4
4
  import { setModuleLoader, loadConfig } from '@fougere/core/node';
5
5
  import { resolve } from 'node:path';
6
6
 
@@ -46,6 +46,10 @@ export default class ProjectScan {
46
46
  // naming its neighbour is unreadable to the very tool that checks it.
47
47
  install(await frondAliases(target, conventions));
48
48
 
49
- return { root: target, config, ...(await scanProject(target, undefined, conventions)) };
49
+ const scanned = await scanProject(target, undefined, conventions);
50
+
51
+ // A scan reads the disk, and the disk is flat: who inherits from whom is in the config.
52
+ // Stamped here so every reader of a project gets what a boot would have given it.
53
+ return { root: target, config, ...scanned, fronds: nested(scanned.fronds, config.fronds) };
50
54
  }
51
55
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fougere/cli",
3
- "version": "0.11.0-alpha.0",
3
+ "version": "0.12.0-alpha.0",
4
4
  "description": "The Fougere CLI — compose a workspace, serve a frond, call an operation.",
5
5
  "keywords": [
6
6
  "fougere",
@@ -42,20 +42,20 @@
42
42
  "jiti": "^2.4.2",
43
43
  "picocolors": "^1.1.1",
44
44
  "safe-regex": "^2.1.1",
45
- "@fougere/adapter-sql": "0.11.0-alpha.0",
46
- "@fougere/core": "0.11.0-alpha.0",
47
- "@fougere/compiler": "0.11.0-alpha.0",
48
- "@fougere/container": "0.11.0-alpha.0",
49
- "@fougere/defaults": "0.11.0-alpha.0",
50
- "@fougere/nuxt": "0.11.0-alpha.0",
51
- "@fougere/schema": "0.11.0-alpha.0",
52
- "@fougere/testing": "0.11.0-alpha.0",
53
- "@fougere/svelte": "0.11.0-alpha.0",
54
- "@fougere/transport-http": "0.11.0-alpha.0",
55
- "@fougere/next": "0.11.0-alpha.0",
56
- "@fougere/oclif": "0.11.0-alpha.0",
57
- "@fougere/admin": "0.11.0-alpha.0",
58
- "@fougere/react": "0.11.0-alpha.0"
45
+ "@fougere/container": "0.12.0-alpha.0",
46
+ "@fougere/compiler": "0.12.0-alpha.0",
47
+ "@fougere/core": "0.12.0-alpha.0",
48
+ "@fougere/adapter-sql": "0.12.0-alpha.0",
49
+ "@fougere/defaults": "0.12.0-alpha.0",
50
+ "@fougere/schema": "0.12.0-alpha.0",
51
+ "@fougere/nuxt": "0.12.0-alpha.0",
52
+ "@fougere/oclif": "0.12.0-alpha.0",
53
+ "@fougere/admin": "0.12.0-alpha.0",
54
+ "@fougere/testing": "0.12.0-alpha.0",
55
+ "@fougere/svelte": "0.12.0-alpha.0",
56
+ "@fougere/transport-http": "0.12.0-alpha.0",
57
+ "@fougere/react": "0.12.0-alpha.0",
58
+ "@fougere/next": "0.12.0-alpha.0"
59
59
  },
60
60
  "devDependencies": {
61
61
  "vitest": "^4.1.0"