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.
Files changed (62) hide show
  1. package/bin/cli.js +42 -1
  2. package/integrations/.prettierignore +15 -0
  3. package/integrations/.yarn/releases/yarn-4.15.0.cjs +940 -0
  4. package/integrations/.yarnrc.yml +6 -0
  5. package/integrations/bun.lock +1250 -0
  6. package/integrations/bunfig.toml +3 -0
  7. package/integrations/deno.json +4 -0
  8. package/integrations/deno.lock +3943 -0
  9. package/integrations/eslint.config.mjs +61 -0
  10. package/integrations/html/client.ts +30 -0
  11. package/integrations/html/index.ts +57 -0
  12. package/integrations/html/server.ts +54 -0
  13. package/integrations/package-lock.json +8926 -0
  14. package/integrations/package.json +42 -0
  15. package/integrations/pnpm-lock.yaml +5562 -0
  16. package/integrations/pnpm-workspace.yaml +4 -0
  17. package/integrations/tsconfig.json +16 -0
  18. package/integrations/twig/client.ts +34 -0
  19. package/integrations/twig/index.ts +185 -0
  20. package/integrations/twig/server.ts +54 -0
  21. package/integrations/yarn.lock +6375 -0
  22. package/package.json +3 -1
  23. package/template/.github/workflows/deno-test.yml +1 -1
  24. package/template/.github/workflows/npm-test.yml +1 -1
  25. package/template/.github/workflows/pnpm-test.yml +2 -2
  26. package/template/.github/workflows/yarn-test.yml +26 -13
  27. package/template/.gitignore +4 -0
  28. package/template/.prettierignore +1 -0
  29. package/template/.yarn/releases/yarn-4.15.0.cjs +940 -0
  30. package/template/.yarnrc.yml +8 -0
  31. package/template/AGENTS.md +93 -1
  32. package/template/README.md +15 -0
  33. package/template/astro.config.mjs +8 -0
  34. package/template/bun.lock +281 -367
  35. package/template/bunfig.toml +3 -0
  36. package/template/deno.json +3 -11
  37. package/template/deno.lock +703 -676
  38. package/template/eslint.config.mjs +1 -0
  39. package/template/package-lock.json +705 -787
  40. package/template/package.json +38 -41
  41. package/template/pnpm-lock.yaml +1126 -1114
  42. package/template/pnpm-workspace.yaml +5 -0
  43. package/template/src/env.d.ts +6 -0
  44. package/template/src/framework/html/Demo.ts +105 -0
  45. package/template/src/framework/html/Store.ts +47 -0
  46. package/template/src/framework/twig/Demo.twig +100 -0
  47. package/template/src/framework/twig/Store.twig +45 -0
  48. package/template/src/images/html.png +0 -0
  49. package/template/src/images/twig.png +0 -0
  50. package/template/src/pages/html/html-demo.astro +61 -0
  51. package/template/src/pages/multi/store.astro +13 -1
  52. package/template/src/pages/twig/twig-demo.astro +65 -0
  53. package/template/src/stores/framework.ts +2 -0
  54. package/template/test/e2e/html/html-demo.spec.ts +36 -0
  55. package/template/test/e2e/twig/twig-demo.spec.ts +36 -0
  56. package/template/test/integration/html/Demo.test.ts +83 -0
  57. package/template/test/integration/twig/Demo.test.ts +84 -0
  58. package/template/tsconfig.json +1 -1
  59. package/template/vitest.config.ts +18 -0
  60. package/template/yarn.lock +14777 -10350
  61. /package/template/patches/{@analogjs+astro-angular+2.5.1.patch → @analogjs+astro-angular+2.5.2.patch} +0 -0
  62. /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
+ });
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "extends": "astro/tsconfigs/strict",
3
3
  "include": [".astro/types.d.ts", "**/*"],
4
- "exclude": ["dist"],
4
+ "exclude": [".integrations", "dist", "output"],
5
5
  "compilerOptions": {
6
6
  "jsx": "preserve",
7
7
  "types": ["node", "vitest/globals"]
@@ -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],