Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(cli-lib): [JS/TS only] experimental support for programmatic CLI…
… api (#22836) Experimental wrapper around the existing `aws-cdk` package, which is possible due to minor adjustments in the cli. The API interface is adapted from `cdk-cli-wrapper`. Currently all options are passed as array args to the existing cli args parser function. In future all code from `aws-cdk` should move over here and the dependency between the two would be reversed. When this is done we can start refactoring the internal APIs to be more programmatically usable. ### What's in a name Currently aiming for `@aws-cdk/cli-lib`, but any suggestions are welcome. ### Why is this bundled? To make the package a jsii library we need to bundle non-jsii dependencies. For now most of the code is still located in the `aws-cdk` package which has a different build pipeline to our other packages, simply including the directory in `bundledDependencies` is not an option. While the aim is to eventually have most code in this package, we are not there yet. Until then, bundling is the easiest option. The build setup as configured for this package is needed because `jsii` MUST operate on TypeScript files and `jsii-pacmak` MUST be used because this is how the various language packages are created. Therefore bundling must happen _after_ the jsii assembly has been created, but before _jsii-pacmak_ runs. ### We should not import submodules that are not explicitly exported Yes, that's right we should not do this and no user land code should do this. In this situation there are two things that make this "okay": - It's our package and we are in a monorepo. The danger of importing submodules is that they can break at any time, as they are usually considered implementation detail. However with the monorepo, the build would fail on any change that's not reflected in both packages. - It's supposed to be temporary. I plan to follow-up with a code move PR very quickly. Ideally this situation will only last for a couple releases. ---- ### All Submissions: * [x] Have you followed the guidelines in our [Contributing guide?](https:/aws/aws-cdk/blob/main/CONTRIBUTING.md) ### Adding new Unconventional Dependencies: * [ ] This PR adds new unconventional dependencies following the process described [here](https:/aws/aws-cdk/blob/main/CONTRIBUTING.md/#adding-new-unconventional-dependencies) ### New Features * [ ] Have you added the new feature to an [integration test](https:/aws/aws-cdk/blob/main/INTEGRATION_TESTS.md)? * [ ] Did you use `yarn integ` to deploy the infrastructure and generate the snapshot (i.e. `yarn integ` without `--dry-run`)? *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
- Loading branch information