@@ -19,12 +19,6 @@ import {
19
19
import { hasFiles } from '@stacksjs/storage'
20
20
import { path as p } from '@stacksjs/path'
21
21
import { app , cloud } from '@stacksjs/config'
22
- import { env } from '@stacksjs/env'
23
-
24
- type BehaviorOptions = {
25
- docsBucket ?: s3 . Bucket
26
- originAccessIdentity ?: cloudfront . OriginAccessIdentity
27
- }
28
22
29
23
export class StacksCloud extends Stack {
30
24
domain : string
@@ -95,7 +89,7 @@ export class StacksCloud extends Stack {
95
89
} )
96
90
}
97
91
98
- deployApi ( ) {
92
+ deployApi ( ) : lambda . FunctionUrl {
99
93
const layer = new lambda . LayerVersion ( this , 'StacksLambdaLayer' , {
100
94
code : lambda . Code . fromAsset ( p . projectStoragePath ( 'framework/cloud/bun-lambda-layer.zip' ) ) ,
101
95
compatibleRuntimes : [ lambda . Runtime . PROVIDED_AL2 ] ,
@@ -197,31 +191,6 @@ export class StacksCloud extends Stack {
197
191
}
198
192
}
199
193
200
- addOutputs ( ) {
201
- new Output ( this , 'AppUrl' , {
202
- value : `https://${ this . domain } ` ,
203
- description : 'The URL of the deployed application' ,
204
- } )
205
-
206
- new Output ( this , 'VanityUrl' , {
207
- value : this . vanityUrl ,
208
- description : 'The vanity URL of the deployed application' ,
209
- } )
210
-
211
- if ( this . apiVanityUrl ) {
212
- new Output ( this , 'ServerVanityUrl' , {
213
- value : this . apiVanityUrl ,
214
- description : 'The vanity URL of the deployed Stacks server.' ,
215
- } )
216
- }
217
-
218
- // Output the nameservers of the hosted zone
219
- // new Output(this, 'Nameservers', {
220
- // value: Fn.join(', ', zone.hostedZoneNameServers),
221
- // description: 'Nameservers for the application domain',
222
- // })
223
- }
224
-
225
194
manageDns ( ) {
226
195
// Create a Route53 record pointing to the CloudFront distribution
227
196
new route53 . ARecord ( this , 'AliasRecord' , {
@@ -341,7 +310,7 @@ export class StacksCloud extends Stack {
341
310
return { cdn, originAccessIdentity, cdnCachePolicy }
342
311
}
343
312
344
- generateAdditionalBehaviors ( options : BehaviorOptions ) : Record < string , cloudfront . BehaviorOptions > {
313
+ generateAdditionalBehaviors ( ) : Record < string , cloudfront . BehaviorOptions > {
345
314
let behaviorOptions : Record < string , cloudfront . BehaviorOptions > = { }
346
315
347
316
if ( this . shouldDeployApi ( ) ) {
@@ -372,7 +341,7 @@ export class StacksCloud extends Stack {
372
341
...behaviorOptions ,
373
342
'/docs/*' : {
374
343
origin : new origins . S3Origin ( docsBucket , {
375
- originAccessIdentity : options . originAccessIdentity ,
344
+ originAccessIdentity : this . originAccessIdentity ,
376
345
} ) ,
377
346
compress : true ,
378
347
allowedMethods : this . allowedMethodsFromString ( cloud . cdn ?. allowedMethods ) ,
@@ -386,6 +355,31 @@ export class StacksCloud extends Stack {
386
355
return behaviorOptions
387
356
}
388
357
358
+ addOutputs ( ) : void {
359
+ new Output ( this , 'AppUrl' , {
360
+ value : `https://${ this . domain } ` ,
361
+ description : 'The URL of the deployed application' ,
362
+ } )
363
+
364
+ new Output ( this , 'VanityUrl' , {
365
+ value : this . vanityUrl ,
366
+ description : 'The vanity URL of the deployed application' ,
367
+ } )
368
+
369
+ if ( this . apiVanityUrl ) {
370
+ new Output ( this , 'ServerVanityUrl' , {
371
+ value : this . apiVanityUrl ,
372
+ description : 'The vanity URL of the deployed Stacks server.' ,
373
+ } )
374
+ }
375
+
376
+ // Output the nameservers of the hosted zone
377
+ // new Output(this, 'Nameservers', {
378
+ // value: Fn.join(', ', zone.hostedZoneNameServers),
379
+ // description: 'Nameservers for the application domain',
380
+ // })
381
+ }
382
+
389
383
deploy ( ) {
390
384
new s3deploy . BucketDeployment ( this , 'DeployWebsite' , {
391
385
sources : [ s3deploy . Source . asset ( this . websiteSource ) ] ,
0 commit comments