@tahminator/pipeline 1.0.8 → 1.0.9

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/dist/index.d.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  export * from "./gh";
2
2
  export * from "./docker";
3
+ export * from "./npm";
3
4
  export * from "./types";
4
5
  export * from "./utils";
package/dist/index.js CHANGED
@@ -1,4 +1,5 @@
1
1
  export * from "./gh";
2
2
  export * from "./docker";
3
+ export * from "./npm";
3
4
  export * from "./types";
4
5
  export * from "./utils";
@@ -1,7 +1,7 @@
1
1
  import { GitHubClient } from "../../gh";
2
- import { getEnvVariables } from "../../utils/env";
2
+ import { Utils } from "../../utils";
3
3
  async function main() {
4
- const { githubPat } = parseCiEnv(await getEnvVariables(["ci"]));
4
+ const { githubPat } = parseCiEnv(await Utils.getEnvVariables(["ci"]));
5
5
  const ghClient = new GitHubClient(githubPat);
6
6
  await ghClient.createTag({
7
7
  onPreTagCreate: async (tag) => {
@@ -1,10 +1,9 @@
1
- import { $ } from "bun";
2
- import { getEnvVariables } from "../../utils/env";
1
+ import { NPMClient } from "../../npm";
2
+ import { Utils } from "../../utils";
3
3
  async function main() {
4
- const { npmToken } = parseCiEnv(await getEnvVariables(["ci"]));
5
- await $ `npm config set //registry.npmjs.org/:_authToken=${npmToken}`;
6
- await $ `npm publish --access public`;
7
- console.log("Package has been successfully published");
4
+ const { npmToken } = parseCiEnv(await Utils.getEnvVariables(["ci"]));
5
+ await using npmClient = await NPMClient.create(npmToken);
6
+ await npmClient.publish();
8
7
  }
9
8
  function parseCiEnv(ciEnv) {
10
9
  const npmToken = (() => {
@@ -0,0 +1,12 @@
1
+ export declare class NPMClient {
2
+ private constructor();
3
+ static create(npmToken: string): Promise<NPMClient>;
4
+ /**
5
+ * @note You must ensure that the current root directory `package.json`
6
+ * is filled out with the name of the package and the version you would like to
7
+ * deploy.
8
+ */
9
+ publish(): Promise<void>;
10
+ [Symbol.asyncDispose](): Promise<void>;
11
+ cleanup(): Promise<void>;
12
+ }
@@ -0,0 +1,23 @@
1
+ import { $ } from "bun";
2
+ export class NPMClient {
3
+ constructor() { }
4
+ static async create(npmToken) {
5
+ await $ `npm config set //registry.npmjs.org/:_authToken=${npmToken}`;
6
+ return new this();
7
+ }
8
+ /**
9
+ * @note You must ensure that the current root directory `package.json`
10
+ * is filled out with the name of the package and the version you would like to
11
+ * deploy.
12
+ */
13
+ async publish() {
14
+ await $ `npm publish --access public`;
15
+ console.log("Package has been successfully published");
16
+ }
17
+ async [Symbol.asyncDispose]() {
18
+ await this.cleanup();
19
+ }
20
+ async cleanup() {
21
+ await $ `npm logout`;
22
+ }
23
+ }
@@ -0,0 +1 @@
1
+ export * from "./client";
@@ -0,0 +1 @@
1
+ export * from "./client";
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@tahminator/pipeline",
3
3
  "type": "module",
4
- "version": "1.0.8",
4
+ "version": "1.0.9",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.js",
7
7
  "types": "./dist/index.d.ts",