@codedazur/cdk-next-app 0.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.
@@ -0,0 +1,16 @@
1
+
2
+ > @codedazur/cdk-next-app@0.0.1 lint
3
+ > TIMING=1 eslint "**/*.ts*"
4
+
5
+ Rule | Time (ms) | Relative
6
+ :------------------------------|----------:|--------:
7
+ react/display-name | 75.522 | 36.3%
8
+ react/no-direct-mutation-state | 75.290 | 36.2%
9
+ react/no-string-refs | 29.212 | 14.0%
10
+ react-hooks/rules-of-hooks | 17.646 | 8.5%
11
+ react/require-render-return | 6.347 | 3.1%
12
+ react/no-deprecated | 0.932 | 0.4%
13
+ turbo/no-undeclared-env-vars | 0.630 | 0.3%
14
+ react-hooks/exhaustive-deps | 0.310 | 0.1%
15
+ react/jsx-no-comment-textnodes | 0.252 | 0.1%
16
+ react/no-render-return-value | 0.168 | 0.1%
@@ -0,0 +1,5 @@
1
+
2
+ > @codedazur/cdk-next-app@0.0.1 test
3
+ > echo "No tests configured."
4
+
5
+ No tests configured.
package/CHANGELOG.md ADDED
@@ -0,0 +1,10 @@
1
+ # @codedazur/cdk-next-app
2
+
3
+ ## 0.0.1
4
+
5
+ ### Patch Changes
6
+
7
+ - [#56](https://github.com/codedazur/toolkit/pull/56) [`61acacd`](https://github.com/codedazur/toolkit/commit/61acacd74af2bae5ec151df37dd7229f892d91ee) Thanks [@thijsdaniels](https://github.com/thijsdaniels)! - add NextApp CDK construct
8
+
9
+ - Updated dependencies [[`6a7da43`](https://github.com/codedazur/toolkit/commit/6a7da43a389d6e45740eea9d77f6e993340cb05c)]:
10
+ - @codedazur/cdk-amplify-app@0.0.1
package/LICENSE.md ADDED
@@ -0,0 +1,9 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2023 code d'azur Interactive B.V.
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
6
+
7
+ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
8
+
9
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
package/README.md ADDED
@@ -0,0 +1 @@
1
+ # @codedazur/cdk-next-app
@@ -0,0 +1,86 @@
1
+ import { Construct } from "constructs";
2
+ import {
3
+ AmplifyApp,
4
+ AmplifyAppProps,
5
+ Framework,
6
+ Platform,
7
+ RewriteStatus,
8
+ } from "@codedazur/cdk-amplify-app";
9
+
10
+ export interface NextAppProps
11
+ extends Omit<
12
+ AmplifyAppProps,
13
+ "platform" | "framework" | "buildSpec" | "headers"
14
+ > {}
15
+
16
+ /**
17
+ * @todo Document that if this is used with a monorepo, the `next.config.js`
18
+ * needs to contain
19
+ * ```
20
+ * {
21
+ * experimental: {
22
+ * outputFileTracingRoot: path.join(__dirname, "../../"),
23
+ * },
24
+ * }
25
+ * ```
26
+ * assuming that the project root is at `"../../"` relative to the the
27
+ * `next.config.js` file.
28
+ * @see https://github.com/aws-amplify/amplify-hosting/issues/3179
29
+ * @see https://nextjs.org/docs/advanced-features/output-file-tracing#caveats
30
+ */
31
+ export class NextApp extends AmplifyApp {
32
+ constructor(scope: Construct, id: string, props: NextAppProps) {
33
+ super(scope, id, {
34
+ platform: Platform.WEB_COMPUTE,
35
+ framework: Framework.NEXTJS_SSR,
36
+ buildSpec: {
37
+ version: 1,
38
+ applications: [
39
+ {
40
+ appRoot: props.source.directory,
41
+ frontend: {
42
+ phases: {
43
+ preBuild: {
44
+ commands: [
45
+ "npm config set //registry.npmjs.org/:_authToken ${NPM_TOKEN}",
46
+ "npm install",
47
+ ],
48
+ },
49
+ build: {
50
+ commands: ["npm run build"],
51
+ },
52
+ postBuild: {
53
+ commands: [
54
+ /**
55
+ * This command moves the Next.js `standalone` directory
56
+ * into the right location for AWS to recognize it.
57
+ * @todo Remove this command when AWS has implemented a fix.
58
+ * @see https://github.com/aws-amplify/amplify-hosting/issues/3179
59
+ */
60
+ `cp -r .next/standalone/${props.source.directory}/. .next/standalone`,
61
+ ],
62
+ },
63
+ },
64
+ artifacts: {
65
+ baseDirectory: ".next",
66
+ files: ["**/*"],
67
+ },
68
+ cache: {
69
+ paths: ["node_modules/**/*"],
70
+ },
71
+ },
72
+ },
73
+ ],
74
+ },
75
+ rewrites: [
76
+ {
77
+ source: "/<*>",
78
+ status: RewriteStatus.NOT_FOUND,
79
+ target: "/index.html",
80
+ },
81
+ ...(props.rewrites ?? []),
82
+ ],
83
+ ...props,
84
+ });
85
+ }
86
+ }
package/package.json ADDED
@@ -0,0 +1,29 @@
1
+ {
2
+ "name": "@codedazur/cdk-next-app",
3
+ "version": "0.0.1",
4
+ "main": "./index.ts",
5
+ "types": "./index.ts",
6
+ "license": "MIT",
7
+ "scripts": {
8
+ "lint": "TIMING=1 eslint \"**/*.ts*\"",
9
+ "test": "echo \"No tests configured.\"",
10
+ "release": "echo \"No releases configured.\""
11
+ },
12
+ "dependencies": {
13
+ "@codedazur/cdk-amplify-app": "*"
14
+ },
15
+ "peerDependencies": {
16
+ "aws-cdk-lib": ">=2",
17
+ "constructs": ">=10"
18
+ },
19
+ "devDependencies": {
20
+ "@types/node": "^16.18.3",
21
+ "aws-cdk-lib": "^2.55.1",
22
+ "constructs": "^10.1.194",
23
+ "esbuild": "^0.16.9",
24
+ "eslint": "^8.30.0",
25
+ "eslint-config-custom": "*",
26
+ "tsconfig": "*",
27
+ "typescript": "^4.9.4"
28
+ }
29
+ }
package/tsconfig.json ADDED
@@ -0,0 +1,5 @@
1
+ {
2
+ "extends": "@codedazur/tsconfig/cdk.json",
3
+ "include": ["."],
4
+ "exclude": ["dist", "build", "node_modules"]
5
+ }