diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 81657ff016..f8a0d4f3e0 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -406,21 +406,18 @@ jobs: - name: Build playground compiler if: matrix.build_playground - run: | - opam exec -- node packages/playground-bundling/scripts/generate_cmijs.js - opam exec -- dune build --profile browser - cp ./_build/default/compiler/jsoo/jsoo_playground_main.bc.js playground/compiler.cjs + run: opam exec -- make playground playground-cmijs - name: Test playground compiler if: matrix.build_playground - run: node playground/playground_test.cjs + run: yarn workspace playground test - name: Upload playground compiler to CDN if: ${{ matrix.build_playground && startsWith(github.ref, 'refs/tags/v') }} env: KEYCDN_USER: ${{ secrets.KEYCDN_USER }} KEYCDN_PASSWORD: ${{ secrets.KEYCDN_PASSWORD }} - run: bash playground/upload_bundle.sh + run: yarn workspace playground upload-bundle - name: "Upload artifacts: binaries" if: matrix.upload_binaries @@ -513,23 +510,36 @@ jobs: with: node-version-file: .nvmrc + - name: Make test directory + id: tmp-dir + shell: bash + run: | + if [[ "$RUNNER_OS" == "Windows" ]]; then + dir=$(powershell -Command "[System.IO.Path]::GetTempPath() + [System.Guid]::NewGuid().ToString()" | tr -d '\r') + mkdir -p "$dir" + else + dir=$(mktemp -d) + fi + echo "path=$dir" >> "$GITHUB_OUTPUT" + cp -r tests/package_tests/installation_test/* "$dir" + - name: Download artifacts uses: actions/download-artifact@v4 with: name: npm-packages - path: packages/test + path: ${{ steps.tmp-dir.outputs.path }} - name: Install ReScript package run: | npm i --ignore-scripts --no-audit \ rescript-${{ needs.package.outputs.rescript_version }}.tgz shell: bash - working-directory: packages/test + working-directory: ${{ steps.tmp-dir.outputs.path }} - name: Test installation - run: npx rescript -h && npx rescript build && cat src/Test.bs.js + run: npx rescript -h && npx rescript build && cat src/Test.res.js shell: bash - working-directory: packages/test + working-directory: ${{ steps.tmp-dir.outputs.path }} publish: needs: [package, installationTest] @@ -564,5 +574,5 @@ jobs: - name: Update Website Playground env: NEXT_REVALIDATE_SECRET_TOKEN: ${{ secrets.NEXT_REVALIDATE_SECRET_TOKEN }} - run: ./playground/website_update_playground.sh + run: yarn workspace playground revalidate shell: bash diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 0e7b135867..b72a486baa 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -241,29 +241,28 @@ make playground make playground-cmijs ``` -Note that building the cmijs is based on the dependencies defined in `packages/playground-bundling/package.json`. In case you want to build some different version of e.g. `@rescript/react` or just want to add a new package, change the definition within the `package.json` file and run `make playground-cmijs` again. +Note that building the cmijs is based on the dependencies defined in `packages/playground/package.json`. In case you want to build some different version of e.g. `@rescript/react` or just want to add a new package, change the definition within the `package.json` file and run `yarn workspace playground build` again. After a successful compilation, you will find following files in your project: - `playground/compiler.js` -> This is the ReScript compiler, which binds the ReScript API to the `window` object. -- `playground/packages` -> Contains third party deps with cmij.js files (as defined in `packages/playground-bundling/bsconfig.json`) -- `playground/compilerCmij.js` -> The compiler base cmij containing all the relevant core modules (`Js`, `Belt`, `Pervasives`, etc.) +- `playground/packages/compiler-builtins` -> The compiler base cmij containing all the relevant core modules (`Js`, `Belt`, `Pervasives`, etc.) +- `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 `