astro-tractstack 2.0.0-rc.22 → 2.0.0-rc.23

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.
@@ -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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "astro-tractstack",
3
- "version": "2.0.0-rc.22",
3
+ "version": "2.0.0-rc.23",
4
4
  "description": "Astro integration for TractStack - redeeming the web from boring experiences",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -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 />
@@ -105,6 +105,8 @@ const fullCanonicalUrl = brandConfig?.SITE_URL
105
105
  ? `${brandConfig.SITE_URL.replace(/\/$/, '')}${canonicalURL}`
106
106
  : `${brandConfig.SITE_URL.replace(/\/$/, '')}/${canonicalURL}`
107
107
  : canonicalURL;
108
+
109
+ const enableBunny = import.meta.env.PUBLIC_ENABLE_BUNNY === 'true';
108
110
  ---
109
111
 
110
112
  <!doctype html>
@@ -194,10 +196,15 @@ const fullCanonicalUrl = brandConfig?.SITE_URL
194
196
 
195
197
  <ClientRouter />
196
198
 
197
- <script
198
- is:inline
199
- type="text/javascript"
200
- src="//assets.mediadelivery.net/playerjs/player-0.1.0.min.js"></script>
199
+ {
200
+ enableBunny && (
201
+ <script
202
+ is:inline
203
+ type="text/javascript"
204
+ src="//assets.mediadelivery.net/playerjs/player-0.1.0.min.js"
205
+ />
206
+ )
207
+ }
201
208
 
202
209
  <script
203
210
  src="https://unpkg.com/htmx.org@2.0.4"