Skip to content

Commit

Permalink
refactor(pulumi): Cleanup (#262)
Browse files Browse the repository at this point in the history
  • Loading branch information
TriPSs authored May 4, 2024
2 parents 0456dac + 3a174d2 commit afce338
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 43 deletions.
23 changes: 10 additions & 13 deletions packages/pulumi/src/executors/preview/preview.impl.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { ExecutorContext, workspaceRoot } from '@nx/devkit'
import { buildCommand } from '@nx-extend/core'
import { execSync } from 'child_process'
import { which } from 'shelljs'
import { join } from 'path'
import { which } from 'shelljs'

export interface PreviewOptions {
stack?: string
Expand All @@ -19,17 +19,14 @@ export default async function creatExecutor(

const { sourceRoot } = context.workspace.projects[context.projectName]

execSync(
buildCommand([
'PULUMI_EXPERIMENTAL=true',
'pulumi preview --diff --suppress-progress',
options.stack && `--stack=${options.stack}`
]),
{
cwd: join(workspaceRoot, options.root ?? sourceRoot),
stdio: 'inherit'
}
)
execSync(buildCommand([
'PULUMI_EXPERIMENTAL=true',
'pulumi preview --diff --suppress-progress',
options.stack && `--stack=${options.stack}`
]), {
cwd: join(workspaceRoot, options.root ?? sourceRoot),
stdio: 'inherit'
})

return Promise.resolve({ success: true })
return { success: true }
}
25 changes: 11 additions & 14 deletions packages/pulumi/src/executors/refresh/refresh.impl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,19 +21,16 @@ export default async function createExecutor(

const { sourceRoot } = context.workspace.projects[context.projectName]

execSync(
buildCommand([
'PULUMI_EXPERIMENTAL=true',
'pulumi refresh --suppress-progress',
options.stack && `--stack=${options.stack}`,
options.skipPreview && '--skip-preview',
options.yes && '--yes'
]),
{
cwd: join(workspaceRoot, options.root ?? sourceRoot),
stdio: 'inherit'
}
)
execSync(buildCommand([
'PULUMI_EXPERIMENTAL=true',
'pulumi refresh --suppress-progress',
options.stack && `--stack=${options.stack}`,
options.skipPreview && '--skip-preview',
options.yes && '--yes'
]), {
cwd: join(workspaceRoot, options.root ?? sourceRoot),
stdio: 'inherit'
})

return Promise.resolve({ success: true })
return { success: true }
}
29 changes: 13 additions & 16 deletions packages/pulumi/src/executors/up/up.impl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,21 +23,18 @@ export default async function createExecutor(

const { sourceRoot } = context.workspace.projects[context.projectName]

execSync(
buildCommand([
'pulumi up --suppress-progress',
options.stack && `--stack=${options.stack}`,
options.skipPreview && '--skip-preview',
options.yes && '--yes',
options.suppressOutputs && '--suppress-outputs',
USE_VERBOSE_LOGGING_MINIMAL && '--debug',
options.json && '--json'
]),
{
cwd: join(workspaceRoot, options.root ?? sourceRoot),
stdio: 'inherit'
}
)
execSync(buildCommand([
'pulumi up --suppress-progress',
options.stack && `--stack=${options.stack}`,
options.skipPreview && '--skip-preview',
options.yes && '--yes',
options.suppressOutputs && '--suppress-outputs',
USE_VERBOSE_LOGGING_MINIMAL && '--debug',
options.json && '--json'
]), {
cwd: join(workspaceRoot, options.root ?? sourceRoot),
stdio: 'inherit'
})

return Promise.resolve({ success: true })
return { success: true }
}

0 comments on commit afce338

Please sign in to comment.