diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 0ea045088fe..66f85ea5601 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -179,6 +179,14 @@ jobs: run: git diff --exit-code lib/js lib/es6 working-directory: packages/@rescript/runtime + - name: Build @rescript/belt + run: yarn workspace @rescript/belt build + shell: bash + + - name: Check for changes in @rescript/belt/lib + run: git diff --exit-code lib/js lib/es6 + working-directory: packages/@rescript/belt + - name: Version Check run: yarn constraints @@ -401,7 +409,7 @@ jobs: - name: Publish packages to pkg.pr.new id: publish run: | - yarn dlx pkg-pr-new publish "." "./packages/@rescript/*" + yarn dlx pkg-pr-new publish --yarn "." "./packages/@rescript/*" api-docs: needs: @@ -493,12 +501,24 @@ jobs: run: | COMMIT_SHA="${{ needs.pkg-pr-new.outputs.commit_sha }}" npm i --no-audit \ - "https://pkg.pr.new/rescript-lang/rescript@${COMMIT_SHA}" + "https://pkg.pr.new/rescript-lang/rescript@${COMMIT_SHA}" \ + "https://pkg.pr.new/rescript-lang/rescript/@rescript/runtime@${COMMIT_SHA}" \ + "https://pkg.pr.new/rescript-lang/rescript/@rescript/belt@${COMMIT_SHA}" shell: bash working-directory: ${{ steps.tmp-dir.outputs.path }} - name: Test installation - run: npx rescript -h && npx rescript build && cat src/Test.res.js + run: | + npx rescript -h + npx rescript build + cp src/BeltTest.res.txt src/BeltTest.res + if npx rescript build; then + echo "Belt unexpectedly compiled without being listed as a dependency" >&2 + exit 1 + fi + cp rescript-with-belt.json rescript.json + npx rescript build + node src/BeltTest.mjs shell: bash working-directory: ${{ steps.tmp-dir.outputs.path }} @@ -548,12 +568,24 @@ jobs: COMMIT_SHA="${{ needs.pkg-pr-new.outputs.commit_sha }}" # pnpm 10 blocks pkg.pr.new's URL-based platform subdependencies unless block-exotic-subdeps is disabled. pnpm --config.block-exotic-subdeps=false i \ - "https://pkg.pr.new/rescript-lang/rescript@${COMMIT_SHA}" + "https://pkg.pr.new/rescript-lang/rescript@${COMMIT_SHA}" \ + "https://pkg.pr.new/rescript-lang/rescript/@rescript/runtime@${COMMIT_SHA}" \ + "https://pkg.pr.new/rescript-lang/rescript/@rescript/belt@${COMMIT_SHA}" shell: bash working-directory: ${{ steps.tmp-dir.outputs.path }} - name: Test installation - run: pnpm rescript -h && pnpm rescript build && cat src/Test.res.js + run: | + pnpm rescript -h + pnpm rescript build + cp src/BeltTest.res.txt src/BeltTest.res + if pnpm rescript build; then + echo "Belt unexpectedly compiled without being listed as a dependency" >&2 + exit 1 + fi + cp rescript-with-belt.json rescript.json + pnpm rescript build + node src/BeltTest.mjs shell: bash working-directory: ${{ steps.tmp-dir.outputs.path }} diff --git a/CHANGELOG.md b/CHANGELOG.md index e29f818a89e..3e6e87c7660 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -15,6 +15,7 @@ #### :boom: Breaking Change - Remove the deprecated `Js` namespace and its runtime modules. https://github.com/rescript-lang/rescript/pull/8531 +- Move Belt into the separately installed `@rescript/belt` package. Projects using Belt must install the package and list it in their `rescript.json` dependencies. https://github.com/rescript-lang/rescript/pull/8554 #### :eyeglasses: Spec Compliance diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 46078febc0b..eb9b33f116b 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -147,7 +147,7 @@ make checkformat ## Adding new Files to the Npm Packages -To make sure that no files are added to or removed from the `rescript` or `@rescript/runtime` npm package inadvertently, an artifact list is kept at `packages/artifacts.json`. During CI build, it is verified that only the files that are listed there are actually included in the npm packages. +To make sure that no files are added to or removed from the `rescript`, `@rescript/runtime`, or `@rescript/belt` npm package inadvertently, an artifact list is kept at `packages/artifacts.json`. During CI build, it is verified that only the files that are listed there are actually included in the npm packages. After adding a new file to the repository that should go into one of the npm packages - e.g., a new stdlib module -, run `make artifacts`. @@ -325,7 +325,8 @@ Note that building the cmijs is based on the dependencies defined in `packages/p After a successful compilation, you will find following files in your project: - `packages/playground/compiler.js` -> This is the ReScript compiler, which binds the ReScript API to the `window` object. -- `packages/playground/packages/compiler-builtins` -> The compiler base cmij containing all the relevant core modules (`Js`, `Belt`, `Pervasives`, etc.) +- `packages/playground/packages/compiler-builtins` -> The compiler base cmij containing the runtime and standard-library modules +- `packages/playground/packages/@rescript/belt` -> The Belt cmij, packaged separately from the compiler built-ins - `packages/playground/packages/*` -> Contains third party deps with cmij.js files (as defined in `packages/playground/rescript.json`) You can now use the `compiler.js` file either directly by using a `