dcl-ops-lib 9.8.0 → 9.9.1

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
@@ -2,6 +2,13 @@
2
2
 
3
3
  Used to compile pulumi projects
4
4
 
5
+ ## Releases
6
+
7
+ Published to npm as `dcl-ops-lib` by GitHub Actions (`.github/workflows/release.yml`)
8
+ via semantic-release, using npm OIDC trusted publishing:
9
+
10
+ - push to `master` → stable release on the `latest` dist-tag
11
+ - push to `next` → prerelease on the `next` dist-tag
5
12
 
6
13
  # License
7
14
  Published under Apache-2.0
@@ -33,4 +33,13 @@ export type StaticWebsite = {
33
33
  responseHeadersPolicyId?: Input<string>;
34
34
  objectOwnership?: string;
35
35
  overrideContentBucketACL?: string;
36
+ /**
37
+ * Tags applied to the content bucket, logs bucket and CloudFront distribution.
38
+ * Optional: when omitted, no tags are set by buildStatic (existing behavior).
39
+ *
40
+ * When provided, each resource receives a default `Name` derived from the domain
41
+ * (content bucket & distribution: `<domain>`, logs bucket: `<domain>-logs`); a
42
+ * `Name` supplied here overrides that default.
43
+ */
44
+ tags?: Record<string, Input<string>>;
36
45
  };
package/buildStatic.js CHANGED
@@ -20,6 +20,13 @@ function buildStatic(staticSite) {
20
20
  additionalDomains: staticSite.additionalDomains ? staticSite.additionalDomains : [],
21
21
  };
22
22
  const slug = staticSite.domain.replace(/\./g, "-") + "-";
23
+ // Tags for each resource. When the caller opts into tagging we default a per-resource
24
+ // `Name` derived from the domain (caller-provided `Name` wins). When `tags` is omitted
25
+ // the value stays `undefined`, preserving the original untagged behavior.
26
+ const makeTags = (name) => staticSite.tags && { Name: name, ...staticSite.tags };
27
+ const contentBucketTags = makeTags(staticSite.domain);
28
+ const logsBucketTags = makeTags(`${staticSite.domain}-logs`);
29
+ const cdnTags = makeTags(staticSite.domain);
23
30
  // contentBucket is the S3 bucket that the website's contents will be stored in.
24
31
  const bucketInfo = {
25
32
  acl: staticSite.overrideContentBucketACL ? staticSite.overrideContentBucketACL : "public-read",
@@ -29,7 +36,8 @@ function buildStatic(staticSite) {
29
36
  indexDocument: "index.html",
30
37
  errorDocument: staticSite.defaultPath ?? "404.html",
31
38
  },
32
- forceDestroy: staticSite.destroy === true
39
+ forceDestroy: staticSite.destroy === true,
40
+ tags: contentBucketTags,
33
41
  };
34
42
  if (staticSite.corsRules !== undefined) {
35
43
  Object.assign(bucketInfo, { corsRules: staticSite.corsRules });
@@ -48,7 +56,8 @@ function buildStatic(staticSite) {
48
56
  // logsBucket is an S3 bucket that will contain the CDN's request logs.
49
57
  const logsBucket = new aws.s3.Bucket(slug + "logs", {
50
58
  acl: "private",
51
- forceDestroy: staticSite.destroy === true
59
+ forceDestroy: staticSite.destroy === true,
60
+ tags: logsBucketTags,
52
61
  }, {
53
62
  protect,
54
63
  });
@@ -88,15 +97,19 @@ function buildStatic(staticSite) {
88
97
  },
89
98
  cachePolicyId: staticSite.cachePolicyId,
90
99
  responseHeadersPolicyId: staticSite.responseHeadersPolicyId,
91
- minTtl: 0,
92
- defaultTtl: tenMinutes,
93
- maxTtl: aYear,
100
+ // Only set the legacy inline TTLs when there is no cache policy. When a
101
+ // cachePolicyId is provided the policy governs TTLs and CloudFront ignores
102
+ // these, so setting them produces a permanent no-op diff (0 => 600 / 0 => aYear)
103
+ // on every preview. Mirrors the forwardedValues handling above.
104
+ minTtl: staticSite.cachePolicyId ? undefined : 0,
105
+ defaultTtl: staticSite.cachePolicyId ? undefined : tenMinutes,
106
+ maxTtl: staticSite.cachePolicyId ? undefined : aYear,
94
107
  compress: true,
95
108
  },
96
109
  // "All" is the most broad distribution, and also the most expensive.
97
110
  // "100" is the least broad, and also the least expensive.
98
111
  priceClass: staticSite.priceClass || "PriceClass_100",
99
- // You can customize error responses. When CloudFront recieves an error from the origin (e.g. S3 or some other
112
+ // You can customize error responses. When CloudFront receives an error from the origin (e.g. S3 or some other
100
113
  // web service) it can return a different error code, and return the response for a different resource.
101
114
  customErrorResponses: [{ errorCode: 404, responseCode: 404, responsePagePath: "/404.html" }],
102
115
  restrictions: {
@@ -113,6 +126,7 @@ function buildStatic(staticSite) {
113
126
  includeCookies: false,
114
127
  prefix: `${config.targetDomain}/`,
115
128
  },
129
+ tags: cdnTags,
116
130
  };
117
131
  const cdn = new aws.cloudfront.Distribution(slug + "cdn", distributionArgs);
118
132
  // Creates a new Route53 DNS record pointing the domain to the CloudFront distribution.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dcl-ops-lib",
3
- "version": "9.8.0",
3
+ "version": "9.9.1",
4
4
  "scripts": {
5
5
  "build": "tsc && cp bin/* . && node test.js",
6
6
  "test": "tsc -p tsconfig.test.json && ENVIRONMENT=dev node bin-test/rateLimiting.test.js",
@@ -21,14 +21,12 @@
21
21
  "name": "next",
22
22
  "prerelease": true
23
23
  }
24
- ],
25
- "extends": "@semantic-release/gitlab-config"
24
+ ]
26
25
  },
27
26
  "devDependencies": {
28
- "@semantic-release/gitlab-config": "^14.0.1",
29
27
  "@types/mime": "^3.0.4",
30
28
  "@types/node": "20.9.3",
31
- "semantic-release": "^24.2.9",
29
+ "semantic-release": "^25.0.5",
32
30
  "typescript": "5.3.2"
33
31
  },
34
32
  "dependencies": {