@tahminator/pipeline 1.0.95 → 1.0.96

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
@@ -30,6 +30,13 @@ bun run src/index.ts
30
30
  > [!WARNING]
31
31
  > This repository is iterating quickly & as such may have rough edges. I will always be happy to respond to & fix any issues anyone may have :)
32
32
 
33
+ The setup action's `INSTALL_BREW`, `INSTALL_PROTOC`, and
34
+ `INSTALL_PROTO_DEPENDENCIES` options use Homebrew preinstalled at
35
+ `/home/linuxbrew/.linuxbrew` on GitHub-hosted Ubuntu runners. Setup adds it to
36
+ the job's `PATH` and disables automatic updates, using the runner image's
37
+ Homebrew version rather than fetching the latest release. Runners without
38
+ Homebrew at that location are not supported by these options.
39
+
33
40
  ## CI script checks
34
41
 
35
42
  Enable `LINT_CI` to typecheck, lint, and check formatting without a `test` script:
@@ -75,8 +75,8 @@ export class DockerClient {
75
75
  --allow network.host \
76
76
  ${tagFlags} \
77
77
  .`;
78
- console.log(shouldUpload ?
79
- `Image build & successfully uploaded to ${this.username}/${dockerRepository}`
78
+ console.log(shouldUpload
79
+ ? `Image build & successfully uploaded to ${this.username}/${dockerRepository}`
80
80
  : "Image has been built (upload skipped.)");
81
81
  }
82
82
  async [Symbol.asyncDispose]() {
@@ -110,11 +110,11 @@ export class FluxClient {
110
110
  head ? renderKustomization(root, head) : undefined,
111
111
  ]);
112
112
  const buildError = headRender?.error;
113
- const objects = buildError ?
114
- []
113
+ const objects = buildError
114
+ ? []
115
115
  : await diffObjects(baseRender?.objects ?? [], headRender?.objects ?? [], nextDiffDir);
116
- const unchanged = buildError ?
117
- buildError === baseRender?.error
116
+ const unchanged = buildError
117
+ ? buildError === baseRender?.error
118
118
  : objects.length === 0;
119
119
  if (unchanged) {
120
120
  return;
@@ -130,9 +130,7 @@ export class FluxClient {
130
130
  name,
131
131
  namespace,
132
132
  path: current.path,
133
- status: !base ? "added"
134
- : !head ? "removed"
135
- : "changed",
133
+ status: !base ? "added" : !head ? "removed" : "changed",
136
134
  objects,
137
135
  ...(buildError ? { buildError } : {}),
138
136
  additions: objects.reduce((sum, o) => sum + o.additions, 0),
@@ -178,9 +176,7 @@ async function diffObjects(baseObjects, headObjects, nextDir) {
178
176
  namespace,
179
177
  name,
180
178
  ...(file ? { file } : {}),
181
- status: !base ? "added"
182
- : !head ? "removed"
183
- : "changed",
179
+ status: !base ? "added" : !head ? "removed" : "changed",
184
180
  diff,
185
181
  additions: lines.filter((line) => line.startsWith("+") && !line.startsWith("+++")).length,
186
182
  deletions: lines.filter((line) => line.startsWith("-") && !line.startsWith("---")).length,
@@ -5,8 +5,8 @@ export function formatFluxDiff(result, { title = "Flux diff", description, artif
5
5
  if (description) {
6
6
  lines.push(description, "");
7
7
  }
8
- lines.push(result.changed.length === 0 ?
9
- `No Flux Kustomization renders differently against ${base}.`
8
+ lines.push(result.changed.length === 0
9
+ ? `No Flux Kustomization renders differently against ${base}.`
10
10
  : `${result.changed.length} Flux Kustomization(s) render differently against ${base}.`, "");
11
11
  if (artifactUrl) {
12
12
  lines.push(`> [!WARNING]`, `> The rendered diff is too long for a GitHub comment. [Download the full diff from the workflow run](${artifactUrl}).`, "");
@@ -40,7 +40,9 @@ export function label({ name, namespace, }) {
40
40
  return namespace ? `${namespace}/${name}` : name;
41
41
  }
42
42
  function summary(change) {
43
- const counts = change.buildError ? "build failed" : (`${change.objects.length} object(s), +${change.additions} −${change.deletions}`);
43
+ const counts = change.buildError
44
+ ? "build failed"
45
+ : `${change.objects.length} object(s), +${change.additions} −${change.deletions}`;
44
46
  return `<code>${label(change)}</code> — <code>${change.path}</code> (${change.status}, ${counts})`;
45
47
  }
46
48
  function objectSummary(object) {
@@ -21,8 +21,12 @@ const NAME_HASH = /-[2456789bcdfghkmt]{10}$/;
21
21
  * from their name so an edited ConfigMap/Secret pairs with its previous version.
22
22
  */
23
23
  export function objectKey(object) {
24
- const group = object.apiVersion.includes("/") ? object.apiVersion.split("/")[0] : "";
25
- const name = object.generated ? object.name.replace(NAME_HASH, "") : object.name;
24
+ const group = object.apiVersion.includes("/")
25
+ ? object.apiVersion.split("/")[0]
26
+ : "";
27
+ const name = object.generated
28
+ ? object.name.replace(NAME_HASH, "")
29
+ : object.name;
26
30
  return [group, object.kind, object.namespace, name].join("\0");
27
31
  }
28
32
  /**
@@ -56,8 +60,8 @@ export async function renderKustomization(root, kustomization) {
56
60
  components: spec.components?.map((component) => relative(path.join(targetDir, component))),
57
61
  images: spec.images,
58
62
  patches: spec.patches,
59
- labels: spec.commonMetadata?.labels ?
60
- [{ pairs: spec.commonMetadata.labels, includeSelectors: false }]
63
+ labels: spec.commonMetadata?.labels
64
+ ? [{ pairs: spec.commonMetadata.labels, includeSelectors: false }]
61
65
  : undefined,
62
66
  commonAnnotations: spec.commonMetadata?.annotations,
63
67
  buildMetadata: ["originAnnotations"],
@@ -89,8 +89,8 @@ export class ArtifactKeeperGoPublisher {
89
89
  }
90
90
  for (const entry of entries) {
91
91
  if (entry.isDirectory()) {
92
- packages.push(...(await this.findPackageDirectories(path.join(directory, entry.name), relativeDirectory ?
93
- `${relativeDirectory}/${entry.name}`
92
+ packages.push(...(await this.findPackageDirectories(path.join(directory, entry.name), relativeDirectory
93
+ ? `${relativeDirectory}/${entry.name}`
94
94
  : entry.name)));
95
95
  }
96
96
  }
@@ -103,8 +103,8 @@ export class ArtifactKeeperGoPublisher {
103
103
  */
104
104
  const major = semver.major(version);
105
105
  const pathMajor = modulePath.match(/\/v([0-9]+)$/)?.[1] ??
106
- (modulePath.startsWith("gopkg.in/") ?
107
- modulePath.match(/\.v([0-9]+)$/)?.[1]
106
+ (modulePath.startsWith("gopkg.in/")
107
+ ? modulePath.match(/\.v([0-9]+)$/)?.[1]
108
108
  : undefined);
109
109
  if ((pathMajor &&
110
110
  !modulePath.startsWith("gopkg.in/") &&
@@ -18,7 +18,9 @@ export class ProtobufCompilerClient {
18
18
  await this.requireToolchains(targets);
19
19
  const outputDirectoryPath = path.resolve(outputDirectory ??
20
20
  (await mkdtemp(path.join(tmpdir(), "protobuf-compiler-"))));
21
- const compilerBackend = backend ? createProtobufCompilerBackendStrategy(backend) : undefined;
21
+ const compilerBackend = backend
22
+ ? createProtobufCompilerBackendStrategy(backend)
23
+ : undefined;
22
24
  await mkdir(outputDirectoryPath, { recursive: true });
23
25
  await this.generateWithBuf({
24
26
  bufToken,
@@ -83,8 +85,8 @@ export class ProtobufCompilerClient {
83
85
  }))),
84
86
  }));
85
87
  try {
86
- const command = bufToken ?
87
- $.env({
88
+ const command = bufToken
89
+ ? $.env({
88
90
  ...process.env,
89
91
  BUF_TOKEN: bufToken,
90
92
  }) `buf generate ${input} --template ${templatePath} ${pathFlag}`.cwd(outputDirectory)
@@ -116,7 +118,9 @@ export class ProtobufCompilerClient {
116
118
  if (stats.isFile() && !resolvedLocation.endsWith(".proto")) {
117
119
  throw new Error(`${protoFilesLocation} is not a .proto file.`);
118
120
  }
119
- const sourceDirectory = stats.isFile() ? path.dirname(resolvedLocation) : resolvedLocation;
121
+ const sourceDirectory = stats.isFile()
122
+ ? path.dirname(resolvedLocation)
123
+ : resolvedLocation;
120
124
  const moduleDirectory = (await this.findBufModuleDirectory(sourceDirectory)) ?? sourceDirectory;
121
125
  return {
122
126
  input: moduleDirectory,
@@ -29,8 +29,8 @@ export class LocalWorkspacePulumiClientStrategy {
29
29
  refresh: false,
30
30
  diff,
31
31
  });
32
- const stdout = rewriteStdoutToDiffFriendly ?
33
- this.rewritePulumiPreviewAsDiffFriendlyText(previewResult.stdout)
32
+ const stdout = rewriteStdoutToDiffFriendly
33
+ ? this.rewritePulumiPreviewAsDiffFriendlyText(previewResult.stdout)
34
34
  : previewResult.stdout;
35
35
  return {
36
36
  ...previewResult,
@@ -45,14 +45,14 @@ export class LocalWorkspacePulumiClientStrategy {
45
45
  return line;
46
46
  }
47
47
  const trimmed = line.trimStart();
48
- const symbol = trimmed.startsWith("+-") ?
49
- "-" // replace
50
- : trimmed.startsWith("+") ?
51
- "+" // create
52
- : trimmed.startsWith("-") ?
53
- "-" // delete
54
- : trimmed.startsWith("~") ?
55
- "!" // modify
48
+ const symbol = trimmed.startsWith("+-")
49
+ ? "-" // replace
50
+ : trimmed.startsWith("+")
51
+ ? "+" // create
52
+ : trimmed.startsWith("-")
53
+ ? "-" // delete
54
+ : trimmed.startsWith("~")
55
+ ? "!" // modify
56
56
  : null;
57
57
  if (!symbol) {
58
58
  return line;
package/package.json CHANGED
@@ -1,18 +1,18 @@
1
1
  {
2
2
  "name": "@tahminator/pipeline",
3
- "type": "module",
4
- "author": "Tahmid Ahmed",
3
+ "version": "1.0.96",
5
4
  "description": "A collection of Bun shell scripts that can be re-used in various CICD pipelines.",
6
- "version": "1.0.95",
5
+ "author": "Tahmid Ahmed",
7
6
  "repository": {
8
7
  "url": "git+https://github.com/tahminator/pipeline.git"
9
8
  },
10
- "main": "./dist/index.js",
11
- "module": "./dist/index.js",
12
- "types": "./dist/index.d.ts",
13
9
  "files": [
14
10
  "dist"
15
11
  ],
12
+ "type": "module",
13
+ "main": "./dist/index.js",
14
+ "module": "./dist/index.js",
15
+ "types": "./dist/index.d.ts",
16
16
  "exports": {
17
17
  ".": {
18
18
  "types": "./dist/index.d.ts",
@@ -22,30 +22,12 @@
22
22
  "scripts": {
23
23
  "typecheck": "tsc --noEmit",
24
24
  "test": "bun run typecheck && bun run fmt && bun run lint && bun test",
25
- "fmt": "bun run prettier",
26
- "lint": "bun run eslint",
27
- "eslint": "eslint .",
28
- "eslint:fix": "eslint . --fix",
29
- "prettier": "prettier --check .",
30
- "prettier:fix": "prettier --write .",
25
+ "lint": "oxlint .",
26
+ "lint:fix": "oxlint . --fix",
27
+ "fmt": "oxfmt --check .",
28
+ "fmt:fix": "oxfmt --write .",
31
29
  "build": "tsc -p tsconfig.build.json"
32
30
  },
33
- "devDependencies": {
34
- "@eslint/js": "^10.0.1",
35
- "@types/bun": "latest",
36
- "@types/semver": "^7.7.1",
37
- "@types/yargs": "^17.0.35",
38
- "eslint": "^10.0.3",
39
- "eslint-plugin-perfectionist": "^5.7.0",
40
- "globals": "^17.4.0",
41
- "jiti": "^2.6.1",
42
- "prettier": "^3.8.1",
43
- "typescript-eslint": "^8.57.1",
44
- "vitest": "^4.1.0"
45
- },
46
- "peerDependencies": {
47
- "typescript": "^5"
48
- },
49
31
  "dependencies": {
50
32
  "@actions/artifact": "^6.2.1",
51
33
  "@octokit/auth-app": "^8.2.0",
@@ -55,10 +37,24 @@
55
37
  "fast-xml-builder": "^1.1.5",
56
38
  "fast-xml-parser": "^5.7.2",
57
39
  "neverthrow": "^8.2.0",
40
+ "oxlint-tsgolint": "^7.0.2003",
58
41
  "semver": "^7.7.4",
59
42
  "xml-trueformat": "^0.9.5",
60
43
  "yaml": "^2.8.2",
61
44
  "yargs": "^18.0.0",
62
45
  "zod": "^4.3.6"
46
+ },
47
+ "devDependencies": {
48
+ "@types/bun": "latest",
49
+ "@types/semver": "^7.7.1",
50
+ "@types/yargs": "^17.0.35",
51
+ "globals": "^17.4.0",
52
+ "jiti": "^2.6.1",
53
+ "oxfmt": "^0.72.0",
54
+ "oxlint": "^1.87.0",
55
+ "vitest": "^4.1.0"
56
+ },
57
+ "peerDependencies": {
58
+ "typescript": "^7"
63
59
  }
64
60
  }