Skip to content

Commit

Permalink
Reduce logging, add spinner
Browse files Browse the repository at this point in the history
  • Loading branch information
MiroDojkic committed Jan 25, 2025
1 parent b1fc62d commit 78ee3d5
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 6 deletions.
18 changes: 18 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@
"@types/node-fetch": "^2.6.12",
"async-retry": "^1.3.3",
"http-status": "^2.1.0",
"nanospinner": "^1.2.2",
"node-fetch": "^2.7.0",
"prettier": "^3.0.3",
"release-it": "^16.2.1",
Expand Down
16 changes: 10 additions & 6 deletions tests/automation.ts
Original file line number Diff line number Diff line change
@@ -1,24 +1,28 @@
import {
DestroyResult,
LocalProgramArgs,
LocalWorkspace,
OutputMap
} from '@pulumi/pulumi/automation';
import { createSpinner } from 'nanospinner';

export async function deploy(args: LocalProgramArgs): Promise<OutputMap> {
const spinner = createSpinner('Deploying stack...').start();
const stack = await LocalWorkspace.createOrSelectStack(args);
await stack.setConfig('aws:region', { value: 'us-east-2' });
const up = await stack.up({
onOutput: console.info,
logToStdErr: true
});
const up = await stack.up({ logToStdErr: true });

spinner.success({ text: 'Stack deployed.' });
return up.outputs;
}

export async function destroy(args: LocalProgramArgs) {
export async function destroy(args: LocalProgramArgs): Promise<DestroyResult> {
const spinner = createSpinner('Destroying stack...').start();
const stack = await LocalWorkspace.createOrSelectStack(args);

return stack.destroy({ onOutput: console.info });
const result = await stack.destroy();
spinner.success({ text: 'Stack destroyed.' });
return result;
}

export async function getOutputs(args: LocalProgramArgs): Promise<OutputMap> {
Expand Down

0 comments on commit 78ee3d5

Please sign in to comment.