astro-tractstack 2.0.0-rc.22 → 2.0.0-rc.24
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/create-tractstack.js +22 -0
- package/dist/index.js +4 -0
- package/package.json +1 -1
- package/templates/custom/minimal/CodeHook.astro +4 -2
- package/templates/custom/with-examples/CodeHook.astro +4 -2
- package/templates/src/client/htmx.min.js +3519 -0
- package/templates/src/layouts/Layout.astro +12 -9
- package/utils/inject-files.ts +4 -0
package/bin/create-tractstack.js
CHANGED
|
@@ -35,6 +35,7 @@ function getEnvState() {
|
|
|
35
35
|
tenantId: 'default',
|
|
36
36
|
goBackendPath: `${homedir()}/t8k-go-server/`,
|
|
37
37
|
enableMultiTenant: false,
|
|
38
|
+
enableBunny: false,
|
|
38
39
|
};
|
|
39
40
|
|
|
40
41
|
const found = {
|
|
@@ -42,6 +43,7 @@ function getEnvState() {
|
|
|
42
43
|
tenantId: false,
|
|
43
44
|
goBackendPath: false,
|
|
44
45
|
enableMultiTenant: false,
|
|
46
|
+
enableBunny: false,
|
|
45
47
|
};
|
|
46
48
|
|
|
47
49
|
if (!existsSync('.env')) {
|
|
@@ -78,12 +80,15 @@ function getEnvState() {
|
|
|
78
80
|
enableMultiTenant:
|
|
79
81
|
envVars.PUBLIC_ENABLE_MULTI_TENANT === 'true' ||
|
|
80
82
|
defaults.enableMultiTenant,
|
|
83
|
+
enableBunny:
|
|
84
|
+
envVars.PUBLIC_ENABLE_BUNNY === 'true' || defaults.enableBunny,
|
|
81
85
|
},
|
|
82
86
|
envState: {
|
|
83
87
|
goBackend: !!envVars.PUBLIC_GO_BACKEND,
|
|
84
88
|
tenantId: !!envVars.PUBLIC_TENANTID,
|
|
85
89
|
goBackendPath: !!envVars.PRIVATE_GO_BACKEND_PATH,
|
|
86
90
|
enableMultiTenant: envVars.PUBLIC_ENABLE_MULTI_TENANT !== undefined,
|
|
91
|
+
enableBunny: envVars.PUBLIC_ENABLE_BUNNY !== undefined,
|
|
87
92
|
},
|
|
88
93
|
};
|
|
89
94
|
} catch (error) {
|
|
@@ -207,6 +212,21 @@ ${kleur.bold('Examples:')}
|
|
|
207
212
|
);
|
|
208
213
|
}
|
|
209
214
|
|
|
215
|
+
if (!envState.enableBunny) {
|
|
216
|
+
promptQuestions.push({
|
|
217
|
+
type: 'confirm',
|
|
218
|
+
name: 'enableBunny',
|
|
219
|
+
message: 'Enable Bunny Video Player?',
|
|
220
|
+
initial: envDefaults.enableBunny,
|
|
221
|
+
});
|
|
222
|
+
} else {
|
|
223
|
+
console.log(
|
|
224
|
+
kleur.green(
|
|
225
|
+
`✓ Bunny Video Player: ${envDefaults.enableBunny ? 'enabled' : 'disabled'}`
|
|
226
|
+
)
|
|
227
|
+
);
|
|
228
|
+
}
|
|
229
|
+
|
|
210
230
|
// Only prompt for tenantId if multi-tenant will be enabled and tenantId not in .env
|
|
211
231
|
const willEnableMultiTenant =
|
|
212
232
|
enableMultiTenant || envDefaults.enableMultiTenant;
|
|
@@ -261,6 +281,7 @@ ${kleur.bold('Examples:')}
|
|
|
261
281
|
responses.enableMultiTenant === true || // explicit true from prompt
|
|
262
282
|
enableMultiTenant || // CLI flag --multi-tenant
|
|
263
283
|
envDefaults.enableMultiTenant === true, // existing .env value was "true"
|
|
284
|
+
enableBunny: responses.enableBunny ?? envDefaults.enableBunny,
|
|
264
285
|
tenantId: responses.tenantId || envDefaults.tenantId,
|
|
265
286
|
goBackendPath: responses.goBackendPath || envDefaults.goBackendPath,
|
|
266
287
|
includeExamples: responses.includeExamples ?? includeExamples,
|
|
@@ -287,6 +308,7 @@ PUBLIC_GO_BACKEND="${finalResponses.goBackend}"
|
|
|
287
308
|
PUBLIC_TENANTID="${finalTenantId}"
|
|
288
309
|
PRIVATE_GO_BACKEND_PATH="${finalResponses.goBackendPath.endsWith('/') ? finalResponses.goBackendPath : finalResponses.goBackendPath + '/'}"
|
|
289
310
|
PUBLIC_ENABLE_MULTI_TENANT="${finalResponses.enableMultiTenant ? 'true' : 'false'}"
|
|
311
|
+
PUBLIC_ENABLE_BUNNY="${finalResponses.enableBunny ? 'true' : 'false'}"
|
|
290
312
|
`;
|
|
291
313
|
|
|
292
314
|
try {
|
package/dist/index.js
CHANGED
|
@@ -1252,6 +1252,10 @@ async function w(t, e, c) {
|
|
|
1252
1252
|
dest: "src/lib/session.ts"
|
|
1253
1253
|
},
|
|
1254
1254
|
// Client Scripts
|
|
1255
|
+
{
|
|
1256
|
+
src: t("../templates/src/client/htmx.min.js"),
|
|
1257
|
+
dest: "public/client/htmx.min.js"
|
|
1258
|
+
},
|
|
1255
1259
|
{
|
|
1256
1260
|
src: t("../templates/src/client/sse.js"),
|
|
1257
1261
|
dest: "public/client/sse.js"
|
package/package.json
CHANGED
|
@@ -20,10 +20,12 @@ export interface Props {
|
|
|
20
20
|
|
|
21
21
|
const { target, options, fullContentMap /*, resourcesPayload */ } = Astro.props;
|
|
22
22
|
|
|
23
|
+
const enableBunny = import.meta.env.PUBLIC_ENABLE_BUNNY === 'true';
|
|
24
|
+
|
|
23
25
|
export const components = {
|
|
24
26
|
'featured-content': true,
|
|
25
27
|
'list-content': true,
|
|
26
|
-
'bunny-video': true,
|
|
28
|
+
...(enableBunny && { 'bunny-video': true }),
|
|
27
29
|
epinet: true,
|
|
28
30
|
// "custom-hero": true, // Uncomment when you create CustomHero.astro
|
|
29
31
|
};
|
|
@@ -34,7 +36,7 @@ export const components = {
|
|
|
34
36
|
<ListContent options={options} contentMap={fullContentMap} />
|
|
35
37
|
) : target === 'featured-content' ? (
|
|
36
38
|
<FeaturedContent options={options} contentMap={fullContentMap} />
|
|
37
|
-
) : target === 'bunny-video' ? (
|
|
39
|
+
) : target === 'bunny-video' && enableBunny ? (
|
|
38
40
|
<BunnyVideoWrapper options={options} />
|
|
39
41
|
) : target === 'epinet' ? (
|
|
40
42
|
<EpinetWrapper fullContentMap={fullContentMap} client:only="react" /> /*
|
|
@@ -20,11 +20,13 @@ export interface Props {
|
|
|
20
20
|
|
|
21
21
|
const { target, options, fullContentMap /*, resourcesPayload */ } = Astro.props;
|
|
22
22
|
|
|
23
|
+
const enableBunny = import.meta.env.PUBLIC_ENABLE_BUNNY === 'true';
|
|
24
|
+
|
|
23
25
|
export const components = {
|
|
24
26
|
'custom-hero': true,
|
|
25
27
|
'featured-content': true,
|
|
26
28
|
'list-content': true,
|
|
27
|
-
'bunny-video': true,
|
|
29
|
+
...(enableBunny && { 'bunny-video': true }),
|
|
28
30
|
epinet: true,
|
|
29
31
|
};
|
|
30
32
|
---
|
|
@@ -34,7 +36,7 @@ export const components = {
|
|
|
34
36
|
<ListContent options={options} contentMap={fullContentMap} />
|
|
35
37
|
) : target === 'featured-content' ? (
|
|
36
38
|
<FeaturedContent options={options} contentMap={fullContentMap} />
|
|
37
|
-
) : target === 'bunny-video' ? (
|
|
39
|
+
) : target === 'bunny-video' && enableBunny ? (
|
|
38
40
|
<BunnyVideoWrapper options={options} />
|
|
39
41
|
) : target === 'custom-hero' ? (
|
|
40
42
|
<CustomHero />
|