@tahminator/pipeline 1.0.44 → 1.0.46

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,4 @@
1
- import type { OpMap, OpType } from "@pulumi/pulumi/automation";
2
- import { type PulumiPreviewResult, type PulumiUpResult } from "./strategy";
1
+ import type { OpMap, OpType, PreviewResult, UpResult } from "@pulumi/pulumi/automation";
3
2
  import { type PulumiClientCreateArgs } from "./types";
4
3
  export declare class PulumiClient {
5
4
  private readonly strategy;
@@ -9,7 +8,7 @@ export declare class PulumiClient {
9
8
  }>;
10
9
  private constructor();
11
10
  static create(args: PulumiClientCreateArgs): Promise<PulumiClient>;
12
- up(): Promise<PulumiUpResult>;
13
- preview(): Promise<PulumiPreviewResult>;
11
+ up(): Promise<UpResult>;
12
+ preview(): Promise<PreviewResult>;
14
13
  static parseChangeSumaryToPrettyTable(changeSummary: OpMap): string;
15
14
  }
@@ -1,11 +1,10 @@
1
+ import { type PreviewResult, type UpResult } from "@pulumi/pulumi/automation";
1
2
  import type { PulumiClientAzureStrategyArgs } from "../types";
2
- import type { PulumiPreviewResult, IPulumiClientStrategy, PulumiUpResult } from "./types";
3
+ import type { IPulumiClientStrategy } from "./types";
3
4
  export declare class AzurePulumiClientStrategy implements IPulumiClientStrategy {
4
- private readonly args;
5
- private readonly env;
5
+ private readonly stack;
6
6
  private constructor();
7
7
  static create(args: PulumiClientAzureStrategyArgs): Promise<AzurePulumiClientStrategy>;
8
- up(): Promise<PulumiUpResult>;
9
- preview(): Promise<PulumiPreviewResult>;
10
- private runPulumiCmd;
8
+ up(): Promise<UpResult>;
9
+ preview(): Promise<PreviewResult>;
11
10
  }
@@ -1,26 +1,30 @@
1
- import { $ } from "bun";
1
+ import { LocalWorkspace, } from "@pulumi/pulumi/automation";
2
2
  export class AzurePulumiClientStrategy {
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));
3
+ stack;
4
+ constructor(stack) {
5
+ this.stack = stack;
8
6
  }
9
7
  static async create(args) {
10
- return new AzurePulumiClientStrategy(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);
11
17
  }
12
18
  async up() {
13
- const cliOutput = await this.runPulumiCmd(["up", "--yes"]);
14
- return { cliOutput };
19
+ return this.stack.up({
20
+ color: "never",
21
+ refresh: false,
22
+ });
15
23
  }
16
24
  async preview() {
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({ ...process.env, ...this.env })
24
- .text();
25
+ return this.stack.preview({
26
+ color: "never",
27
+ refresh: false,
28
+ });
25
29
  }
26
30
  }
@@ -1,10 +1,5 @@
1
- export type PulumiPreviewResult = {
2
- cliOutput: string;
3
- };
4
- export type PulumiUpResult = {
5
- cliOutput: string;
6
- };
1
+ import type { PreviewResult, UpResult } from "@pulumi/pulumi/automation";
7
2
  export interface IPulumiClientStrategy {
8
- up(): Promise<PulumiUpResult>;
9
- preview(): Promise<PulumiPreviewResult>;
3
+ up(): Promise<UpResult>;
4
+ preview(): Promise<PreviewResult>;
10
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.44",
6
+ "version": "1.0.46",
7
7
  "repository": {
8
8
  "url": "git+https://github.com/tahminator/pipeline.git"
9
9
  },