Skip to content

Commit 7e7f138

Browse files
authored
Use Yarn workspace (#7357)
* Use NPM workspace * fix Makefiles * ignore lockfiles in temp packages * ignore lockfiles in alaysis example projects * Switch to Yarn (Berry) workspace * vendor rescript-react for testing * Use link (or portal) protocol to avoid force-hoisting * add doc * immutable is default in CI * fix test * removed a module to keep it as minimal * biome should ignore yarn binary * add changelog
1 parent 978c979 commit 7e7f138

Some content is hidden

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

67 files changed

+5039
-7473
lines changed

.devcontainer/Dockerfile

+1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ LABEL org.opencontainers.image.description="Docker image for ReScript developmen
44

55
RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \
66
&& apt-get -y install --no-install-recommends \
7+
yarn \
78
opam \
89
musl-tools \
910
python-is-python3 \

.gitattributes

+2
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,5 @@
22
*.mli linguist-language=OCaml
33
*.res linguist-language=ReScript
44
*.resi linguist-language=ReScript
5+
6+
.yarn/releases/* binary linguist-vendored

.github/workflows/ci.yml

+5-2
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,7 @@ jobs:
135135
- name: Use Node.js
136136
uses: actions/setup-node@v4
137137
with:
138+
cache: yarn
138139
node-version-file: .nvmrc
139140

140141
- name: Get artifact dir name
@@ -281,7 +282,7 @@ jobs:
281282
key: ${{ steps.compiler-build-state-key.outputs.value }}
282283

283284
- name: Install npm packages
284-
run: npm ci --ignore-scripts
285+
run: yarn install
285286

286287
- name: Copy compiler exes to platform bin dir
287288
run: node ./scripts/copyExes.js -compiler
@@ -429,10 +430,11 @@ jobs:
429430
- name: Use Node.js
430431
uses: actions/setup-node@v4
431432
with:
433+
cache: yarn
432434
node-version-file: .nvmrc
433435

434436
- name: NPM install
435-
run: npm ci --ignore-scripts
437+
run: yarn install
436438

437439
- name: Download artifacts
438440
uses: actions/download-artifact@v4
@@ -523,6 +525,7 @@ jobs:
523525
- name: Use Node.js
524526
uses: actions/setup-node@v4
525527
with:
528+
cache: yarn
526529
node-version-file: .nvmrc
527530
registry-url: https://registry.npmjs.org # Needed to make auth work for publishing
528531

.gitignore

+7
Original file line numberDiff line numberDiff line change
@@ -81,3 +81,10 @@ tests/tools_tests/**/*.res.js
8181
tests/tools_tests/lib
8282
tests/analysis_tests*/lib
8383
tests/analysis_tests/**/*.bs.js
84+
85+
.yarn/*
86+
!.yarn/patches
87+
!.yarn/plugins
88+
!.yarn/releases
89+
!.yarn/sdks
90+
!.yarn/versions

.yarn/releases/yarn-4.7.0.cjs

+935
Large diffs are not rendered by default.

.yarnrc.yml

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
yarnPath: .yarn/releases/yarn-4.7.0.cjs
2+
3+
nodeLinker: node-modules
4+
5+
nmMode: hardlinks-global

CHANGELOG.md

+1
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
#### :house: Internal
3434

3535
- Clean up legacy tags handling. https://github.com/rescript-lang/rescript/pull/7309
36+
- Use Yarn (Berry) workspaces for internal tooling. https://github.com/rescript-lang/rescript/pull/7309
3637

3738
#### :nail_care: Polish
3839

CONTRIBUTING.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ Happy hacking!
1515
> Most of our contributors are working on Apple machines, so all our instructions are currently macOS / Linux centric. Contributions for Windows development welcome!
1616
1717
- [Node.js](https://nodejs.org/) v20.x
18+
- [Yarn CLI](https://yarnpkg.com/getting-started/install) (can be installed with `corepack`, Homebrew, etc)
1819
- C compiler toolchain (usually installed with `xcode` on Mac)
1920
- Python <= 3.11 (required to build ninja)
2021
- Rust toolchain (required to build rewatch; follow the instructions at https://www.rust-lang.org/tools/install)
@@ -58,7 +59,7 @@ opam install . --deps-only --with-test --with-dev-setup -y
5859

5960
#### npm install
6061

61-
Run `npm install --ignore-scripts`. This will install the npm dependencies required for the build scripts.
62+
Run `yarn install`. This will install the npm dependencies required for the build scripts.
6263

6364
### B. Devcontainer
6465

Makefile

+1-4
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,6 @@ ninja/ninja:
2626

2727
ninja: ninja/ninja
2828

29-
node_modules/.bin/semver:
30-
npm install
31-
3229
test: lib
3330
node scripts/test.js -all
3431

@@ -54,7 +51,7 @@ test-all: test test-gentype test-analysis test-tools
5451
reanalyze:
5552
reanalyze.exe -set-exit-code -all-cmt _build/default/compiler _build/default/tests -exclude-paths compiler/outcome_printer,compiler/ml,compiler/js_parser,compiler/frontend,compiler/ext,compiler/depends,compiler/core,compiler/common,compiler/cmij,compiler/bsb_helper,compiler/bsb
5653

57-
lib: build node_modules/.bin/semver
54+
lib: build
5855
./scripts/buildRuntime.sh
5956
./scripts/prebuilt.js
6057

Original file line numberDiff line numberDiff line change
@@ -1,2 +1,4 @@
11
lib
2-
.merlin
2+
.merlin
3+
package-lock.json
4+
yarn.lock

analysis/examples/example-project/package-lock.json

-16
This file was deleted.
+3-1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,4 @@
11
/node_modules
2-
/lib
2+
/lib
3+
package-lock.json
4+
yarn.lock

analysis/examples/larger-project/package-lock.json

-192
This file was deleted.

analysis/examples/larger-project/src/Hooks.res

+1-1
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ type callback<'input, 'output> = React.callback<'input, 'output>
9191
type testReactContext = React.Context.t<int>
9292

9393
@genType
94-
type testReactRef = React.Ref.t<int>
94+
type testReactRef = React.ref<int>
9595

9696
@genType
9797
type testDomRef = ReactDOM.domRef

analysis/examples/workspace-project/.gitignore

+2
Original file line numberDiff line numberDiff line change
@@ -25,3 +25,5 @@ lib
2525
.merlin
2626
.bsb.lock
2727
/node_modules/
28+
package-lock.json
29+
yarn.lock

analysis/examples/workspace-project/package-lock.json

-14
This file was deleted.

biome.json

+1
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
"lineWidth": 80,
2222
"attributePosition": "auto",
2323
"ignore": [
24+
".yarn/**",
2425
"tests/build_tests/**",
2526
"tests/tests/**",
2627
"tests/tools_tests/**",

0 commit comments

Comments
 (0)