create-outsystems-astro 0.5.0 → 0.6.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 +6 -1
- package/package.json +1 -1
- package/template/.prettierignore +2 -0
- package/template/.prettierrc +4 -0
- package/template/AGENTS.md +56 -20
- package/template/astro.config.mjs +2 -0
- package/template/bun.lock +370 -663
- package/template/deno.json +1 -9
- package/template/deno.lock +732 -582
- package/template/eslint.config.mjs +18 -0
- package/template/output.ts +14 -2
- package/template/package-lock.json +2753 -2931
- package/template/package.json +34 -69
- package/template/pnpm-lock.yaml +1438 -1366
- package/template/pnpm-workspace.yaml +6 -0
- package/template/src/framework/svelte/Counter.svelte +77 -0
- package/template/src/pages/angular/angular-counter.astro +27 -23
- package/template/src/pages/react/react-counter.astro +54 -49
- package/template/src/pages/svelte/svelte-counter.astro +63 -0
- package/template/src/pages/vue/vue-counter.astro +58 -53
- package/template/svelte.config.js +5 -0
- package/template/test/e2e/svelte/svelte-counter.spec.ts +42 -0
- package/template/test/integration/svelte/Counter.test.ts +81 -0
- package/template/test/integration/svelte/SlotCounter.wrapper.svelte +27 -0
- package/template/vitest.config.ts +17 -2
- package/template/yarn.lock +1842 -2120
package/bin/cli.js
CHANGED
|
@@ -17,13 +17,14 @@ const __dirname = path.dirname(__filename);
|
|
|
17
17
|
const FRAMEWORKS = [
|
|
18
18
|
{ title: "Angular", value: "angular" },
|
|
19
19
|
{ title: "React", value: "react" },
|
|
20
|
+
{ title: "Svelte", value: "svelte" },
|
|
20
21
|
{ title: "Vue", value: "vue" }
|
|
21
22
|
];
|
|
22
23
|
|
|
23
24
|
const LOCKFILES = {
|
|
24
25
|
npm: ["package-lock.json"],
|
|
25
26
|
yarn: ["yarn.lock"],
|
|
26
|
-
pnpm: ["pnpm-lock.yaml"],
|
|
27
|
+
pnpm: ["pnpm-lock.yaml", "pnpm-workspace.yaml"],
|
|
27
28
|
bun: ["bun.lock"],
|
|
28
29
|
deno: ["deno.lock", "deno.json"]
|
|
29
30
|
};
|
|
@@ -156,6 +157,10 @@ function updateAstroConfig(projectDir, selectedFrameworks) {
|
|
|
156
157
|
import: /import\s+react\s+from\s+['"]@astrojs\/react['"];\s*\n?/,
|
|
157
158
|
integration: /react\(\)\s*,?\s*/
|
|
158
159
|
},
|
|
160
|
+
svelte: {
|
|
161
|
+
import: /import\s+svelte\s+from\s+['"]@astrojs\/svelte['"];\s*\n?/,
|
|
162
|
+
integration: /svelte\(\)\s*,?\s*/
|
|
163
|
+
},
|
|
159
164
|
vue: {
|
|
160
165
|
import: /import\s+vue\s+from\s+['"]@astrojs\/vue['"];\s*\n?/,
|
|
161
166
|
integration: /vue\(\)\s*,?\s*/
|
package/package.json
CHANGED
package/template/.prettierignore
CHANGED
package/template/.prettierrc
CHANGED
package/template/AGENTS.md
CHANGED
|
@@ -31,14 +31,20 @@ In OutSystems Developer Cloud, the Islands library is available at https://www.o
|
|
|
31
31
|
### Pages
|
|
32
32
|
|
|
33
33
|
- The files in src/pages/\*.astro are used as a starting point and holds the components for generation. They can be tested by running `npm run dev`. That will show what the component looks like as rendered. The sample example pages are broken out by framework name (src/pages/react, src/pages/vue, etc). This page will house the component(s) entry points.
|
|
34
|
-
- When importing a component, the component must have the attribute of the client:only= + the framework name
|
|
35
|
-
-
|
|
36
|
-
-
|
|
37
|
-
-
|
|
34
|
+
- When importing a component, the component must have the attribute of the client:only= + the framework name.\
|
|
35
|
+
- Angular: `client:visible`
|
|
36
|
+
- React: `client:only="react"`
|
|
37
|
+
- Svelte: `client:only="svelte"`
|
|
38
|
+
- Vue: `client:only="vue"`
|
|
38
39
|
|
|
39
40
|
### Components
|
|
40
41
|
|
|
41
|
-
- The components live in the folder framework/{NAME}
|
|
42
|
+
- The components live in the folder framework/{NAME}/:
|
|
43
|
+
- Angular: src/framework/angular
|
|
44
|
+
- React: src/framework/react
|
|
45
|
+
- Svelte: src/framework/svelte
|
|
46
|
+
- Vue: src/framework/vue
|
|
47
|
+
The framework folder should stay in place as the components will be rendered from there. The Angular components will only be transformed by Astro if they are in the framework/angular folder.
|
|
42
48
|
|
|
43
49
|
### Parameters
|
|
44
50
|
|
|
@@ -49,6 +55,10 @@ In OutSystems Developer Cloud, the Islands library is available at https://www.o
|
|
|
49
55
|
|
|
50
56
|
Astro slots can be sent in. A slot can be either the default one or the named one. Each framework handles slots differently. Slots can only be HTML elements and cannot be components of a framework.
|
|
51
57
|
|
|
58
|
+
##### Angular
|
|
59
|
+
|
|
60
|
+
Angular does not support the use of slots. Any use of slots with Angular should be discouraged.
|
|
61
|
+
|
|
52
62
|
##### React
|
|
53
63
|
|
|
54
64
|
- In React, slots are handled as props. The default slot is the `children` prop. A named slot will have the name of its slot as the parameter. For example, a slot with the following:
|
|
@@ -67,10 +77,10 @@ import CounterComponent from '../../framework/react/Counter';
|
|
|
67
77
|
---
|
|
68
78
|
<CounterComponent client:only="react">
|
|
69
79
|
<div slot="header">
|
|
70
|
-
Counter
|
|
80
|
+
Counter Component
|
|
71
81
|
</div>
|
|
72
82
|
<div style="text-align: center;">
|
|
73
|
-
<p>
|
|
83
|
+
<p>This is content passed into the component.</p>
|
|
74
84
|
</div>
|
|
75
85
|
</CounterComponent>
|
|
76
86
|
```
|
|
@@ -97,6 +107,31 @@ export default function Counter({
|
|
|
97
107
|
}
|
|
98
108
|
```
|
|
99
109
|
|
|
110
|
+
##### Svelte
|
|
111
|
+
|
|
112
|
+
- In Svelte, slots are handled as by using the <slot /> tag. The default slot is the is just <slot />. A named slot will have the name of its slot as an attribute such as <slot name="header" />. Placement of the slot will determine where the slot will render.
|
|
113
|
+
|
|
114
|
+
```js
|
|
115
|
+
---
|
|
116
|
+
import CounterComponent from "../../framework/svelte/Counter.svelte";
|
|
117
|
+
---
|
|
118
|
+
<CounterComponent client:only="svelte">
|
|
119
|
+
<div class="counter-title" slot="header">Counter Component</div>
|
|
120
|
+
<div style="text-align: center;">
|
|
121
|
+
<p><strong>This is content passed into the component.</strong></p>
|
|
122
|
+
</div>
|
|
123
|
+
</CounterComponent>
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
the slots can be used as:
|
|
127
|
+
|
|
128
|
+
```svelte
|
|
129
|
+
<slot name="header" />
|
|
130
|
+
<div>
|
|
131
|
+
<slot />
|
|
132
|
+
</div>
|
|
133
|
+
```
|
|
134
|
+
|
|
100
135
|
##### Vue
|
|
101
136
|
|
|
102
137
|
- In Vue, slots are handled as by using the <slot /> tag. The default slot is the is just <slot />. A named slot will have the name of its slot as an attribute such as <slot name="header" />. Placement of the slot will determine where the slot will render.
|
|
@@ -107,10 +142,10 @@ import CounterComponent from '../../framework/react/Counter';
|
|
|
107
142
|
---
|
|
108
143
|
<CounterComponent client:only="vue">
|
|
109
144
|
<div slot="header">
|
|
110
|
-
Counter
|
|
145
|
+
Counter Component
|
|
111
146
|
</div>
|
|
112
147
|
<div style="text-align: center;">
|
|
113
|
-
<p>
|
|
148
|
+
<p>This is content passed into the component.</p>
|
|
114
149
|
</div>
|
|
115
150
|
</CounterComponent>
|
|
116
151
|
```
|
|
@@ -126,10 +161,6 @@ the slots can be used as:
|
|
|
126
161
|
</template>
|
|
127
162
|
```
|
|
128
163
|
|
|
129
|
-
##### Angular
|
|
130
|
-
|
|
131
|
-
Angular does not support the use of slots. Any use of slots with Angular should be discouraged.
|
|
132
|
-
|
|
133
164
|
### Nano Stores
|
|
134
165
|
|
|
135
166
|
The Nano Stores library - https://github.com/nanostores/nanostores - is supported for both sharing state between different Islands or from OutSystems to an Island. This could be used in place of a parameter, but parameters should be the default method.
|
|
@@ -155,15 +186,22 @@ export default function Counter({}) {
|
|
|
155
186
|
|
|
156
187
|
return (
|
|
157
188
|
<>
|
|
158
|
-
<div>
|
|
159
|
-
<strong>Nano Store value:</strong>
|
|
160
|
-
<div>{nanoStoreValue}</div>
|
|
161
|
-
</div>
|
|
189
|
+
<div>{nanoStoreValue}</div>
|
|
162
190
|
</>
|
|
163
191
|
);
|
|
164
192
|
}
|
|
165
193
|
```
|
|
166
194
|
|
|
195
|
+
#### Svelte
|
|
196
|
+
|
|
197
|
+
```svelte
|
|
198
|
+
<script lang="ts">
|
|
199
|
+
const nanoStoreValue = (window as any).Stores["svelteStore"];
|
|
200
|
+
</script>
|
|
201
|
+
|
|
202
|
+
<div>{$nanoStoreValue}</div>
|
|
203
|
+
```
|
|
204
|
+
|
|
167
205
|
#### Vue
|
|
168
206
|
|
|
169
207
|
```vue
|
|
@@ -173,9 +211,7 @@ const nanoStoreValue = useStore(window.Stores["MyGreatStore"]);
|
|
|
173
211
|
</script>
|
|
174
212
|
|
|
175
213
|
<template>
|
|
176
|
-
<div>
|
|
177
|
-
<div>{{ nanoStoreValue }}</div>
|
|
178
|
-
</div>
|
|
214
|
+
<div>{{ nanoStoreValue }}</div>
|
|
179
215
|
</template>
|
|
180
216
|
```
|
|
181
217
|
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
// @ts-check
|
|
2
2
|
import angular from "@analogjs/astro-angular";
|
|
3
3
|
import react from "@astrojs/react";
|
|
4
|
+
import svelte from "@astrojs/svelte";
|
|
4
5
|
import vue from "@astrojs/vue";
|
|
5
6
|
import { defineConfig } from "astro/config";
|
|
6
7
|
|
|
@@ -19,6 +20,7 @@ export default defineConfig({
|
|
|
19
20
|
}),
|
|
20
21
|
react(),
|
|
21
22
|
vue(),
|
|
23
|
+
svelte(),
|
|
22
24
|
],
|
|
23
25
|
server: {
|
|
24
26
|
host: true,
|