@berenddeboer/nx-aws-cdk
v3.0.3
Published
Nx self-inferring plugin for AWS CDK stacks
Maintainers
Readme
@berenddeboer/nx-aws-cdk
A self-inferring Nx plugin for developing aws-cdk applications.
Table of Contents
Install
npm install --save-dev @berenddeboer/nx-aws-cdkpnpm i --save-dev @berenddeboer/nx-aws-cdkyarn add --dev @berenddeboer/nx-aws-cdkbun add -D @berenddeboer/nx-aws-cdkUsage
Plugin
This package uses inferred
targets (tasks). Any project
with a cdk.json in its root will create the appropriate cdk targets
for that project.
You can configure the default target names in the plugin:
{
"plugin": "@berenddeboer/nx-aws-cdk/plugin",
"options": {
"cdkTargetName": "cdk",
"synthTargetName": "synth",
"deployTargetName": "deploy",
"diffTargetName": "diff",
"rollbackTargetName": "rollback",
"watchTargetName": "watch",
"destroyTargetName": "destroy"
}
},Remove a target if you do not want it auto-generated.
There's no need to use the executor anymore, but you can still use it for non-inferred targets.
Use the cdk target to run any cdk command easily:
npx nx run my-stack:cdk diff ...Generating a CDK application
To generate an AWS CDK v2 Application:
npx nx generate @berenddeboer/nx-aws-cdk:application --directory=stacks/cdk-app --name=cdk-appCurrently do not specify a unit test runner. This crashes nx for as yet unknown reasons.
You can customize it further by passing these options:
nx generate @berenddeboer/nx-aws-cdk:application [directory] [options,...]
Options:
--directory The directory of the new [string]
application.
--name The name of the application. [string]
--linter The tool to use for running [string] [choices: "eslint",
lint checks. "none"] [default: "none"]
--setParserOptionsProject Whether or not to configure [boolean]
the ESLint
`parserOptions.project`
option. We do not do this by
default for lint performance
reasons.
--tags Add tags to the project (used [string]
for linting)
--unitTestRunner Test runner to use for unit [string] [choices: "jest",
tests. "vitest", "none"] [default:
"none"]
--useProjectJson Use a `project.json` [boolean]
configuration file instead of
inlining the Nx configuration
in the `package.json` file.
--skipFormat Skip formatting files. [boolean]
--skipPackageJson Do not add dependencies to [boolean]
`package.json`.Targets
Generated applications expose several functions to the CLI that allow users to deploy, destroy and so on.
nx deploy myApp
nx destroy myAppWe infer the most common cdk commands. Use the executor to have access to all CDK commands.
Contributing
PRs accepted.
If editing the README, please conform to the standard-readme specification.
License
This project is MIT licensed.
