-
Notifications
You must be signed in to change notification settings - Fork 83
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
chore: add settings for the "cdk watch" command #383
Conversation
@eladb thanks for the review. I've incorporated your comments, would appreciate another pass! |
@eladb included your last comment about automatically excluding the CDK output directory, hopefully this is now ready 🙂. |
Adds a `build` field to `cdk.json`. The command specified in the `build` will be executed before synthesis. This can be used to build any code that needs to be built before synthesis (for example, CDK App code or Lambda Function code). This is part of the changes needed for the `cdk watch` command (aws/aws-cdk-rfcs#383). ---- *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
This PR introduces the "watch" command, in two variants: as a separate new `cdk watch` command, and as an argument to the existing `cdk deploy` command. The "watch" process will observe the project files, defined by the new `"include"` and `"exclude"` settings in `cdk.json` (see aws/aws-cdk-rfcs#383 for details), and will trigger a `cdk deploy` when it detects any changes. The deployment will by default use the new "hotswap" deployments for maximum speed. Since `cdk deploy` is a relatively slow process for a "watch" command, there is some logic to perform intelligent queuing of any file events that happen while `cdk deploy` is running. We will batch all of those events, and trigger a single `cdk deploy` after the current one finishes. This ensures only a single `cdk deploy` command ever executes at a time. The observing of the files, and reacting to their changes, is accomplished using the [`chokidar` library](https://www.npmjs.com/package/chokidar). ---- *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
This PR introduces the "watch" command, in two variants: as a separate new `cdk watch` command, and as an argument to the existing `cdk deploy` command. The "watch" process will observe the project files, defined by the new `"include"` and `"exclude"` settings in `cdk.json` (see aws/aws-cdk-rfcs#383 for details), and will trigger a `cdk deploy` when it detects any changes. The deployment will by default use the new "hotswap" deployments for maximum speed. Since `cdk deploy` is a relatively slow process for a "watch" command, there is some logic to perform intelligent queuing of any file events that happen while `cdk deploy` is running. We will batch all of those events, and trigger a single `cdk deploy` after the current one finishes. This ensures only a single `cdk deploy` command ever executes at a time. The observing of the files, and reacting to their changes, is accomplished using the [`chokidar` library](https://www.npmjs.com/package/chokidar). ---- *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
Thanks for adding this great feature! I've noticed that adding the following section to 'cdk.json' based on the example will pickup changes to my CDK stack, but also changes in other, non CDK files:
If I change something in my README.md file, I see the following on my CLI:
Would it make sense to include only './lib', './bin' for example and to update this in the CDK docs? |
Hey @marekq, yes, the default is to look at your entire root directory. This is so that, if you add some runtime code to your CDK application outside We will soon update our init templates, so that you'll get the correct values when starting a new CDK project. |
Adds a `build` field to `cdk.json`. The command specified in the `build` will be executed before synthesis. This can be used to build any code that needs to be built before synthesis (for example, CDK App code or Lambda Function code). This is part of the changes needed for the `cdk watch` command (aws/aws-cdk-rfcs#383). ---- *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
This PR introduces the "watch" command, in two variants: as a separate new `cdk watch` command, and as an argument to the existing `cdk deploy` command. The "watch" process will observe the project files, defined by the new `"include"` and `"exclude"` settings in `cdk.json` (see aws/aws-cdk-rfcs#383 for details), and will trigger a `cdk deploy` when it detects any changes. The deployment will by default use the new "hotswap" deployments for maximum speed. Since `cdk deploy` is a relatively slow process for a "watch" command, there is some logic to perform intelligent queuing of any file events that happen while `cdk deploy` is running. We will batch all of those events, and trigger a single `cdk deploy` after the current one finishes. This ensures only a single `cdk deploy` command ever executes at a time. The observing of the files, and reacting to their changes, is accomplished using the [`chokidar` library](https://www.npmjs.com/package/chokidar). ---- *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
This PR updates the "CDK Watch" RFC with details of how to customize the watching process by introducing new options to the
cdk.json
file:"build"
key that allows specifying what command(s) should be executed before the project is synthesized."watch"
key with two sub-keys,"include"
and"exclude"
, that allows specifying what files should be observed for changes, and which ones should be ignored by the watcher.By submitting this pull request, I confirm that my contribution is made under
the terms of the Apache-2.0 license