create-outsystems-astro 0.9.0 → 0.11.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/bin/cli.js +42 -1
- package/integrations/.prettierignore +15 -0
- package/integrations/.yarn/releases/yarn-4.15.0.cjs +940 -0
- package/integrations/.yarnrc.yml +6 -0
- package/integrations/bun.lock +1250 -0
- package/integrations/bunfig.toml +3 -0
- package/integrations/deno.json +4 -0
- package/integrations/deno.lock +3943 -0
- package/integrations/eslint.config.mjs +61 -0
- package/integrations/html/client.ts +30 -0
- package/integrations/html/index.ts +57 -0
- package/integrations/html/server.ts +54 -0
- package/integrations/package-lock.json +8926 -0
- package/integrations/package.json +42 -0
- package/integrations/pnpm-lock.yaml +5562 -0
- package/integrations/pnpm-workspace.yaml +4 -0
- package/integrations/tsconfig.json +16 -0
- package/integrations/twig/client.ts +34 -0
- package/integrations/twig/index.ts +185 -0
- package/integrations/twig/server.ts +54 -0
- package/integrations/yarn.lock +6375 -0
- package/package.json +3 -1
- package/template/.github/workflows/deno-test.yml +1 -1
- package/template/.github/workflows/npm-test.yml +1 -1
- package/template/.github/workflows/pnpm-test.yml +2 -2
- package/template/.github/workflows/yarn-test.yml +26 -13
- package/template/.gitignore +4 -0
- package/template/.prettierignore +1 -0
- package/template/.yarn/releases/yarn-4.15.0.cjs +940 -0
- package/template/.yarnrc.yml +8 -0
- package/template/AGENTS.md +93 -1
- package/template/README.md +15 -0
- package/template/astro.config.mjs +8 -0
- package/template/bun.lock +281 -367
- package/template/bunfig.toml +3 -0
- package/template/deno.json +3 -11
- package/template/deno.lock +703 -676
- package/template/eslint.config.mjs +1 -0
- package/template/package-lock.json +705 -787
- package/template/package.json +38 -41
- package/template/pnpm-lock.yaml +1126 -1114
- package/template/pnpm-workspace.yaml +5 -0
- package/template/src/env.d.ts +6 -0
- package/template/src/framework/html/Demo.ts +105 -0
- package/template/src/framework/html/Store.ts +47 -0
- package/template/src/framework/twig/Demo.twig +100 -0
- package/template/src/framework/twig/Store.twig +45 -0
- package/template/src/images/html.png +0 -0
- package/template/src/images/twig.png +0 -0
- package/template/src/pages/html/html-demo.astro +61 -0
- package/template/src/pages/multi/store.astro +13 -1
- package/template/src/pages/twig/twig-demo.astro +65 -0
- package/template/src/stores/framework.ts +2 -0
- package/template/test/e2e/html/html-demo.spec.ts +36 -0
- package/template/test/e2e/twig/twig-demo.spec.ts +36 -0
- package/template/test/integration/html/Demo.test.ts +83 -0
- package/template/test/integration/twig/Demo.test.ts +84 -0
- package/template/tsconfig.json +1 -1
- package/template/vitest.config.ts +18 -0
- package/template/yarn.lock +14777 -10350
- /package/template/patches/{@analogjs+astro-angular+2.5.1.patch → @analogjs+astro-angular+2.5.2.patch} +0 -0
- /package/template/patches/{@angular+build+21.2.11.patch → @angular+build+21.2.12.patch} +0 -0
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import { fireEvent, screen } from "@testing-library/dom";
|
|
2
|
+
import Twig from "twig";
|
|
3
|
+
import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
|
|
4
|
+
|
|
5
|
+
import template from "../../../src/framework/twig/Demo.twig?raw";
|
|
6
|
+
|
|
7
|
+
function renderDemo(props: Record<string, unknown> = {}) {
|
|
8
|
+
document.body.innerHTML = Twig.twig({ data: template }).render(props);
|
|
9
|
+
document.body.querySelectorAll("script").forEach((script) => {
|
|
10
|
+
new Function(script.textContent ?? "")();
|
|
11
|
+
});
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
describe("Demo", () => {
|
|
15
|
+
let capturedListener: ((val: string) => void) | undefined;
|
|
16
|
+
let storeValue = "Mocked Nano Value";
|
|
17
|
+
|
|
18
|
+
beforeEach(() => {
|
|
19
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
20
|
+
(window as any).mockFunction = vi.fn();
|
|
21
|
+
|
|
22
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
23
|
+
(window as any).Stores = {
|
|
24
|
+
twigStore: {
|
|
25
|
+
get: vi.fn(() => storeValue),
|
|
26
|
+
set: vi.fn((v: string) => {
|
|
27
|
+
storeValue = v;
|
|
28
|
+
capturedListener?.(v);
|
|
29
|
+
}),
|
|
30
|
+
subscribe: vi.fn((fn: (val: string) => void) => {
|
|
31
|
+
capturedListener = fn;
|
|
32
|
+
fn(storeValue);
|
|
33
|
+
return () => {};
|
|
34
|
+
}),
|
|
35
|
+
},
|
|
36
|
+
};
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
afterEach(() => {
|
|
40
|
+
vi.clearAllMocks();
|
|
41
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
42
|
+
delete (window as any).mockFunction;
|
|
43
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
44
|
+
delete (window as any).Stores;
|
|
45
|
+
capturedListener = undefined;
|
|
46
|
+
storeValue = "Mocked Nano Value";
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
it("renders the initial count", () => {
|
|
50
|
+
renderDemo({ initialCount: 5 });
|
|
51
|
+
expect(screen.getByText("5")).toBeInTheDocument();
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
it("increments count when add button is clicked", () => {
|
|
55
|
+
renderDemo({ initialCount: 5 });
|
|
56
|
+
fireEvent.click(screen.getByRole("button", { name: "+" }));
|
|
57
|
+
expect(screen.getByText("6")).toBeInTheDocument();
|
|
58
|
+
});
|
|
59
|
+
|
|
60
|
+
it("decrements count when subtract button is clicked", () => {
|
|
61
|
+
renderDemo({ initialCount: 5 });
|
|
62
|
+
fireEvent.click(screen.getByRole("button", { name: "-" }));
|
|
63
|
+
expect(screen.getByText("4")).toBeInTheDocument();
|
|
64
|
+
});
|
|
65
|
+
|
|
66
|
+
it("calls the show message function with the current count", () => {
|
|
67
|
+
renderDemo({ initialCount: 5, showMessage: "mockFunction" });
|
|
68
|
+
fireEvent.click(screen.getByRole("button", { name: "Send value" }));
|
|
69
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
70
|
+
expect((window as any).mockFunction).toHaveBeenCalledWith(5);
|
|
71
|
+
});
|
|
72
|
+
|
|
73
|
+
it("displays the initial nanostore value", () => {
|
|
74
|
+
renderDemo({});
|
|
75
|
+
expect(screen.getByText("Mocked Nano Value")).toBeInTheDocument();
|
|
76
|
+
});
|
|
77
|
+
|
|
78
|
+
it("updates the display when the nanostore value changes", () => {
|
|
79
|
+
renderDemo({});
|
|
80
|
+
expect(screen.getByText("Mocked Nano Value")).toBeInTheDocument();
|
|
81
|
+
capturedListener?.("Updated Value");
|
|
82
|
+
expect(screen.getByText("Updated Value")).toBeInTheDocument();
|
|
83
|
+
});
|
|
84
|
+
});
|
package/template/tsconfig.json
CHANGED
|
@@ -22,6 +22,15 @@ export default defineConfig(({ mode }) => ({
|
|
|
22
22
|
setupFiles: ["test/setup-test-env-angular.ts"],
|
|
23
23
|
},
|
|
24
24
|
},
|
|
25
|
+
{
|
|
26
|
+
test: {
|
|
27
|
+
environment: "happy-dom",
|
|
28
|
+
globals: true,
|
|
29
|
+
include: ["test/integration/html/**/*.test.ts"],
|
|
30
|
+
name: "html",
|
|
31
|
+
setupFiles: ["test/setup-test-env.ts"],
|
|
32
|
+
},
|
|
33
|
+
},
|
|
25
34
|
{
|
|
26
35
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
27
36
|
plugins: [preact() as any],
|
|
@@ -69,6 +78,15 @@ export default defineConfig(({ mode }) => ({
|
|
|
69
78
|
setupFiles: ["test/setup-test-env.ts"],
|
|
70
79
|
},
|
|
71
80
|
},
|
|
81
|
+
{
|
|
82
|
+
test: {
|
|
83
|
+
environment: "happy-dom",
|
|
84
|
+
globals: true,
|
|
85
|
+
include: ["test/integration/twig/**/*.test.ts"],
|
|
86
|
+
name: "twig",
|
|
87
|
+
setupFiles: ["test/setup-test-env.ts"],
|
|
88
|
+
},
|
|
89
|
+
},
|
|
72
90
|
{
|
|
73
91
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
74
92
|
plugins: [vue() as any],
|