dcl-ops-lib 9.8.0 → 9.9.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
@@ -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
  });
@@ -96,7 +105,7 @@ function buildStatic(staticSite) {
96
105
  // "All" is the most broad distribution, and also the most expensive.
97
106
  // "100" is the least broad, and also the least expensive.
98
107
  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
108
+ // You can customize error responses. When CloudFront receives an error from the origin (e.g. S3 or some other
100
109
  // web service) it can return a different error code, and return the response for a different resource.
101
110
  customErrorResponses: [{ errorCode: 404, responseCode: 404, responsePagePath: "/404.html" }],
102
111
  restrictions: {
@@ -113,6 +122,7 @@ function buildStatic(staticSite) {
113
122
  includeCookies: false,
114
123
  prefix: `${config.targetDomain}/`,
115
124
  },
125
+ tags: cdnTags,
116
126
  };
117
127
  const cdn = new aws.cloudfront.Distribution(slug + "cdn", distributionArgs);
118
128
  // 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.0",
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": {