@codedazur/cdk-next-app 0.2.0 → 0.2.2

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/CHANGELOG.md CHANGED
@@ -1,5 +1,20 @@
1
1
  # @codedazur/cdk-next-app
2
2
 
3
+ ## 0.2.2
4
+
5
+ ### Patch Changes
6
+
7
+ - [`17d19aea004254b214364caef8fa02f9a6019f8f`](https://github.com/codedazur/toolkit/commit/17d19aea004254b214364caef8fa02f9a6019f8f) Thanks [@thijsdaniels](https://github.com/thijsdaniels)! - The version of the DockerCluster dependency is now explicit.
8
+
9
+ - Updated dependencies [[`17d19aea004254b214364caef8fa02f9a6019f8f`](https://github.com/codedazur/toolkit/commit/17d19aea004254b214364caef8fa02f9a6019f8f)]:
10
+ - @codedazur/cdk-docker-cluster@0.4.0
11
+
12
+ ## 0.2.1
13
+
14
+ ### Patch Changes
15
+
16
+ - [`4aad27259400d8c8c4fd6825ee20ef970b6ad718`](https://github.com/codedazur/toolkit/commit/4aad27259400d8c8c4fd6825ee20ef970b6ad718) Thanks [@thijsdaniels](https://github.com/thijsdaniels)! - The construct name was corrected.
17
+
3
18
  ## 0.2.0
4
19
 
5
20
  ### Minor Changes
package/README.md CHANGED
@@ -2,14 +2,60 @@
2
2
 
3
3
  The NextApp CDK construct deploys a standalone Next.js build to a load balanced Fargate service on AWS.
4
4
 
5
+ It automatically mounts the `~/.npmrc` file as a build secret for installation of private NPM packages.
6
+
7
+ ## Prerequisites
8
+
9
+ ### Next.js Configuration
10
+
11
+ Your `next.config.js` file needs to be configured for standalone output.
12
+
13
+ ```js
14
+ // next.config.js
15
+ // ...
16
+ const nextConfig = {
17
+ // ...
18
+ output: "standalone",
19
+ }
20
+ // ...
21
+ ```
22
+
23
+ ### Docker
24
+
25
+ In order to use this construct, your Next.js application needs to be configure for Docker deployments. See the [official documentation](https://nextjs.org/docs/pages/building-your-application/deploying#docker-image) for more information.
26
+
5
27
  ## Example
6
28
 
29
+ ### Standard Repository
30
+
31
+ For a non-monorepo build, simply provide the path to the directory that contains your Dockerfile.
32
+
7
33
  ```ts
8
- new NextApp(this, "Next", {
9
- path: "../next", // Must contain a Dockerfile.
34
+ new NextApp(this, "NextApp", {
35
+ path: "../next",
10
36
  });
11
37
  ```
12
38
 
13
- ## Docker
39
+ ### Monorepo
14
40
 
15
- In order to use this construct, your Next.js application needs to be configure for Docker deployments. See the [official documentation](https://nextjs.org/docs/pages/building-your-application/deploying#docker-image) for more information.
41
+ For monorepo builds, set the build context to the root of your monorepo, and provide the path to your Next.js module's Dockerfile.
42
+
43
+ ```ts
44
+ new NextApp(this, "NextApp", {
45
+ path: "../../",
46
+ file: "apps/next/Dockerfile",
47
+ });
48
+ ```
49
+
50
+ ### Scaling
51
+
52
+ The NextApp is based on the [DockerCluster](https://github.com/codedazur/toolkit/tree/main/packages/cdk-docker-cluster) construct and supports all of its features for horizontal and vertical scaling.
53
+
54
+ ```ts
55
+ new NextApp(this, "NextApp", {
56
+ // ...
57
+ cpu: 1024,
58
+ memory: 4096,
59
+ tasks: { min: 1, max: 10 },
60
+ });
61
+ ```
package/dist/index.d.mts CHANGED
@@ -1,14 +1,14 @@
1
1
  import { DockerClusterProps, DockerCluster } from '@codedazur/cdk-docker-cluster';
2
2
  import { Construct } from 'constructs';
3
3
 
4
- interface NextDockerClusterProps extends DockerClusterProps {
4
+ interface NextAppProps extends DockerClusterProps {
5
5
  }
6
6
  /**
7
7
  * A docker cluster preconfigured for running a Next.js application with support
8
8
  * for private NPM packages using a build-time secret.
9
9
  */
10
- declare class NextDockerCluster extends DockerCluster {
11
- constructor(scope: Construct, id: string, { port, secrets, ...props }: NextDockerClusterProps);
10
+ declare class NextApp extends DockerCluster {
11
+ constructor(scope: Construct, id: string, { port, secrets, ...props }: NextAppProps);
12
12
  }
13
13
 
14
- export { NextDockerCluster, NextDockerClusterProps };
14
+ export { NextApp, NextAppProps };
package/dist/index.d.ts CHANGED
@@ -1,14 +1,14 @@
1
1
  import { DockerClusterProps, DockerCluster } from '@codedazur/cdk-docker-cluster';
2
2
  import { Construct } from 'constructs';
3
3
 
4
- interface NextDockerClusterProps extends DockerClusterProps {
4
+ interface NextAppProps extends DockerClusterProps {
5
5
  }
6
6
  /**
7
7
  * A docker cluster preconfigured for running a Next.js application with support
8
8
  * for private NPM packages using a build-time secret.
9
9
  */
10
- declare class NextDockerCluster extends DockerCluster {
11
- constructor(scope: Construct, id: string, { port, secrets, ...props }: NextDockerClusterProps);
10
+ declare class NextApp extends DockerCluster {
11
+ constructor(scope: Construct, id: string, { port, secrets, ...props }: NextAppProps);
12
12
  }
13
13
 
14
- export { NextDockerCluster, NextDockerClusterProps };
14
+ export { NextApp, NextAppProps };
package/dist/index.js CHANGED
@@ -30,7 +30,7 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
30
30
  // src/index.ts
31
31
  var src_exports = {};
32
32
  __export(src_exports, {
33
- NextDockerCluster: () => NextDockerCluster
33
+ NextApp: () => NextApp
34
34
  });
35
35
  module.exports = __toCommonJS(src_exports);
36
36
 
@@ -39,7 +39,7 @@ var import_os = __toESM(require("os"));
39
39
  var import_path = __toESM(require("path"));
40
40
  var import_cdk_docker_cluster = require("@codedazur/cdk-docker-cluster");
41
41
  var import_aws_cdk_lib = require("aws-cdk-lib");
42
- var NextDockerCluster = class extends import_cdk_docker_cluster.DockerCluster {
42
+ var NextApp = class extends import_cdk_docker_cluster.DockerCluster {
43
43
  constructor(scope, id, { port = 3e3, secrets, ...props }) {
44
44
  super(scope, id, {
45
45
  port,
@@ -53,5 +53,5 @@ var NextDockerCluster = class extends import_cdk_docker_cluster.DockerCluster {
53
53
  };
54
54
  // Annotate the CommonJS export names for ESM import in node:
55
55
  0 && (module.exports = {
56
- NextDockerCluster
56
+ NextApp
57
57
  });
package/dist/index.mjs CHANGED
@@ -5,7 +5,7 @@ import {
5
5
  DockerCluster
6
6
  } from "@codedazur/cdk-docker-cluster";
7
7
  import { DockerBuildSecret } from "aws-cdk-lib";
8
- var NextDockerCluster = class extends DockerCluster {
8
+ var NextApp = class extends DockerCluster {
9
9
  constructor(scope, id, { port = 3e3, secrets, ...props }) {
10
10
  super(scope, id, {
11
11
  port,
@@ -18,5 +18,5 @@ var NextDockerCluster = class extends DockerCluster {
18
18
  }
19
19
  };
20
20
  export {
21
- NextDockerCluster
21
+ NextApp
22
22
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@codedazur/cdk-next-app",
3
- "version": "0.2.0",
3
+ "version": "0.2.2",
4
4
  "main": ".dist/index.js",
5
5
  "module": "./dist/index.mjs",
6
6
  "types": "./dist/index.d.ts",
@@ -23,7 +23,7 @@
23
23
  "test": "vitest run --passWithNoTests"
24
24
  },
25
25
  "dependencies": {
26
- "@codedazur/cdk-docker-cluster": "*"
26
+ "@codedazur/cdk-docker-cluster": "^0.4.0"
27
27
  },
28
28
  "peerDependencies": {
29
29
  "aws-cdk-lib": ">=2",
@@ -32,8 +32,8 @@
32
32
  "devDependencies": {
33
33
  "@codedazur/eslint-config": "*",
34
34
  "@codedazur/tsconfig": "*",
35
- "@types/node": "^20.12.8",
36
- "aws-cdk-lib": "^2.139.1",
35
+ "@types/node": "^20.14.2",
36
+ "aws-cdk-lib": "^2.145.0",
37
37
  "constructs": "^10.3.0",
38
38
  "esbuild": "^0.20.2",
39
39
  "eslint": "^8.30.0",