@codedazur/cdk-next-app 1.1.2 → 2.0.0
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 +11 -0
- package/dist/index.js +19 -54
- package/eslint.config.ts +2 -1
- package/package.json +10 -15
- package/dist/index.d.mts +0 -29
- package/dist/index.mjs +0 -100
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,16 @@
|
|
|
1
1
|
# @codedazur/cdk-next-app
|
|
2
2
|
|
|
3
|
+
## 2.0.0
|
|
4
|
+
|
|
5
|
+
### Major Changes
|
|
6
|
+
|
|
7
|
+
- [`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.
|
|
8
|
+
|
|
9
|
+
### Patch Changes
|
|
10
|
+
|
|
11
|
+
- Updated dependencies [[`4f12708`](https://github.com/codedazur/toolkit/commit/4f12708f7b35ce7e96af62c10a6f637e347c3c69)]:
|
|
12
|
+
- @codedazur/cdk-docker-cluster@2.0.0
|
|
13
|
+
|
|
3
14
|
## 1.1.2
|
|
4
15
|
|
|
5
16
|
### Patch Changes
|
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
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
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:
|
|
69
|
-
cachePolicy:
|
|
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:
|
|
79
|
-
cachePolicy:
|
|
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:
|
|
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:
|
|
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
|
|
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
|
|
95
|
+
return DockerBuildSecret.fromSrc(path.join(os.homedir(), ".npmrc"));
|
|
130
96
|
}
|
|
131
97
|
};
|
|
132
|
-
|
|
133
|
-
0 && (module.exports = {
|
|
98
|
+
export {
|
|
134
99
|
NextApp
|
|
135
|
-
}
|
|
100
|
+
};
|
package/eslint.config.ts
CHANGED
package/package.json
CHANGED
|
@@ -1,23 +1,18 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@codedazur/cdk-next-app",
|
|
3
|
-
"version": "
|
|
4
|
-
"
|
|
5
|
-
"
|
|
3
|
+
"version": "2.0.0",
|
|
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
|
|
20
|
-
"build": "tsup src/index.ts --format esm
|
|
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": "^
|
|
26
|
+
"@codedazur/cdk-docker-cluster": "^2.0.0"
|
|
32
27
|
},
|
|
33
28
|
"devDependencies": {
|
|
34
|
-
"@types/node": "^25.0.
|
|
35
|
-
"aws-cdk-lib": "^2.
|
|
36
|
-
"constructs": "^10.4.
|
|
29
|
+
"@types/node": "^25.0.9",
|
|
30
|
+
"aws-cdk-lib": "^2.235.1",
|
|
31
|
+
"constructs": "^10.4.5",
|
|
37
32
|
"esbuild": "^0.27.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
|
-
};
|