@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
  }
@@ -19,7 +19,6 @@ var lambdaEventSources = require('aws-cdk-lib/aws-lambda-event-sources');
19
19
  var awsEvents = require('aws-cdk-lib/aws-events');
20
20
  var awsEventsTargets = require('aws-cdk-lib/aws-events-targets');
21
21
  var awsLogs = require('aws-cdk-lib/aws-logs');
22
- var constructs$1 = require('@jaypie/constructs');
23
22
  var cdkNextjsStandalone = require('cdk-nextjs-standalone');
24
23
  var path = require('path');
25
24
  var awsCloudtrail = require('aws-cdk-lib/aws-cloudtrail');
@@ -2199,7 +2198,8 @@ class JaypieMongoDbSecret extends JaypieEnvSecret {
2199
2198
  class JaypieNextJs extends constructs.Construct {
2200
2199
  constructor(scope, id, props) {
2201
2200
  super(scope, id);
2202
- const domainName = props?.domainName || constructs$1.envHostname();
2201
+ const domainName = props?.domainName || envHostname();
2202
+ this.domainName = domainName;
2203
2203
  const domainNameSanitized = domainName
2204
2204
  .replace(/\./g, "-")
2205
2205
  .replace(/[^a-zA-Z0-9]/g, "_");
@@ -2224,18 +2224,30 @@ class JaypieNextJs extends constructs.Construct {
2224
2224
  }
2225
2225
  return acc;
2226
2226
  }, {});
2227
+ // Process NEXT_PUBLIC_ environment variables
2228
+ const nextPublicEnv = Object.entries(process.env).reduce((acc, [key, value]) => {
2229
+ if (key.startsWith("NEXT_PUBLIC_") && value) {
2230
+ return {
2231
+ ...acc,
2232
+ [key]: value,
2233
+ };
2234
+ }
2235
+ return acc;
2236
+ }, {});
2227
2237
  const nextjs = new cdkNextjsStandalone.Nextjs(this, "NextJsApp", {
2228
2238
  nextjsPath,
2229
2239
  domainProps: {
2230
2240
  domainName,
2231
- hostedZone: constructs$1.resolveHostedZone(this, {
2241
+ hostedZone: resolveHostedZone(this, {
2232
2242
  zone: props?.hostedZone,
2233
2243
  }),
2234
2244
  },
2235
2245
  environment: {
2236
- ...constructs$1.jaypieLambdaEnv(),
2246
+ ...jaypieLambdaEnv(),
2237
2247
  ...secretsEnvironment,
2238
2248
  ...jaypieSecretsEnvironment,
2249
+ ...nextPublicEnv,
2250
+ NEXT_PUBLIC_SITE_URL: `https://${domainName}`,
2239
2251
  },
2240
2252
  overrides: {
2241
2253
  nextjsDistribution: {