-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Introduce next.js specific component.
- Loading branch information
Showing
1 changed file
with
49 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
import * as website from 'ts/pulumi/lib/website'; | ||
import path from 'node:path'; | ||
import Website from 'ts/pulumi/lib/website'; | ||
import * as pulumi from "@pulumi/pulumi"; | ||
|
||
export interface Args { | ||
/** | ||
* Zone to create any needed DNS records in. | ||
*/ | ||
zone: website.Args["zone"], | ||
|
||
/** | ||
* The domain or subdomain itself within the zone to create the website for | ||
* @example | ||
* "mywebsite.com." | ||
*/ | ||
domain: website.Args["domain"] | ||
|
||
/** | ||
* A next.js project directory | ||
*/ | ||
directory: website.Args["directory"] | ||
|
||
} | ||
|
||
/** | ||
* Provisions an S3 Bucket, CloudFront instance and certificate | ||
* to serve a static next.js website. | ||
*/ | ||
export class NextWebsite extends pulumi.ComponentResource { | ||
constructor(name: string, args: Args, opts?: pulumi.ComponentResourceOptions) { | ||
super('ts:pulumi:lib:Website', name, args, opts); | ||
|
||
const w = new Website(`${name}_website`, { | ||
zone: args.zone, | ||
domain: args.domain, | ||
directory: args.directory, | ||
index: path.join(args.directory, 'index.html'), | ||
notFound: path.join(args.directory, '404.html') | ||
}, opts); | ||
|
||
|
||
super.registerOutputs({ | ||
w | ||
}) | ||
} | ||
} | ||
|
||
export default Website; |