@codedazur/cdk-next-app 1.1.2 → 2.0.1

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,23 @@
1
1
  # @codedazur/cdk-next-app
2
2
 
3
+ ## 2.0.1
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies [[`f361c4c`](https://github.com/codedazur/toolkit/commit/f361c4cbf2974360c9eeec0feb04c9c2cc33b730)]:
8
+ - @codedazur/cdk-docker-cluster@2.1.0
9
+
10
+ ## 2.0.0
11
+
12
+ ### Major Changes
13
+
14
+ - [`4f12708`](https://github.com/codedazur/toolkit/commit/4f12708f7b35ce7e96af62c10a6f637e347c3c69) Thanks [@thijsdaniels](https://github.com/thijsdaniels)! - Custom domain names with external DNS registry are now supported. A HostedZone will no longer be looked up and must be provided instead if needed.
15
+
16
+ ### Patch Changes
17
+
18
+ - Updated dependencies [[`4f12708`](https://github.com/codedazur/toolkit/commit/4f12708f7b35ce7e96af62c10a6f637e347c3c69)]:
19
+ - @codedazur/cdk-docker-cluster@2.0.0
20
+
3
21
  ## 1.1.2
4
22
 
5
23
  ### Patch Changes
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { DockerClusterProps, DockerCluster } from '@codedazur/cdk-docker-cluster';
1
+ import { DockerCluster, DockerClusterProps } from '@codedazur/cdk-docker-cluster';
2
2
  import { ContainerImage } from 'aws-cdk-lib/aws-ecs';
3
3
  import { Construct } from 'constructs';
4
4
 
package/dist/index.js CHANGED
@@ -1,47 +1,13 @@
1
- "use strict";
2
- var __create = Object.create;
3
- var __defProp = Object.defineProperty;
4
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
- var __getOwnPropNames = Object.getOwnPropertyNames;
6
- var __getProtoOf = Object.getPrototypeOf;
7
- var __hasOwnProp = Object.prototype.hasOwnProperty;
8
- var __export = (target, all) => {
9
- for (var name in all)
10
- __defProp(target, name, { get: all[name], enumerable: true });
11
- };
12
- var __copyProps = (to, from, except, desc) => {
13
- if (from && typeof from === "object" || typeof from === "function") {
14
- for (let key of __getOwnPropNames(from))
15
- if (!__hasOwnProp.call(to, key) && key !== except)
16
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
- }
18
- return to;
19
- };
20
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
- // If the importer is in node compatibility mode or this is not an ESM
22
- // file that has been converted to a CommonJS file using a Babel-
23
- // compatible transform (i.e. "__esModule" has not been set), then set
24
- // "default" to the CommonJS "module.exports" for node compatibility.
25
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
- mod
27
- ));
28
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
-
30
- // src/index.ts
31
- var index_exports = {};
32
- __export(index_exports, {
33
- NextApp: () => NextApp
34
- });
35
- module.exports = __toCommonJS(index_exports);
36
-
37
1
  // src/constructs/NextApp.ts
38
- var import_os = __toESM(require("os"));
39
- var import_path = __toESM(require("path"));
40
- var import_cdk_docker_cluster = require("@codedazur/cdk-docker-cluster");
41
- var import_aws_cdk_lib = require("aws-cdk-lib");
42
- var import_aws_cloudfront = require("aws-cdk-lib/aws-cloudfront");
43
- var import_aws_ecs = require("aws-cdk-lib/aws-ecs");
44
- var NextApp = class _NextApp extends import_cdk_docker_cluster.DockerCluster {
2
+ import os from "os";
3
+ import path from "path";
4
+ import {
5
+ DockerCluster
6
+ } from "@codedazur/cdk-docker-cluster";
7
+ import { DockerBuildSecret } from "aws-cdk-lib";
8
+ import { AllowedMethods, CachePolicy } from "aws-cdk-lib/aws-cloudfront";
9
+ import { ContainerImage } from "aws-cdk-lib/aws-ecs";
10
+ var NextApp = class _NextApp extends DockerCluster {
45
11
  constructor(scope, id, {
46
12
  source,
47
13
  service: { port = 3e3, ...service } = {},
@@ -65,8 +31,8 @@ var NextApp = class _NextApp extends import_cdk_docker_cluster.DockerCluster {
65
31
  */
66
32
  "/api/*": {
67
33
  authentication: false,
68
- allowedMethods: import_aws_cloudfront.AllowedMethods.ALLOW_ALL,
69
- cachePolicy: import_aws_cloudfront.CachePolicy.CACHING_DISABLED,
34
+ allowedMethods: AllowedMethods.ALLOW_ALL,
35
+ cachePolicy: CachePolicy.CACHING_DISABLED,
70
36
  ...distribution?.behaviors?.["/api/*"]
71
37
  },
72
38
  /**
@@ -75,8 +41,8 @@ var NextApp = class _NextApp extends import_cdk_docker_cluster.DockerCluster {
75
41
  * @see https://nextjs.org/docs/app/guides/self-hosting#automatic-caching
76
42
  */
77
43
  "/_next/static/*": {
78
- allowedMethods: import_aws_cloudfront.AllowedMethods.ALLOW_GET_HEAD_OPTIONS,
79
- cachePolicy: import_aws_cloudfront.CachePolicy.CACHING_OPTIMIZED,
44
+ allowedMethods: AllowedMethods.ALLOW_GET_HEAD_OPTIONS,
45
+ cachePolicy: CachePolicy.CACHING_OPTIMIZED,
80
46
  ...distribution?.behaviors?.["/_next/static/*"]
81
47
  },
82
48
  /**
@@ -87,7 +53,7 @@ var NextApp = class _NextApp extends import_cdk_docker_cluster.DockerCluster {
87
53
  * @see https://nextjs.org/docs/app/guides/self-hosting#image-optimization
88
54
  */
89
55
  "/_next/image*": {
90
- allowedMethods: import_aws_cloudfront.AllowedMethods.ALLOW_GET_HEAD_OPTIONS,
56
+ allowedMethods: AllowedMethods.ALLOW_GET_HEAD_OPTIONS,
91
57
  ...distribution?.behaviors?.["/_next/image*"]
92
58
  },
93
59
  /**
@@ -98,7 +64,7 @@ var NextApp = class _NextApp extends import_cdk_docker_cluster.DockerCluster {
98
64
  * @see https://nextjs.org/docs/app/guides/self-hosting#caching-and-isr
99
65
  */
100
66
  "/_next/data/*": {
101
- allowedMethods: import_aws_cloudfront.AllowedMethods.ALLOW_GET_HEAD_OPTIONS,
67
+ allowedMethods: AllowedMethods.ALLOW_GET_HEAD_OPTIONS,
102
68
  ...distribution?.behaviors?.["/_next/data/*"]
103
69
  }
104
70
  }
@@ -106,7 +72,7 @@ var NextApp = class _NextApp extends import_cdk_docker_cluster.DockerCluster {
106
72
  });
107
73
  }
108
74
  static withNpmSecret(source) {
109
- if (source instanceof import_aws_ecs.ContainerImage) {
75
+ if (source instanceof ContainerImage) {
110
76
  return source;
111
77
  }
112
78
  if (typeof source === "string") {
@@ -126,10 +92,9 @@ var NextApp = class _NextApp extends import_cdk_docker_cluster.DockerCluster {
126
92
  };
127
93
  }
128
94
  static npmSecret() {
129
- return import_aws_cdk_lib.DockerBuildSecret.fromSrc(import_path.default.join(import_os.default.homedir(), ".npmrc"));
95
+ return DockerBuildSecret.fromSrc(path.join(os.homedir(), ".npmrc"));
130
96
  }
131
97
  };
132
- // Annotate the CommonJS export names for ESM import in node:
133
- 0 && (module.exports = {
98
+ export {
134
99
  NextApp
135
- });
100
+ };
package/eslint.config.ts CHANGED
@@ -1,4 +1,5 @@
1
- import { cdk, distribution } from "@codedazur/eslint-config";
1
+ import { distribution } from "@codedazur/eslint-config";
2
+ import { cdk } from "@codedazur/eslint-config/cdk";
2
3
  import { defineConfig } from "eslint/config";
3
4
  import root from "../../eslint.config";
4
5
 
package/package.json CHANGED
@@ -1,23 +1,18 @@
1
1
  {
2
2
  "name": "@codedazur/cdk-next-app",
3
- "version": "1.1.2",
4
- "main": ".dist/index.js",
5
- "module": "./dist/index.mjs",
3
+ "version": "2.0.1",
4
+ "type": "module",
5
+ "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",
7
- "exports": {
8
- ".": {
9
- "require": "./dist/index.js",
10
- "import": "./dist/index.mjs"
11
- }
12
- },
7
+ "exports": "./dist/index.js",
13
8
  "publishConfig": {
14
9
  "access": "public"
15
10
  },
16
11
  "license": "MIT",
17
12
  "sideEffects": false,
18
13
  "scripts": {
19
- "develop": "tsup src/index.ts --format esm,cjs --dts --watch",
20
- "build": "tsup src/index.ts --format esm,cjs --dts",
14
+ "develop": "tsup src/index.ts --clean --format esm --dts --watch",
15
+ "build": "tsup src/index.ts --clean --format esm --dts",
21
16
  "audit": "npm audit --omit dev --audit-level high",
22
17
  "lint": "eslint .",
23
18
  "types": "tsc --noEmit",
@@ -28,12 +23,12 @@
28
23
  "constructs": ">=10"
29
24
  },
30
25
  "dependencies": {
31
- "@codedazur/cdk-docker-cluster": "^1.1.2"
26
+ "@codedazur/cdk-docker-cluster": "~2.1.0"
32
27
  },
33
28
  "devDependencies": {
34
- "@types/node": "^25.0.3",
35
- "aws-cdk-lib": "^2.233.0",
36
- "constructs": "^10.4.4",
37
- "esbuild": "^0.27.2"
29
+ "@types/node": "^25.9.1",
30
+ "aws-cdk-lib": "^2.268.0",
31
+ "constructs": "^10.8.1",
32
+ "esbuild": "^0.28.2"
38
33
  }
39
34
  }
package/dist/index.d.mts DELETED
@@ -1,29 +0,0 @@
1
- import { DockerClusterProps, DockerCluster } from '@codedazur/cdk-docker-cluster';
2
- import { ContainerImage } from 'aws-cdk-lib/aws-ecs';
3
- import { Construct } from 'constructs';
4
-
5
- interface NextAppProps extends DockerClusterProps {
6
- }
7
- /**
8
- * A docker cluster preconfigured for running a Next.js application with support
9
- * for private NPM packages using a build-time secret.
10
- *
11
- * @todo Document and standardize a shared cache pool for Next.js applications
12
- * that run on multiple containers.
13
- * @see https://nextjs.org/docs/app/guides/self-hosting#configuring-caching
14
- */
15
- declare class NextApp extends DockerCluster {
16
- constructor(scope: Construct, id: string, { source, service: { port, ...service }, distribution, ...props }: NextAppProps);
17
- protected static withNpmSecret(source: NextAppProps["source"]): ContainerImage | {
18
- secrets: {
19
- npmrc: string;
20
- };
21
- directory: string;
22
- exclude?: string[];
23
- file?: string;
24
- arguments?: Record<string, string>;
25
- };
26
- protected static npmSecret(): string;
27
- }
28
-
29
- export { NextApp, type NextAppProps };
package/dist/index.mjs DELETED
@@ -1,100 +0,0 @@
1
- // src/constructs/NextApp.ts
2
- import os from "os";
3
- import path from "path";
4
- import {
5
- DockerCluster
6
- } from "@codedazur/cdk-docker-cluster";
7
- import { DockerBuildSecret } from "aws-cdk-lib";
8
- import { AllowedMethods, CachePolicy } from "aws-cdk-lib/aws-cloudfront";
9
- import { ContainerImage } from "aws-cdk-lib/aws-ecs";
10
- var NextApp = class _NextApp extends DockerCluster {
11
- constructor(scope, id, {
12
- source,
13
- service: { port = 3e3, ...service } = {},
14
- distribution,
15
- ...props
16
- }) {
17
- super(scope, id, {
18
- source: _NextApp.withNpmSecret(source),
19
- ...props,
20
- service: {
21
- port,
22
- ...service
23
- },
24
- distribution: {
25
- ...distribution,
26
- behaviors: {
27
- ...distribution?.behaviors,
28
- /**
29
- * API routes should not be cached by the CDN.
30
- * @see https://nextjs.org/docs/app/guides/self-hosting#usage-with-cdns
31
- */
32
- "/api/*": {
33
- authentication: false,
34
- allowedMethods: AllowedMethods.ALLOW_ALL,
35
- cachePolicy: CachePolicy.CACHING_DISABLED,
36
- ...distribution?.behaviors?.["/api/*"]
37
- },
38
- /**
39
- * Statically generated assets with hashes in the filename. These can
40
- * be cached forever.
41
- * @see https://nextjs.org/docs/app/guides/self-hosting#automatic-caching
42
- */
43
- "/_next/static/*": {
44
- allowedMethods: AllowedMethods.ALLOW_GET_HEAD_OPTIONS,
45
- cachePolicy: CachePolicy.CACHING_OPTIMIZED,
46
- ...distribution?.behaviors?.["/_next/static/*"]
47
- },
48
- /**
49
- * Assets for Next.js Image Optimization. Caching is based on query
50
- * strings. This behavior inherits the default cache policy from the
51
- * DockerCluster, which should be configured to include query
52
- * strings in the cache key.
53
- * @see https://nextjs.org/docs/app/guides/self-hosting#image-optimization
54
- */
55
- "/_next/image*": {
56
- allowedMethods: AllowedMethods.ALLOW_GET_HEAD_OPTIONS,
57
- ...distribution?.behaviors?.["/_next/image*"]
58
- },
59
- /**
60
- * Page data for client-side navigation. Caching should be aligned
61
- * with the corresponding page. This behavior inherits the default
62
- * cache policy, which should respect the origin's Cache-Control
63
- * headers.
64
- * @see https://nextjs.org/docs/app/guides/self-hosting#caching-and-isr
65
- */
66
- "/_next/data/*": {
67
- allowedMethods: AllowedMethods.ALLOW_GET_HEAD_OPTIONS,
68
- ...distribution?.behaviors?.["/_next/data/*"]
69
- }
70
- }
71
- }
72
- });
73
- }
74
- static withNpmSecret(source) {
75
- if (source instanceof ContainerImage) {
76
- return source;
77
- }
78
- if (typeof source === "string") {
79
- return {
80
- directory: source,
81
- secrets: {
82
- npmrc: _NextApp.npmSecret()
83
- }
84
- };
85
- }
86
- return {
87
- ...source,
88
- secrets: {
89
- npmrc: _NextApp.npmSecret(),
90
- ...source.secrets
91
- }
92
- };
93
- }
94
- static npmSecret() {
95
- return DockerBuildSecret.fromSrc(path.join(os.homedir(), ".npmrc"));
96
- }
97
- };
98
- export {
99
- NextApp
100
- };