Thanks for your interest in contributing to AWS JSII! ❤️
This document describes how to set up a development environment and submit your contributions. Please read it carefully and let us know if it's not up-to date (or even better, submit a pull request with your corrections! 😉).
Due to the polyglot nature of jsii
, the toolchain requirements are somewhat
more complicated than for most projects. In order to locally develop jsii
, you
will need a number of tools.
We have built a Docker image with all the required tools, which we are using for our own CI/CD: the "superchain" image from.
The image can be built for local usage, too:
$ IMAGE=superchain
$ docker build -t ${IMAGE} ./superchain
In order to get an interactive shell within a Docker container using the superchain image you just built:
$ cd jsii # go to the root of the jsii repo
$ docker run --rm --net=host -it -v $PWD:$PWD -w $PWD ${IMAGE}
In the shell that pops up, the npm run
commands in the following sections must
be executed.
The following tools need to be installed to develop on JSII locally. We recommend using the docker image from the above section, but if you wish to, you can install in your development environment.
- Node
12.7.0
or later - Yarn
1.19.1
or later - An OpenJDK-8 distribution (e.g: Oracle's OpenJDK8, Amazon Corretto 8)
- .NET Core
3.1
or later- Recommended:
mono >= 5
- Recommended:
- Python
3.7.3
or laterpip
setuptools >= 38.6.0
wheel
- Recommended:
twine
The project is managed as a monorepo using lerna.
- Check out this respository and change directory to its root.
- Run
yarn install && yarn build
to install lerna, bootstrap the repository and perform an initial build and test cycle.
All packages within this repository have the following scripts:
build
- builds the package, usually runs the TypeScript compiler,tsc
.watch
- watches for file changes and builds them progressively, usually runningtsc --watch
.test
- executes all unit tests for the current package.test:update
- executes all unit tests and overwrites snapshot expectations (those.snap
files).package
- emits publishable artifacts todist
.lint
- run linter against sourcelint:fix
- lint and auto-correct formatting issues when possible
Each one of these scripts can be executed either from the root of the repo using
npx lerna run <script> --scope <package>
or from individual modules using
yarn <script>
.
Eslint and Prettier are used to lint and format our typescript code. The lint
and lint:fix
scripts can be run from the root or from a specific module.
You can integrate the linting and formatting workflow with your editor or ide by installing the approporiate eslint plugin. For example, when using Visual Studio Code, the eslint plugin exposes a number of options including "fix on save". This will auto correct lint and formatting errors whenever possible while saving a document.
To bump the version of this repository, use the yarn bump
script.
This repository emits artifacts in multiple languages. The yarn package
script is used to prepare the repository for publishing.
Each module that needs to be published implements an npm script called package
which emits publishable artifacts to dist/<lang>
(e.g. dist/dotnet
for
NuGet, dist/js
for npm, dist/java
for Maven Central). All those "dist"
directories are merged into a single .zip file that is later on used in our
CI/CD publishing tasks. Each <lang>
directory is published to the respective
package repository.
jsii language bindings consist of two main components:
- A runtime client library: a library implemented for each language. This
library is responsible to manage the child
@jsii/runtime
process and interact with the @jsii/kernel. - A
jsii-pacmak
generator: extend the jsii-pacmak project to be able to generate proxy classes for a jsii module.
This section can definitely use some additional information.
The runtime client library should be implemented as a module under
packages/@jsii/<lang>-runtime
.
The jsii runtime client library usually includes the following components:
- Child process manager: responsible to start/stop the @jsii/runtime child process.
- Protocol layer: implements the STDIN/STDOUT protocol that interacts with the @jsii/runtime.
- Proxy layer: includes base classes and serialization utilities to implement the generated proxy classes.
More documentation should be added here. In the meantime, refer to the Java implementation as a reference:
The pacmak code generator should be implemented under
jsii-pacmak/lib/targets
.
The Python target is a good example to work from.
Upon merging new changes to the main
branch, the jsii/superchain:nightly
image will be released by TravisCI after a last validation build.
Upon making a new jsii
release (when the GitHub release entry - and its
corresponding git tag - is created), the jsii/superchain:latest
image will
be released by TravisCI after a last validation build.
The latest release information (for both of the Docker image tags) can be seen on Docker Hub