@wolsok/spa-cdk-stack 1.0.42 → 1.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/README.md CHANGED
@@ -11,6 +11,21 @@ Features are:
11
11
  - Redirect from HTTP to HTTPS with an ACM certificate.
12
12
  - Route53 alias record creation,
13
13
 
14
+ ## Usage
15
+
16
+ `SpaStack` is a stack holding one `SpaConstruct`. Use it as is, or extend it and
17
+ call `this.spa.addExtraAssets(...)` to deploy further files with their own cache
18
+ headers:
19
+
20
+ ```ts
21
+ new SpaStack(app, 'MyApp', {
22
+ env: { region: 'us-east-1', account: '123456789012' },
23
+ buildOutputPath: 'dist/apps/my-app',
24
+ domainName: 'my-app.example.com',
25
+ noCacheFiles: ['remoteEntry.json'],
26
+ });
27
+ ```
28
+
14
29
  ## Building
15
30
 
16
31
  ## Running unit tests
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wolsok/spa-cdk-stack",
3
- "version": "1.0.42",
3
+ "version": "1.1.0",
4
4
  "repository": "https://github.com/WolfSoko/wol-sok-mono/tree/main/libs/public/spa-cdk-stack",
5
5
  "dependencies": {
6
6
  "tslib": "^2.3.0",
package/src/index.d.ts CHANGED
@@ -1,2 +1,3 @@
1
1
  export * from './lib/spa/spa.construct';
2
+ export * from './lib/spa/spa.stack';
2
3
  export * from './lib/utils/envOrDie';
package/src/index.js CHANGED
@@ -1,3 +1,4 @@
1
1
  export * from './lib/spa/spa.construct';
2
+ export * from './lib/spa/spa.stack';
2
3
  export * from './lib/utils/envOrDie';
3
4
  //# sourceMappingURL=index.js.map
package/src/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../libs/public/spa-cdk-stack/src/index.ts"],"names":[],"mappings":"AAAA,cAAc,yBAAyB,CAAC;AACxC,cAAc,sBAAsB,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../libs/public/spa-cdk-stack/src/index.ts"],"names":[],"mappings":"AAAA,cAAc,yBAAyB,CAAC;AACxC,cAAc,qBAAqB,CAAC;AACpC,cAAc,sBAAsB,CAAC"}
@@ -0,0 +1,12 @@
1
+ import { Stack, StackProps } from 'aws-cdk-lib';
2
+ import { Construct } from 'constructs';
3
+ import { SpaConstruct, SpaProps } from './spa.construct';
4
+ export type SpaStackProps = StackProps & SpaProps;
5
+ /**
6
+ * A stack that holds a single SpaConstruct with the same id as the stack.
7
+ * Extend it and call `spa.addExtraAssets` to deploy further files.
8
+ */
9
+ export declare class SpaStack extends Stack {
10
+ readonly spa: SpaConstruct;
11
+ constructor(parent: Construct, name: string, props: SpaStackProps);
12
+ }
@@ -0,0 +1,19 @@
1
+ import { Stack } from 'aws-cdk-lib';
2
+ import { SpaConstruct } from './spa.construct';
3
+ /**
4
+ * A stack that holds a single SpaConstruct with the same id as the stack.
5
+ * Extend it and call `spa.addExtraAssets` to deploy further files.
6
+ */
7
+ export class SpaStack extends Stack {
8
+ constructor(parent, name, props) {
9
+ super(parent, name, props);
10
+ this.spa = new SpaConstruct(this, name, {
11
+ domainName: props.domainName,
12
+ buildOutputPath: props.buildOutputPath,
13
+ bucketRemovalPolicy: props.bucketRemovalPolicy,
14
+ extraAllowedOrigins: props.extraAllowedOrigins,
15
+ noCacheFiles: props.noCacheFiles,
16
+ });
17
+ }
18
+ }
19
+ //# sourceMappingURL=spa.stack.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"spa.stack.js","sourceRoot":"","sources":["../../../../../../../libs/public/spa-cdk-stack/src/lib/spa/spa.stack.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAc,MAAM,aAAa,CAAC;AAEhD,OAAO,EAAE,YAAY,EAAY,MAAM,iBAAiB,CAAC;AAIzD;;;GAGG;AACH,MAAM,OAAO,QAAS,SAAQ,KAAK;IAGjC,YAAY,MAAiB,EAAE,IAAY,EAAE,KAAoB;QAC/D,KAAK,CAAC,MAAM,EAAE,IAAI,EAAE,KAAK,CAAC,CAAC;QAE3B,IAAI,CAAC,GAAG,GAAG,IAAI,YAAY,CAAC,IAAI,EAAE,IAAI,EAAE;YACtC,UAAU,EAAE,KAAK,CAAC,UAAU;YAC5B,eAAe,EAAE,KAAK,CAAC,eAAe;YACtC,mBAAmB,EAAE,KAAK,CAAC,mBAAmB;YAC9C,mBAAmB,EAAE,KAAK,CAAC,mBAAmB;YAC9C,YAAY,EAAE,KAAK,CAAC,YAAY;SACjC,CAAC,CAAC;IACL,CAAC;CACF"}