@codedazur/cdk-next-app 0.0.1 → 0.1.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 CHANGED
@@ -1,5 +1,22 @@
1
1
  # @codedazur/cdk-next-app
2
2
 
3
+ ## 0.1.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [`dd2a6c9`](https://github.com/codedazur/toolkit/commit/dd2a6c9934b9b0ad2fb63e45e963d94d3ebf6dca) Thanks [@thijsdaniels](https://github.com/thijsdaniels)! - Transpile TypeScript to CJS and ESM.
8
+
9
+ ### Patch Changes
10
+
11
+ - Updated dependencies [[`dd2a6c9`](https://github.com/codedazur/toolkit/commit/dd2a6c9934b9b0ad2fb63e45e963d94d3ebf6dca)]:
12
+ - @codedazur/cdk-amplify-app@0.1.0
13
+
14
+ ## 0.0.2
15
+
16
+ ### Patch Changes
17
+
18
+ - [`43029b6`](https://github.com/codedazur/toolkit/commit/43029b6f7d19422d889c0c608efd0064d584c2f3) Thanks [@thijsdaniels](https://github.com/thijsdaniels)! - Added a main index file.
19
+
3
20
  ## 0.0.1
4
21
 
5
22
  ### Patch Changes
@@ -0,0 +1,26 @@
1
+ import { AmplifyAppProps, AmplifyApp } from '@codedazur/cdk-amplify-app';
2
+ export { BasicAuth, Branch, Environment, GitRegistry, GitSource, Redirect, RedirectStatus, Rewrite, RewriteStatus } from '@codedazur/cdk-amplify-app';
3
+ import { Construct } from 'constructs';
4
+
5
+ interface NextAppProps extends Omit<AmplifyAppProps, "platform" | "framework" | "buildSpec" | "headers"> {
6
+ }
7
+ /**
8
+ * @todo Document that if this is used with a monorepo, the `next.config.js`
9
+ * needs to contain
10
+ * ```
11
+ * {
12
+ * experimental: {
13
+ * outputFileTracingRoot: path.join(__dirname, "../../"),
14
+ * },
15
+ * }
16
+ * ```
17
+ * assuming that the project root is at `"../../"` relative to the the
18
+ * `next.config.js` file.
19
+ * @see https://github.com/aws-amplify/amplify-hosting/issues/3179
20
+ * @see https://nextjs.org/docs/advanced-features/output-file-tracing#caveats
21
+ */
22
+ declare class NextApp extends AmplifyApp {
23
+ constructor(scope: Construct, id: string, props: NextAppProps);
24
+ }
25
+
26
+ export { NextApp, NextAppProps };
@@ -0,0 +1,26 @@
1
+ import { AmplifyAppProps, AmplifyApp } from '@codedazur/cdk-amplify-app';
2
+ export { BasicAuth, Branch, Environment, GitRegistry, GitSource, Redirect, RedirectStatus, Rewrite, RewriteStatus } from '@codedazur/cdk-amplify-app';
3
+ import { Construct } from 'constructs';
4
+
5
+ interface NextAppProps extends Omit<AmplifyAppProps, "platform" | "framework" | "buildSpec" | "headers"> {
6
+ }
7
+ /**
8
+ * @todo Document that if this is used with a monorepo, the `next.config.js`
9
+ * needs to contain
10
+ * ```
11
+ * {
12
+ * experimental: {
13
+ * outputFileTracingRoot: path.join(__dirname, "../../"),
14
+ * },
15
+ * }
16
+ * ```
17
+ * assuming that the project root is at `"../../"` relative to the the
18
+ * `next.config.js` file.
19
+ * @see https://github.com/aws-amplify/amplify-hosting/issues/3179
20
+ * @see https://nextjs.org/docs/advanced-features/output-file-tracing#caveats
21
+ */
22
+ declare class NextApp extends AmplifyApp {
23
+ constructor(scope: Construct, id: string, props: NextAppProps);
24
+ }
25
+
26
+ export { NextApp, NextAppProps };
package/dist/index.js ADDED
@@ -0,0 +1,88 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+
20
+ // src/index.ts
21
+ var src_exports = {};
22
+ __export(src_exports, {
23
+ NextApp: () => NextApp
24
+ });
25
+ module.exports = __toCommonJS(src_exports);
26
+
27
+ // src/constructs/NextApp.ts
28
+ var import_cdk_amplify_app = require("@codedazur/cdk-amplify-app");
29
+ var NextApp = class extends import_cdk_amplify_app.AmplifyApp {
30
+ constructor(scope, id, props) {
31
+ super(scope, id, {
32
+ platform: import_cdk_amplify_app.Platform.WEB_COMPUTE,
33
+ framework: import_cdk_amplify_app.Framework.NEXTJS_SSR,
34
+ buildSpec: {
35
+ version: 1,
36
+ applications: [
37
+ {
38
+ appRoot: props.source.directory,
39
+ frontend: {
40
+ phases: {
41
+ preBuild: {
42
+ commands: [
43
+ "npm config set //registry.npmjs.org/:_authToken ${NPM_TOKEN}",
44
+ "npm install"
45
+ ]
46
+ },
47
+ build: {
48
+ commands: ["npm run build"]
49
+ },
50
+ postBuild: {
51
+ commands: [
52
+ /**
53
+ * This command moves the Next.js `standalone` directory
54
+ * into the right location for AWS to recognize it.
55
+ * @todo Remove this command when AWS has implemented a fix.
56
+ * @see https://github.com/aws-amplify/amplify-hosting/issues/3179
57
+ */
58
+ `cp -r .next/standalone/${props.source.directory}/. .next/standalone`
59
+ ]
60
+ }
61
+ },
62
+ artifacts: {
63
+ baseDirectory: ".next",
64
+ files: ["**/*"]
65
+ },
66
+ cache: {
67
+ paths: ["node_modules/**/*"]
68
+ }
69
+ }
70
+ }
71
+ ]
72
+ },
73
+ rewrites: [
74
+ {
75
+ source: "/<*>",
76
+ status: import_cdk_amplify_app.RewriteStatus.NOT_FOUND,
77
+ target: "/index.html"
78
+ },
79
+ ...props.rewrites ?? []
80
+ ],
81
+ ...props
82
+ });
83
+ }
84
+ };
85
+ // Annotate the CommonJS export names for ESM import in node:
86
+ 0 && (module.exports = {
87
+ NextApp
88
+ });
package/dist/index.mjs ADDED
@@ -0,0 +1,66 @@
1
+ // src/constructs/NextApp.ts
2
+ import {
3
+ AmplifyApp,
4
+ Framework,
5
+ Platform,
6
+ RewriteStatus
7
+ } from "@codedazur/cdk-amplify-app";
8
+ var NextApp = class extends AmplifyApp {
9
+ constructor(scope, id, props) {
10
+ super(scope, id, {
11
+ platform: Platform.WEB_COMPUTE,
12
+ framework: Framework.NEXTJS_SSR,
13
+ buildSpec: {
14
+ version: 1,
15
+ applications: [
16
+ {
17
+ appRoot: props.source.directory,
18
+ frontend: {
19
+ phases: {
20
+ preBuild: {
21
+ commands: [
22
+ "npm config set //registry.npmjs.org/:_authToken ${NPM_TOKEN}",
23
+ "npm install"
24
+ ]
25
+ },
26
+ build: {
27
+ commands: ["npm run build"]
28
+ },
29
+ postBuild: {
30
+ commands: [
31
+ /**
32
+ * This command moves the Next.js `standalone` directory
33
+ * into the right location for AWS to recognize it.
34
+ * @todo Remove this command when AWS has implemented a fix.
35
+ * @see https://github.com/aws-amplify/amplify-hosting/issues/3179
36
+ */
37
+ `cp -r .next/standalone/${props.source.directory}/. .next/standalone`
38
+ ]
39
+ }
40
+ },
41
+ artifacts: {
42
+ baseDirectory: ".next",
43
+ files: ["**/*"]
44
+ },
45
+ cache: {
46
+ paths: ["node_modules/**/*"]
47
+ }
48
+ }
49
+ }
50
+ ]
51
+ },
52
+ rewrites: [
53
+ {
54
+ source: "/<*>",
55
+ status: RewriteStatus.NOT_FOUND,
56
+ target: "/index.html"
57
+ },
58
+ ...props.rewrites ?? []
59
+ ],
60
+ ...props
61
+ });
62
+ }
63
+ };
64
+ export {
65
+ NextApp
66
+ };
package/package.json CHANGED
@@ -1,13 +1,24 @@
1
1
  {
2
2
  "name": "@codedazur/cdk-next-app",
3
- "version": "0.0.1",
4
- "main": "./index.ts",
5
- "types": "./index.ts",
3
+ "version": "0.1.0",
4
+ "main": ".dist/index.js",
5
+ "module": "./dist/index.mjs",
6
+ "types": "./dist/index.d.ts",
7
+ "exports": {
8
+ ".": {
9
+ "require": "./dist/index.js",
10
+ "import": "./dist/index.mjs"
11
+ }
12
+ },
13
+ "publishConfig": {
14
+ "access": "public"
15
+ },
6
16
  "license": "MIT",
7
17
  "scripts": {
18
+ "dev": "tsup src/index.ts --format esm,cjs --dts --watch",
19
+ "build": "tsup src/index.ts --format esm,cjs --dts",
8
20
  "lint": "TIMING=1 eslint \"**/*.ts*\"",
9
- "test": "echo \"No tests configured.\"",
10
- "release": "echo \"No releases configured.\""
21
+ "test": "echo \"No tests configured.\""
11
22
  },
12
23
  "dependencies": {
13
24
  "@codedazur/cdk-amplify-app": "*"
@@ -17,13 +28,13 @@
17
28
  "constructs": ">=10"
18
29
  },
19
30
  "devDependencies": {
20
- "@types/node": "^16.18.3",
31
+ "@types/node": "^16.18.3 || ^18.18.0",
21
32
  "aws-cdk-lib": "^2.55.1",
22
33
  "constructs": "^10.1.194",
23
- "esbuild": "^0.16.9",
34
+ "esbuild": "^0.16.9 || ^0.19.1",
24
35
  "eslint": "^8.30.0",
25
36
  "eslint-config-custom": "*",
26
37
  "tsconfig": "*",
27
- "typescript": "^4.9.4"
38
+ "typescript": "^4.9.4 || ^5.2.2"
28
39
  }
29
40
  }
@@ -1,16 +0,0 @@
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%
@@ -1,5 +0,0 @@
1
-
2
- > @codedazur/cdk-next-app@0.0.1 test
3
- > echo "No tests configured."
4
-
5
- No tests configured.
@@ -1,86 +0,0 @@
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/tsconfig.json DELETED
@@ -1,5 +0,0 @@
1
- {
2
- "extends": "@codedazur/tsconfig/cdk.json",
3
- "include": ["."],
4
- "exclude": ["dist", "build", "node_modules"]
5
- }