Skip to content

Commit

Permalink
Introduce next.js specific component.
Browse files Browse the repository at this point in the history
  • Loading branch information
Zemnmez committed Jun 5, 2023
1 parent bffdb77 commit a90b90a
Showing 1 changed file with 49 additions and 0 deletions.
49 changes: 49 additions & 0 deletions ts/pulumi/lib/next_website.ts
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;

0 comments on commit a90b90a

Please sign in to comment.