# Contributing to jsii Thanks for your interest in contributing to AWS JSII! :heart: 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! :wink:). ## Pre-requisites ### Setup Docker image 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][superchain] from. [superchain]: https://github.com/aws/jsii/blob/main/superchain/Dockerfile The image can be built for local usage, too: ```console $ IMAGE=superchain $ docker build -t ${IMAGE} -f superchain/Dockerfile . ``` In order to get an interactive shell within a Docker container using the *superchain* image you just built: ```console $ 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. ### Alternative: Manually install the toolchain 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 `14.6.0`] or later - [Yarn `1.19.1`] or later - An OpenJDK-8 distribution (e.g: [Oracle's OpenJDK8], [Amazon Corretto 8]) + [`maven >= 3.0.5`](https://maven.apache.org) - [.NET `6.0`] or later + *Recommended:* [`mono >= 6`](https://www.mono-project.com) - [Python `3.7.3`] or later + [`pip`](https://pip.pypa.io/en/stable/installing/) + [`setuptools >= 38.6.0`](https://pypi.org/project/setuptools/) + [`wheel`](https://pypi.org/project/wheel/) + *Recommended:* [`twine`](https://pypi.org/project/twine/) - [Go] `1.18` or newer [Node `14.6.0`]: https://nodejs.org/download/release/v14.6.0/ [Yarn `1.19.1`]: https://yarnpkg.com/en/docs/install [Oracle's OpenJDK8]: http://openjdk.java.net/install/ [Amazon Corretto 8]: https://aws.amazon.com/corretto/ [.NET `6.0`]: https://www.microsoft.com/net/download [Python `3.7.3`]: https://www.python.org/downloads/release/python-373/ [Go]: https://go.dev/dl/ ## Getting Started ### Bootstrapping The project is managed as a [monorepo] using [lerna]. [monorepo]: https://github.com/babel/babel/blob/main/doc/design/monorepo.md [lerna]: https://github.com/lerna/lerna 1. Check out this respository and change directory to its root. 2. Run `yarn install && yarn build` to install lerna, bootstrap the repository and perform an initial build and test cycle. ### Development Workflow 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 running `tsc --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 to `dist`. - `lint` - run linter against source - `lint: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