@jaypie/constructs 1.1.59 → 1.1.60

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.
@@ -13,5 +13,6 @@ export interface JaypieNextjsProps {
13
13
  secrets?: JaypieEnvSecret[];
14
14
  }
15
15
  export declare class JaypieNextJs extends Construct {
16
+ readonly domainName: string;
16
17
  constructor(scope: Construct, id: string, props?: JaypieNextjsProps);
17
18
  }
package/dist/esm/index.js CHANGED
@@ -21,7 +21,6 @@ import * as lambdaEventSources from 'aws-cdk-lib/aws-lambda-event-sources';
21
21
  import { Rule, RuleTargetInput } from 'aws-cdk-lib/aws-events';
22
22
  import { LambdaFunction } from 'aws-cdk-lib/aws-events-targets';
23
23
  import { LogGroup, RetentionDays, FilterPattern } from 'aws-cdk-lib/aws-logs';
24
- import { envHostname as envHostname$1, jaypieLambdaEnv as jaypieLambdaEnv$1, resolveHostedZone as resolveHostedZone$1 } from '@jaypie/constructs';
25
24
  import { Nextjs } from 'cdk-nextjs-standalone';
26
25
  import * as path from 'path';
27
26
  import { Trail, ReadWriteType } from 'aws-cdk-lib/aws-cloudtrail';
@@ -2168,7 +2167,8 @@ class JaypieMongoDbSecret extends JaypieEnvSecret {
2168
2167
  class JaypieNextJs extends Construct {
2169
2168
  constructor(scope, id, props) {
2170
2169
  super(scope, id);
2171
- const domainName = props?.domainName || envHostname$1();
2170
+ const domainName = props?.domainName || envHostname();
2171
+ this.domainName = domainName;
2172
2172
  const domainNameSanitized = domainName
2173
2173
  .replace(/\./g, "-")
2174
2174
  .replace(/[^a-zA-Z0-9]/g, "_");
@@ -2193,18 +2193,30 @@ class JaypieNextJs extends Construct {
2193
2193
  }
2194
2194
  return acc;
2195
2195
  }, {});
2196
+ // Process NEXT_PUBLIC_ environment variables
2197
+ const nextPublicEnv = Object.entries(process.env).reduce((acc, [key, value]) => {
2198
+ if (key.startsWith("NEXT_PUBLIC_") && value) {
2199
+ return {
2200
+ ...acc,
2201
+ [key]: value,
2202
+ };
2203
+ }
2204
+ return acc;
2205
+ }, {});
2196
2206
  const nextjs = new Nextjs(this, "NextJsApp", {
2197
2207
  nextjsPath,
2198
2208
  domainProps: {
2199
2209
  domainName,
2200
- hostedZone: resolveHostedZone$1(this, {
2210
+ hostedZone: resolveHostedZone(this, {
2201
2211
  zone: props?.hostedZone,
2202
2212
  }),
2203
2213
  },
2204
2214
  environment: {
2205
- ...jaypieLambdaEnv$1(),
2215
+ ...jaypieLambdaEnv(),
2206
2216
  ...secretsEnvironment,
2207
2217
  ...jaypieSecretsEnvironment,
2218
+ ...nextPublicEnv,
2219
+ NEXT_PUBLIC_SITE_URL: `https://${domainName}`,
2208
2220
  },
2209
2221
  overrides: {
2210
2222
  nextjsDistribution: {