@effindomv2/create-fui-as-app 0.1.5 → 0.1.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (27) hide show
  1. package/build/templates/hello/README.md +20 -0
  2. package/build/templates/mvc/README.md +27 -0
  3. package/build/templates/mvc/harness.ts +9 -9
  4. package/build/templates/mvc/index.html +3 -3
  5. package/build/templates/mvc/package.json +3 -3
  6. package/build/templates/mvc/route-shell.html +2 -2
  7. package/build/templates/mvc/scripts/prepare-runtime.ts +4 -4
  8. package/build/templates/mvc/scripts/smoke.ts +4 -4
  9. package/build/templates/mvc/src/routes/HomeApp.ts +15 -0
  10. package/build/templates/mvc/src/routes/SettingsApp.ts +15 -0
  11. package/build/templates/mvc/src/routes/{mvc/pages/home → home}/HomeController.ts +7 -10
  12. package/build/templates/mvc/src/routes/{mvc/pages/home → home}/HomeView.ts +6 -19
  13. package/build/templates/mvc/src/routes/{mvc/pages/settings → settings}/SettingsController.ts +3 -10
  14. package/build/templates/mvc/src/routes/{mvc/pages/settings → settings}/SettingsView.ts +6 -19
  15. package/build/templates/mvc/src/routes/shared/design-system/NavBar.ts +18 -0
  16. package/build/templates/mvc/src/routes/{mvc/shared/design-system/MvcNavPill.ts → shared/design-system/NavPill.ts} +2 -2
  17. package/build/templates/mvc/src/routes/{mvc/shared/design-system/MvcPrimaryButton.ts → shared/design-system/PrimaryButton.ts} +2 -2
  18. package/build/templates/mvc/src/routes/{mvc/shared → shared}/routes.ts +7 -7
  19. package/dist/scripts/sync-templates.js +16 -14
  20. package/dist/src/versions.d.ts +1 -1
  21. package/dist/src/versions.js +1 -1
  22. package/dist/tests/scaffold.test.js +5 -2
  23. package/package.json +1 -1
  24. package/build/templates/mvc/src/routes/mvc_home.ts +0 -20
  25. package/build/templates/mvc/src/routes/mvc_settings.ts +0 -20
  26. /package/build/templates/mvc/src/routes/{mvc/pages/home → home}/HomeModel.ts +0 -0
  27. /package/build/templates/mvc/src/routes/{mvc/pages/settings → settings}/SettingsModel.ts +0 -0
@@ -0,0 +1,20 @@
1
+ # Hello World scaffold guide
2
+
3
+ This template is the smallest FUI-AS app shape:
4
+
5
+ - `src/App.ts` is the app entrypoint (`__runApp`) and where you compose your root retained UI tree.
6
+ - `src/HelloWorld.ts` is a simple feature module you can replace with your own screens/components.
7
+ - `harness.ts` boots the browser runtime and mounts the wasm app.
8
+ - `src/host/host-services.ts` and `src/host/host-events.ts` define app-owned JS bridge contracts.
9
+ - `src/host/generated/*` is generated from those host definition files.
10
+
11
+ ## Typical workflow
12
+
13
+ 1. Build UI from `src/App.ts` with controls/nodes from `./fui/Fui`.
14
+ 2. Split real features into more files under `src/` and compose them in `App.ts`.
15
+ 3. If browser-owned capabilities are needed (for example shell APIs), add definitions in `src/host/*.ts` and run `npm run generate:host`.
16
+ 4. Run `npm run dev` while iterating.
17
+
18
+ ## Architecture intent
19
+
20
+ Use this template as a single-app baseline: one wasm, one harness, one mounted root tree. Keep UI composition in AssemblyScript and keep browser glue inside `harness.ts` + host bridge definitions.
@@ -0,0 +1,27 @@
1
+ # MVC scaffold guide
2
+
3
+ This template scaffolds a multi-route FUI-AS app with explicit page-level MVC.
4
+
5
+ - `src/routes/HomeApp.ts` and `src/routes/SettingsApp.ts` are route app entrypoints.
6
+ - `src/routes/home/*` and `src/routes/settings/*` hold each route's model, view, and controller.
7
+ - `src/routes/shared/*` holds shared route UI primitives (for example nav pills/nav bar) and shared route helpers.
8
+ - `harness.ts` wires routed host boot, route table, and host-services/events registration.
9
+ - `route-shell.html` is the per-route host shell copied for each route path.
10
+ - `src/host/host-services.ts` and `src/host/host-events.ts` are app-owned bridge contracts; `src/host/generated/*` is generated output.
11
+
12
+ ## Routing + deployment model
13
+
14
+ Each route builds to its own wasm (`home.wasm`, `settings.wasm`) and is mounted by routed harness config. This is designed for true MFE slices: each route app can evolve and deploy independently while still sharing the same browser host/runtime contract.
15
+
16
+ The routed harness is optimized for fast navigation:
17
+
18
+ - route shells stay stable while route wasm swaps,
19
+ - warm route transitions can avoid full loading overlays,
20
+ - host bridge wiring is reused consistently across route apps.
21
+
22
+ ## Typical workflow
23
+
24
+ 1. Add/modify page behavior inside `home/` or `settings/` controllers/models/views.
25
+ 2. Add new routes by creating another `*App.ts` entrypoint plus a new route folder and route record in `harness.ts`.
26
+ 3. Keep shared browser bridge capabilities in `src/host/*.ts`, then regenerate with `npm run generate:host`.
27
+ 4. Use `npm run dev` for local routed iteration.
@@ -2,7 +2,7 @@ import { startRoutedHarness, type HarnessExports, type RoutedHarnessRoute } from
2
2
  import { appHostEvents } from './src/host/host-events';
3
3
  import { appHostServices } from './src/host/host-services';
4
4
 
5
- type MvcRouteExports = HarnessExports & {
5
+ type RouteExports = HarnessExports & {
6
6
  __runApp(): void;
7
7
  __disposeApp?(): void;
8
8
  };
@@ -10,19 +10,19 @@ type MvcRouteExports = HarnessExports & {
10
10
  const routePrefix = window.location.pathname.startsWith('/v2/fui-as/demo-mvc/') ? '/v2/fui-as/demo-mvc' : '';
11
11
  const routes: readonly RoutedHarnessRoute[] = [
12
12
  {
13
- routePath: `${routePrefix}/mvc-home/`,
14
- wasmPath: `${routePrefix}/mvc-home.wasm`,
15
- title: 'MVC Home',
13
+ routePath: `${routePrefix}/home/`,
14
+ wasmPath: `${routePrefix}/home.wasm`,
15
+ title: 'Home',
16
16
  },
17
17
  {
18
- routePath: `${routePrefix}/mvc-settings/`,
19
- wasmPath: `${routePrefix}/mvc-settings.wasm`,
20
- title: 'MVC Settings',
18
+ routePath: `${routePrefix}/settings/`,
19
+ wasmPath: `${routePrefix}/settings.wasm`,
20
+ title: 'Settings',
21
21
  },
22
22
  ];
23
23
 
24
- startRoutedHarness<MvcRouteExports>({
25
- shellId: 'fui-mvc',
24
+ startRoutedHarness<RouteExports>({
25
+ shellId: 'fui-routes',
26
26
  routeBase: routes[0].routePath,
27
27
  routes,
28
28
  recreateRuntimeOnWarmRouteSwap: true,
@@ -2,10 +2,10 @@
2
2
  <html lang="en">
3
3
  <head>
4
4
  <meta charset="utf-8" />
5
- <meta http-equiv="refresh" content="0; url=/mvc-home/" />
6
- <title>FUI-AS MVC App</title>
5
+ <meta http-equiv="refresh" content="0; url=/home/" />
6
+ <title>FUI-AS Routed App</title>
7
7
  </head>
8
8
  <body>
9
- <p>Redirecting to <a href="/mvc-home/">/mvc-home/</a>…</p>
9
+ <p>Redirecting to <a href="/home/">/home/</a>…</p>
10
10
  </body>
11
11
  </html>
@@ -3,13 +3,13 @@
3
3
  "version": "0.1.0",
4
4
  "private": true,
5
5
  "type": "module",
6
- "description": "Scaffolded FUI-AS MVC app",
6
+ "description": "Scaffolded FUI-AS routed app",
7
7
  "scripts": {
8
8
  "build": "npm run generate:host && npm run build:assets && npm run build:wasm && npm run build:harness",
9
9
  "build:assets": "tsx scripts/prepare-runtime.ts",
10
10
  "build:wasm": "npm run build:wasm:home && npm run build:wasm:settings",
11
- "build:wasm:home": "asc src/routes/mvc_home.ts --config asconfig.json --target release --outFile public/mvc-home.wasm",
12
- "build:wasm:settings": "asc src/routes/mvc_settings.ts --config asconfig.json --target release --outFile public/mvc-settings.wasm",
11
+ "build:wasm:home": "asc src/routes/HomeApp.ts --config asconfig.json --target release --outFile public/home.wasm",
12
+ "build:wasm:settings": "asc src/routes/SettingsApp.ts --config asconfig.json --target release --outFile public/settings.wasm",
13
13
  "build:harness": "esbuild harness.ts --bundle --format=esm --platform=browser --outfile=public/harness.js",
14
14
  "generate:host-services": "tsx ./node_modules/@effindomv2/fui-as/scripts/generate-host-services.ts src/host/host-services.ts appHostServices src/host/generated/HostServices.ts ../../fui/FuiPrimitives",
15
15
  "generate:host-events": "tsx ./node_modules/@effindomv2/fui-as/scripts/generate-host-events.ts src/host/host-events.ts appHostEvents src/host/generated/HostEvents.ts ../../fui/FuiPrimitives",
@@ -4,7 +4,7 @@
4
4
  <meta charset="utf-8" />
5
5
  <meta name="viewport" content="width=device-width, initial-scale=1" />
6
6
  <base href="../" />
7
- <title>FUI-AS MVC Demo</title>
7
+ <title>FUI-AS Routed Demo</title>
8
8
  <style>
9
9
  html, body {
10
10
  margin: 0;
@@ -47,7 +47,7 @@
47
47
  <canvas id="fui-canvas"></canvas>
48
48
  </main>
49
49
  <div class="effindom-loading-overlay" id="effindom-loading-overlay" data-state="loading">
50
- <div>Loading MVC demo…</div>
50
+ <div>Loading routed demo…</div>
51
51
  </div>
52
52
  <script src="./effindom-runtime-config.js"></script>
53
53
  <script src="./bridge.js"></script>
@@ -3,8 +3,8 @@ import { copyFileSync, cpSync, existsSync, mkdirSync, rmSync, writeFileSync } fr
3
3
  const outputDir = "public";
4
4
  rmSync(outputDir, { recursive: true, force: true });
5
5
  mkdirSync(`${outputDir}/runtime`, { recursive: true });
6
- mkdirSync(`${outputDir}/mvc-home`, { recursive: true });
7
- mkdirSync(`${outputDir}/mvc-settings`, { recursive: true });
6
+ mkdirSync(`${outputDir}/home`, { recursive: true });
7
+ mkdirSync(`${outputDir}/settings`, { recursive: true });
8
8
 
9
9
  cpSync("node_modules/@effindomv2/runtime/dist", `${outputDir}/runtime/dist`, { recursive: true });
10
10
  cpSync("node_modules/@effindomv2/runtime/dist/fonts", `${outputDir}/runtime/fonts`, { recursive: true });
@@ -18,5 +18,5 @@ writeFileSync(
18
18
  "utf8",
19
19
  );
20
20
  copyFileSync("index.html", `${outputDir}/index.html`);
21
- copyFileSync("route-shell.html", `${outputDir}/mvc-home/index.html`);
22
- copyFileSync("route-shell.html", `${outputDir}/mvc-settings/index.html`);
21
+ copyFileSync("route-shell.html", `${outputDir}/home/index.html`);
22
+ copyFileSync("route-shell.html", `${outputDir}/settings/index.html`);
@@ -3,10 +3,10 @@ import { accessSync } from "node:fs";
3
3
  const expectedFiles = [
4
4
  "public/index.html",
5
5
  "public/harness.js",
6
- "public/mvc-home/index.html",
7
- "public/mvc-settings/index.html",
8
- "public/mvc-home.wasm",
9
- "public/mvc-settings.wasm",
6
+ "public/home/index.html",
7
+ "public/settings/index.html",
8
+ "public/home.wasm",
9
+ "public/settings.wasm",
10
10
  "public/bridge.js",
11
11
  "public/effindom-runtime-config.js",
12
12
  "public/runtime/dist/effindom.v2.manifest.json",
@@ -0,0 +1,15 @@
1
+ export * from "../fui/FuiExports";
2
+ export * from "../host/generated/HostEvents";
3
+
4
+ import { createManagedApplication } from "../fui/Fui";
5
+ import { HomeController } from "./home/HomeController";
6
+
7
+ const app = createManagedApplication<HomeController>(() => new HomeController());
8
+
9
+ export function __runApp(): void {
10
+ app.run();
11
+ }
12
+
13
+ export function __disposeApp(): void {
14
+ app.dispose();
15
+ }
@@ -0,0 +1,15 @@
1
+ export * from "../fui/FuiExports";
2
+ export * from "../host/generated/HostEvents";
3
+
4
+ import { createManagedApplication } from "../fui/Fui";
5
+ import { SettingsController } from "./settings/SettingsController";
6
+
7
+ const app = createManagedApplication<SettingsController>(() => new SettingsController());
8
+
9
+ export function __runApp(): void {
10
+ app.run();
11
+ }
12
+
13
+ export function __disposeApp(): void {
14
+ app.dispose();
15
+ }
@@ -1,7 +1,7 @@
1
- import { Application, Node } from "../../../../fui/Fui";
2
- import { Callback1 } from "../../../../fui/FuiPrimitives";
3
- import { onAppClockTick } from "../../../../host/generated/HostEvents";
4
- import { appClockNowUnixSeconds } from "../../../../host/generated/HostServices";
1
+ import { ManagedApplicationController, Node } from "../../fui/Fui";
2
+ import { Callback1 } from "../../fui/FuiPrimitives";
3
+ import { onAppClockTick } from "../../host/generated/HostEvents";
4
+ import { appClockNowUnixSeconds } from "../../host/generated/HostServices";
5
5
  import { HomeModel } from "./HomeModel";
6
6
  import { HomeView } from "./HomeView";
7
7
 
@@ -19,12 +19,13 @@ class ClockTickHandler extends Callback1<i32> {
19
19
  }
20
20
  }
21
21
 
22
- export class HomeController {
22
+ export class HomeController extends ManagedApplicationController {
23
23
  readonly model: HomeModel = new HomeModel();
24
24
  readonly view: HomeView = new HomeView(this.model);
25
25
  private readonly clockTickHandler: ClockTickHandler = new ClockTickHandler(this);
26
26
 
27
27
  constructor() {
28
+ super();
28
29
  this.view.actionButton.onClickWith(this, (controller) => {
29
30
  controller.model.actionCount += 1;
30
31
  controller.view.setActionCount(controller.model.actionCount);
@@ -44,12 +45,8 @@ export class HomeController {
44
45
  return this.view.getRoot();
45
46
  }
46
47
 
47
- mount(): void {
48
- Application.mount(this.view.getRoot());
49
- }
50
-
51
48
  dispose(): void {
52
49
  onAppClockTick(null);
53
- Application.unmount();
50
+ super.dispose();
54
51
  }
55
52
  }
@@ -1,37 +1,24 @@
1
- import { Column, FlexBox, JustifyContent, Row, SelectionArea, Text, Unit, rgb } from "../../../../fui/Fui";
2
- import { MvcNavPill } from "../../shared/design-system/MvcNavPill";
3
- import { MvcPrimaryButton } from "../../shared/design-system/MvcPrimaryButton";
4
- import { mvcHomeRoute, mvcSettingsRoute } from "../../shared/routes";
1
+ import { Column, FlexBox, SelectionArea, Text, Unit, rgb } from "../../fui/Fui";
2
+ import { createNavBar } from "../shared/design-system/NavBar";
3
+ import { PrimaryButton } from "../shared/design-system/PrimaryButton";
5
4
  import { HomeModel } from "./HomeModel";
6
5
 
7
- function navSpacer(): FlexBox {
8
- return new FlexBox().width(10.0, Unit.Pixel).height(1.0, Unit.Pixel);
9
- }
10
-
11
6
  export class HomeView {
12
- readonly actionButton: MvcPrimaryButton;
7
+ readonly actionButton: PrimaryButton;
13
8
  private readonly statusText: Text;
14
9
  private readonly hostServiceText: Text;
15
10
  private readonly hostEventText: Text;
16
11
  private readonly root!: SelectionArea;
17
12
 
18
13
  constructor(model: HomeModel) {
19
- const homePill = new MvcNavPill(mvcHomeRoute(), "Home").active(true);
20
- const settingsPill = new MvcNavPill(mvcSettingsRoute(), "Settings").active(false);
21
-
22
- const navBar = Row()
23
- .width(100.0, Unit.Percent)
24
- .justifyContent(JustifyContent.End)
25
- .child(homePill)
26
- .child(navSpacer())
27
- .child(settingsPill);
14
+ const navBar = createNavBar(true);
28
15
 
29
16
  const title = new Text(model.title).fontSize(34.0).textColor(rgb(241, 245, 249)) as Text;
30
17
  const subtitle = new Text(model.subtitle).fontSize(16.0).textColor(rgb(148, 163, 184)) as Text;
31
18
  this.statusText = new Text("Home counter: 0").fontSize(18.0).textColor(rgb(147, 197, 253)) as Text;
32
19
  this.hostServiceText = new Text("Host service time: -").fontSize(15.0).textColor(rgb(191, 219, 254)) as Text;
33
20
  this.hostEventText = new Text("Host event tick: -").fontSize(15.0).textColor(rgb(134, 239, 172)) as Text;
34
- this.actionButton = new MvcPrimaryButton(model.actionLabel);
21
+ this.actionButton = new PrimaryButton(model.actionLabel);
35
22
 
36
23
  const content = Column(
37
24
  navBar,
@@ -1,12 +1,13 @@
1
- import { Application, Node } from "../../../../fui/Fui";
1
+ import { ManagedApplicationController, Node } from "../../fui/Fui";
2
2
  import { SettingsModel } from "./SettingsModel";
3
3
  import { SettingsView } from "./SettingsView";
4
4
 
5
- export class SettingsController {
5
+ export class SettingsController extends ManagedApplicationController {
6
6
  readonly model: SettingsModel = new SettingsModel();
7
7
  readonly view: SettingsView = new SettingsView(this.model);
8
8
 
9
9
  constructor() {
10
+ super();
10
11
  this.view.actionButton.onClickWith(this, (controller) => {
11
12
  controller.model.saveCount += 1;
12
13
  controller.view.setSaveCount(controller.model.saveCount);
@@ -16,12 +17,4 @@ export class SettingsController {
16
17
  getRoot(): Node {
17
18
  return this.view.getRoot();
18
19
  }
19
-
20
- mount(): void {
21
- Application.mount(this.view.getRoot());
22
- }
23
-
24
- dispose(): void {
25
- Application.unmount();
26
- }
27
20
  }
@@ -1,33 +1,20 @@
1
- import { Column, FlexBox, JustifyContent, Row, SelectionArea, Text, Unit, rgb } from "../../../../fui/Fui";
2
- import { MvcNavPill } from "../../shared/design-system/MvcNavPill";
3
- import { MvcPrimaryButton } from "../../shared/design-system/MvcPrimaryButton";
4
- import { mvcHomeRoute, mvcSettingsRoute } from "../../shared/routes";
1
+ import { Column, FlexBox, SelectionArea, Text, Unit, rgb } from "../../fui/Fui";
2
+ import { createNavBar } from "../shared/design-system/NavBar";
3
+ import { PrimaryButton } from "../shared/design-system/PrimaryButton";
5
4
  import { SettingsModel } from "./SettingsModel";
6
5
 
7
- function navSpacer(): FlexBox {
8
- return new FlexBox().width(10.0, Unit.Pixel).height(1.0, Unit.Pixel);
9
- }
10
-
11
6
  export class SettingsView {
12
- readonly actionButton: MvcPrimaryButton;
7
+ readonly actionButton: PrimaryButton;
13
8
  private readonly statusText: Text;
14
9
  private readonly root!: SelectionArea;
15
10
 
16
11
  constructor(model: SettingsModel) {
17
- const homePill = new MvcNavPill(mvcHomeRoute(), "Home").active(false);
18
- const settingsPill = new MvcNavPill(mvcSettingsRoute(), "Settings").active(true);
19
-
20
- const navBar = Row()
21
- .width(100.0, Unit.Percent)
22
- .justifyContent(JustifyContent.End)
23
- .child(homePill)
24
- .child(navSpacer())
25
- .child(settingsPill);
12
+ const navBar = createNavBar(false);
26
13
 
27
14
  const title = new Text(model.title).fontSize(34.0).textColor(rgb(241, 245, 249)) as Text;
28
15
  const subtitle = new Text(model.subtitle).fontSize(16.0).textColor(rgb(148, 163, 184)) as Text;
29
16
  this.statusText = new Text("Settings saved: 0").fontSize(18.0).textColor(rgb(134, 239, 172)) as Text;
30
- this.actionButton = new MvcPrimaryButton(model.actionLabel);
17
+ this.actionButton = new PrimaryButton(model.actionLabel);
31
18
 
32
19
  const content = Column(
33
20
  navBar,
@@ -0,0 +1,18 @@
1
+ import { FlexBox, JustifyContent, Row, Unit } from "../../../fui/Fui";
2
+ import { NavPill } from "./NavPill";
3
+ import { homeRoute, settingsRoute } from "../routes";
4
+
5
+ function navSpacer(): FlexBox {
6
+ return new FlexBox().width(10.0, Unit.Pixel).height(1.0, Unit.Pixel);
7
+ }
8
+
9
+ export function createNavBar(homeIsActive: bool): FlexBox {
10
+ const homePill = new NavPill(homeRoute(), "Home").active(homeIsActive);
11
+ const settingsPill = new NavPill(settingsRoute(), "Settings").active(!homeIsActive);
12
+ return Row()
13
+ .width(100.0, Unit.Percent)
14
+ .justifyContent(JustifyContent.End)
15
+ .child(homePill)
16
+ .child(navSpacer())
17
+ .child(settingsPill);
18
+ }
@@ -1,4 +1,4 @@
1
- import { NavLink, Text, rgb } from "../../../../fui/Fui";
1
+ import { NavLink, Text, rgb } from "../../../fui/Fui";
2
2
 
3
3
  const PILL_RADIUS: f32 = 999.0;
4
4
  const PILL_PADDING_X: f32 = 16.0;
@@ -8,7 +8,7 @@ const PILL_ACTIVE_BG: u32 = rgb(34, 197, 94);
8
8
  const PILL_INACTIVE_TEXT: u32 = rgb(226, 232, 240);
9
9
  const PILL_ACTIVE_TEXT: u32 = rgb(12, 16, 24);
10
10
 
11
- export class MvcNavPill extends NavLink {
11
+ export class NavPill extends NavLink {
12
12
  private readonly labelNode: Text;
13
13
  private activeValue: bool = false;
14
14
 
@@ -1,4 +1,4 @@
1
- import { Button, rgb } from "../../../../fui/Fui";
1
+ import { Button, rgb } from "../../../fui/Fui";
2
2
 
3
3
  const BUTTON_RADIUS: f32 = 12.0;
4
4
  const BUTTON_PADDING_X: f32 = 18.0;
@@ -6,7 +6,7 @@ const BUTTON_PADDING_Y: f32 = 10.0;
6
6
  const BUTTON_BG: u32 = rgb(59, 130, 246);
7
7
  const BUTTON_TEXT: u32 = rgb(241, 245, 249);
8
8
 
9
- export class MvcPrimaryButton extends Button {
9
+ export class PrimaryButton extends Button {
10
10
  constructor(label: string) {
11
11
  super(label);
12
12
  this
@@ -1,10 +1,10 @@
1
- import { currentRoute } from "../../../fui/Fui";
1
+ import { currentRoute } from "../../fui/Fui";
2
2
 
3
3
  const SOURCE_DEMO_BASE: string = "/v2/fui-as/demo-mvc";
4
- const SOURCE_HOME_ROUTE: string = "/v2/fui-as/demo-mvc/mvc-home/";
5
- const SOURCE_SETTINGS_ROUTE: string = "/v2/fui-as/demo-mvc/mvc-settings/";
6
- const PUBLISHED_HOME_ROUTE: string = "/mvc-home/";
7
- const PUBLISHED_SETTINGS_ROUTE: string = "/mvc-settings/";
4
+ const SOURCE_HOME_ROUTE: string = "/v2/fui-as/demo-mvc/home/";
5
+ const SOURCE_SETTINGS_ROUTE: string = "/v2/fui-as/demo-mvc/settings/";
6
+ const PUBLISHED_HOME_ROUTE: string = "/home/";
7
+ const PUBLISHED_SETTINGS_ROUTE: string = "/settings/";
8
8
 
9
9
  function isSourceDemoRoute(route: string): bool {
10
10
  if (route.length == 0) {
@@ -13,10 +13,10 @@ function isSourceDemoRoute(route: string): bool {
13
13
  return route.startsWith(SOURCE_DEMO_BASE);
14
14
  }
15
15
 
16
- export function mvcHomeRoute(): string {
16
+ export function homeRoute(): string {
17
17
  return isSourceDemoRoute(currentRoute.value) ? SOURCE_HOME_ROUTE : PUBLISHED_HOME_ROUTE;
18
18
  }
19
19
 
20
- export function mvcSettingsRoute(): string {
20
+ export function settingsRoute(): string {
21
21
  return isSourceDemoRoute(currentRoute.value) ? SOURCE_SETTINGS_ROUTE : PUBLISHED_SETTINGS_ROUTE;
22
22
  }
@@ -165,11 +165,11 @@ function writeMvcSupportFiles(templateRoot) {
165
165
  <html lang="en">
166
166
  <head>
167
167
  <meta charset="utf-8" />
168
- <meta http-equiv="refresh" content="0; url=/mvc-home/" />
169
- <title>FUI-AS MVC App</title>
168
+ <meta http-equiv="refresh" content="0; url=/home/" />
169
+ <title>FUI-AS Routed App</title>
170
170
  </head>
171
171
  <body>
172
- <p>Redirecting to <a href="/mvc-home/">/mvc-home/</a>…</p>
172
+ <p>Redirecting to <a href="/home/">/home/</a>…</p>
173
173
  </body>
174
174
  </html>
175
175
  `);
@@ -178,8 +178,8 @@ function writeMvcSupportFiles(templateRoot) {
178
178
  const outputDir = "public";
179
179
  rmSync(outputDir, { recursive: true, force: true });
180
180
  mkdirSync(\`\${outputDir}/runtime\`, { recursive: true });
181
- mkdirSync(\`\${outputDir}/mvc-home\`, { recursive: true });
182
- mkdirSync(\`\${outputDir}/mvc-settings\`, { recursive: true });
181
+ mkdirSync(\`\${outputDir}/home\`, { recursive: true });
182
+ mkdirSync(\`\${outputDir}/settings\`, { recursive: true });
183
183
 
184
184
  cpSync("node_modules/@effindomv2/runtime/dist", \`\${outputDir}/runtime/dist\`, { recursive: true });
185
185
  cpSync("node_modules/@effindomv2/runtime/dist/fonts", \`\${outputDir}/runtime/fonts\`, { recursive: true });
@@ -193,18 +193,18 @@ writeFileSync(
193
193
  "utf8",
194
194
  );
195
195
  copyFileSync("index.html", \`\${outputDir}/index.html\`);
196
- copyFileSync("route-shell.html", \`\${outputDir}/mvc-home/index.html\`);
197
- copyFileSync("route-shell.html", \`\${outputDir}/mvc-settings/index.html\`);
196
+ copyFileSync("route-shell.html", \`\${outputDir}/home/index.html\`);
197
+ copyFileSync("route-shell.html", \`\${outputDir}/settings/index.html\`);
198
198
  `);
199
199
  writeTextFile(join(templateRoot, "scripts", "smoke.ts"), `import { accessSync } from "node:fs";
200
200
 
201
201
  const expectedFiles = [
202
202
  "public/index.html",
203
203
  "public/harness.js",
204
- "public/mvc-home/index.html",
205
- "public/mvc-settings/index.html",
206
- "public/mvc-home.wasm",
207
- "public/mvc-settings.wasm",
204
+ "public/home/index.html",
205
+ "public/settings/index.html",
206
+ "public/home.wasm",
207
+ "public/settings.wasm",
208
208
  "public/bridge.js",
209
209
  "public/effindom-runtime-config.js",
210
210
  "public/runtime/dist/effindom.v2.manifest.json",
@@ -219,8 +219,8 @@ for (const filePath of expectedFiles) {
219
219
  build: "npm run generate:host && npm run build:assets && npm run build:wasm && npm run build:harness",
220
220
  "build:assets": "tsx scripts/prepare-runtime.ts",
221
221
  "build:wasm": "npm run build:wasm:home && npm run build:wasm:settings",
222
- "build:wasm:home": "asc src/routes/mvc_home.ts --config asconfig.json --target release --outFile public/mvc-home.wasm",
223
- "build:wasm:settings": "asc src/routes/mvc_settings.ts --config asconfig.json --target release --outFile public/mvc-settings.wasm",
222
+ "build:wasm:home": "asc src/routes/HomeApp.ts --config asconfig.json --target release --outFile public/home.wasm",
223
+ "build:wasm:settings": "asc src/routes/SettingsApp.ts --config asconfig.json --target release --outFile public/settings.wasm",
224
224
  "build:harness": "esbuild harness.ts --bundle --format=esm --platform=browser --outfile=public/harness.js",
225
225
  "generate:host-services": "tsx ./node_modules/@effindomv2/fui-as/scripts/generate-host-services.ts src/host/host-services.ts appHostServices src/host/generated/HostServices.ts ../../fui/FuiPrimitives",
226
226
  "generate:host-events": "tsx ./node_modules/@effindomv2/fui-as/scripts/generate-host-events.ts src/host/host-events.ts appHostEvents src/host/generated/HostEvents.ts ../../fui/FuiPrimitives",
@@ -229,7 +229,7 @@ for (const filePath of expectedFiles) {
229
229
  serve: "http-server public -p 8080 -c-1",
230
230
  dev: 'npm run build && concurrently -k -n watch,serve "npm run watch" "npm run serve"',
231
231
  test: "npm run build && tsx scripts/smoke.ts",
232
- }, "Scaffolded FUI-AS MVC app");
232
+ }, "Scaffolded FUI-AS routed app");
233
233
  }
234
234
  function rewriteHarnessImports(filePath) {
235
235
  const original = readFileSync(filePath, "utf8");
@@ -256,6 +256,7 @@ function syncHelloTemplate() {
256
256
  cpSync(join(sourceRoot, "src"), templateSrcRoot, { recursive: true });
257
257
  cpSync(join(sourceRoot, "harness.ts"), join(templateRoot, "harness.ts"));
258
258
  cpSync(join(sourceRoot, "index.html"), join(templateRoot, "index.html"));
259
+ cpSync(join(sourceRoot, "README.md"), join(templateRoot, "README.md"));
259
260
  writeSharedSdkShims(templateRoot);
260
261
  writeAsconfig(templateRoot);
261
262
  writeTsconfig(templateRoot);
@@ -277,6 +278,7 @@ function syncMvcTemplate() {
277
278
  cpSync(join(sourceRoot, "src"), templateSrcRoot, { recursive: true });
278
279
  cpSync(join(sourceRoot, "harness.ts"), join(templateRoot, "harness.ts"));
279
280
  cpSync(join(sourceRoot, "route-shell.html"), join(templateRoot, "route-shell.html"));
281
+ cpSync(join(sourceRoot, "README.md"), join(templateRoot, "README.md"));
280
282
  writeSharedSdkShims(templateRoot);
281
283
  writeAsconfig(templateRoot);
282
284
  writeTsconfig(templateRoot);
@@ -1,2 +1,2 @@
1
- export declare const FUI_AS_VERSION = "0.1.2";
1
+ export declare const FUI_AS_VERSION = "0.1.4";
2
2
  export declare const RUNTIME_VERSION = "0.1.0";
@@ -1,2 +1,2 @@
1
- export const FUI_AS_VERSION = "0.1.2";
1
+ export const FUI_AS_VERSION = "0.1.4";
2
2
  export const RUNTIME_VERSION = "0.1.0";
@@ -21,6 +21,7 @@ test("createProject writes hello-world scaffold including AssemblyScript tsconfi
21
21
  assert.equal(typeof packageJson.scripts.test, "string");
22
22
  assert.equal(typeof packageJson.scripts["generate:host"], "string");
23
23
  assert.equal(readFileSync(join(target, "src", "HelloWorld.ts"), "utf8").includes("Hello world"), true);
24
+ assert.equal(readFileSync(join(target, "README.md"), "utf8").includes("Hello World scaffold guide"), true);
24
25
  assert.equal(readFileSync(join(target, "src", "fui", "Fui.ts"), "utf8").includes("@effindomv2/fui-as/src/Fui"), true);
25
26
  assert.equal(readFileSync(join(target, "src", "host", "host-events.ts"), "utf8").includes("appHostEvents"), true);
26
27
  assert.equal(readFileSync(join(target, "src", "host", "host-services.ts"), "utf8").includes("appHostServices"), true);
@@ -44,13 +45,15 @@ test("createProject writes mvc scaffold when template is mvc", () => {
44
45
  assert.equal(typeof packageJson.scripts["build:wasm:home"], "string");
45
46
  assert.equal(typeof packageJson.scripts["build:wasm:settings"], "string");
46
47
  assert.equal(typeof packageJson.scripts["generate:host"], "string");
47
- assert.equal(readFileSync(join(target, "src", "routes", "mvc", "pages", "home", "HomeController.ts"), "utf8").includes("HomeController"), true);
48
+ assert.equal(readFileSync(join(target, "src", "routes", "home", "HomeController.ts"), "utf8").includes("HomeController"), true);
49
+ assert.equal(readFileSync(join(target, "src", "routes", "HomeApp.ts"), "utf8").includes("createManagedApplication"), true);
50
+ assert.equal(readFileSync(join(target, "README.md"), "utf8").includes("MVC scaffold guide"), true);
48
51
  assert.equal(readFileSync(join(target, "src", "host", "host-events.ts"), "utf8").includes("appHostEvents"), true);
49
52
  assert.equal(readFileSync(join(target, "src", "host", "host-services.ts"), "utf8").includes("appHostServices"), true);
50
53
  assert.equal(readFileSync(join(target, "src", "fui", "Fui.ts"), "utf8").includes("@effindomv2/fui-as/src/Fui"), true);
51
54
  assert.equal(readFileSync(join(target, "src", "host", "generated", "HostEvents.ts"), "utf8").includes("onAppClockTick"), true);
52
55
  assert.equal(readFileSync(join(target, "src", "host", "generated", "HostServices.ts"), "utf8").includes("appClockNowUnixSeconds"), true);
53
- assert.equal(readFileSync(join(target, "route-shell.html"), "utf8").includes("FUI-AS MVC Demo"), true);
56
+ assert.equal(readFileSync(join(target, "route-shell.html"), "utf8").includes("FUI-AS Routed Demo"), true);
54
57
  }
55
58
  finally {
56
59
  rmSync(root, { recursive: true, force: true });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@effindomv2/create-fui-as-app",
3
- "version": "0.1.5",
3
+ "version": "0.1.6",
4
4
  "private": false,
5
5
  "license": "MIT",
6
6
  "description": "Scaffold a minimal EffinDom v2 FUI-AS app",
@@ -1,20 +0,0 @@
1
- export * from "../fui/FuiExports";
2
- export * from "../host/generated/HostEvents";
3
-
4
- import { Node, createManagedApplication } from "../fui/Fui";
5
- import { HomeController } from "./mvc/pages/home/HomeController";
6
-
7
- const app = createManagedApplication<HomeController>(
8
- () => new HomeController(),
9
- (controller): Node => controller.getRoot(),
10
- (controller): void => controller.mount(),
11
- (controller): void => controller.dispose(),
12
- );
13
-
14
- export function __runApp(): void {
15
- app.run();
16
- }
17
-
18
- export function __disposeApp(): void {
19
- app.dispose();
20
- }
@@ -1,20 +0,0 @@
1
- export * from "../fui/FuiExports";
2
- export * from "../host/generated/HostEvents";
3
-
4
- import { Node, createManagedApplication } from "../fui/Fui";
5
- import { SettingsController } from "./mvc/pages/settings/SettingsController";
6
-
7
- const app = createManagedApplication<SettingsController>(
8
- () => new SettingsController(),
9
- (controller): Node => controller.getRoot(),
10
- (controller): void => controller.mount(),
11
- (controller): void => controller.dispose(),
12
- );
13
-
14
- export function __runApp(): void {
15
- app.run();
16
- }
17
-
18
- export function __disposeApp(): void {
19
- app.dispose();
20
- }