@fougere/cli 0.8.3-alpha.0 → 0.9.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/app/commands/CallCommand.ts +2 -2
- package/app/commands/ServeCommand.ts +5 -5
- package/dist/bin.js +3 -1
- package/dist/bin.js.map +1 -1
- package/dist/bridge.d.ts.map +1 -1
- package/dist/bridge.js +20 -7
- package/dist/bridge.js.map +1 -1
- package/dist/index.d.ts +0 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +0 -2
- package/dist/index.js.map +1 -1
- package/dist/loader.d.ts +1 -1
- package/dist/loader.d.ts.map +1 -1
- package/dist/loader.js +3 -1
- package/dist/loader.js.map +1 -1
- package/fronds/analysis/handlers/BuildHandler.ts +1 -1
- package/fronds/analysis/handlers/CheckHandler.ts +2 -3
- package/fronds/analysis/services/ProjectScan.ts +4 -4
- package/fronds/scaffold/handlers/BuildFrondHandler.ts +2 -1
- package/fronds/scaffold/handlers/SyncHandler.ts +2 -3
- package/fronds/scaffold/services/ProjectWriter.ts +1 -1
- package/package.json +8 -7
- package/src/bin.ts +3 -1
- package/src/bridge.ts +23 -9
- package/src/index.ts +0 -2
- package/src/loader.ts +4 -4
- package/templates/frond/package.json +2 -1
- package/templates/frond/serve.mjs +2 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { createAppRunner } from '@fougere/core';
|
|
2
2
|
import { lowerFirst } from '@fougere/core/contract';
|
|
3
|
-
import {
|
|
3
|
+
import { bootApp } from '@fougere/defaults';
|
|
4
4
|
import type { App } from '@fougere/core';
|
|
5
5
|
import type { ui as createUi } from '../../src/ui.js';
|
|
6
6
|
|
|
@@ -54,7 +54,7 @@ export default class CallCommand {
|
|
|
54
54
|
else input[k] = v;
|
|
55
55
|
}
|
|
56
56
|
|
|
57
|
-
const app = await
|
|
57
|
+
const app = await bootApp(process.cwd(), {});
|
|
58
58
|
try {
|
|
59
59
|
const result = await createAppRunner(app)(
|
|
60
60
|
{ entity: lowerFirst(entityName), op },
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { createLocalRunner, identityFromEnv } from '@fougere/core';
|
|
2
|
-
import { watchPathsOf } from '@fougere/
|
|
2
|
+
import { watchPathsOf } from '@fougere/compiler';
|
|
3
3
|
import { installLoader } from '../../src/loader.js';
|
|
4
|
-
import type { Conventions } from '@fougere/core
|
|
5
|
-
import {
|
|
4
|
+
import type { Conventions } from '@fougere/core';
|
|
5
|
+
import { bootApp } from '@fougere/defaults';
|
|
6
6
|
import { serve } from '@fougere/transport-http';
|
|
7
7
|
import { watch } from 'node:fs';
|
|
8
8
|
import type { App, Transport } from '@fougere/core';
|
|
@@ -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
|
|
39
|
+
let hosted = await bootApp(root, { fronds: [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
|
|
67
|
+
next = await bootApp(root, { fronds: [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.
|
package/dist/bin.js
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
/** fougere CLI — a Fougere app powered by citty. */
|
|
3
3
|
import { createApp, setLogLevel, envLevel } from '@fougere/core';
|
|
4
|
-
import { scanProject
|
|
4
|
+
import { scanProject } from '@fougere/compiler';
|
|
5
|
+
import { frondDirsOf, DEFAULT_CONVENTIONS } from '@fougere/core';
|
|
6
|
+
import { getModuleLoader } from '@fougere/core/node';
|
|
5
7
|
import { readdir, stat } from 'node:fs/promises';
|
|
6
8
|
import { join } from 'node:path';
|
|
7
9
|
import { createContainer } from '@fougere/container';
|
package/dist/bin.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bin.js","sourceRoot":"","sources":["../src/bin.ts"],"names":[],"mappings":";AACA,oDAAoD;AACpD,OAAO,EAAE,SAAS,EAAE,WAAW,EAAE,QAAQ,EAAmB,MAAM,eAAe,CAAC;AAClF,OAAO,EAAE,WAAW,EAAE,
|
|
1
|
+
{"version":3,"file":"bin.js","sourceRoot":"","sources":["../src/bin.ts"],"names":[],"mappings":";AACA,oDAAoD;AACpD,OAAO,EAAE,SAAS,EAAE,WAAW,EAAE,QAAQ,EAAmB,MAAM,eAAe,CAAC;AAClF,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,WAAW,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAC;AACjE,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AACrD,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AACrD,OAAO,EAAE,EAAE,EAAE,MAAM,SAAS,CAAC;AAC7B,OAAO,EAAE,GAAG,EAAE,MAAM,aAAa,CAAC;AAClC,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAE5C,MAAM,aAAa,CAAC,OAAO,CAAC,GAAG,EAAE,CAAC,CAAC;AAEnC,MAAM,OAAO,GAAG,IAAI,GAAG,CAAC,IAAI,EAAE,OAAO,IAAI,CAAC,GAAG,CAAC,CAAC,QAAQ,CAAC;AACxD,MAAM,SAAS,GAAG,eAAe,EAAE,CAAC;AACpC,MAAM,QAAQ,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,CAAC,QAAQ,CAAC,OAAO,CAAC,gBAAgB,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;IACnF,MAAM,IAAI,GAAG,MAAM,WAAW,CAAC,IAAI,CAAC,CAAC;IACrC,IAAI,EAAE,IAAI,CAAC,GAAG,IAAI,CAAC,MAAM,CAAC,MAAM,WAAW,CAAC,CAAC;IAC7C,OAAO,IAAI,CAAC;AACd,CAAC;AAED,MAAM,IAAI,GAAG,MAAM,MAAM,CAAC,OAAO,CAAC,CAAC;AAEnC,MAAM,GAAG,GAAG,MAAM,SAAS,CAAC,EAAE,IAAI,EAAE,eAAe,EAAE,GAAG,EAAE,CAAC,SAAS,EAAE,CAAC,CAAC;AAExE,SAAS,CAAC,aAAa,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC;AAEpC,MAAM,GAAG,CAAC,GAAG,CAAC,CAAC"}
|
package/dist/bridge.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bridge.d.ts","sourceRoot":"","sources":["../src/bridge.ts"],"names":[],"mappings":"AACA,6BAA6B;AAC7B,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AAE9C,OAAO,KAAK,EAAE,OAAO,EAAU,MAAM,OAAO,CAAC;AAM7C,6DAA6D;AAC7D,wBAAgB,YAAY,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,
|
|
1
|
+
{"version":3,"file":"bridge.d.ts","sourceRoot":"","sources":["../src/bridge.ts"],"names":[],"mappings":"AACA,6BAA6B;AAC7B,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AAE9C,OAAO,KAAK,EAAE,OAAO,EAAU,MAAM,OAAO,CAAC;AAM7C,6DAA6D;AAC7D,wBAAgB,YAAY,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CA4CpD"}
|
package/dist/bridge.js
CHANGED
|
@@ -10,11 +10,12 @@ export function entityToArgs(fields) {
|
|
|
10
10
|
// Axes-derived ingress membership; the CLI additionally skips ALL relations
|
|
11
11
|
// (a ref is not a flag — supplying related rows is not a CLI gesture).
|
|
12
12
|
for (const [key, field] of Object.entries(Visibility.of(fields).input)) {
|
|
13
|
-
if (Role.of(field).
|
|
13
|
+
if (Role.of(field).isRelation)
|
|
14
14
|
continue;
|
|
15
15
|
// A `default(v)` travels as the create rule `{ value }` — citty shows it.
|
|
16
16
|
const defaultValue = Lifecycle.of(field).literal?.value;
|
|
17
17
|
const { base: shape, nullable } = Shapes.of(field.shape);
|
|
18
|
+
const type = Shapes.typeOf(field.shape);
|
|
18
19
|
const common = {
|
|
19
20
|
description: field.meta?.description,
|
|
20
21
|
required: !nullable && Lifecycle.of(field).requiredAtCreate,
|
|
@@ -31,14 +32,28 @@ export function entityToArgs(fields) {
|
|
|
31
32
|
&& common.required
|
|
32
33
|
&& key !== 'force'
|
|
33
34
|
&& options === undefined
|
|
34
|
-
&&
|
|
35
|
-
&&
|
|
35
|
+
&& type !== 'boolean'
|
|
36
|
+
&& type !== 'date';
|
|
36
37
|
if (positional)
|
|
37
38
|
positionalIndex++;
|
|
38
|
-
args[toKebab(key) === key ? key : toKebab(key)] = argFor(
|
|
39
|
+
args[toKebab(key) === key ? key : toKebab(key)] = argFor(type, common, defaultValue, options, positional);
|
|
39
40
|
}
|
|
40
41
|
return args;
|
|
41
42
|
}
|
|
43
|
+
/**
|
|
44
|
+
* Which types carry a declared default onto the CLI. A `boolean` is answered above, with
|
|
45
|
+
* its own default; an `object` and an `array` are named and bare.
|
|
46
|
+
*/
|
|
47
|
+
const CARRIES_DEFAULT = {
|
|
48
|
+
number: true,
|
|
49
|
+
integer: true,
|
|
50
|
+
text: true,
|
|
51
|
+
date: true,
|
|
52
|
+
choice: true,
|
|
53
|
+
boolean: false,
|
|
54
|
+
object: false,
|
|
55
|
+
array: false,
|
|
56
|
+
};
|
|
42
57
|
/** One arg, built WITH its `type`. */
|
|
43
58
|
function argFor(type, common, defaultValue, options, positional) {
|
|
44
59
|
if (type === 'boolean') {
|
|
@@ -46,9 +61,7 @@ function argFor(type, common, defaultValue, options, positional) {
|
|
|
46
61
|
? { ...common, type: 'boolean' }
|
|
47
62
|
: { ...common, type: 'boolean', default: defaultValue };
|
|
48
63
|
}
|
|
49
|
-
|
|
50
|
-
const carriesDefault = type === 'number' || type === 'integer' || type === 'string';
|
|
51
|
-
const withDefault = carriesDefault && defaultValue !== undefined
|
|
64
|
+
const withDefault = type && CARRIES_DEFAULT[type] && defaultValue !== undefined
|
|
52
65
|
? { default: String(defaultValue) }
|
|
53
66
|
: {};
|
|
54
67
|
if (options)
|
package/dist/bridge.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bridge.js","sourceRoot":"","sources":["../src/bridge.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAC;AAGlD,OAAO,EAAE,MAAM,EAAE,UAAU,
|
|
1
|
+
{"version":3,"file":"bridge.js","sourceRoot":"","sources":["../src/bridge.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAC;AAGlD,OAAO,EAAE,MAAM,EAAE,UAAU,EAAkB,MAAM,iBAAiB,CAAC;AAGrE,SAAS,OAAO,CAAC,IAAY;IAC3B,OAAO,IAAI,CAAC,OAAO,CAAC,QAAQ,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,GAAG,GAAG,CAAC,CAAC,WAAW,EAAE,CAAC,CAAC;AAC9D,CAAC;AAED,6DAA6D;AAC7D,MAAM,UAAU,YAAY,CAAC,MAAc;IACzC,MAAM,IAAI,GAAY,EAAE,CAAC;IACzB,IAAI,eAAe,GAAG,CAAC,CAAC;IAExB,4EAA4E;IAC5E,uEAAuE;IACvE,KAAK,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,UAAU,CAAC,EAAE,CAAC,MAAM,CAAC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map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,aAAa,CAAC
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,aAAa,CAAC"}
|
package/dist/index.js
CHANGED
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,aAAa,CAAC
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,aAAa,CAAC"}
|
package/dist/loader.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Conventions } from '@fougere/core
|
|
1
|
+
import type { Conventions } from '@fougere/core';
|
|
2
2
|
/** The loader every command needs. */
|
|
3
3
|
export declare function installLoader(root: string, reread?: boolean): Promise<Conventions>;
|
|
4
4
|
//# sourceMappingURL=loader.d.ts.map
|
package/dist/loader.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"loader.d.ts","sourceRoot":"","sources":["../src/loader.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"loader.d.ts","sourceRoot":"","sources":["../src/loader.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAEjD,sCAAsC;AACtC,wBAAsB,aAAa,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,UAAQ,GAAG,OAAO,CAAC,WAAW,CAAC,CActF"}
|
package/dist/loader.js
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { frondAliases } from '@fougere/compiler';
|
|
2
|
+
import { resolveConventions } from '@fougere/core';
|
|
3
|
+
import { setModuleLoader, loadConfig } from '@fougere/core/node';
|
|
2
4
|
/** The loader every command needs. */
|
|
3
5
|
export async function installLoader(root, reread = false) {
|
|
4
6
|
const { createJiti } = await import('jiti');
|
package/dist/loader.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"loader.js","sourceRoot":"","sources":["../src/loader.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"loader.js","sourceRoot":"","sources":["../src/loader.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACjD,OAAO,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;AACnD,OAAO,EAAE,eAAe,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAGjE,sCAAsC;AACtC,MAAM,CAAC,KAAK,UAAU,aAAa,CAAC,IAAY,EAAE,MAAM,GAAG,KAAK;IAC9D,MAAM,EAAE,UAAU,EAAE,GAAG,MAAM,MAAM,CAAC,MAAM,CAAC,CAAC;IAC5C,MAAM,IAAI,GAAG,UAAU,CAAC,OAAO,IAAI,CAAC,GAAG,EAAE,EAAE,cAAc,EAAE,IAAI,EAAE,CAAC,CAAC;IACnE,eAAe,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAqC,CAAC,CAAC;IAEzF,MAAM,WAAW,GAAG,kBAAkB,CAAC,CAAC,MAAM,UAAU,CAAC,IAAI,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC;IAC7E,MAAM,IAAI,GAAG,UAAU,CAAC,OAAO,IAAI,CAAC,GAAG,EAAE;QACvC,cAAc,EAAE,IAAI;QACpB,KAAK,EAAE,MAAM,YAAY,CAAC,IAAI,EAAE,WAAW,CAAC;QAC5C,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,WAAW,EAAE,KAAK,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;KAC1C,CAAC,CAAC;IACH,eAAe,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAqC,CAAC,CAAC;IAEzF,OAAO,WAAW,CAAC;AACrB,CAAC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { mkdir, writeFile } from 'node:fs/promises';
|
|
2
2
|
import { dirname, relative, resolve } from 'node:path';
|
|
3
|
-
import { emitScan } from '@fougere/
|
|
3
|
+
import { emitScan } from '@fougere/compiler';
|
|
4
4
|
import ProjectScan from '../services/ProjectScan.js';
|
|
5
5
|
import type Build from '../entities/Build.js';
|
|
6
6
|
|
|
@@ -6,9 +6,8 @@ import {
|
|
|
6
6
|
resolveEffectiveOperations,
|
|
7
7
|
type ScanDiagnostic,
|
|
8
8
|
} from '@fougere/core';
|
|
9
|
-
import {
|
|
10
|
-
|
|
11
|
-
} from '@fougere/core/node';
|
|
9
|
+
import { adaptersOf, crossFrondImports, handlerDeclarations, outsideConventions } from '@fougere/compiler';
|
|
10
|
+
import { resolveConventions } from '@fougere/core';
|
|
12
11
|
import ProjectScan from '../services/ProjectScan.js';
|
|
13
12
|
|
|
14
13
|
/** One thing that does not hold, in the terms of whoever has to fix it. */
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { type FougereConfig, type ScanResult } from '@fougere/core';
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
} from '@fougere/core/node';
|
|
2
|
+
import { scanProject, frondAliases } from '@fougere/compiler';
|
|
3
|
+
import { resolveConventions } from '@fougere/core';
|
|
4
|
+
import { setModuleLoader, loadConfig } from '@fougere/core/node';
|
|
5
5
|
import { resolve } from 'node:path';
|
|
6
6
|
|
|
7
7
|
/**
|
|
@@ -11,7 +11,7 @@ import { resolve } from 'node:path';
|
|
|
11
11
|
* CLI's cwd, install a jiti loader so the scan can import TypeScript sources, scan.
|
|
12
12
|
* Two copies of one gesture, and the second was written by copying the first.
|
|
13
13
|
*
|
|
14
|
-
* Not a boot: `
|
|
14
|
+
* Not a boot: `bootApp` runs migrations and seeds, so an analysis command
|
|
15
15
|
* that booted would write to the target's database. The cost is stated rather than
|
|
16
16
|
* hidden, though — the scan IMPORTS the modules it reads, so a frond's top-level
|
|
17
17
|
* code runs. "No application cycle, no database", not "no side effect".
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { execSync } from 'node:child_process';
|
|
2
2
|
import { existsSync, mkdirSync, writeFileSync, readFileSync, readdirSync, unlinkSync } from 'node:fs';
|
|
3
3
|
import { join, basename } from 'node:path';
|
|
4
|
-
import {
|
|
4
|
+
import { resolveConventions, frondPackage } from '@fougere/core';
|
|
5
|
+
import { loadConfig } from '@fougere/core/node';
|
|
5
6
|
|
|
6
7
|
export default class BuildFrondHandler {
|
|
7
8
|
// cwd is ambient in a CLI — not a DI service (the container resolves by type).
|
|
@@ -7,9 +7,8 @@ import { FacadeTypes } from '../../../src/typescript/FacadeTypes.js';
|
|
|
7
7
|
// lived in this file and went stale the day an op stopped being a bare name: nothing
|
|
8
8
|
// compared the copy to the original, so the drift cost nothing until someone read it.
|
|
9
9
|
import { assertIdentityCard, type IdentityCard } from '@fougere/core';
|
|
10
|
-
import {
|
|
11
|
-
|
|
12
|
-
} from '@fougere/core/node';
|
|
10
|
+
import { type Conventions, resolveConventions, frondPackage } from '@fougere/core';
|
|
11
|
+
import { loadConfig } from '@fougere/core/node';
|
|
13
12
|
|
|
14
13
|
function assertSafeName(kind: string, name: string): void {
|
|
15
14
|
if (typeof name !== 'string' || !/^[A-Za-z_$][A-Za-z0-9_$-]*$/.test(name)) {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { cpSync, existsSync, renameSync, readFileSync, writeFileSync, readdirSync } from 'node:fs';
|
|
2
2
|
import { dirname, join } from 'node:path';
|
|
3
3
|
import { fileURLToPath } from 'node:url';
|
|
4
|
-
import { type Conventions, DEFAULT_CONVENTIONS, frondPackage } from '@fougere/core
|
|
4
|
+
import { type Conventions, DEFAULT_CONVENTIONS, frondPackage } from '@fougere/core';
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* The monorepo's `packages/`, found by its workspace marker rather than counted
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fougere/cli",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.9.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,12 +42,13 @@
|
|
|
42
42
|
"jiti": "^2.4.2",
|
|
43
43
|
"picocolors": "^1.1.1",
|
|
44
44
|
"safe-regex": "^2.1.1",
|
|
45
|
-
"@fougere/adapter-sql": "0.
|
|
46
|
-
"@fougere/
|
|
47
|
-
"@fougere/
|
|
48
|
-
"@fougere/
|
|
49
|
-
"@fougere/
|
|
50
|
-
"@fougere/
|
|
45
|
+
"@fougere/adapter-sql": "0.9.0-alpha.0",
|
|
46
|
+
"@fougere/container": "0.9.0-alpha.0",
|
|
47
|
+
"@fougere/core": "0.9.0-alpha.0",
|
|
48
|
+
"@fougere/transport-http": "0.9.0-alpha.0",
|
|
49
|
+
"@fougere/compiler": "0.9.0-alpha.0",
|
|
50
|
+
"@fougere/schema": "0.9.0-alpha.0",
|
|
51
|
+
"@fougere/defaults": "0.9.0-alpha.0"
|
|
51
52
|
},
|
|
52
53
|
"devDependencies": {
|
|
53
54
|
"vitest": "^4.1.0"
|
package/src/bin.ts
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
/** fougere CLI — a Fougere app powered by citty. */
|
|
3
3
|
import { createApp, setLogLevel, envLevel, type ScanResult } from '@fougere/core';
|
|
4
|
-
import { scanProject
|
|
4
|
+
import { scanProject } from '@fougere/compiler';
|
|
5
|
+
import { frondDirsOf, DEFAULT_CONVENTIONS } from '@fougere/core';
|
|
6
|
+
import { getModuleLoader } from '@fougere/core/node';
|
|
5
7
|
import { readdir, stat } from 'node:fs/promises';
|
|
6
8
|
import { join } from 'node:path';
|
|
7
9
|
import { createContainer } from '@fougere/container';
|
package/src/bridge.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Lifecycle, Role } from '@fougere/schema';
|
|
2
2
|
/** Entity → citty bridge. */
|
|
3
3
|
import type { Fields } from '@fougere/schema';
|
|
4
|
-
import { Shapes, Visibility } from '@fougere/schema';
|
|
4
|
+
import { Shapes, Visibility, type ShapeType } from '@fougere/schema';
|
|
5
5
|
import type { ArgsDef, ArgDef } from 'citty';
|
|
6
6
|
|
|
7
7
|
function toKebab(name: string): string {
|
|
@@ -16,11 +16,12 @@ export function entityToArgs(fields: Fields): ArgsDef {
|
|
|
16
16
|
// Axes-derived ingress membership; the CLI additionally skips ALL relations
|
|
17
17
|
// (a ref is not a flag — supplying related rows is not a CLI gesture).
|
|
18
18
|
for (const [key, field] of Object.entries(Visibility.of(fields).input)) {
|
|
19
|
-
if (Role.of(field).
|
|
19
|
+
if (Role.of(field).isRelation) continue;
|
|
20
20
|
|
|
21
21
|
// A `default(v)` travels as the create rule `{ value }` — citty shows it.
|
|
22
22
|
const defaultValue = Lifecycle.of(field).literal?.value;
|
|
23
23
|
const { base: shape, nullable } = Shapes.of(field.shape);
|
|
24
|
+
const type = Shapes.typeOf(field.shape);
|
|
24
25
|
const common = {
|
|
25
26
|
description: field.meta?.description,
|
|
26
27
|
required: !nullable && Lifecycle.of(field).requiredAtCreate,
|
|
@@ -38,12 +39,12 @@ export function entityToArgs(fields: Fields): ArgsDef {
|
|
|
38
39
|
&& common.required
|
|
39
40
|
&& key !== 'force'
|
|
40
41
|
&& options === undefined
|
|
41
|
-
&&
|
|
42
|
-
&&
|
|
42
|
+
&& type !== 'boolean'
|
|
43
|
+
&& type !== 'date';
|
|
43
44
|
if (positional) positionalIndex++;
|
|
44
45
|
|
|
45
46
|
args[toKebab(key) === key ? key : toKebab(key)] = argFor(
|
|
46
|
-
|
|
47
|
+
type,
|
|
47
48
|
common,
|
|
48
49
|
defaultValue,
|
|
49
50
|
options,
|
|
@@ -54,9 +55,24 @@ export function entityToArgs(fields: Fields): ArgsDef {
|
|
|
54
55
|
return args;
|
|
55
56
|
}
|
|
56
57
|
|
|
58
|
+
/**
|
|
59
|
+
* Which types carry a declared default onto the CLI. A `boolean` is answered above, with
|
|
60
|
+
* its own default; an `object` and an `array` are named and bare.
|
|
61
|
+
*/
|
|
62
|
+
const CARRIES_DEFAULT: Record<ShapeType, boolean> = {
|
|
63
|
+
number: true,
|
|
64
|
+
integer: true,
|
|
65
|
+
text: true,
|
|
66
|
+
date: true,
|
|
67
|
+
choice: true,
|
|
68
|
+
boolean: false,
|
|
69
|
+
object: false,
|
|
70
|
+
array: false,
|
|
71
|
+
};
|
|
72
|
+
|
|
57
73
|
/** One arg, built WITH its `type`. */
|
|
58
74
|
function argFor(
|
|
59
|
-
type:
|
|
75
|
+
type: ShapeType | undefined,
|
|
60
76
|
common: { description?: string; required: boolean },
|
|
61
77
|
defaultValue: unknown,
|
|
62
78
|
options: string[] | undefined,
|
|
@@ -68,9 +84,7 @@ function argFor(
|
|
|
68
84
|
: { ...common, type: 'boolean', default: defaultValue as boolean };
|
|
69
85
|
}
|
|
70
86
|
|
|
71
|
-
|
|
72
|
-
const carriesDefault = type === 'number' || type === 'integer' || type === 'string';
|
|
73
|
-
const withDefault = carriesDefault && defaultValue !== undefined
|
|
87
|
+
const withDefault = type && CARRIES_DEFAULT[type] && defaultValue !== undefined
|
|
74
88
|
? { default: String(defaultValue) }
|
|
75
89
|
: {};
|
|
76
90
|
|
package/src/index.ts
CHANGED
package/src/loader.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
} from '@fougere/core/node';
|
|
4
|
-
import type { Conventions } from '@fougere/core
|
|
1
|
+
import { frondAliases } from '@fougere/compiler';
|
|
2
|
+
import { resolveConventions } from '@fougere/core';
|
|
3
|
+
import { setModuleLoader, loadConfig } from '@fougere/core/node';
|
|
4
|
+
import type { Conventions } from '@fougere/core';
|
|
5
5
|
|
|
6
6
|
/** The loader every command needs. */
|
|
7
7
|
export async function installLoader(root: string, reread = false): Promise<Conventions> {
|
|
@@ -9,7 +9,8 @@
|
|
|
9
9
|
*/
|
|
10
10
|
import { createJiti } from 'jiti';
|
|
11
11
|
import { createLocalRunner, Logger } from '@fougere/core';
|
|
12
|
-
import {
|
|
12
|
+
import { frondAliases } from '@fougere/compiler';
|
|
13
|
+
import { setModuleLoader } from '@fougere/core/node';
|
|
13
14
|
import { bootAppFromConfig } from '@fougere/defaults';
|
|
14
15
|
import { serve } from '@fougere/transport-http';
|
|
15
16
|
|