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 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
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "create-outsystems-astro",
3
3
  "type": "module",
4
- "version": "0.5.0",
4
+ "version": "0.6.0",
5
5
  "description": "Create an OutSystems Astro Island project to import as a component into your OutSystems application",
6
6
  "repository": {
7
7
  "type": "git",
@@ -1,4 +1,5 @@
1
1
  .github/
2
+ .prettierrc
2
3
  bun.lock
3
4
  deno.json
4
5
  deno.lock
@@ -9,4 +10,5 @@ package-lock.json
9
10
  package.json
10
11
  patches/
11
12
  pnpm-lock.yaml
13
+ pnpm-workspace.yaml
12
14
  yarn.lock
@@ -0,0 +1,4 @@
1
+ {
2
+ "plugins": ["prettier-plugin-svelte"],
3
+ "overrides": [{ "files": "*.svelte", "options": { "parser": "svelte" } }]
4
+ }
@@ -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
- - React: `client:only="react"`.
36
- - Vue: `client:only="vue"`.
37
- - Angular: `client:visible`.
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}/ (src/framework/angular, src/framework/react and src/framework/vue ) with each framework having its own folder. 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
+ - 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>Slot content!</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>Slot content!</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,