@fy-stack/app-construct 0.0.147-alpha.304 → 0.0.147-alpha.3042

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.
@@ -1 +1 @@
1
- {"version":3,"file":"image-app-construct.d.ts","sourceRoot":"","sources":["../../../../src/lib/ecs/apps/image-app-construct.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,8BAA8B,CAAC;AACzE,OAAO,EAEL,eAAe,EAKhB,MAAM,4BAA4B,CAAC;AACpC,OAAO,KAAK,GAAG,MAAM,qBAAqB,CAAC;AAC3C,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAIvC,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAEvD,qBAAa,iBAAkB,SAAQ,SAAU,YAAW,YAAY;IAMpE,OAAO,CAAC,KAAK;IALR,SAAS,EAAE,GAAG,CAAC,mBAAmB,CAAC;gBAGxC,KAAK,EAAE,SAAS,EAChB,EAAE,EAAE,MAAM,EACF,KAAK,EAAE,aAAa,CAAC,OAAO,CAAC;IAMvC,MAAM,CAAC,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,UAAU,CAAC,GAAG,IAAI;IAOpD,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,eAAe,CAAC;IAyBzD,gBAAgB,CAAC,cAAc,EAAE,MAAM;IAIvC,GAAG,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,oBAAoB,CAAC;IAIvD,MAAM,CAAC,KAAK,CAAC,MAAM,EAAE,OAAO;CAG7B"}
1
+ {"version":3,"file":"image-app-construct.d.ts","sourceRoot":"","sources":["../../../../src/lib/ecs/apps/image-app-construct.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,8BAA8B,CAAC;AACzE,OAAO,EAEL,eAAe,EAKhB,MAAM,4BAA4B,CAAC;AACpC,OAAO,KAAK,GAAG,MAAM,qBAAqB,CAAC;AAC3C,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAIvC,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAEvD,qBAAa,iBAAkB,SAAQ,SAAU,YAAW,YAAY;IAMpE,OAAO,CAAC,KAAK;IALR,SAAS,EAAE,GAAG,CAAC,mBAAmB,CAAC;gBAGxC,KAAK,EAAE,SAAS,EAChB,EAAE,EAAE,MAAM,EACF,KAAK,EAAE,aAAa,CAAC,OAAO,CAAC;IAUvC,MAAM,CAAC,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,UAAU,CAAC,GAAG,IAAI;IAOpD,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,eAAe,CAAC;IAyBzD,gBAAgB,CAAC,cAAc,EAAE,MAAM;IAIvC,GAAG,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,oBAAoB,CAAC;IAIvD,MAAM,CAAC,KAAK,CAAC,MAAM,EAAE,OAAO;CAG7B"}
@@ -11,7 +11,7 @@ class ImageAppConstruct extends constructs_1.Construct {
11
11
  constructor(scope, id, props) {
12
12
  super(scope, id);
13
13
  this.props = props;
14
- this.container = (0, taskDefinitionImage_1.taskDefinitionImage)(`${props.appName}AppContainer`, props);
14
+ this.container = (0, taskDefinitionImage_1.taskDefinitionImage)(this, `${props.appName}AppContainer`, props);
15
15
  }
16
16
  attach(attachable) {
17
17
  const params = Object.assign({}, ...(0, params_from_attachable_1.paramsFromAttachable)(attachable));
@@ -1 +1 @@
1
- {"version":3,"file":"next-app-router-construct.d.ts","sourceRoot":"","sources":["../../../../src/lib/ecs/apps/next-app-router-construct.ts"],"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OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,8BAA8B,CAAC;AACzE,OAAO,KAAK,UAAU,MAAM,4BAA4B,CAAC;AACzD,OAAO,KAAK,GAAG,MAAM,qBAAqB,CAAC;AAE3C,OAAO,KAAK,GAAG,MAAM,qBAAqB,CAAC;AAC3C,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AASvC,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAEvD,KAAK,kBAAkB,GAAG,aAAa,CAAC,OAAO,CAAC,CAAC;AAEjD,qBAAa,sBAAuB,SAAQ,SAAU,YAAW,YAAY;IAOjC,OAAO,CAAC,KAAK;IANhD,SAAS,EAAE,GAAG,CAAC,mBAAmB,CAAC;IACnC,KAAK,EAAE,GAAG,CAAC,KAAK,GAAG,SAAS,CAAC;IAEpC,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAa;IACpC,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAU;gBAEpB,KAAK,EAAE,SAAS,EAAE,EAAE,EAAE,MAAM,EAAU,KAAK,EAAE,kBAAkB;IA4B3E,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,UAAU,CAAC,eAAe,CAAC;IAcpE,gBAAgB,CAAC,cAAc,EAAE,MAAM;IAIvC,GAAG,IAAI,MAAM,CAAC,MAAM,EAAE,oBAAoB,CAAC;IAI3C,MAAM,CAAC,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,UAAU,CAAC;IAO7C,MAAM,CAAC,KAAK,CAAC,MAAM,EAAE,OAAO;CAG7B"}
@@ -1,6 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.NextAppRouterConstruct = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const s3 = tslib_1.__importStar(require("aws-cdk-lib/aws-s3"));
4
6
  const constructs_1 = require("constructs");
5
7
  const next_app_router_1 = require("../../shared/next-app-router");
6
8
  const params_from_attachable_1 = require("../../util/params-from-attachable");
@@ -14,10 +16,19 @@ class NextAppRouterConstruct extends constructs_1.Construct {
14
16
  constructor(scope, id, props) {
15
17
  super(scope, id);
16
18
  this.props = props;
17
- const deployment = (0, next_app_router_1.staticDeployment)(this, props.output);
18
- this.static = deployment.staticBucket;
19
- this.files = deployment.files;
20
- this.container = (0, taskDefinitionImage_1.taskDefinitionImage)(`${props.appName}AppContainer`, props);
19
+ if ('output' in props) {
20
+ const deployment = (0, next_app_router_1.staticDeployment)(this, props.output);
21
+ this.static = deployment.staticBucket;
22
+ this.files = deployment.files;
23
+ }
24
+ else {
25
+ if (!props.reference.static || !props.reference.files) {
26
+ throw new Error('Static bucket reference and files are required');
27
+ }
28
+ this.static = s3.Bucket.fromBucketName(this, 'StaticBucket', props.reference.static);
29
+ this.files = props.reference.files;
30
+ }
31
+ this.container = (0, taskDefinitionImage_1.taskDefinitionImage)(this, `${props.appName}AppContainer`, props);
21
32
  }
22
33
  cloudfront(path) {
23
34
  const { origin, basePath } = this.props.serverOrigin(this.props.port, this.container.containerName, path, '/');
@@ -1 +1 @@
1
- {"version":3,"file":"task-construct.d.ts","sourceRoot":"","sources":["../../../../src/lib/ecs/apps/task-construct.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,MAAM,EACN,UAAU,EACV,aAAa,EACb,KAAK,EACL,SAAS,EACV,MAAM,iBAAiB,CAAC;AAEzB,OAAO,KAAK,GAAG,MAAM,qBAAqB,CAAC;AAG3C,OAAO,KAAK,GAAG,MAAM,qBAAqB,CAAC;AAC3C,OAAO,KAAK,eAAe,MAAM,mCAAmC,CAAC;AAErE,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAGvC,OAAO,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAC;AAE/C,qBAAa,aACX,SAAQ,SACR,YAAW,aAAa,EAAE,KAAK,EAAE,MAAM;IAOrC,OAAO,CAAC,KAAK;IALR,UAAU,EAAE,GAAG,CA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,EAAE,OAAO;CAG7B"}
@@ -2,7 +2,6 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.TaskConstruct = void 0;
4
4
  const tslib_1 = require("tslib");
5
- const ecrAssets = tslib_1.__importStar(require("aws-cdk-lib/aws-ecr-assets"));
6
5
  const ecs = tslib_1.__importStar(require("aws-cdk-lib/aws-ecs"));
7
6
  const iam = tslib_1.__importStar(require("aws-cdk-lib/aws-iam"));
8
7
  const pipes = tslib_1.__importStar(require("aws-cdk-lib/aws-pipes"));
@@ -10,35 +9,27 @@ const snsSubscription = tslib_1.__importStar(require("aws-cdk-lib/aws-sns-subscr
10
9
  const sqs = tslib_1.__importStar(require("aws-cdk-lib/aws-sqs"));
11
10
  const constructs_1 = require("constructs");
12
11
  const params_from_attachable_1 = require("../../util/params-from-attachable");
12
+ const taskDefinitionImage_1 = require("../shared/taskDefinitionImage");
13
13
  class TaskConstruct extends constructs_1.Construct {
14
14
  props;
15
15
  definition;
16
16
  constructor(scope, id, props) {
17
17
  super(scope, id);
18
18
  this.props = props;
19
- const { container, output, ...definitionProps } = props;
19
+ const { definition, cluster, taskName, vpc, ...containerProps } = props;
20
20
  this.definition = new ecs.FargateTaskDefinition(this, 'Task', {
21
21
  cpu: 256,
22
22
  memoryLimitMiB: 512,
23
23
  runtimePlatform: {
24
24
  cpuArchitecture: ecs.CpuArchitecture.X86_64,
25
25
  },
26
- ...definitionProps,
26
+ ...props.definition,
27
+ });
28
+ (0, taskDefinitionImage_1.taskDefinitionImage)(this, 'DefaultImage', {
29
+ port: 8080,
30
+ taskDefinition: this.definition,
31
+ ...containerProps,
27
32
  });
28
- if (container) {
29
- const { image: imageProps, logDuration, ...containerProps } = container;
30
- this.definition.addContainer('DefaultImage', {
31
- image: ecs.ContainerImage.fromAsset(output, {
32
- platform: ecrAssets.Platform.LINUX_AMD64,
33
- ...imageProps,
34
- }),
35
- logging: new ecs.AwsLogDriver({
36
- streamPrefix: `${props.taskName}TaskContainer`,
37
- logGroup: props.logGroup,
38
- }),
39
- ...containerProps,
40
- });
41
- }
42
33
  }
43
34
  subscription(props) {
44
35
  const queue = new sqs.Queue(this, 'TaskQueue');
@@ -1,14 +1,7 @@
1
1
  import * as ecs from 'aws-cdk-lib/aws-ecs';
2
- import type { LogGroup } from 'aws-cdk-lib/aws-logs';
3
- import type { AppProperties } from '../types';
4
- type Props = {
5
- output: string;
6
- logGroup: LogGroup;
7
- taskDefinition: ecs.TaskDefinition;
8
- env?: Record<string, string>;
9
- port: number;
10
- container?: AppProperties['container'];
11
- };
12
- export declare function taskDefinitionImage(id: string, props: Props): ecs.ContainerDefinition;
2
+ import type { AppProperties, AppSource } from '../types';
3
+ import type { Construct } from 'constructs';
4
+ type Props = AppSource & Pick<AppProperties, 'env' | 'port' | 'logGroup' | 'taskDefinition'>;
5
+ export declare function taskDefinitionImage(scope: Construct, id: string, props: Props): ecs.ContainerDefinition;
13
6
  export {};
14
7
  //# sourceMappingURL=taskDefinitionImage.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"taskDefinitionImage.d.ts","sourceRoot":"","sources":["../../../../src/lib/ecs/shared/taskDefinitionImage.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,GAAG,MAAM,qBAAqB,CAAC;AAC3C,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAErD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAE9C,KAAK,KAAK,GAAG;IACX,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,QAAQ,CAAC;IACnB,cAAc,EAAE,GAAG,CAAC,cAAc,CAAC;IACnC,GAAG,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC7B,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,CAAC,EAAE,aAAa,CAAC,WAAW,CAAC,CAAC;CACxC,CAAC;AAEF,wBAAgB,mBAAmB,CAAC,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,KAAK,2BAuB3D"}
1
+ {"version":3,"file":"taskDefinitionImage.d.ts","sourceRoot":"","sources":["../../../../src/lib/ecs/shared/taskDefinitionImage.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,GAAG,MAAM,qBAAqB,CAAC;AAG3C,OAAO,KAAK,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AACzD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAE5C,KAAK,KAAK,GAAG,SAAS,GACpB,IAAI,CAAC,aAAa,EAAE,KAAK,GAAG,MAAM,GAAG,UAAU,GAAG,gBAAgB,CAAC,CAAC;AAEtE,wBAAgB,mBAAmB,CACjC,KAAK,EAAE,SAAS,EAChB,EAAE,EAAE,MAAM,EACV,KAAK,EAAE,KAAK,2BA8Cb"}
@@ -5,17 +5,29 @@ const tslib_1 = require("tslib");
5
5
  const node_path_1 = tslib_1.__importDefault(require("node:path"));
6
6
  const ecrAssets = tslib_1.__importStar(require("aws-cdk-lib/aws-ecr-assets"));
7
7
  const ecs = tslib_1.__importStar(require("aws-cdk-lib/aws-ecs"));
8
- function taskDefinitionImage(id, props) {
9
- const { image, logDuration, ...containerProps } = props.container ?? {};
10
- return props.taskDefinition.addContainer(id, {
11
- image: ecs.ContainerImage.fromAsset(node_path_1.default.join(props.output), {
8
+ const ecr = tslib_1.__importStar(require("aws-cdk-lib/aws-ecr"));
9
+ function taskDefinitionImage(scope, id, props) {
10
+ let image;
11
+ let containerProps;
12
+ if ('output' in props) {
13
+ const { image: imageProps, ..._containerProps } = props.container ?? {};
14
+ image = ecs.ContainerImage.fromAsset(node_path_1.default.join(props.output), {
12
15
  platform: ecrAssets.Platform.LINUX_AMD64,
13
- ...(image ?? {}),
16
+ ...(imageProps ?? {}),
14
17
  buildArgs: {
15
18
  PORT: props.port.toString(),
16
- ...(image?.buildArgs ?? {}),
19
+ ...(imageProps?.buildArgs ?? {}),
17
20
  },
18
- }),
21
+ });
22
+ containerProps = _containerProps;
23
+ }
24
+ else {
25
+ const repository = ecr.Repository.fromRepositoryName(scope, `${id}Repository`, props.reference.repository);
26
+ image = ecs.ContainerImage.fromEcrRepository(repository, props.reference.tag);
27
+ containerProps = props.container;
28
+ }
29
+ return props.taskDefinition.addContainer(id, {
30
+ image,
19
31
  logging: new ecs.AwsLogDriver({
20
32
  streamPrefix: id,
21
33
  logGroup: props.logGroup,
@@ -4,7 +4,7 @@ import type { LoadBalancerV2Origin } from 'aws-cdk-lib/aws-cloudfront-origins';
4
4
  import type { IVpc } from 'aws-cdk-lib/aws-ec2';
5
5
  import type { AssetImageProps, Cluster, ContainerDefinitionOptions, FargateServiceProps, FargateTaskDefinitionProps, TaskDefinition } from 'aws-cdk-lib/aws-ecs';
6
6
  import type { ApplicationLoadBalancerProps } from 'aws-cdk-lib/aws-elasticloadbalancingv2';
7
- import type { LogGroup, RetentionDays } from 'aws-cdk-lib/aws-logs';
7
+ import type { LogGroup } from 'aws-cdk-lib/aws-logs';
8
8
  export type EcsConstructProps = {
9
9
  logGroup: LogGroup;
10
10
  environmentPath: string;
@@ -33,30 +33,33 @@ export type EcsConstructProps = {
33
33
  };
34
34
  tasks?: Record<string, TaskApp>;
35
35
  };
36
+ export type AppSource = {
37
+ output: string;
38
+ container?: Omit<ContainerDefinitionOptions, 'image' | 'logging'> & {
39
+ image: AssetImageProps;
40
+ };
41
+ } | {
42
+ reference: {
43
+ repository: string;
44
+ static?: string;
45
+ files?: Record<string, string>;
46
+ tag?: string;
47
+ };
48
+ container?: Omit<ContainerDefinitionOptions, 'image' | 'logging'>;
49
+ };
36
50
  export type ServerApp = {
37
51
  type: typeof AppType.NEXT_APP_ROUTER | typeof AppType.IMAGE_APP;
38
- /** Directory of build output to be deployed */
39
- output: string;
40
52
  env?: Record<string, string>;
41
53
  /** Additional parameters that may be required, this varies based on type */
42
54
  buildParams?: Record<string, unknown>;
43
55
  port: number;
44
- container?: Omit<ContainerDefinitionOptions, 'image' | 'logging'> & {
45
- image: AssetImageProps;
46
- logDuration?: RetentionDays;
47
- };
48
- };
56
+ } & AppSource;
49
57
  export type TaskApp = {
50
58
  type: typeof AppType.IMAGE_APP;
51
- /** Directory of build output to be deployed */
52
- output: string;
53
59
  env?: Record<string, string>;
54
60
  buildParams?: Record<string, unknown>;
55
- container?: Omit<ContainerDefinitionOptions, 'image' | 'logging'> & {
56
- image: AssetImageProps;
57
- logDuration?: RetentionDays;
58
- };
59
- };
61
+ definition?: FargateTaskDefinitionProps;
62
+ } & AppSource;
60
63
  export type AppProperties<BuildParams = Record<string, unknown>> = {
61
64
  appName: string;
62
65
  environmentPath: string;
@@ -69,25 +72,15 @@ export type AppProperties<BuildParams = Record<string, unknown>> = {
69
72
  origin: LoadBalancerV2Origin;
70
73
  };
71
74
  port: number;
72
- output: string;
73
- container?: Omit<ContainerDefinitionOptions, 'image' | 'logging'> & {
74
- image: AssetImageProps;
75
- logDuration?: RetentionDays;
76
- };
77
- };
78
- export type TaskConstructsProps = FargateTaskDefinitionProps & {
75
+ } & AppSource;
76
+ export type TaskConstructsProps = {
79
77
  vpc: IVpc;
80
78
  logGroup: LogGroup;
81
79
  taskName: string;
82
80
  cluster: Cluster;
83
81
  env?: Record<string, string>;
84
- /** Directory of build output to be deployed */
85
- output: string;
86
- container?: Omit<ContainerDefinitionOptions, 'image' | 'logging'> & {
87
- image: AssetImageProps;
88
- logDuration?: RetentionDays;
89
- };
90
- };
82
+ definition?: FargateTaskDefinitionProps;
83
+ } & AppSource;
91
84
  export interface AppConstruct extends Attach, CDNResource, ApiResource {
92
85
  }
93
86
  //# sourceMappingURL=types.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/lib/ecs/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AACxE,OAAO,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAC;AAC1C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Q,CAAC,MAAM,CAAY;IACnC,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAU;gBAG9B,KAAK,EAAE,SAAS,EAChB,EAAE,EAAE,MAAM,EACV,KAAK,EAAE,aAAa,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,iBAAiB,CAAC,CAAC;IAyCzD,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,UAAU,CAAC,eAAe,CAAC;IAkBpE,gBAAgB,CAAC,cAAc,EAAE,MAAM;IAIvC,GAAG,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,oBAAoB,CAAC;IAkF3D,MAAM,CAAC,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,UAAU,CAAC;IAI7C,KAAK,CAAC,GAAG,MAAM,EAAE,SAAS,EAAE;IAI5B,YAAY,IAAI,kBAAkB;IAIlC,MAAM,CAAC,KAAK,CAAC,MAAM,EAAE,OAAO;;;CAG7B"}
@@ -66,21 +66,26 @@ class NextAppRouterConstruct extends constructs_1.Construct {
66
66
  authType: lambda.FunctionUrlAuthType.NONE,
67
67
  invokeMode: aws_lambda_1.InvokeMode.RESPONSE_STREAM,
68
68
  });
69
- if (strippedBasePath) {
69
+ if (this.files.staticFiles) {
70
+ const staticFiles = s3Deploy.Source.bucket(this.static, this.files.staticFiles);
70
71
  new s3Deploy.BucketDeployment(this, `${strippedBasePath}StaticDeployment`, {
71
72
  destinationBucket: this.static,
72
- sources: [this.files.staticFiles],
73
+ sources: [staticFiles],
73
74
  destinationKeyPrefix: `${strippedBasePath}/_next/static/`,
74
75
  retainOnDelete: false,
75
76
  });
77
+ }
78
+ if (this.files.publicFiles) {
79
+ const publicFiles = s3Deploy.Source.bucket(this.static, this.files.publicFiles);
76
80
  new s3Deploy.BucketDeployment(this, `${strippedBasePath}PublicDeployment`, {
77
81
  destinationBucket: this.static,
78
- sources: [this.files.publicFiles],
82
+ sources: [publicFiles],
79
83
  destinationKeyPrefix: `${strippedBasePath}/`,
80
84
  retainOnDelete: false,
81
85
  });
82
- this.function.addEnvironment('BASE_PATH', basePath);
83
86
  }
87
+ if (strippedBasePath)
88
+ this.function.addEnvironment('BASE_PATH', basePath);
84
89
  const imageIntegration = new aws_apigatewayv2_integrations_1.HttpUrlIntegration('AppImageIntegration', apiUrl.url + path.join(strippedBasePath, '_next/image', '{proxy}'));
85
90
  const staticIntegration = new aws_apigatewayv2_integrations_1.HttpUrlIntegration('AppStaticIntegration', this.static.bucketWebsiteUrl +
86
91
  path.join(strippedBasePath, '/_next', '{proxy}'));
@@ -1,20 +1,19 @@
1
1
  import * as cdk from 'aws-cdk-lib';
2
2
  import * as cloudfront from 'aws-cdk-lib/aws-cloudfront';
3
3
  import * as s3 from 'aws-cdk-lib/aws-s3';
4
- import * as s3Deploy from 'aws-cdk-lib/aws-s3-deployment';
5
4
  import { Construct } from 'constructs';
6
5
  export type AppFile = {
7
- staticFiles: s3Deploy.ISource;
8
- publicFiles: s3Deploy.ISource;
6
+ staticFiles?: string;
7
+ publicFiles?: string;
9
8
  };
10
9
  export declare function staticDeployment(app: Construct, output: string): {
11
10
  staticBucket: cdk.aws_s3.Bucket;
12
11
  files: {
13
- staticFiles: cdk.aws_s3_deployment.ISource;
14
- publicFiles: cdk.aws_s3_deployment.ISource;
12
+ staticFiles: string;
13
+ publicFiles: string;
15
14
  };
16
15
  };
17
- export declare function cloudfrontBehaviours(app: Construct, staticBucket: s3.Bucket, serverOrigin: cloudfront.IOrigin, basePath: string, files: AppFile, isLambda?: boolean): {
16
+ export declare function cloudfrontBehaviours(app: Construct, staticBucket: s3.IBucket, serverOrigin: cloudfront.IOrigin, basePath: string, files: AppFile, isLambda?: boolean): {
18
17
  [x: string]: cdk.aws_cloudfront.BehaviorOptions;
19
18
  };
20
19
  //# sourceMappingURL=next-app-router.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"next-app-router.d.ts","sourceRoot":"","sources":["../../../src/lib/shared/next-app-router.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AAC,OAAO,EAChC,QAAQ,EAAE,MAAM,EAChB,KAAK,EAAE,OAAO,EACd,QAAQ,UAAQ;;EA0EjB"}
@@ -28,36 +28,48 @@ function staticDeployment(app, output) {
28
28
  });
29
29
  const staticFiles = s3Deploy.Source.asset(node_path_1.default.join(output, '/.next/static'));
30
30
  const publicFiles = s3Deploy.Source.asset(node_path_1.default.join(output, '/public'));
31
- new s3Deploy.BucketDeployment(app, `StaticDeployment`, {
31
+ const staticDeployment = new s3Deploy.BucketDeployment(app, `StaticAssetDeployment`, {
32
32
  destinationBucket: staticBucket,
33
33
  sources: [staticFiles],
34
- destinationKeyPrefix: '_next/static',
34
+ destinationKeyPrefix: 'assets',
35
35
  retainOnDelete: false,
36
+ extract: false,
36
37
  });
37
- new s3Deploy.BucketDeployment(app, `PublicDeployment`, {
38
+ const publicDeployment = new s3Deploy.BucketDeployment(app, `StaticAssetDeployment`, {
38
39
  destinationBucket: staticBucket,
39
40
  sources: [publicFiles],
40
- destinationKeyPrefix: '',
41
+ destinationKeyPrefix: 'assets',
41
42
  retainOnDelete: false,
43
+ extract: false,
42
44
  });
43
- return {
44
- staticBucket,
45
- files: { staticFiles, publicFiles },
45
+ const files = {
46
+ staticFiles: staticDeployment.objectKeys[0],
47
+ publicFiles: publicDeployment.objectKeys[0],
46
48
  };
49
+ if (!files.publicFiles || !files.staticFiles) {
50
+ throw new Error('Failed to deploy static and public files');
51
+ }
52
+ return { staticBucket, files };
47
53
  }
48
54
  function cloudfrontBehaviours(app, staticBucket, serverOrigin, basePath, files, isLambda = false) {
49
- if (basePath) {
50
- const strippedBasePath = basePath.replace(/^\/+|\/+$/g, '');
55
+ const strippedBasePath = basePath.replace(/^\/+|\/+$/g, '');
56
+ if (files.staticFiles) {
57
+ const staticFiles = s3Deploy.Source.bucket(staticBucket, files.staticFiles);
51
58
  new s3Deploy.BucketDeployment(app, `${basePath}StaticDeployment`, {
52
59
  destinationBucket: staticBucket,
53
- sources: [files.staticFiles],
60
+ sources: [staticFiles],
54
61
  destinationKeyPrefix: `${strippedBasePath}/_next/static/`,
55
62
  retainOnDelete: false,
56
63
  });
64
+ }
65
+ if (files.publicFiles) {
66
+ const publicFiles = s3Deploy.Source.bucket(staticBucket, files.publicFiles);
57
67
  new s3Deploy.BucketDeployment(app, `${basePath}PublicDeployment`, {
58
68
  destinationBucket: staticBucket,
59
- sources: [files.publicFiles],
60
- destinationKeyPrefix: `${strippedBasePath}/`,
69
+ sources: [publicFiles],
70
+ destinationKeyPrefix: strippedBasePath
71
+ ? `${strippedBasePath}/`
72
+ : undefined,
61
73
  retainOnDelete: false,
62
74
  });
63
75
  }
package/package.json CHANGED
@@ -1,9 +1,9 @@
1
1
  {
2
2
  "name": "@fy-stack/app-construct",
3
- "version": "0.0.147-alpha.304",
3
+ "version": "0.0.147-alpha.3042",
4
4
  "repository": "https://github.com/festusyuma/fy-stack",
5
5
  "dependencies": {
6
- "@fy-stack/types": "0.0.147-alpha.304",
6
+ "@fy-stack/types": "0.0.147-alpha.3042",
7
7
  "tslib": "^2.3.0",
8
8
  "zod": "^3.24.1"
9
9
  },