@tahminator/pipeline 1.0.63 → 1.0.65-beta.7047ce5c
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 +35 -1
- package/dist/utils/client.d.ts +2 -0
- package/dist/utils/client.js +4 -0
- package/dist/utils/string.d.ts +1 -0
- package/dist/utils/string.js +6 -0
- package/dist/versioning/client.js +3 -0
- package/dist/versioning/types.d.ts +2 -1
- package/dist/versioning/types.js +1 -0
- package/dist/versioning/updating/none/index.d.ts +5 -0
- package/dist/versioning/updating/none/index.js +6 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -252,6 +252,7 @@ await frontendClient.uploadTestCoverage();
|
|
|
252
252
|
Assorted helper class used by clients and useful as an exported class to pipelines.
|
|
253
253
|
|
|
254
254
|
```ts
|
|
255
|
+
// ----- strings -----
|
|
255
256
|
const githubPrivateKey = await Utils.decodeBase64EncodedString(
|
|
256
257
|
process.env.GH_PRIVATE_KEY_B64!,
|
|
257
258
|
);
|
|
@@ -262,9 +263,42 @@ if (await Utils.isCmdAvailable("gh")) {
|
|
|
262
263
|
console.log(Utils.Colors.green(`gh is installed (${shortId})`));
|
|
263
264
|
}
|
|
264
265
|
|
|
265
|
-
|
|
266
|
+
// ----- required -----
|
|
267
|
+
const token = Utils.required(process.env.GITHUB_TOKEN); // will throw if null or undefined
|
|
268
|
+
|
|
269
|
+
// ----- wait / polling -----
|
|
270
|
+
const reachable = await Utils.waitUntil({
|
|
271
|
+
predicate: async () => await Utils.isCmdAvailable("docker"),
|
|
272
|
+
attempts: 10,
|
|
273
|
+
intervalMs: 500,
|
|
274
|
+
});
|
|
275
|
+
|
|
276
|
+
if (!reachable) throw new Error("docker unavailable");
|
|
277
|
+
|
|
278
|
+
// ----- debug -----
|
|
279
|
+
if (Utils.Log.isDebug) {
|
|
280
|
+
console.log(Utils.Colors.dim("debug logging enabled"));
|
|
281
|
+
}
|
|
266
282
|
```
|
|
267
283
|
|
|
284
|
+
Available Utils APIs:
|
|
285
|
+
|
|
286
|
+
- `Utils.decodeBase64EncodedString(s: string): string`
|
|
287
|
+
- `Utils.generateShortId(len = 7): string`
|
|
288
|
+
- `Utils.isCmdAvailable(cmd: string): Promise<boolean>`
|
|
289
|
+
- `Utils.waitUntil({ predicate, attempts?, intervalMs? }): Promise<boolean>`
|
|
290
|
+
- `Utils.required<T>(value: T | null | undefined): T`
|
|
291
|
+
- `Utils.SemVer.validate(version: string | semver.SemVer): boolean`
|
|
292
|
+
- `Utils.Log.isDebug: boolean` (`true` when `DEBUG=true`)
|
|
293
|
+
- `Utils.Colors.<formatter>(s: string): string`
|
|
294
|
+
|
|
295
|
+
`Utils.Colors` formatters:
|
|
296
|
+
|
|
297
|
+
- `black`, `red`, `green`, `yellow`, `blue`, `magenta`, `cyan`, `white`, `gray`
|
|
298
|
+
- `brightRed`, `brightGreen`, `brightYellow`, `brightBlue`, `brightMagenta`, `brightCyan`, `brightWhite`
|
|
299
|
+
- `pink`, `orange`
|
|
300
|
+
- `bold`, `dim`, `italic`, `underline`
|
|
301
|
+
|
|
268
302
|
### `EnvClient`
|
|
269
303
|
|
|
270
304
|
Load environment variables from encrypted files and automatically mask them in GitHub Actions logs.
|
package/dist/utils/client.d.ts
CHANGED
|
@@ -4,6 +4,7 @@ import { Colors } from "./colors";
|
|
|
4
4
|
import { Log } from "./log";
|
|
5
5
|
import { SemVer } from "./semver";
|
|
6
6
|
import { generateShortId } from "./short";
|
|
7
|
+
import { required } from "./string";
|
|
7
8
|
import { waitUntil } from "./wait";
|
|
8
9
|
export declare class Utils {
|
|
9
10
|
static Colors: typeof Colors;
|
|
@@ -13,4 +14,5 @@ export declare class Utils {
|
|
|
13
14
|
static isCmdAvailable(...args: Parameters<typeof isCmdAvailable>): Promise<boolean>;
|
|
14
15
|
static decodeBase64EncodedString(...args: Parameters<typeof decodeBase64EncodedString>): Promise<string>;
|
|
15
16
|
static waitUntil(...args: Parameters<typeof waitUntil>): Promise<boolean>;
|
|
17
|
+
static required<T>(...args: Parameters<typeof required<T>>): T;
|
|
16
18
|
}
|
package/dist/utils/client.js
CHANGED
|
@@ -4,6 +4,7 @@ import { Colors } from "./colors";
|
|
|
4
4
|
import { Log } from "./log";
|
|
5
5
|
import { SemVer } from "./semver";
|
|
6
6
|
import { generateShortId } from "./short";
|
|
7
|
+
import { required } from "./string";
|
|
7
8
|
import { waitUntil } from "./wait";
|
|
8
9
|
export class Utils {
|
|
9
10
|
// hoist
|
|
@@ -22,4 +23,7 @@ export class Utils {
|
|
|
22
23
|
static async waitUntil(...args) {
|
|
23
24
|
return waitUntil(...args);
|
|
24
25
|
}
|
|
26
|
+
static required(...args) {
|
|
27
|
+
return required(...args);
|
|
28
|
+
}
|
|
25
29
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function required<T>(value: T | null | undefined): T;
|
|
@@ -2,6 +2,7 @@ import semver from "semver";
|
|
|
2
2
|
import { VersionUpdatingStrategy, } from "./types";
|
|
3
3
|
import { JavaMavenVersioningClient } from "./updating/java/maven";
|
|
4
4
|
import { JavascriptPackageJsonVersioningClient } from "./updating/jsts";
|
|
5
|
+
import { NoneVersioningClient } from "./updating/none";
|
|
5
6
|
export class VersioningClient {
|
|
6
7
|
githubClient;
|
|
7
8
|
static INITIAL_VERSION = "1.0.0";
|
|
@@ -16,6 +17,8 @@ export class VersioningClient {
|
|
|
16
17
|
return new JavascriptPackageJsonVersioningClient();
|
|
17
18
|
case VersionUpdatingStrategy.JAVA_MAVEN:
|
|
18
19
|
return new JavaMavenVersioningClient();
|
|
20
|
+
case VersionUpdatingStrategy.NONE:
|
|
21
|
+
return new NoneVersioningClient();
|
|
19
22
|
}
|
|
20
23
|
}
|
|
21
24
|
parseOrThrow(label, v) {
|
package/dist/versioning/types.js
CHANGED
|
@@ -2,4 +2,5 @@ export var VersionUpdatingStrategy;
|
|
|
2
2
|
(function (VersionUpdatingStrategy) {
|
|
3
3
|
VersionUpdatingStrategy[VersionUpdatingStrategy["JSTS"] = 0] = "JSTS";
|
|
4
4
|
VersionUpdatingStrategy[VersionUpdatingStrategy["JAVA_MAVEN"] = 1] = "JAVA_MAVEN";
|
|
5
|
+
VersionUpdatingStrategy[VersionUpdatingStrategy["NONE"] = 2] = "NONE";
|
|
5
6
|
})(VersionUpdatingStrategy || (VersionUpdatingStrategy = {}));
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { IJavascriptPackageJsonVersionUpdatingClient } from "../../types";
|
|
2
|
+
import { BaseVersionUpdatingClient } from "../base";
|
|
3
|
+
export declare class NoneVersioningClient extends BaseVersionUpdatingClient implements IJavascriptPackageJsonVersionUpdatingClient {
|
|
4
|
+
update(version: string): Promise<void>;
|
|
5
|
+
}
|
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"type": "module",
|
|
4
4
|
"author": "Tahmid Ahmed",
|
|
5
5
|
"description": "A collection of Bun shell scripts that can be re-used in various CICD pipelines.",
|
|
6
|
-
"version": "1.0.
|
|
6
|
+
"version": "1.0.65-beta.7047ce5c",
|
|
7
7
|
"repository": {
|
|
8
8
|
"url": "git+https://github.com/tahminator/pipeline.git"
|
|
9
9
|
},
|