@fougere/cli 0.12.5-alpha.0 → 0.13.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.
- package/dist/.fougere/scan.generated.d.ts +3 -0
- package/dist/.fougere/scan.generated.d.ts.map +1 -0
- package/dist/.fougere/scan.generated.js +140 -0
- package/dist/.fougere/scan.generated.js.map +1 -0
- package/dist/app/commands/BuildCommand.d.ts +18 -0
- package/dist/app/commands/BuildCommand.d.ts.map +1 -0
- package/dist/app/commands/BuildCommand.js +35 -0
- package/dist/app/commands/BuildCommand.js.map +1 -0
- package/dist/app/commands/CallCommand.d.ts +16 -0
- package/dist/app/commands/CallCommand.d.ts.map +1 -0
- package/dist/app/commands/CallCommand.js +73 -0
- package/dist/app/commands/CallCommand.js.map +1 -0
- package/dist/app/commands/CheckCommand.d.ts +11 -0
- package/dist/app/commands/CheckCommand.d.ts.map +1 -0
- package/dist/app/commands/CheckCommand.js +59 -0
- package/dist/app/commands/CheckCommand.js.map +1 -0
- package/dist/app/commands/CompletionCommand.d.ts +7 -0
- package/dist/app/commands/CompletionCommand.d.ts.map +1 -0
- package/dist/app/commands/CompletionCommand.js +23 -0
- package/dist/app/commands/CompletionCommand.js.map +1 -0
- package/dist/app/commands/DevtoolsCommand.d.ts +20 -0
- package/dist/app/commands/DevtoolsCommand.d.ts.map +1 -0
- package/dist/app/commands/DevtoolsCommand.js +79 -0
- package/dist/app/commands/DevtoolsCommand.js.map +1 -0
- package/dist/app/commands/ExplainCommand.d.ts +18 -0
- package/dist/app/commands/ExplainCommand.d.ts.map +1 -0
- package/dist/app/commands/ExplainCommand.js +111 -0
- package/dist/app/commands/ExplainCommand.js.map +1 -0
- package/dist/app/commands/FreezeCommand.d.ts +21 -0
- package/dist/app/commands/FreezeCommand.d.ts.map +1 -0
- package/dist/app/commands/FreezeCommand.js +102 -0
- package/dist/app/commands/FreezeCommand.js.map +1 -0
- package/dist/app/commands/GrantCommand.d.ts +18 -0
- package/dist/app/commands/GrantCommand.d.ts.map +1 -0
- package/dist/app/commands/GrantCommand.js +39 -0
- package/dist/app/commands/GrantCommand.js.map +1 -0
- package/dist/app/commands/GraphCommand.d.ts +11 -0
- package/dist/app/commands/GraphCommand.d.ts.map +1 -0
- package/dist/app/commands/GraphCommand.js +72 -0
- package/dist/app/commands/GraphCommand.js.map +1 -0
- package/dist/app/commands/KeysCommand.d.ts +22 -0
- package/dist/app/commands/KeysCommand.d.ts.map +1 -0
- package/dist/app/commands/KeysCommand.js +50 -0
- package/dist/app/commands/KeysCommand.js.map +1 -0
- package/dist/app/commands/LoadCommand.d.ts +19 -0
- package/dist/app/commands/LoadCommand.d.ts.map +1 -0
- package/dist/app/commands/LoadCommand.js +37 -0
- package/dist/app/commands/LoadCommand.js.map +1 -0
- package/dist/app/commands/MigrateCommand.d.ts +17 -0
- package/dist/app/commands/MigrateCommand.d.ts.map +1 -0
- package/dist/app/commands/MigrateCommand.js +47 -0
- package/dist/app/commands/MigrateCommand.js.map +1 -0
- package/dist/app/commands/NewCommand.d.ts +24 -0
- package/dist/app/commands/NewCommand.d.ts.map +1 -0
- package/dist/app/commands/NewCommand.js +108 -0
- package/dist/app/commands/NewCommand.js.map +1 -0
- package/dist/app/commands/ServeCommand.d.ts +17 -0
- package/dist/app/commands/ServeCommand.d.ts.map +1 -0
- package/dist/app/commands/ServeCommand.js +92 -0
- package/dist/app/commands/ServeCommand.js.map +1 -0
- package/dist/app/commands/grant-material.d.ts +5 -0
- package/dist/app/commands/grant-material.d.ts.map +1 -0
- package/{app/commands/grant-material.ts → dist/app/commands/grant-material.js} +2 -2
- package/dist/app/commands/grant-material.js.map +1 -0
- package/dist/fronds/analysis/entities/Build.d.ts +10 -0
- package/dist/fronds/analysis/entities/Build.d.ts.map +1 -0
- package/dist/fronds/analysis/entities/Build.js +9 -0
- package/dist/fronds/analysis/entities/Build.js.map +1 -0
- package/dist/fronds/analysis/entities/Check.d.ts +8 -0
- package/dist/fronds/analysis/entities/Check.d.ts.map +1 -0
- package/dist/fronds/analysis/entities/Check.js +7 -0
- package/dist/fronds/analysis/entities/Check.js.map +1 -0
- package/dist/fronds/analysis/entities/Devtools.d.ts +10 -0
- package/dist/fronds/analysis/entities/Devtools.d.ts.map +1 -0
- package/dist/fronds/analysis/entities/Devtools.js +9 -0
- package/dist/fronds/analysis/entities/Devtools.js.map +1 -0
- package/dist/fronds/analysis/entities/Explain.d.ts +11 -0
- package/dist/fronds/analysis/entities/Explain.d.ts.map +1 -0
- package/dist/fronds/analysis/entities/Explain.js +10 -0
- package/dist/fronds/analysis/entities/Explain.js.map +1 -0
- package/dist/fronds/analysis/entities/Freeze.d.ts +10 -0
- package/dist/fronds/analysis/entities/Freeze.d.ts.map +1 -0
- package/dist/fronds/analysis/entities/Freeze.js +9 -0
- package/dist/fronds/analysis/entities/Freeze.js.map +1 -0
- package/dist/fronds/analysis/entities/Graph.d.ts +9 -0
- package/dist/fronds/analysis/entities/Graph.d.ts.map +1 -0
- package/dist/fronds/analysis/entities/Graph.js +8 -0
- package/dist/fronds/analysis/entities/Graph.js.map +1 -0
- package/dist/fronds/analysis/entities/Load.d.ts +10 -0
- package/dist/fronds/analysis/entities/Load.d.ts.map +1 -0
- package/dist/fronds/analysis/entities/Load.js +9 -0
- package/dist/fronds/analysis/entities/Load.js.map +1 -0
- package/dist/fronds/analysis/entities/Migrate.d.ts +10 -0
- package/dist/fronds/analysis/entities/Migrate.d.ts.map +1 -0
- package/dist/fronds/analysis/entities/Migrate.js +9 -0
- package/dist/fronds/analysis/entities/Migrate.js.map +1 -0
- package/dist/fronds/analysis/handlers/BuildHandler.d.ts +50 -0
- package/dist/fronds/analysis/handlers/BuildHandler.d.ts.map +1 -0
- package/dist/fronds/analysis/handlers/BuildHandler.js +63 -0
- package/dist/fronds/analysis/handlers/BuildHandler.js.map +1 -0
- package/dist/fronds/analysis/handlers/CheckHandler.d.ts +30 -0
- package/dist/fronds/analysis/handlers/CheckHandler.d.ts.map +1 -0
- package/dist/fronds/analysis/handlers/CheckHandler.js +196 -0
- package/dist/fronds/analysis/handlers/CheckHandler.js.map +1 -0
- package/dist/fronds/analysis/handlers/DevtoolsHandler.d.ts +45 -0
- package/dist/fronds/analysis/handlers/DevtoolsHandler.d.ts.map +1 -0
- package/dist/fronds/analysis/handlers/DevtoolsHandler.js +61 -0
- package/dist/fronds/analysis/handlers/DevtoolsHandler.js.map +1 -0
- package/dist/fronds/analysis/handlers/ExplainHandler.d.ts +99 -0
- package/dist/fronds/analysis/handlers/ExplainHandler.d.ts.map +1 -0
- package/dist/fronds/analysis/handlers/ExplainHandler.js +157 -0
- package/dist/fronds/analysis/handlers/ExplainHandler.js.map +1 -0
- package/dist/fronds/analysis/handlers/FreezeHandler.d.ts +55 -0
- package/dist/fronds/analysis/handlers/FreezeHandler.d.ts.map +1 -0
- package/dist/fronds/analysis/handlers/FreezeHandler.js +145 -0
- package/dist/fronds/analysis/handlers/FreezeHandler.js.map +1 -0
- package/dist/fronds/analysis/handlers/GraphHandler.d.ts +23 -0
- package/dist/fronds/analysis/handlers/GraphHandler.d.ts.map +1 -0
- package/dist/fronds/analysis/handlers/GraphHandler.js +23 -0
- package/dist/fronds/analysis/handlers/GraphHandler.js.map +1 -0
- package/dist/fronds/analysis/handlers/LoadHandler.d.ts +26 -0
- package/dist/fronds/analysis/handlers/LoadHandler.d.ts.map +1 -0
- package/dist/fronds/analysis/handlers/LoadHandler.js +35 -0
- package/dist/fronds/analysis/handlers/LoadHandler.js.map +1 -0
- package/dist/fronds/analysis/handlers/MigrateHandler.d.ts +34 -0
- package/dist/fronds/analysis/handlers/MigrateHandler.d.ts.map +1 -0
- package/dist/fronds/analysis/handlers/MigrateHandler.js +92 -0
- package/dist/fronds/analysis/handlers/MigrateHandler.js.map +1 -0
- package/dist/fronds/analysis/services/ProjectScan.d.ts +22 -0
- package/dist/fronds/analysis/services/ProjectScan.d.ts.map +1 -0
- package/dist/fronds/analysis/services/ProjectScan.js +48 -0
- package/dist/fronds/analysis/services/ProjectScan.js.map +1 -0
- package/dist/fronds/analysis/versions.d.ts +21 -0
- package/dist/fronds/analysis/versions.d.ts.map +1 -0
- package/dist/fronds/analysis/versions.js +48 -0
- package/dist/fronds/analysis/versions.js.map +1 -0
- package/dist/fronds/scaffold/entities/BuildFrond.d.ts +7 -0
- package/dist/fronds/scaffold/entities/BuildFrond.d.ts.map +1 -0
- package/dist/fronds/scaffold/entities/BuildFrond.js +6 -0
- package/dist/fronds/scaffold/entities/BuildFrond.js.map +1 -0
- package/dist/fronds/scaffold/entities/Call.d.ts +8 -0
- package/dist/fronds/scaffold/entities/Call.d.ts.map +1 -0
- package/{fronds/scaffold/entities/Call.ts → dist/fronds/scaffold/entities/Call.js} +4 -3
- package/dist/fronds/scaffold/entities/Call.js.map +1 -0
- package/dist/fronds/scaffold/entities/Completion.d.ts +7 -0
- package/dist/fronds/scaffold/entities/Completion.d.ts.map +1 -0
- package/dist/fronds/scaffold/entities/Completion.js +6 -0
- package/dist/fronds/scaffold/entities/Completion.js.map +1 -0
- package/dist/fronds/scaffold/entities/Grant.d.ts +8 -0
- package/dist/fronds/scaffold/entities/Grant.d.ts.map +1 -0
- package/{fronds/scaffold/entities/Grant.ts → dist/fronds/scaffold/entities/Grant.js} +4 -3
- package/dist/fronds/scaffold/entities/Grant.js.map +1 -0
- package/dist/fronds/scaffold/entities/Keys.d.ts +6 -0
- package/dist/fronds/scaffold/entities/Keys.d.ts.map +1 -0
- package/{fronds/scaffold/entities/Keys.ts → dist/fronds/scaffold/entities/Keys.js} +3 -2
- package/dist/fronds/scaffold/entities/Keys.js.map +1 -0
- package/dist/fronds/scaffold/entities/New.d.ts +19 -0
- package/dist/fronds/scaffold/entities/New.d.ts.map +1 -0
- package/dist/fronds/scaffold/entities/New.js +18 -0
- package/dist/fronds/scaffold/entities/New.js.map +1 -0
- package/dist/fronds/scaffold/entities/Serve.d.ts +10 -0
- package/dist/fronds/scaffold/entities/Serve.d.ts.map +1 -0
- package/dist/fronds/scaffold/entities/Serve.js +9 -0
- package/dist/fronds/scaffold/entities/Serve.js.map +1 -0
- package/dist/fronds/scaffold/entities/Sync.d.ts +8 -0
- package/dist/fronds/scaffold/entities/Sync.d.ts.map +1 -0
- package/dist/fronds/scaffold/entities/Sync.js +7 -0
- package/dist/fronds/scaffold/entities/Sync.js.map +1 -0
- package/dist/fronds/scaffold/handlers/BuildFrondHandler.d.ts +11 -0
- package/dist/fronds/scaffold/handlers/BuildFrondHandler.d.ts.map +1 -0
- package/dist/fronds/scaffold/handlers/BuildFrondHandler.js +82 -0
- package/dist/fronds/scaffold/handlers/BuildFrondHandler.js.map +1 -0
- package/dist/fronds/scaffold/handlers/CallHandler.d.ts +10 -0
- package/dist/fronds/scaffold/handlers/CallHandler.d.ts.map +1 -0
- package/{fronds/scaffold/handlers/CallHandler.ts → dist/fronds/scaffold/handlers/CallHandler.js} +3 -2
- package/dist/fronds/scaffold/handlers/CallHandler.js.map +1 -0
- package/dist/fronds/scaffold/handlers/CompletionHandler.d.ts +9 -0
- package/dist/fronds/scaffold/handlers/CompletionHandler.d.ts.map +1 -0
- package/{fronds/scaffold/handlers/CompletionHandler.ts → dist/fronds/scaffold/handlers/CompletionHandler.js} +3 -2
- package/dist/fronds/scaffold/handlers/CompletionHandler.js.map +1 -0
- package/dist/fronds/scaffold/handlers/GrantHandler.d.ts +9 -0
- package/dist/fronds/scaffold/handlers/GrantHandler.d.ts.map +1 -0
- package/{fronds/scaffold/handlers/GrantHandler.ts → dist/fronds/scaffold/handlers/GrantHandler.js} +3 -2
- package/dist/fronds/scaffold/handlers/GrantHandler.js.map +1 -0
- package/dist/fronds/scaffold/handlers/KeysHandler.d.ts +9 -0
- package/dist/fronds/scaffold/handlers/KeysHandler.d.ts.map +1 -0
- package/{fronds/scaffold/handlers/KeysHandler.ts → dist/fronds/scaffold/handlers/KeysHandler.js} +3 -2
- package/dist/fronds/scaffold/handlers/KeysHandler.js.map +1 -0
- package/dist/fronds/scaffold/handlers/NewHandler.d.ts +9 -0
- package/dist/fronds/scaffold/handlers/NewHandler.d.ts.map +1 -0
- package/{fronds/scaffold/handlers/NewHandler.ts → dist/fronds/scaffold/handlers/NewHandler.js} +3 -2
- package/dist/fronds/scaffold/handlers/NewHandler.js.map +1 -0
- package/dist/fronds/scaffold/handlers/ServeHandler.d.ts +10 -0
- package/dist/fronds/scaffold/handlers/ServeHandler.d.ts.map +1 -0
- package/{fronds/scaffold/handlers/ServeHandler.ts → dist/fronds/scaffold/handlers/ServeHandler.js} +3 -2
- package/dist/fronds/scaffold/handlers/ServeHandler.js.map +1 -0
- package/dist/fronds/scaffold/handlers/SyncHandler.d.ts +18 -0
- package/dist/fronds/scaffold/handlers/SyncHandler.d.ts.map +1 -0
- package/dist/fronds/scaffold/handlers/SyncHandler.js +327 -0
- package/dist/fronds/scaffold/handlers/SyncHandler.js.map +1 -0
- package/dist/fronds/scaffold/services/ProjectWriter.d.ts +54 -0
- package/dist/fronds/scaffold/services/ProjectWriter.d.ts.map +1 -0
- package/dist/fronds/scaffold/services/ProjectWriter.js +315 -0
- package/dist/fronds/scaffold/services/ProjectWriter.js.map +1 -0
- package/dist/src/bin.d.ts.map +1 -0
- package/dist/src/bin.js +11 -0
- package/dist/src/bin.js.map +1 -0
- package/dist/src/bridge.d.ts.map +1 -0
- package/dist/src/bridge.js.map +1 -0
- package/dist/src/completion.d.ts.map +1 -0
- package/dist/src/completion.js.map +1 -0
- package/dist/src/index.d.ts.map +1 -0
- package/dist/src/index.js.map +1 -0
- package/dist/src/loader.d.ts.map +1 -0
- package/dist/src/loader.js.map +1 -0
- package/dist/src/machine.d.ts.map +1 -0
- package/dist/src/machine.js.map +1 -0
- package/dist/src/main.d.ts +2 -0
- package/dist/src/main.d.ts.map +1 -0
- package/dist/src/main.js +19 -0
- package/dist/src/main.js.map +1 -0
- package/dist/src/runner.d.ts.map +1 -0
- package/dist/{runner.js → src/runner.js} +22 -22
- package/dist/src/runner.js.map +1 -0
- package/dist/src/theme.d.ts.map +1 -0
- package/dist/src/theme.js.map +1 -0
- package/dist/src/typescript/EntityTypes.d.ts.map +1 -0
- package/dist/src/typescript/EntityTypes.js.map +1 -0
- package/dist/src/typescript/FacadeTypes.d.ts.map +1 -0
- package/dist/src/typescript/FacadeTypes.js.map +1 -0
- package/dist/src/typescript/syntax.d.ts.map +1 -0
- package/dist/src/typescript/syntax.js.map +1 -0
- package/dist/{ui.d.ts → src/ui.d.ts} +0 -1
- package/dist/src/ui.d.ts.map +1 -0
- package/dist/{ui.js → src/ui.js} +24 -22
- package/dist/src/ui.js.map +1 -0
- package/package.json +25 -29
- package/templates/frond/fronds/tsconfig.json +17 -0
- package/templates/workspace/fronds/tsconfig.json +2 -4
- package/templates/workspace/package.json +1 -1
- package/templates/workspace/pnpm-workspace.yaml +5 -3
- package/app/commands/BuildCommand.ts +0 -43
- package/app/commands/CallCommand.ts +0 -70
- package/app/commands/CheckCommand.ts +0 -70
- package/app/commands/CompletionCommand.ts +0 -24
- package/app/commands/DevtoolsCommand.ts +0 -92
- package/app/commands/ExplainCommand.ts +0 -136
- package/app/commands/FreezeCommand.ts +0 -119
- package/app/commands/GrantCommand.ts +0 -46
- package/app/commands/GraphCommand.ts +0 -91
- package/app/commands/KeysCommand.ts +0 -57
- package/app/commands/LoadCommand.ts +0 -46
- package/app/commands/MigrateCommand.ts +0 -61
- package/app/commands/NewCommand.ts +0 -137
- package/app/commands/ServeCommand.ts +0 -108
- package/dist/bin.d.ts.map +0 -1
- package/dist/bin.js +0 -64
- package/dist/bin.js.map +0 -1
- package/dist/bridge.d.ts.map +0 -1
- package/dist/bridge.js.map +0 -1
- package/dist/completion.d.ts.map +0 -1
- package/dist/completion.js.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/loader.d.ts.map +0 -1
- package/dist/loader.js.map +0 -1
- package/dist/machine.d.ts.map +0 -1
- package/dist/machine.js.map +0 -1
- package/dist/runner.d.ts.map +0 -1
- package/dist/runner.js.map +0 -1
- package/dist/theme.d.ts.map +0 -1
- package/dist/theme.js.map +0 -1
- package/dist/typescript/EntityTypes.d.ts.map +0 -1
- package/dist/typescript/EntityTypes.js.map +0 -1
- package/dist/typescript/FacadeTypes.d.ts.map +0 -1
- package/dist/typescript/FacadeTypes.js.map +0 -1
- package/dist/typescript/syntax.d.ts.map +0 -1
- package/dist/typescript/syntax.js.map +0 -1
- package/dist/ui.d.ts.map +0 -1
- package/dist/ui.js.map +0 -1
- package/fronds/analysis/entities/Build.ts +0 -8
- package/fronds/analysis/entities/Check.ts +0 -6
- package/fronds/analysis/entities/Devtools.ts +0 -8
- package/fronds/analysis/entities/Explain.ts +0 -9
- package/fronds/analysis/entities/Freeze.ts +0 -8
- package/fronds/analysis/entities/Graph.ts +0 -7
- package/fronds/analysis/entities/Load.ts +0 -8
- package/fronds/analysis/entities/Migrate.ts +0 -8
- package/fronds/analysis/handlers/BuildHandler.ts +0 -87
- package/fronds/analysis/handlers/CheckHandler.ts +0 -217
- package/fronds/analysis/handlers/DevtoolsHandler.ts +0 -97
- package/fronds/analysis/handlers/ExplainHandler.ts +0 -263
- package/fronds/analysis/handlers/FreezeHandler.ts +0 -183
- package/fronds/analysis/handlers/GraphHandler.ts +0 -38
- package/fronds/analysis/handlers/LoadHandler.ts +0 -44
- package/fronds/analysis/handlers/MigrateHandler.ts +0 -110
- package/fronds/analysis/services/ProjectScan.ts +0 -55
- package/fronds/analysis/versions.ts +0 -59
- package/fronds/scaffold/entities/BuildFrond.ts +0 -5
- package/fronds/scaffold/entities/Completion.ts +0 -5
- package/fronds/scaffold/entities/New.ts +0 -19
- package/fronds/scaffold/entities/Serve.ts +0 -8
- package/fronds/scaffold/entities/Sync.ts +0 -6
- package/fronds/scaffold/handlers/BuildFrondHandler.ts +0 -96
- package/fronds/scaffold/handlers/SyncHandler.ts +0 -376
- package/fronds/scaffold/services/ProjectWriter.ts +0 -339
- package/fronds/shims.d.ts +0 -9
- package/src/bin.ts +0 -77
- package/src/bridge.ts +0 -118
- package/src/completion.ts +0 -145
- package/src/index.ts +0 -1
- package/src/loader.ts +0 -28
- package/src/machine.ts +0 -17
- package/src/runner.ts +0 -152
- package/src/theme.ts +0 -19
- package/src/typescript/EntityTypes.ts +0 -92
- package/src/typescript/FacadeTypes.ts +0 -50
- package/src/typescript/syntax.ts +0 -11
- package/src/ui.ts +0 -142
- package/templates/flat/AGENTS.md +0 -14
- package/templates/flat/CLAUDE.md +0 -87
- package/templates/flat/_gitignore +0 -6
- package/templates/flat/app/app.vue +0 -25
- package/templates/flat/app/pages/index.vue +0 -7
- package/templates/flat/fougere.config.ts +0 -7
- package/templates/flat/nuxt.config.ts +0 -4
- package/templates/flat/package.json +0 -24
- package/templates/flat/pnpm-workspace.yaml +0 -6
- package/templates/flat/tsconfig.frond.json +0 -25
- package/templates/flat/tsconfig.json +0 -3
- /package/dist/{bin.d.ts → src/bin.d.ts} +0 -0
- /package/dist/{bridge.d.ts → src/bridge.d.ts} +0 -0
- /package/dist/{bridge.js → src/bridge.js} +0 -0
- /package/dist/{completion.d.ts → src/completion.d.ts} +0 -0
- /package/dist/{completion.js → src/completion.js} +0 -0
- /package/dist/{index.d.ts → src/index.d.ts} +0 -0
- /package/dist/{index.js → src/index.js} +0 -0
- /package/dist/{loader.d.ts → src/loader.d.ts} +0 -0
- /package/dist/{loader.js → src/loader.js} +0 -0
- /package/dist/{machine.d.ts → src/machine.d.ts} +0 -0
- /package/dist/{machine.js → src/machine.js} +0 -0
- /package/dist/{runner.d.ts → src/runner.d.ts} +0 -0
- /package/dist/{theme.d.ts → src/theme.d.ts} +0 -0
- /package/dist/{theme.js → src/theme.js} +0 -0
- /package/dist/{typescript → src/typescript}/EntityTypes.d.ts +0 -0
- /package/dist/{typescript → src/typescript}/EntityTypes.js +0 -0
- /package/dist/{typescript → src/typescript}/FacadeTypes.d.ts +0 -0
- /package/dist/{typescript → src/typescript}/FacadeTypes.js +0 -0
- /package/dist/{typescript → src/typescript}/syntax.d.ts +0 -0
- /package/dist/{typescript → src/typescript}/syntax.js +0 -0
|
@@ -1,183 +0,0 @@
|
|
|
1
|
-
import { mkdir, readFile, writeFile } from 'node:fs/promises';
|
|
2
|
-
import { join } from 'node:path';
|
|
3
|
-
import { Bundle, lowerFirst, type SchemaBundle, type SchemaView, type SetDiff } from '@fougere/schema';
|
|
4
|
-
import ProjectScan from '../services/ProjectScan.js';
|
|
5
|
-
import { VERSIONS, chainOf } from '../versions.js';
|
|
6
|
-
import type Freeze from '../entities/Freeze.js';
|
|
7
|
-
|
|
8
|
-
export interface FreezeInspection {
|
|
9
|
-
version: string;
|
|
10
|
-
/** The version this one follows, or absent when it is the first. */
|
|
11
|
-
previous?: string;
|
|
12
|
-
entities: string[];
|
|
13
|
-
/** What the step contains — absent when there is nothing before to step from. */
|
|
14
|
-
step?: SetDiff;
|
|
15
|
-
/** Per entity, the pairs the calculation refuses to decide. Empty means it was written. */
|
|
16
|
-
ambiguous: Record<string, { removed: string; added: string }[]>;
|
|
17
|
-
/** Whether anything reached the disk — false while a question stands. */
|
|
18
|
-
written: boolean;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
/**
|
|
22
|
-
* Freezing a version — the artefact three readers share.
|
|
23
|
-
*
|
|
24
|
-
* A snapshot alone loses the INTENT (a field gone plus a field appeared cannot be told
|
|
25
|
-
* from a rename), and a step alone corrupts in silence. Both are written, and replaying
|
|
26
|
-
* the step over the previous snapshot must reproduce this one — which is what catches a
|
|
27
|
-
* missing step or a hand-edited file.
|
|
28
|
-
*
|
|
29
|
-
* Nothing is written while an ambiguity stands: the only information the code does not
|
|
30
|
-
* hold is what the person who made the change meant, and this is the one place asking
|
|
31
|
-
* for it is justified.
|
|
32
|
-
*/
|
|
33
|
-
export default class FreezeHandler {
|
|
34
|
-
constructor(private projectScan: ProjectScan) {}
|
|
35
|
-
|
|
36
|
-
/**
|
|
37
|
-
* Record this version — or report what stops it, having written nothing.
|
|
38
|
-
*
|
|
39
|
-
* One op and not two: it is idempotent while it refuses, so a caller settles the
|
|
40
|
-
* ambiguities and calls again with `renamed`. Splitting it would let a caller write
|
|
41
|
-
* a version it never inspected.
|
|
42
|
-
*
|
|
43
|
-
* `json` is the presentation's, so it is not part of what this operation receives.
|
|
44
|
-
*/
|
|
45
|
-
async execute(input: Omit<Freeze, 'json'> & { renamed?: Record<string, Record<string, string>> }): Promise<FreezeInspection> {
|
|
46
|
-
const fronds = await this.read(input);
|
|
47
|
-
const version = input.version;
|
|
48
|
-
const entities = fronds.flatMap(({ bundle }) => Object.keys(bundle.$defs ?? {}));
|
|
49
|
-
// Two entrances, one map: what the entities declare, and what a caller answered.
|
|
50
|
-
// The answer wins — it is the later word on a question the declaration left open.
|
|
51
|
-
const renamed = settled(fronds.map(({ declared }) => declared), input.renamed ?? {});
|
|
52
|
-
|
|
53
|
-
// Every frond is inspected before ANY of them writes: a question standing in one
|
|
54
|
-
// frond must not leave the others recorded, or a second run cuts half a version.
|
|
55
|
-
const inspected = fronds.map(({ path, bundle, previous }) => ({
|
|
56
|
-
path,
|
|
57
|
-
bundle,
|
|
58
|
-
previous,
|
|
59
|
-
step: previous
|
|
60
|
-
? Bundle.fromDescriptor(previous.bundle).diff(Bundle.fromDescriptor(bundle), { renamed })
|
|
61
|
-
: undefined,
|
|
62
|
-
}));
|
|
63
|
-
|
|
64
|
-
const ambiguous: FreezeInspection['ambiguous'] = {};
|
|
65
|
-
for (const { step } of inspected) {
|
|
66
|
-
for (const [name, answer] of Object.entries(step?.entities ?? {})) {
|
|
67
|
-
if (answer.ambiguous.length > 0) ambiguous[name] = answer.ambiguous;
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
// Nothing on disk while a question stands. The only information the code does not
|
|
71
|
-
// hold is what the person who made the change meant.
|
|
72
|
-
if (Object.keys(ambiguous).length > 0) {
|
|
73
|
-
return { version, previous: previousName(inspected), entities, step: merge(inspected), ambiguous, written: false };
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
for (const { path, bundle, previous, step } of inspected) {
|
|
77
|
-
await this.record(path, version, bundle);
|
|
78
|
-
if (!previous || !step) continue;
|
|
79
|
-
// `previous` is recorded rather than re-derived: the chain is a fact of the moment
|
|
80
|
-
// this version was cut, and a later sort of directory names is not that fact.
|
|
81
|
-
await writeFile(
|
|
82
|
-
join(path, VERSIONS, version, 'from.json'),
|
|
83
|
-
`${JSON.stringify({ previous: previous.name, renamed, ...step }, null, 2)}\n`,
|
|
84
|
-
);
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
return { version, previous: previousName(inspected), entities, step: merge(inspected), ambiguous: {}, written: true };
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
private async record(root: string, version: string, bundle: SchemaBundle): Promise<void> {
|
|
91
|
-
const directory = join(root, VERSIONS, version);
|
|
92
|
-
await mkdir(directory, { recursive: true });
|
|
93
|
-
await writeFile(join(directory, 'shape.json'), `${JSON.stringify(bundle, null, 2)}\n`);
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
/**
|
|
97
|
-
* Today's shapes and the version before them, one entry per frond.
|
|
98
|
-
*
|
|
99
|
-
* `Fronds.schemas()` is deliberately flat — a fact heard in one frond is declared in
|
|
100
|
-
* another — so the per-frond map is built here, where the question IS per frond.
|
|
101
|
-
*/
|
|
102
|
-
private async read(input: Omit<Freeze, 'json'>) {
|
|
103
|
-
const scan = await this.projectScan.at(input.root ?? undefined);
|
|
104
|
-
|
|
105
|
-
return Promise.all(
|
|
106
|
-
scan.fronds
|
|
107
|
-
.filter((frond) => frond.entities.length > 0)
|
|
108
|
-
.map(async (frond) => ({
|
|
109
|
-
path: frond.source.path,
|
|
110
|
-
bundle: Bundle.fromSchemas(
|
|
111
|
-
Object.fromEntries(frond.entities.map((e) => [e.name, e.entityClass])),
|
|
112
|
-
).descriptor,
|
|
113
|
-
declared: declaredRenames(frond.entities),
|
|
114
|
-
previous: await previousOf(frond.source.path, input.version),
|
|
115
|
-
})),
|
|
116
|
-
);
|
|
117
|
-
}
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
type Inspected = { previous?: { name: string }; step?: SetDiff };
|
|
121
|
-
|
|
122
|
-
/**
|
|
123
|
-
* What the entities state about themselves — `previous` says what a field WAS, while
|
|
124
|
-
* `Bundle.diff` reads old to new, so the pair is turned around here and nowhere else.
|
|
125
|
-
*/
|
|
126
|
-
function declaredRenames(
|
|
127
|
-
entities: readonly { name: string; entityClass: unknown }[],
|
|
128
|
-
): Record<string, Record<string, string>> {
|
|
129
|
-
const out: Record<string, Record<string, string>> = {};
|
|
130
|
-
for (const { name, entityClass } of entities) {
|
|
131
|
-
const previous = (entityClass as SchemaView).previous;
|
|
132
|
-
// Keyed as `Bundle.fromSchemas` keys `$defs`, which is what `Bundle.diff` reads. Spelling the
|
|
133
|
-
// convention a second way here is the defect this repo has already recorded twice.
|
|
134
|
-
const key = lowerFirst(name);
|
|
135
|
-
if (previous) out[key] = Object.fromEntries(Object.entries(previous).map(([now, was]) => [was, now]));
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
return out;
|
|
139
|
-
}
|
|
140
|
-
|
|
141
|
-
/** Every source of an answer, folded per entity — later sources win field by field. */
|
|
142
|
-
function settled(
|
|
143
|
-
sources: readonly Record<string, Record<string, string>>[],
|
|
144
|
-
answers: Record<string, Record<string, string>>,
|
|
145
|
-
): Record<string, Record<string, string>> {
|
|
146
|
-
const out: Record<string, Record<string, string>> = {};
|
|
147
|
-
for (const source of [...sources, answers]) {
|
|
148
|
-
for (const [entity, pairs] of Object.entries(source)) out[entity] = { ...out[entity], ...pairs };
|
|
149
|
-
}
|
|
150
|
-
|
|
151
|
-
return out;
|
|
152
|
-
}
|
|
153
|
-
|
|
154
|
-
/** The version every frond steps from. They are cut together, so they agree. */
|
|
155
|
-
function previousName(inspected: readonly Inspected[]): string | undefined {
|
|
156
|
-
return inspected.find(({ previous }) => previous)?.previous?.name;
|
|
157
|
-
}
|
|
158
|
-
|
|
159
|
-
/**
|
|
160
|
-
* One report out of several fronds — entity names are unique across a scan, so the
|
|
161
|
-
* union loses nothing. Writing stays per frond; only the telling is gathered.
|
|
162
|
-
*/
|
|
163
|
-
function merge(inspected: readonly Inspected[]): SetDiff | undefined {
|
|
164
|
-
const steps = inspected.map(({ step }) => step).filter((step): step is SetDiff => Boolean(step));
|
|
165
|
-
if (steps.length === 0) return undefined;
|
|
166
|
-
|
|
167
|
-
return {
|
|
168
|
-
entities: Object.assign({}, ...steps.map((step) => step.entities)),
|
|
169
|
-
entitiesAdded: steps.flatMap((step) => step.entitiesAdded),
|
|
170
|
-
entitiesRemoved: steps.flatMap((step) => step.entitiesRemoved),
|
|
171
|
-
};
|
|
172
|
-
}
|
|
173
|
-
|
|
174
|
-
/** The version this one steps from: the tip of the chain, the links read rather than sorted. */
|
|
175
|
-
async function previousOf(root: string, version: string): Promise<{ name: string; bundle: SchemaBundle } | undefined> {
|
|
176
|
-
const chain = (await chainOf(root)).filter((cut) => cut.name !== version);
|
|
177
|
-
const last = chain.at(-1)?.name;
|
|
178
|
-
if (!last) return undefined;
|
|
179
|
-
|
|
180
|
-
const raw = await readFile(join(root, VERSIONS, last, 'shape.json'), 'utf8').catch(() => undefined);
|
|
181
|
-
|
|
182
|
-
return raw ? { name: last, bundle: JSON.parse(raw) as SchemaBundle } : undefined;
|
|
183
|
-
}
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
buildGraph, declaredTopologyOf, suggestSplit,
|
|
3
|
-
type DeclaredTopology, type EntityNode, type DomainCluster,
|
|
4
|
-
} from '@fougere/core';
|
|
5
|
-
import ProjectScan from '../services/ProjectScan.js';
|
|
6
|
-
import { remotesOf } from '@fougere/core/node';
|
|
7
|
-
|
|
8
|
-
export interface GraphResult {
|
|
9
|
-
/** How many fronds the scan found — the descriptors themselves hold classes, which no
|
|
10
|
-
* operation answers: a reader outside this process would receive the husk JSON makes of them. */
|
|
11
|
-
totalFronds: number;
|
|
12
|
-
/** Where the fronds run and which reaches which — the same picture, one altitude up. */
|
|
13
|
-
declared: DeclaredTopology;
|
|
14
|
-
nodes: Record<string, EntityNode>;
|
|
15
|
-
clusters: DomainCluster[];
|
|
16
|
-
totalEntities: number;
|
|
17
|
-
totalRefs: number;
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
export default class GraphHandler {
|
|
21
|
-
constructor(private projectScan: ProjectScan) {}
|
|
22
|
-
|
|
23
|
-
/** Report how a workspace's fronds and entities reference each other. */
|
|
24
|
-
async execute(input: { root?: string; minEntities?: number }): Promise<GraphResult> {
|
|
25
|
-
const { fronds, config } = await this.projectScan.at(input.root);
|
|
26
|
-
const nodes = buildGraph(fronds);
|
|
27
|
-
const clusters = suggestSplit(nodes);
|
|
28
|
-
|
|
29
|
-
return {
|
|
30
|
-
totalFronds: fronds.length,
|
|
31
|
-
declared: declaredTopologyOf({ fronds, remotes: remotesOf(config) }),
|
|
32
|
-
nodes: Object.fromEntries(nodes),
|
|
33
|
-
clusters,
|
|
34
|
-
totalEntities: nodes.size,
|
|
35
|
-
totalRefs: [...nodes.values()].reduce((sum, n) => sum + n.refs.length, 0),
|
|
36
|
-
};
|
|
37
|
-
}
|
|
38
|
-
}
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
import { loadScript, reachableOps } from '@fougere/testing/load';
|
|
2
|
-
import { writeFile } from 'node:fs/promises';
|
|
3
|
-
import { join } from 'node:path';
|
|
4
|
-
import ProjectScan from '../services/ProjectScan.js';
|
|
5
|
-
import { remotesOf } from '@fougere/core/node';
|
|
6
|
-
|
|
7
|
-
export interface LoadScenario {
|
|
8
|
-
/** Where it was written, or `null` when it was only printed. */
|
|
9
|
-
file: string | null;
|
|
10
|
-
facade: string;
|
|
11
|
-
/** Every operation the scenario calls, in the order it lists them. */
|
|
12
|
-
operations: string[];
|
|
13
|
-
script: string;
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
/**
|
|
17
|
-
* A load scenario, written from what the project serves.
|
|
18
|
-
*
|
|
19
|
-
* Read from the SCAN rather than a boot: an app that boots runs its migrations and plants its
|
|
20
|
-
* seeds, and a command that describes a project has no business writing to its database.
|
|
21
|
-
*/
|
|
22
|
-
export default class LoadHandler {
|
|
23
|
-
constructor(private projectScan: ProjectScan) {}
|
|
24
|
-
|
|
25
|
-
/** Generate a k6 scenario covering every operation the default facade answers. */
|
|
26
|
-
async execute(input: { root?: string; facade?: string; out?: string }): Promise<LoadScenario> {
|
|
27
|
-
const { root, fronds, config } = await this.projectScan.at(input.root);
|
|
28
|
-
const facade = input.facade?.trim() || undefined;
|
|
29
|
-
// The topology statement travels with it: an op that crosses a process is not held to the
|
|
30
|
-
// same figure as one that never leaves, and `remotes:` is what says which is which.
|
|
31
|
-
const remotes = remotesOf(config);
|
|
32
|
-
const script = loadScript({ fronds }, { ...(facade ? { facade } : {}), remotes });
|
|
33
|
-
|
|
34
|
-
const file = input.out === undefined ? join(root, 'load.js') : input.out || null;
|
|
35
|
-
if (file) await writeFile(file, script, 'utf8');
|
|
36
|
-
|
|
37
|
-
return {
|
|
38
|
-
file,
|
|
39
|
-
facade: facade ?? 'http://127.0.0.1:3000/_fougere/call',
|
|
40
|
-
operations: reachableOps({ fronds }, {}, remotes).map((one) => one.method),
|
|
41
|
-
script,
|
|
42
|
-
};
|
|
43
|
-
}
|
|
44
|
-
}
|
|
@@ -1,110 +0,0 @@
|
|
|
1
|
-
import { loadConfig } from '@fougere/core/node';
|
|
2
|
-
import { resolveStorage } from '@fougere/defaults';
|
|
3
|
-
import type { Plan, StepChange } from '@fougere/adapter-sql';
|
|
4
|
-
import type { SetDiff } from '@fougere/schema';
|
|
5
|
-
import ProjectScan from '../services/ProjectScan.js';
|
|
6
|
-
import { chainOf } from '../versions.js';
|
|
7
|
-
import type Migrate from '../entities/Migrate.js';
|
|
8
|
-
|
|
9
|
-
export interface MigrationPlan {
|
|
10
|
-
/** Versions whose step was read, oldest first. */
|
|
11
|
-
chain: string[];
|
|
12
|
-
changes: StepChange[];
|
|
13
|
-
refusals: Plan['refusals'];
|
|
14
|
-
/** The statements actually run — empty unless `apply` was asked for. */
|
|
15
|
-
ran: string[];
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
/**
|
|
19
|
-
* Catching the database up with the frozen chain.
|
|
20
|
-
*
|
|
21
|
-
* Every step is replayed in order and what has already happened is SKIPPED, read off the
|
|
22
|
-
* columns themselves rather than a ledger of applied migrations. That is what makes the
|
|
23
|
-
* chain safe to replay whole: nothing here has to know which version the database sits
|
|
24
|
-
* at, and a column renamed by hand is seen rather than contradicted.
|
|
25
|
-
*
|
|
26
|
-
* The additive pass is not repeated here — a boot already creates missing tables and
|
|
27
|
-
* columns. What this adds is the half that touches live data, and only what a human
|
|
28
|
-
* declared at `fougere freeze`.
|
|
29
|
-
*/
|
|
30
|
-
export default class MigrateHandler {
|
|
31
|
-
constructor(private projectScan: ProjectScan) {}
|
|
32
|
-
|
|
33
|
-
/**
|
|
34
|
-
* Realise the frozen steps this database has not caught up with.
|
|
35
|
-
*
|
|
36
|
-
* `json` is the presentation's, so it is not part of what this operation receives.
|
|
37
|
-
*/
|
|
38
|
-
async execute(input: Omit<Migrate, 'json'>): Promise<MigrationPlan> {
|
|
39
|
-
const scan = await this.projectScan.at(input.root ?? undefined);
|
|
40
|
-
const perFrond = await Promise.all(scan.fronds.map((frond) => stepsOf(frond.source.path)));
|
|
41
|
-
const steps = perFrond.flat();
|
|
42
|
-
if (steps.length === 0) return { chain: [], changes: [], refusals: [], ran: [] };
|
|
43
|
-
|
|
44
|
-
const config = await loadConfig(scan.root);
|
|
45
|
-
// `fougere migrate --root ../app` read that project's config and planned against a
|
|
46
|
-
// database beside the CLI's own directory — the loudest form of this bug.
|
|
47
|
-
const storage = resolveStorage(config.db ?? {}, undefined, scan.root);
|
|
48
|
-
if (!storage.db) {
|
|
49
|
-
return {
|
|
50
|
-
chain: versionsOf(steps),
|
|
51
|
-
changes: [],
|
|
52
|
-
refusals: [{ entity: '*', field: '*', reason: 'no `db` in fougere.config.ts — nothing to migrate' }],
|
|
53
|
-
ran: [],
|
|
54
|
-
};
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
// Resolved from the project rather than named in this package's dependencies:
|
|
58
|
-
// `@fougere/adapter-sql` declares `better-sqlite3`, so a CLI depending on it installs
|
|
59
|
-
// 26 MB of native module into every `npm create fougere`. A project that migrates
|
|
60
|
-
// declares the adapter itself, which is where this resolves from.
|
|
61
|
-
const { actualState, desiredTables, planStep, collapseChain, applyStep } = await import('@fougere/adapter-sql');
|
|
62
|
-
|
|
63
|
-
const tables = desiredTables(scan as never);
|
|
64
|
-
// Each frond's chain is composed on its own — its versions are its own line — and the
|
|
65
|
-
// results are gathered by SOURCE, because an engine is what a statement runs against.
|
|
66
|
-
const composed = collapseChain(perFrond.map((chain) => collapseChain(chain.map(({ step }) => step))));
|
|
67
|
-
const sourceOf = storage.sourceOf ?? (() => 'db');
|
|
68
|
-
|
|
69
|
-
const changes: StepChange[] = [];
|
|
70
|
-
const refusals: Plan['refusals'] = [];
|
|
71
|
-
const ran: string[] = [];
|
|
72
|
-
for (const source of storage.sources?.() ?? ['db']) {
|
|
73
|
-
const db = (source === 'db' ? storage.db : storage.dbOf?.(source)) as Parameters<typeof actualState>[0];
|
|
74
|
-
if (!db) continue;
|
|
75
|
-
|
|
76
|
-
const mine = onSource(composed, source, sourceOf);
|
|
77
|
-
if (Object.keys(mine.entities).length === 0) continue;
|
|
78
|
-
|
|
79
|
-
const plan = planStep(mine, tables, { actual: await actualState(db) });
|
|
80
|
-
changes.push(...plan.changes);
|
|
81
|
-
refusals.push(...plan.refusals);
|
|
82
|
-
// Held back: a refusal anywhere stops every engine, for the reason it stops every
|
|
83
|
-
// statement — half a chain is worse across two engines than within one.
|
|
84
|
-
if (input.apply && refusals.length === 0) ran.push(...(await applyStep(plan, db)));
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
return { chain: versionsOf(steps), changes, refusals, ran: refusals.length > 0 ? [] : ran };
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
/** The versions read, oldest first and each named once however many fronds cut it. */
|
|
92
|
-
function versionsOf(steps: readonly { version: string }[]): string[] {
|
|
93
|
-
return [...new Set(steps.map(({ version }) => version))].sort((a, b) => a.localeCompare(b, 'en', { numeric: true }));
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
/** The part of a step whose entities live on one engine. */
|
|
97
|
-
function onSource(step: SetDiff, source: string, sourceOf: (entity: string) => string): SetDiff {
|
|
98
|
-
return {
|
|
99
|
-
...step,
|
|
100
|
-
entities: Object.fromEntries(Object.entries(step.entities).filter(([entity]) => sourceOf(entity) === source)),
|
|
101
|
-
};
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
/** Every recorded step, oldest first — the chain composes, so it is replayed whole. */
|
|
105
|
-
async function stepsOf(frondPath: string): Promise<{ version: string; step: SetDiff }[]> {
|
|
106
|
-
const chain = await chainOf(frondPath);
|
|
107
|
-
|
|
108
|
-
// The first version has a shape and no step — there was nothing before it to move from.
|
|
109
|
-
return chain.flatMap(({ name, step }) => (step ? [{ version: name, step }] : []));
|
|
110
|
-
}
|
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
import { type FougereConfig, type ScanResult } from '@fougere/core';
|
|
2
|
-
import { scanProject, frondAliases } from '@fougere/compiler';
|
|
3
|
-
import { nested, resolveConventions } from '@fougere/core';
|
|
4
|
-
import { setModuleLoader, loadConfig } from '@fougere/core/node';
|
|
5
|
-
import { resolve } from 'node:path';
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* Read a target project without booting it — what every analysis command needs first.
|
|
9
|
-
*
|
|
10
|
-
* `graph` and `check` had the same five lines each: resolve the root against the
|
|
11
|
-
* CLI's cwd, install a jiti loader so the scan can import TypeScript sources, scan.
|
|
12
|
-
* Two copies of one gesture, and the second was written by copying the first.
|
|
13
|
-
*
|
|
14
|
-
* Not a boot: `bootApp` runs migrations and seeds, so an analysis command
|
|
15
|
-
* that booted would write to the target's database. The cost is stated rather than
|
|
16
|
-
* hidden, though — the scan IMPORTS the modules it reads, so a frond's top-level
|
|
17
|
-
* code runs. "No application cycle, no database", not "no side effect".
|
|
18
|
-
*/
|
|
19
|
-
export default class ProjectScan {
|
|
20
|
-
// cwd is ambient in a CLI — not a DI service (the container resolves by type).
|
|
21
|
-
private cwd = process.cwd();
|
|
22
|
-
|
|
23
|
-
/** Scan the project at `root`, relative to where the command was invoked. */
|
|
24
|
-
async at(root?: string): Promise<ScanResult & { root: string; config: FougereConfig }> {
|
|
25
|
-
const target = resolve(this.cwd, root || '.');
|
|
26
|
-
|
|
27
|
-
// The scan reads `.ts` sources; the default loader is a plain `import`, which
|
|
28
|
-
// cannot. Installed once per call because the loader is module-global — the
|
|
29
|
-
// CLI's own app was loaded with its own, and this replaces it for the target.
|
|
30
|
-
const { createJiti } = await import('jiti');
|
|
31
|
-
const install = (alias?: Record<string, string>): void => {
|
|
32
|
-
const jiti = createJiti(import.meta.url, { interopDefault: true, ...(alias ? { alias } : {}) });
|
|
33
|
-
setModuleLoader((filePath) => jiti.import(filePath) as Promise<Record<string, unknown>>);
|
|
34
|
-
};
|
|
35
|
-
|
|
36
|
-
/**
|
|
37
|
-
* The config is read BEFORE the aliases, because it names the scope they are built
|
|
38
|
-
* from. Safe because nothing in `fougere.config.ts` may import `@fronds/*` — the one
|
|
39
|
-
* import that would need the name to read the file that declares it.
|
|
40
|
-
*/
|
|
41
|
-
install();
|
|
42
|
-
const config = await loadConfig(target);
|
|
43
|
-
const conventions = resolveConventions(config.conventions);
|
|
44
|
-
|
|
45
|
-
// The scope is the framework's own convention; the loader has to know it, or a frond
|
|
46
|
-
// naming its neighbour is unreadable to the very tool that checks it.
|
|
47
|
-
install(await frondAliases(target, conventions));
|
|
48
|
-
|
|
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) };
|
|
54
|
-
}
|
|
55
|
-
}
|
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
import { readFile, readdir } from 'node:fs/promises';
|
|
2
|
-
import { join } from 'node:path';
|
|
3
|
-
import type { SetDiff } from '@fougere/schema';
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* Where a FROND keeps what its shapes used to be — beside `entities/`, not under a dot.
|
|
7
|
-
* Written by `fougere freeze`, replayed by `fougere migrate`.
|
|
8
|
-
*/
|
|
9
|
-
export const VERSIONS = 'versions';
|
|
10
|
-
|
|
11
|
-
/** One cut version: its name, and the step that reached it — absent on the first. */
|
|
12
|
-
export interface Version {
|
|
13
|
-
name: string;
|
|
14
|
-
step?: SetDiff & { previous?: string };
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
/**
|
|
18
|
-
* The versions a frond has cut, oldest first — read by FOLLOWING each step's `previous`.
|
|
19
|
-
*
|
|
20
|
-
* That link is the fact recorded the day the version was cut. Sorting directory names is
|
|
21
|
-
* a guess about the same fact, and a hotfix cut after a later version orders it wrong.
|
|
22
|
-
*/
|
|
23
|
-
export async function chainOf(frondPath: string): Promise<Version[]> {
|
|
24
|
-
const directory = join(frondPath, VERSIONS);
|
|
25
|
-
const found = await readdir(directory, { withFileTypes: true }).catch(() => []);
|
|
26
|
-
const names = found.filter((entry) => entry.isDirectory()).map((entry) => entry.name);
|
|
27
|
-
if (names.length === 0) return [];
|
|
28
|
-
|
|
29
|
-
const steps = new Map<string, Version['step']>();
|
|
30
|
-
for (const name of names) {
|
|
31
|
-
const raw = await readFile(join(directory, name, 'from.json'), 'utf8').catch(() => undefined);
|
|
32
|
-
steps.set(name, raw ? (JSON.parse(raw) as Version['step']) : undefined);
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
const roots = names.filter((name) => steps.get(name)?.previous === undefined);
|
|
36
|
-
if (roots.length !== 1) {
|
|
37
|
-
const said = roots.length === 0 ? 'none starts it' : `${roots.join(', ')} each start one`;
|
|
38
|
-
throw new Error(`${directory}: a frond's versions are ONE line and ${said}.`);
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
const next = new Map<string, string>();
|
|
42
|
-
for (const [name, step] of steps) if (step?.previous !== undefined) next.set(step.previous, name);
|
|
43
|
-
|
|
44
|
-
const chain: Version[] = [];
|
|
45
|
-
const seen = new Set<string>();
|
|
46
|
-
for (let at: string | undefined = roots[0]; at !== undefined && !seen.has(at); at = next.get(at)) {
|
|
47
|
-
seen.add(at);
|
|
48
|
-
chain.push({ name: at, step: steps.get(at) });
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
// One check for every way the links fail to be a line: a fork (two versions claiming
|
|
52
|
-
// the same `previous`), a cycle, or a step naming a version that is not there.
|
|
53
|
-
const adrift = names.filter((name) => !seen.has(name));
|
|
54
|
-
if (adrift.length > 0) {
|
|
55
|
-
throw new Error(`${directory}: ${adrift.join(', ')} follow no version in the chain that starts at ${roots[0]}.`);
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
return chain;
|
|
59
|
-
}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { entity, text, bool } from "@fougere/schema";
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* `fougere new [name]` — the workspace composer.
|
|
5
|
-
*
|
|
6
|
-
* Guided when it has a TTY and nothing to compose from; stated when `--frond` or
|
|
7
|
-
* `--app` is given, which is the only form a script, a CI job or an agent can drive.
|
|
8
|
-
* `--bare` is the third: the empty shell, nothing composed. `--flat` is the fourth, and
|
|
9
|
-
* it selects a SHAPE rather than a composition: one app that is its own domain.
|
|
10
|
-
*/
|
|
11
|
-
export default class New extends entity({
|
|
12
|
-
name: text({ description: "Workspace name" }),
|
|
13
|
-
force: bool({ description: "Overwrite existing directory", default: false }),
|
|
14
|
-
bare: bool({ description: "Skip the guided flow — just the empty shell", default: false }),
|
|
15
|
-
flat: bool({ description: "One domain: no fronds/ — the app root is the frond", default: false }),
|
|
16
|
-
local: bool({ description: "Link @fougere/* to this monorepo (dev — installs offline)", default: false }),
|
|
17
|
-
frond: text({ description: "Fronds to add, no prompt — 'blog' or 'blog:shop', comma-separated", default: "" }),
|
|
18
|
-
app: text({ description: "Apps to add, no prompt — 'nuxt' or 'nuxt:web', comma-separated", default: "" }),
|
|
19
|
-
}) {}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { entity, text, number, bool, optional } from "@fougere/schema";
|
|
2
|
-
|
|
3
|
-
/** `fougere serve <frond>` — run one frond alone in its own process (JSON-RPC over HTTP). */
|
|
4
|
-
export default class Serve extends entity({
|
|
5
|
-
frond: text({ min: 1, description: "Frond to host in its own process" }),
|
|
6
|
-
port: optional(number({ description: "Port to listen on (default 4100)" })),
|
|
7
|
-
watch: optional(bool({ description: "Rebuild the app when the frond changes" })),
|
|
8
|
-
}) {}
|
|
@@ -1,96 +0,0 @@
|
|
|
1
|
-
import { execSync } from 'node:child_process';
|
|
2
|
-
import { existsSync, writeFileSync, readFileSync, readdirSync, unlinkSync } from 'node:fs';
|
|
3
|
-
import { join, basename } from 'node:path';
|
|
4
|
-
import { resolveConventions, frondPackage } from '@fougere/core';
|
|
5
|
-
import { loadConfig } from '@fougere/core/node';
|
|
6
|
-
|
|
7
|
-
export default class BuildFrondHandler {
|
|
8
|
-
// cwd is ambient in a CLI — not a DI service (the container resolves by type).
|
|
9
|
-
private cwd = process.cwd();
|
|
10
|
-
|
|
11
|
-
/** Build a frond into a standalone deployable package. */
|
|
12
|
-
async execute(input: { frond: string }): Promise<{ path: string; entities: string[] }> {
|
|
13
|
-
const conventions = resolveConventions((await loadConfig(this.cwd)).conventions);
|
|
14
|
-
const frondDir = join(this.cwd, conventions.fronds, input.frond);
|
|
15
|
-
|
|
16
|
-
if (!existsSync(frondDir)) {
|
|
17
|
-
throw new Error(`Frond '${input.frond}' not found at ${frondDir}`);
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
const entitiesDir = join(frondDir, conventions.dirs.entities);
|
|
21
|
-
if (!existsSync(entitiesDir)) {
|
|
22
|
-
throw new Error(`No ${conventions.dirs.entities}/ directory in frond '${input.frond}'`);
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
// Discover entity files
|
|
26
|
-
const entityFiles = readdirSync(entitiesDir)
|
|
27
|
-
.filter((f) => f.endsWith('.ts') && !f.endsWith('.d.ts'))
|
|
28
|
-
.sort();
|
|
29
|
-
|
|
30
|
-
if (entityFiles.length === 0) {
|
|
31
|
-
throw new Error(`No .ts files in ${entitiesDir}`);
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
const entityNames = entityFiles.map((f) => basename(f, '.ts'));
|
|
35
|
-
|
|
36
|
-
// Generate barrel index.ts
|
|
37
|
-
const indexLines = entityNames.map(
|
|
38
|
-
(name) => `export { default as ${name} } from './${conventions.dirs.entities}/${name}.js';`,
|
|
39
|
-
);
|
|
40
|
-
writeFileSync(join(frondDir, 'index.ts'), indexLines.join('\n') + '\n');
|
|
41
|
-
|
|
42
|
-
// Generate tsconfig.build.json
|
|
43
|
-
const tsconfig = {
|
|
44
|
-
compilerOptions: {
|
|
45
|
-
target: 'ES2022',
|
|
46
|
-
module: 'Node16',
|
|
47
|
-
moduleResolution: 'Node16',
|
|
48
|
-
declaration: true,
|
|
49
|
-
outDir: './dist',
|
|
50
|
-
rootDir: '.',
|
|
51
|
-
strict: true,
|
|
52
|
-
esModuleInterop: true,
|
|
53
|
-
skipLibCheck: true,
|
|
54
|
-
},
|
|
55
|
-
include: ['index.ts', `${conventions.dirs.entities}/**/*.ts`],
|
|
56
|
-
};
|
|
57
|
-
|
|
58
|
-
const tsconfigPath = join(frondDir, 'tsconfig.build.json');
|
|
59
|
-
writeFileSync(tsconfigPath, JSON.stringify(tsconfig, null, 2));
|
|
60
|
-
|
|
61
|
-
try {
|
|
62
|
-
execSync('npx tsc -p tsconfig.build.json', { cwd: frondDir, stdio: 'inherit' });
|
|
63
|
-
} finally {
|
|
64
|
-
try { unlinkSync(tsconfigPath); } catch { /* ignore */ }
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
// Update package.json
|
|
68
|
-
const pkgPath = join(frondDir, 'package.json');
|
|
69
|
-
const pkg = existsSync(pkgPath)
|
|
70
|
-
? JSON.parse(readFileSync(pkgPath, 'utf-8'))
|
|
71
|
-
: { name: frondPackage(input.frond, conventions), version: '0.0.1', type: 'module' };
|
|
72
|
-
|
|
73
|
-
pkg.exports = {
|
|
74
|
-
'.': {
|
|
75
|
-
types: './dist/index.d.ts',
|
|
76
|
-
default: './dist/index.js',
|
|
77
|
-
},
|
|
78
|
-
[`./${conventions.dirs.entities}/*`]: {
|
|
79
|
-
types: `./dist/${conventions.dirs.entities}/*.d.ts`,
|
|
80
|
-
default: `./dist/${conventions.dirs.entities}/*.js`,
|
|
81
|
-
},
|
|
82
|
-
'./package.json': './package.json',
|
|
83
|
-
};
|
|
84
|
-
|
|
85
|
-
// Only publish dist + package.json
|
|
86
|
-
pkg.files = ['dist', 'package.json'];
|
|
87
|
-
|
|
88
|
-
// Ensure peerDependencies on @fougere/schema
|
|
89
|
-
pkg.peerDependencies ??= {};
|
|
90
|
-
pkg.peerDependencies['@fougere/schema'] ??= '*';
|
|
91
|
-
|
|
92
|
-
writeFileSync(pkgPath, JSON.stringify(pkg, null, 2) + '\n');
|
|
93
|
-
|
|
94
|
-
return { path: join(frondDir, 'dist'), entities: entityNames };
|
|
95
|
-
}
|
|
96
|
-
}
|