You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
v1.2.0: add "skip build" option and functionality (#14)
* package version updates
* allow options to skip build step
* fix so we don't build when `cdk destroy` etc. is run
* update Settings with `SKIP_BUILD`
* check for `build` context value passed when invoking `cdk`
* update sample CDK apps to use `swc` when deploying `cdk` -- minor optimization
* update docs
* update CHANGELOG.md etc
* Update CHANGELOG.md
* update docs
Copy file name to clipboardExpand all lines: CHANGELOG.md
+26-3Lines changed: 26 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -11,17 +11,40 @@ Possible header types:
11
11
12
12
## [Unreleased]
13
13
14
+
## v1.2.0 (2023-02-03)
15
+
16
+
### Bug Fixes
17
+
18
+
-`RustFunction` should not execute `cargo lambda` when certain `cdk` sub-commands are invoked, such as:
19
+
-`destroy`
20
+
-`list`
21
+
- etc.
22
+
-_Potential_ bug-fix (unconfirmed): The library should not execute `cargo lambda` when a project has multiple stacks, and the stack being deployed doesn't include any `RustFunction` constructs.
23
+
24
+
### Features
25
+
26
+
- Add parameters to `Settings`:
27
+
-`SKIP_BUILD`
28
+
- Update docs to mention how to _skip_ the build step by passing in the `build` context flag when invoking a `cdk` command. For example:
29
+
```shell
30
+
cdk synth -c build=0
31
+
```
32
+
- Update developer docs used forlocal testing, as I determined a newish approach with `npm link` can be used, as outlinedin [this article].
33
+
- Enable `swc`in all sample CDK apps, in order to improve the overall [performance of `ts-node`](https://typestrong.org/ts-node/docs/performance) when `cdk` is run.
- [zig] can now be installed via the `--save-optional` flag when installing this package:
27
50
```shell
@@ -35,7 +58,7 @@ Possible header types:
35
58
36
59
## v1.0.0 (2022-03-21)
37
60
38
-
## Breaking Changes
61
+
### Breaking Changes
39
62
40
63
- Switch to use [`cargo-zigbuild`] -- instead of `cross` -- for building Rust code.
41
64
- Switch the default build architecture from `x86_64` to `arm64`; this package now uses **aarch64-unknown-linux-gnu** as the default build target forAWS Lambda functions, mainly as I've found this architecture to be slightly more performantin general use cases.
|`BUILD_INDIVIDUALLY`| Whether to build each executable individually, either via `--bin` or `--package`. |
296
-
|`DEFAULT_LOG_LEVEL`| Log Level for non-module libraries. Note that this value is only used when `RustFunctionProps.setupLogging` is enabled. Defaults to `warn`. |
297
-
|`MODULE_LOG_LEVEL`| Log Level for a module (i.e. the executable). Note that this value is only used when `RustFunctionProps.setupLogging` is enabled. Defaults to `debug`. |
298
-
|`WORKSPACE_DIR`| Sets the root workspace directory. By default, the workspace directory is assumed to be the directory where `cdk` was invoked.<br><br>This directory should contain at the minimum a `Cargo.toml` file which defines the workspace members. |
299
-
|`FEATURES`| A list of features to activate when compiling Rust code. These must also be added to the `Cargo.toml` file. |
300
-
|`BUILD_ENVIRONMENT`| Key-value pairs that are passed in at compile time, i.e. to `cargo build` or `cargo lambda`. This differs from `environment`, which determines the environment variables which are set on the AWS Lambda functionitself.|
301
-
|`EXTRA_BUILD_ARGS`| Additional arguments that are passed in at build time to both `cargo lambda`. For example, [`--all-features`]. |
|`BUILD_INDIVIDUALLY`| Whether to build each executable individually, either via `--bin` or `--package`. |
296
+
|`DEFAULT_LOG_LEVEL`| Log Level for non-module libraries. Note that this value is only used when `RustFunctionProps.setupLogging` is enabled. Defaults to `warn`. |
297
+
|`MODULE_LOG_LEVEL`| Log Level for a module (i.e. the executable). Note that this value is only used when `RustFunctionProps.setupLogging` is enabled. Defaults to `debug`. |
298
+
|`WORKSPACE_DIR`| Sets the root workspace directory. By default, the workspace directory is assumed to be the directory where `cdk` was invoked.<br><br>This directory should contain at the minimum a `Cargo.toml` file which defines the workspace members. |
299
+
|`FEATURES`| A list of features to activate when compiling Rust code. These must also be added to the `Cargo.toml` file. |
300
+
|`BUILD_ENVIRONMENT`| Key-value pairs that are passed in at compile time, i.e. to `cargo build` or `cargo lambda`. This differs from `environment`, which determines the environment variables which are set on the AWS Lambda functionitself.|
301
+
|`EXTRA_BUILD_ARGS`| Additional arguments that are passed in at build time to both `cargo lambda`. For example, [`--all-features`]. |
302
+
|`SKIP_BUILD`| Whether to skip building Rust Lambdas -- e.g. skip the compile step with `cargo lambda`.<br><br>Alternatively, this can be setin the `build` context, when invoking `cdk` -- for example:<br>`$ cdk synth -c build=[T \|true\| 1 \| Y \| yes \| ok \| on]`<br>Any values other than the listed evaluate to `false`. So, this would skip the build step on `synth`:<br>`$ cdk synth -c build=0`|
As per [this article](https://stackoverflow.com/a/18778516/10237506) I found that explains how a local module can be installed with `npm link`, this is a slightly different approach to commenting out and then un-commenting an `import` statement as mentioned above.
96
+
97
+
This does also have a few unavoidable side-effects, but hopefully such a method should yield an overall better (developer) experience.
98
+
99
+
Here then, is the updated approach which leverages `npm link` under the hood to locally install an NPM module.
100
+
101
+
First, `cd` into the local directory of a sample CDK app.
102
+
103
+
Within this folder, run the npm script `link` (alias: `l`) to automatically link to the local `rust.aws-cdk-lambda` module -- i.e. the project folder two levels up:
104
+
105
+
```shell
106
+
npm run l
107
+
```
108
+
109
+
If all is well, you should see that the _linking_ is successful.
That means everything is set up correctly! CDK code should reference the definitions under `../../dist/`, i.e. under the root folder.
126
+
127
+
Next -- open a new terminal window, and from the project root folder `$root`, run the following command:
128
+
129
+
```shell
130
+
npm run watch
131
+
```
132
+
133
+
This will listen for any changes to the project TypeScript code, and automatically run `tsc` to down-compile it to JS code, which it places in the `dist/` folder.
134
+
135
+
These changes will also be reflected in the sample CDK project, thanks to `npm link` which was run earlier.
136
+
137
+
To _unlink_ the local module and use the remote one installed as a dependency listed in the `package.json`, simply run the following from the root of a sample CDK app:
0 commit comments