@fougere/cli 0.1.0-alpha.0 → 0.2.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/NewCommand.ts +9 -4
- package/dist/bin.js +1 -1
- package/dist/bin.js.map +1 -1
- package/package.json +16 -8
- package/templates/admin/fronds/admin/entities/User.ts +2 -2
- package/templates/api/fronds/api/entities/Task.ts +2 -2
- package/templates/apps/nuxt/package.json +2 -2
- package/templates/blog/fronds/blog/entities/Post.ts +2 -2
- package/templates/flat/package.json +2 -2
- package/templates/frond/fronds/__name__/entities/Post.ts +2 -2
- package/templates/frond/package.json +2 -2
- package/templates/frond/serve.mjs +9 -2
- package/templates/fronds/blank/entities/Item.ts +2 -2
- package/templates/fronds/blog/entities/Post.ts +2 -2
|
@@ -6,6 +6,13 @@ import type { App } from '@fougere/core';
|
|
|
6
6
|
|
|
7
7
|
type Ui = ReturnType<typeof createUi>;
|
|
8
8
|
|
|
9
|
+
/**
|
|
10
|
+
* The same line either way, which is the point: `--local` links this checkout, the
|
|
11
|
+
* default resolves `@fougere/*` from npm, and neither needs a caveat since the alpha
|
|
12
|
+
* is published. It used to carry one, and a stale caveat is worse than none.
|
|
13
|
+
*/
|
|
14
|
+
const INSTALL = 'pnpm install';
|
|
15
|
+
|
|
9
16
|
/**
|
|
10
17
|
* The guided composer: a workspace, then its fronds (domains), then the apps
|
|
11
18
|
* that consume them — in that dependency order. ProjectWriter is a plain,
|
|
@@ -39,8 +46,7 @@ export default class NewCommand {
|
|
|
39
46
|
pw.addRootFrond(dir, template);
|
|
40
47
|
if (raw.local) pw.linkLocal(dir);
|
|
41
48
|
this.ui.info(`${template} at the root`);
|
|
42
|
-
|
|
43
|
-
this.ui.note([`cd ${name}`, flatInstall, `pnpm dev`].join('\n'), `${name} — one frond, at the root`);
|
|
49
|
+
this.ui.note([`cd ${name}`, INSTALL, `pnpm dev`].join('\n'), `${name} — one frond, at the root`);
|
|
44
50
|
this.ui.outro('Prêt.');
|
|
45
51
|
return;
|
|
46
52
|
}
|
|
@@ -67,8 +73,7 @@ export default class NewCommand {
|
|
|
67
73
|
// Every app depends on every frond — stated here, where both names are known.
|
|
68
74
|
pw.linkFronds(dir);
|
|
69
75
|
if (raw.local) pw.linkLocal(dir);
|
|
70
|
-
|
|
71
|
-
this.ui.note([`cd ${name}`, install, `pnpm dev`].join('\n'), `${name} — ${fronds} frond(s), ${apps} app(s)`);
|
|
76
|
+
this.ui.note([`cd ${name}`, INSTALL, `pnpm dev`].join('\n'), `${name} — ${fronds} frond(s), ${apps} app(s)`);
|
|
72
77
|
this.ui.outro('Prêt.');
|
|
73
78
|
}
|
|
74
79
|
|
package/dist/bin.js
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
* app/ → loaded at runtime by jiti (presentation)
|
|
8
8
|
*/
|
|
9
9
|
import { createApp, setModuleLoader } from '@fougere/core';
|
|
10
|
-
import { createContainer } from '@fougere/container
|
|
10
|
+
import { createContainer } from '@fougere/container';
|
|
11
11
|
import { ui } from '@fougere/cli-ui';
|
|
12
12
|
import { run } from './runner.js';
|
|
13
13
|
const { createJiti } = await import('jiti');
|
package/dist/bin.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bin.js","sourceRoot":"","sources":["../src/bin.ts"],"names":[],"mappings":";AACA;;;;;;GAMG;AACH,OAAO,EAAE,SAAS,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAC3D,OAAO,EAAE,eAAe,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"bin.js","sourceRoot":"","sources":["../src/bin.ts"],"names":[],"mappings":";AACA;;;;;;GAMG;AACH,OAAO,EAAE,SAAS,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAC3D,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AACrD,OAAO,EAAE,EAAE,EAAE,MAAM,iBAAiB,CAAC;AACrC,OAAO,EAAE,GAAG,EAAE,MAAM,aAAa,CAAC;AAElC,MAAM,EAAE,UAAU,EAAE,GAAG,MAAM,MAAM,CAAC,MAAM,CAAC,CAAC;AAC5C,MAAM,IAAI,GAAG,UAAU,CAAC,OAAO,IAAI,CAAC,GAAG,EAAE,EAAE,cAAc,EAAE,IAAI,EAAE,CAAC,CAAC;AACnE,eAAe,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAqC,CAAC,CAAC;AAEzF,MAAM,OAAO,GAAG,IAAI,GAAG,CAAC,IAAI,EAAE,OAAO,IAAI,CAAC,GAAG,CAAC,CAAC,QAAQ,CAAC;AACxD,MAAM,SAAS,GAAG,eAAe,EAAE,CAAC;AACpC,SAAS,CAAC,aAAa,CAAC,IAAI,EAAE,EAAE,EAAE,CAAC,CAAC;AACpC,SAAS,CAAC,aAAa,CAAC,KAAK,EAAE,OAAO,CAAC,GAAG,EAAE,CAAC,CAAC;AAE9C,+EAA+E;AAC/E,OAAO,CAAC,GAAG,CAAC,iBAAiB,KAAK,MAAM,CAAC;AAEzC,MAAM,GAAG,GAAG,MAAM,SAAS,CAAC;IAC1B,IAAI,EAAE,OAAO;IACb,eAAe,EAAE,GAAG,EAAE,CAAC,SAAS;CACjC,CAAC,CAAC;AAEH,SAAS,CAAC,aAAa,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC;AAEpC,MAAM,GAAG,CAAC,GAAG,CAAC,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fougere/cli",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0-alpha.0",
|
|
4
4
|
"description": "The Fougere CLI — compose a workspace, serve a frond, call an operation.",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"fougere",
|
|
7
|
+
"cli",
|
|
8
|
+
"typescript",
|
|
9
|
+
"scaffold",
|
|
10
|
+
"codegen"
|
|
11
|
+
],
|
|
5
12
|
"license": "MIT",
|
|
6
13
|
"repository": {
|
|
7
14
|
"type": "git",
|
|
@@ -18,7 +25,8 @@
|
|
|
18
25
|
".": {
|
|
19
26
|
"types": "./dist/index.d.ts",
|
|
20
27
|
"import": "./dist/index.js"
|
|
21
|
-
}
|
|
28
|
+
},
|
|
29
|
+
"./bin": "./dist/bin.js"
|
|
22
30
|
},
|
|
23
31
|
"files": [
|
|
24
32
|
"dist",
|
|
@@ -30,12 +38,12 @@
|
|
|
30
38
|
"citty": "^0.2.1",
|
|
31
39
|
"jiti": "^2.4.2",
|
|
32
40
|
"picocolors": "^1.1.1",
|
|
33
|
-
"@fougere/cli-ui": "0.
|
|
34
|
-
"@fougere/
|
|
35
|
-
"@fougere/
|
|
36
|
-
"@fougere/
|
|
37
|
-
"@fougere/core": "0.
|
|
38
|
-
"@fougere/
|
|
41
|
+
"@fougere/cli-ui": "0.2.0-alpha.0",
|
|
42
|
+
"@fougere/runtime": "0.2.0-alpha.0",
|
|
43
|
+
"@fougere/container": "0.2.0-alpha.0",
|
|
44
|
+
"@fougere/schema": "0.2.0-alpha.0",
|
|
45
|
+
"@fougere/core": "0.2.0-alpha.0",
|
|
46
|
+
"@fougere/transport-http": "0.2.0-alpha.0"
|
|
39
47
|
},
|
|
40
48
|
"devDependencies": {
|
|
41
49
|
"vitest": "^4.1.0"
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { entity, primary, text, email,
|
|
1
|
+
import { entity, primary, text, email, created, oneOf, readOnly } from '@fougere/schema';
|
|
2
2
|
|
|
3
3
|
export default class User extends entity({
|
|
4
4
|
id: primary(),
|
|
5
5
|
name: text({ min: 1, max: 100 }),
|
|
6
6
|
email: email(),
|
|
7
|
-
createdAt:
|
|
7
|
+
createdAt: created(),
|
|
8
8
|
// Server-owned: a user is born active and flipped by the deactivate operation.
|
|
9
9
|
status: readOnly(oneOf('active', 'inactive', { default: 'active' })),
|
|
10
10
|
}) {}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { entity, primary, text,
|
|
1
|
+
import { entity, primary, text, created, oneOf, readOnly } from '@fougere/schema';
|
|
2
2
|
|
|
3
3
|
export default class Task extends entity({
|
|
4
4
|
id: primary(),
|
|
5
5
|
title: text({ min: 1, max: 200 }),
|
|
6
|
-
createdAt:
|
|
6
|
+
createdAt: created(),
|
|
7
7
|
// Server-owned: a task is born open and flipped by the complete operation.
|
|
8
8
|
status: readOnly(oneOf('open', 'done', { default: 'open' })),
|
|
9
9
|
}) {}
|
|
@@ -11,9 +11,9 @@
|
|
|
11
11
|
"@fougere/nuxt": "latest",
|
|
12
12
|
"@fougere/schema": "latest",
|
|
13
13
|
"@fougere/runtime": "latest",
|
|
14
|
-
"@fougere/container-fougere": "latest",
|
|
15
14
|
"better-sqlite3": "^12.8.0",
|
|
16
15
|
"kysely": "^0.28.17",
|
|
17
|
-
"nuxt": "^4.5.1"
|
|
16
|
+
"nuxt": "^4.5.1",
|
|
17
|
+
"@fougere/container": "latest"
|
|
18
18
|
}
|
|
19
19
|
}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { entity, primary, text,
|
|
1
|
+
import { entity, primary, text, created, oneOf, readOnly } from '@fougere/schema';
|
|
2
2
|
|
|
3
3
|
export default class Post extends entity({
|
|
4
4
|
id: primary(),
|
|
5
5
|
title: text({ min: 1, max: 200 }),
|
|
6
6
|
body: text(),
|
|
7
|
-
createdAt:
|
|
7
|
+
createdAt: created(),
|
|
8
8
|
// Server-owned: a post is born a draft and flipped by the publish
|
|
9
9
|
// operation, never by a client writing the field. readOnly closes
|
|
10
10
|
// the inbound door — the field is projected out, never accepted in.
|
|
@@ -13,10 +13,10 @@
|
|
|
13
13
|
"@fougere/nuxt": "latest",
|
|
14
14
|
"@fougere/schema": "latest",
|
|
15
15
|
"@fougere/runtime": "latest",
|
|
16
|
-
"@fougere/container-fougere": "latest",
|
|
17
16
|
"better-sqlite3": "^12.8.0",
|
|
18
17
|
"kysely": "^0.28.17",
|
|
19
|
-
"nuxt": "^4.5.1"
|
|
18
|
+
"nuxt": "^4.5.1",
|
|
19
|
+
"@fougere/container": "latest"
|
|
20
20
|
},
|
|
21
21
|
"devDependencies": {
|
|
22
22
|
"@types/node": "^22.19.15"
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { entity, primary, text,
|
|
1
|
+
import { entity, primary, text, created, oneOf, readOnly } from '@fougere/schema';
|
|
2
2
|
|
|
3
3
|
export default class Post extends entity({
|
|
4
4
|
id: primary(),
|
|
5
5
|
title: text({ min: 1, max: 200 }),
|
|
6
6
|
body: text(),
|
|
7
|
-
createdAt:
|
|
7
|
+
createdAt: created(),
|
|
8
8
|
// Server-owned: born a draft, flipped by the publish operation.
|
|
9
9
|
status: readOnly(oneOf('draft', 'published', { default: 'draft' })),
|
|
10
10
|
}) {}
|
|
@@ -9,10 +9,10 @@
|
|
|
9
9
|
"@fougere/core": "latest",
|
|
10
10
|
"@fougere/schema": "latest",
|
|
11
11
|
"@fougere/runtime": "latest",
|
|
12
|
-
"@fougere/container-fougere": "latest",
|
|
13
12
|
"@fougere/transport-http": "latest",
|
|
14
13
|
"better-sqlite3": "^12.8.0",
|
|
15
14
|
"kysely": "^0.28.17",
|
|
16
|
-
"jiti": "^2.4.2"
|
|
15
|
+
"jiti": "^2.4.2",
|
|
16
|
+
"@fougere/container": "latest"
|
|
17
17
|
}
|
|
18
18
|
}
|
|
@@ -8,11 +8,18 @@
|
|
|
8
8
|
* Nothing in the frond changes — only where it runs.
|
|
9
9
|
*/
|
|
10
10
|
import { createJiti } from 'jiti';
|
|
11
|
-
import { createLocalRunner, setModuleLoader, Logger } from '@fougere/core';
|
|
11
|
+
import { createLocalRunner, setModuleLoader, frondAliases, Logger } from '@fougere/core';
|
|
12
12
|
import { bootAppFromConfig } from '@fougere/runtime';
|
|
13
13
|
import { serve } from '@fougere/transport-http';
|
|
14
14
|
|
|
15
|
-
|
|
15
|
+
// `frondAliases` is what makes `@frond/<neighbour>/entities/X.js` resolve — the
|
|
16
|
+
// named form a frond uses for its neighbour. A bare jiti loads frond sources but
|
|
17
|
+
// not that convention, so a collector or handler importing across fronds dies here
|
|
18
|
+
// while the same code works in-process.
|
|
19
|
+
const jiti = createJiti(import.meta.url, {
|
|
20
|
+
interopDefault: true,
|
|
21
|
+
alias: await frondAliases(process.cwd()),
|
|
22
|
+
});
|
|
16
23
|
setModuleLoader((filePath) => jiti.import(filePath));
|
|
17
24
|
|
|
18
25
|
const log = new Logger('frond-host');
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { entity, primary, text,
|
|
1
|
+
import { entity, primary, text, created } from '@fougere/schema';
|
|
2
2
|
|
|
3
3
|
/** Rename it, then declare your fields — this is the whole shape of an entity. */
|
|
4
4
|
export default class Item extends entity({
|
|
5
5
|
id: primary(),
|
|
6
6
|
name: text({ min: 1, max: 200 }),
|
|
7
|
-
createdAt:
|
|
7
|
+
createdAt: created(),
|
|
8
8
|
}) {}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { entity, primary, text,
|
|
1
|
+
import { entity, primary, text, created, oneOf, readOnly } from '@fougere/schema';
|
|
2
2
|
|
|
3
3
|
export default class Post extends entity({
|
|
4
4
|
id: primary(),
|
|
5
5
|
title: text({ min: 1, max: 200 }),
|
|
6
6
|
body: text(),
|
|
7
|
-
createdAt:
|
|
7
|
+
createdAt: created(),
|
|
8
8
|
// Server-owned: born a draft, flipped by the publish operation.
|
|
9
9
|
status: readOnly(oneOf('draft', 'published', { default: 'draft' })),
|
|
10
10
|
}) {}
|