@codedazur/cdk-next-app 0.0.2 → 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,16 @@
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
+
3
14
  ## 0.0.2
4
15
 
5
16
  ### 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
+ });
@@ -1,35 +1,12 @@
1
- import { Construct } from "constructs";
1
+ // src/constructs/NextApp.ts
2
2
  import {
3
3
  AmplifyApp,
4
- AmplifyAppProps,
5
4
  Framework,
6
5
  Platform,
7
- RewriteStatus,
6
+ RewriteStatus
8
7
  } 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) {
8
+ var NextApp = class extends AmplifyApp {
9
+ constructor(scope, id, props) {
33
10
  super(scope, id, {
34
11
  platform: Platform.WEB_COMPUTE,
35
12
  framework: Framework.NEXTJS_SSR,
@@ -43,11 +20,11 @@ export class NextApp extends AmplifyApp {
43
20
  preBuild: {
44
21
  commands: [
45
22
  "npm config set //registry.npmjs.org/:_authToken ${NPM_TOKEN}",
46
- "npm install",
47
- ],
23
+ "npm install"
24
+ ]
48
25
  },
49
26
  build: {
50
- commands: ["npm run build"],
27
+ commands: ["npm run build"]
51
28
  },
52
29
  postBuild: {
53
30
  commands: [
@@ -57,30 +34,33 @@ export class NextApp extends AmplifyApp {
57
34
  * @todo Remove this command when AWS has implemented a fix.
58
35
  * @see https://github.com/aws-amplify/amplify-hosting/issues/3179
59
36
  */
60
- `cp -r .next/standalone/${props.source.directory}/. .next/standalone`,
61
- ],
62
- },
37
+ `cp -r .next/standalone/${props.source.directory}/. .next/standalone`
38
+ ]
39
+ }
63
40
  },
64
41
  artifacts: {
65
42
  baseDirectory: ".next",
66
- files: ["**/*"],
43
+ files: ["**/*"]
67
44
  },
68
45
  cache: {
69
- paths: ["node_modules/**/*"],
70
- },
71
- },
72
- },
73
- ],
46
+ paths: ["node_modules/**/*"]
47
+ }
48
+ }
49
+ }
50
+ ]
74
51
  },
75
52
  rewrites: [
76
53
  {
77
54
  source: "/<*>",
78
55
  status: RewriteStatus.NOT_FOUND,
79
- target: "/index.html",
56
+ target: "/index.html"
80
57
  },
81
- ...(props.rewrites ?? []),
58
+ ...props.rewrites ?? []
82
59
  ],
83
- ...props,
60
+ ...props
84
61
  });
85
62
  }
86
- }
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.2",
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": "*"
@@ -1,16 +0,0 @@
1
-
2
- > @codedazur/cdk-next-app@0.0.2 lint
3
- > TIMING=1 eslint "**/*.ts*"
4
-
5
- Rule | Time (ms) | Relative
6
- :------------------------------|----------:|--------:
7
- react/display-name | 110.889 | 76.6%
8
- turbo/no-undeclared-env-vars | 14.348 | 9.9%
9
- react/no-direct-mutation-state | 10.400 | 7.2%
10
- react/require-render-return | 4.000 | 2.8%
11
- react/no-string-refs | 1.033 | 0.7%
12
- react/no-deprecated | 0.883 | 0.6%
13
- react-hooks/rules-of-hooks | 0.540 | 0.4%
14
- react-hooks/exhaustive-deps | 0.275 | 0.2%
15
- react/jsx-no-comment-textnodes | 0.272 | 0.2%
16
- react/no-render-return-value | 0.214 | 0.1%
@@ -1,5 +0,0 @@
1
-
2
- > @codedazur/cdk-next-app@0.0.2 test
3
- > echo "No tests configured."
4
-
5
- No tests configured.
package/index.ts DELETED
@@ -1,13 +0,0 @@
1
- export {
2
- type GitSource,
3
- type GitRegistry,
4
- type Environment,
5
- type Rewrite,
6
- type RewriteStatus,
7
- type Redirect,
8
- type RedirectStatus,
9
- type BasicAuth,
10
- type Branch,
11
- } from "@codedazur/cdk-amplify-app";
12
-
13
- export * from "./constructs/NextApp";
package/tsconfig.json DELETED
@@ -1,5 +0,0 @@
1
- {
2
- "extends": "@codedazur/tsconfig/cdk.json",
3
- "include": ["."],
4
- "exclude": ["dist", "build", "node_modules"]
5
- }