Skip to content

Commit d145f2b

Browse files
RomainMullermergify[bot]
authored andcommitted
chore: migrate mono-repository to use "yarn workspaces" (#891)
* chore: migrate mono-repository to use "yarn workspaces" This appears to improve the bootsrapping performance and makes the lock files much easier to manager (`yarn` maintains a single `yarn.lock` file at the root of the mono-repository instead of having one for each package like `npm` does). As required, this adjusted the `jsii/superchain` Docker image to also contain `yarn`, and changes how the `node` binary is installed to using the `nodesource` repository (so as to satisfy the `yarn` RPM dependencies without hacking around too much). * CodeBuild: install yarn if it is not there already (temporarily) * Temporarily skip yarn's engine check * better way to tune the ignore-engines * fixup Gemfile.lock * add missing yarn install * added required link for bundled dependency * fix hoisting problem w/ jsii-calc-bundled, use * versions where possible. * increase timeout of negatives test (need to investigate why they are so slow though) * fix build-test * fixup python test * try to install & test from the same container (suspecting ruby's .bundle directory somehow gets lost) * unset some problematic BUNDLER_ environment variables in Docker (they assumed single-app workloads, we're making a development image) * revert * dependency versions
1 parent 69851e6 commit d145f2b

File tree

80 files changed

+8317
-69021
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

80 files changed

+8317
-69021
lines changed

.npmrc

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# Helps with using npm package-locally, while in a yarn workflow (avoids coupling scripts to yarn).
2+
# This is needed because yarn goes out of it's way to ensure it controls what `node` binary is used (for good!)
3+
scripts-prepend-node-path=auto

.travis.yml

+5-1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,10 @@ branches:
55
- master
66
- /v\d+\.\d+.\d+/
77

8+
cache:
9+
yarn: true
10+
directories: node_modules
11+
812
services:
913
- docker
1014

@@ -13,7 +17,7 @@ script:
1317
# Building the Docker image
1418
- docker build --pull --build-arg BUILD_TIMESTAMP=$(date -u +'%Y-%m-%dT%H:%M:%SZ') --build-arg COMMIT_ID="${TRAVIS_COMMIT}" -t "jsii/superchain:nightly" ./superchain
1519
# Building jsii itself within the Docker image
16-
- docker run --rm -it --net=host -v ${PWD}:${PWD} -w ${PWD} jsii/superchain:nightly npm run build
20+
- docker run --rm -it --network=host -v ${PWD}:${PWD} -w ${PWD} jsii/superchain:nightly bash -c "yarn install && yarn build && yarn test"
1721
# Make sure the build did not change the source tree
1822
- git update-index --refresh
1923
- git diff-index --exit-code --stat HEAD

.yarnrc

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# This is required as the *current* CodeBuild image has node8, but we "require" node 10.
2+
# The whole file can be dropped once the new Docker image is released.
3+
--install.ignore-engines true
4+
--run.ignore-engines true

CONTRIBUTING.md

+9-7
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,10 @@ using the docker image from the above section, but if you wish to, you can insta
4040
in your development environment.
4141

4242
- [Node `8.11.0`] or later
43+
- [Yarn `1.19.1`] or later
4344
- An OpenJDK-8 distribution (e.g: [Oracle's OpenJDK8], [Amazon Corretto 8])
4445
+ [`maven >= 3.0.5`](https://maven.apache.org)
45-
- [.NET Core `2.0`] or later
46+
- [.NET Core `2.1`] or later
4647
+ *Recommended:* [`mono >= 5`](https://www.mono-project.com)
4748
- [Python `3.6.5`] or later
4849
+ [`pip`](https://pip.pypa.io/en/stable/installing/)
@@ -53,6 +54,7 @@ in your development environment.
5354
+ [`bundler ~> 1.17.2`](https://bundler.io)
5455

5556
[Node `8.11.0`]: https://nodejs.org/download/release/v8.11.0/
57+
[Yarn `1.19.1`]: https://yarnpkg.com/en/docs/install
5658
[Oracle's OpenJDK8]: http://openjdk.java.net/install/
5759
[Amazon Corretto 8]: https://aws.amazon.com/corretto/
5860
[.NET Core `2.0`]: https://www.microsoft.com/net/download
@@ -68,7 +70,7 @@ The project is managed as a [monorepo] using [lerna].
6870
[lerna]: https://github.com/lerna/lerna
6971

7072
1. Check out this respository and change directory to its root.
71-
2. Run `npm run bootstrap && npm run build` to install lerna, bootstrap the repository
73+
2. Run `yarn install && yarn build` to install lerna, bootstrap the repository
7274
and perform an initial build and test cycle.
7375

7476
### Development Workflow
@@ -83,20 +85,20 @@ All packages within this repository have the following scripts:
8385

8486
Each one of these scripts can be executed either from the root of the repo using
8587
`npx lerna run <script> --scope <package>` or from individual modules using
86-
`npm run <script>`.
88+
`yarn <script>`.
8789

8890
### Bump
8991

90-
To bump the version of this repository, use the [`npm run bump`] script.
92+
To bump the version of this repository, use the [`yarn bump`] script.
9193

92-
[`npm run bump`]: ./scripts/bump.sh
94+
[`yarn bump`]: ./scripts/bump.sh
9395

9496
### Packaging and Bundling
9597

96-
This repository emits artifacts in multiple languages. The [`npm run package`]
98+
This repository emits artifacts in multiple languages. The [`yarn package`]
9799
script is used to prepare the repository for publishing.
98100

99-
[`npm run package`]: ./scripts/package.sh
101+
[`yarn package`]: ./scripts/package.sh
100102

101103
Each module that needs to be published implements an npm script called `package`
102104
which emits publishable artifacts to `dist/<lang>` (e.g. `dist/dotnet` for

buildspec.yaml

+6-4
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,18 @@ version: 0.2
33
phases:
44
install:
55
commands:
6-
- npm run bootstrap
6+
# Temporarily - install yarn if it's not there already
7+
- yarn --version || npm install --global yarn
8+
- yarn install
79
pre_build:
810
commands:
9-
- npm run fetch-dotnet-snk
11+
- yarn fetch-dotnet-snk
1012
build:
1113
commands:
12-
- npm run build
14+
- yarn build && yarn test
1315
post_build:
1416
commands:
15-
- '[ ${CODEBUILD_BUILD_SUCCEEDING} = 1 ] && npm run package'
17+
- '[ ${CODEBUILD_BUILD_SUCCEEDING} = 1 ] && yarn package'
1618
artifacts:
1719
files:
1820
- "**/*"

lerna.json

+2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
{
22
"lerna": "3.13.1",
3+
"npmClient": "yarn",
4+
"useWorkspaces": true,
35
"packages": [
46
"packages/*"
57
],

0 commit comments

Comments
 (0)