@tahminator/pipeline 1.0.41 → 1.0.43

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.
@@ -1,5 +1,5 @@
1
- import type { OpMap, OpType, UpResult } from "@pulumi/pulumi/automation";
2
- import { type ChargedPreviewOutput } from "./strategy";
1
+ import type { OpMap, OpType } from "@pulumi/pulumi/automation";
2
+ import { type PulumiPreviewResult, type PulumiUpResult } from "./strategy";
3
3
  import { type PulumiClientCreateArgs } from "./types";
4
4
  export declare class PulumiClient {
5
5
  private readonly strategy;
@@ -9,7 +9,7 @@ export declare class PulumiClient {
9
9
  }>;
10
10
  private constructor();
11
11
  static create(args: PulumiClientCreateArgs): Promise<PulumiClient>;
12
- up(): Promise<UpResult>;
13
- preview(): Promise<ChargedPreviewOutput>;
12
+ up(): Promise<PulumiUpResult>;
13
+ preview(): Promise<PulumiPreviewResult>;
14
14
  static parseChangeSumaryToPrettyTable(changeSummary: OpMap): string;
15
15
  }
@@ -1,10 +1,11 @@
1
- import { type UpResult } from "@pulumi/pulumi/automation";
2
1
  import type { PulumiClientAzureStrategyArgs } from "../types";
3
- import type { ChargedPreviewOutput, IPulumiClientStrategy } from "./types";
2
+ import type { PulumiPreviewResult, IPulumiClientStrategy, PulumiUpResult } from "./types";
4
3
  export declare class AzurePulumiClientStrategy implements IPulumiClientStrategy {
5
- private readonly stack;
4
+ private readonly args;
5
+ private readonly env;
6
6
  private constructor();
7
7
  static create(args: PulumiClientAzureStrategyArgs): Promise<AzurePulumiClientStrategy>;
8
- up(): Promise<UpResult>;
9
- preview(): Promise<ChargedPreviewOutput>;
8
+ up(): Promise<PulumiUpResult>;
9
+ preview(): Promise<PulumiPreviewResult>;
10
+ private runPulumiCmd;
10
11
  }
@@ -1,36 +1,26 @@
1
- import { LocalWorkspace, } from "@pulumi/pulumi/automation";
1
+ import { $ } from "bun";
2
2
  export class AzurePulumiClientStrategy {
3
- stack;
4
- constructor(stack) {
5
- this.stack = stack;
3
+ args;
4
+ env;
5
+ constructor(args) {
6
+ this.args = args;
7
+ this.env = Object.fromEntries(Object.entries(this.args.envs).filter((entry) => entry[1] !== undefined));
6
8
  }
7
9
  static async create(args) {
8
- const stack = await LocalWorkspace.createOrSelectStack({
9
- stackName: args.stackName,
10
- workDir: args.workDir,
11
- }, {
12
- envVars: {
13
- ...Object.fromEntries(Object.entries(args.envs).filter((entry) => entry[1] !== undefined)),
14
- },
15
- });
16
- return new AzurePulumiClientStrategy(stack);
10
+ return new AzurePulumiClientStrategy(args);
17
11
  }
18
12
  async up() {
19
- return this.stack.up({
20
- refresh: true,
21
- });
13
+ const cliOutput = await this.runPulumiCmd(["up", "--yes"]);
14
+ return { cliOutput };
22
15
  }
23
16
  async preview() {
24
- let buffer = "";
25
- const result = await this.stack.preview({
26
- onOutput: (out) => {
27
- buffer += out;
28
- },
29
- refresh: true,
30
- });
31
- return {
32
- ...result,
33
- cliOutput: buffer,
34
- };
17
+ const cliOutput = await this.runPulumiCmd(["preview"]);
18
+ return { cliOutput };
19
+ }
20
+ async runPulumiCmd(args) {
21
+ return $ `pulumi ${args} --stack ${this.args.stackName}`
22
+ .cwd(this.args.workDir)
23
+ .env(this.env)
24
+ .text();
35
25
  }
36
26
  }
@@ -1,8 +1,10 @@
1
- import type { PreviewResult, UpResult } from "@pulumi/pulumi/automation";
2
- export type ChargedPreviewOutput = PreviewResult & {
1
+ export type PulumiPreviewResult = {
2
+ cliOutput: string;
3
+ };
4
+ export type PulumiUpResult = {
3
5
  cliOutput: string;
4
6
  };
5
7
  export interface IPulumiClientStrategy {
6
- up(): Promise<UpResult>;
7
- preview(): Promise<ChargedPreviewOutput>;
8
+ up(): Promise<PulumiUpResult>;
9
+ preview(): Promise<PulumiPreviewResult>;
8
10
  }
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.41",
6
+ "version": "1.0.43",
7
7
  "repository": {
8
8
  "url": "git+https://github.com/tahminator/pipeline.git"
9
9
  },