npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@wanews/nx-pulumi

v1.1.0

Published

NX Plugin for setting up Pulumi projects in an NX repo.

Downloads

22,875

Readme

@wanews/nx-pulumi

NX Plugin for setting up Pulumi projects in an NX repo.

Generators

init

nx g @wanews/nx-pulumi:init

create-stack

nx g @wanews/nx-pulumi:create-stack --projectName=my-app-infrastructure --env=dev

env

--env=prod

Will create the stack name by prefixing the pulumi project name. ie --env=prod is the same as --stack=<projectname>.prod.

destroy-stack

nx g @wanews/nx-pulumi:destroy-stack --projectName=my-app-infrastructure --env=dev

env

--env=prod

Will create the stack name by prefixing the pulumi project name. ie --env=prod is the same as --stack=<projectname>.prod.

config-backup

Config files have the secret provider hashes so as an alternative to checking them into git you can use this command to put the config files into s3, then optionally restore them before doing an up

If you use this feature you will need to install @aws-sdk/client-s3

nx g @wanews/nx-pulumi:backup-config --projectName=my-app-infrastructure --env=dev

config-restore

Config files have the secret provider hashes so as an alternative to checking them into git you can use this command to put the config files into s3, then optionally restore them before doing an up

nx g @wanews/nx-pulumi:restore-config --projectName=my-app-infrastructure --env=dev

Executors

up

nx up my-app-infrastructure --stack dev

env

--env=prod

Will create the stack name by prefixing the pulumi project name. ie --env=prod is the same as --stack=<projectname>.prod.

Environment Variables

--envVars="KEY=value

Passes through a comma-seperated list of environment variables to the pulumi command

For example, if you need to build docker images built by pulumi to target a specific architechure CPU architechure (eg linux/amd64), you can the add arguement --envVars="DOCKER_DEFAULT_PLATFORM=linux/amd64"

Running deploy

@wanews/nx-pulumi will add a deploy target to the selected project. This will start pulumi with a --cwd of the infrastructure project automatically

All arguments will be passed onto the pulumi CLI.

Under the hood, this will run the up against your infrastructure project. You can also run the up target against the infrastructure project

nx up my-app-infrastructure --stack dev

Affected deploys

when using S3 or another state which doesn't include the project name in the state path, a good workaround is naming your stacks <project-name>.<env>. For example my-project.prod.

[projectName].[env]

For example if your name key in Pulumi.yaml is my-infrastructure and you pass --env prod, the stack name will be my-infrastructure.prod

This allows you to use the NX affected command with Pulumi to deploy all the affected stacks.

Configuration

Use the configurationStackFormat executor configuration value to change the stack name format.

Current placeholders [projectName], [environment]

Default:

configurationStackFormat='[projectName].[environment]'

Example

nx affected --target=up --env=prod --all
# Or in parallel
nx affected --target=up --env=prod --all --parallel --maxParallel=5

Running other pulumi commands

The main reason for having a plugin is to automatically build the target application and allows NX to deploy applications which have changed in the mono repo. Only the up command needs to rebuild the target application.

All other commands you can just use the --cwd apps/<my-app>-infrastructure flag when running the pulumi CLI

Troubleshooting

Error: unknown flag: --nonInteractive (or similar)

NX Mangles command line args, the issue is being tracked at https://github.com/nrwl/nx/issues/5710

This package manually reverts the mangled command line args but the list of fixed commands is not up to date. Submit a pull request adding the mapped command to libs/pulumi/src/helpers/get-pulumi-args.ts