diff --git a/.github/workflows/size-limit.yml b/.github/workflows/size-limit.yml index cb532868..119cc8c3 100644 --- a/.github/workflows/size-limit.yml +++ b/.github/workflows/size-limit.yml @@ -1,4 +1,4 @@ -name: "size" +name: "Bundle Size check @excalidraw/excalidraw" on: pull_request: branches: @@ -15,12 +15,10 @@ jobs: uses: actions/setup-node@v3 with: node-version: 18.x - - name: Install and build - run: yarn --frozen-lockfile env: CI: true - uses: andresz1/size-limit-action@v1 with: github_token: ${{ secrets.GITHUB_TOKEN }} - build_script: build:app + build_script: size skip_step: install diff --git a/package.json b/package.json index 54c45c9a..44251d31 100644 --- a/package.json +++ b/package.json @@ -146,13 +146,13 @@ "autorelease": "node scripts/autorelease.js", "prerelease": "node scripts/prerelease.js", "release": "node scripts/release.js", - "size": "yarn build:app && size-limit" + "size": "node scripts/buildPackageExcalidraw.js && size-limit" }, "size-limit": [ { - "limit": "500kb", "path": [ - "build/static/js/*.js" + "src/packages/excalidraw/dist/excalidraw.development.js", + "src/packages/excalidraw/dist/excalidraw.production.min.js" ] } ] diff --git a/scripts/buildPackageExcalidraw.js b/scripts/buildPackageExcalidraw.js new file mode 100644 index 00000000..4e323411 --- /dev/null +++ b/scripts/buildPackageExcalidraw.js @@ -0,0 +1,16 @@ +const { execSync } = require("child_process"); + +const excalidrawDir = `${__dirname}/../src/packages/excalidraw`; + +const build = () => { + try { + execSync(`yarn --frozen-lockfile`); + execSync(`yarn --frozen-lockfile`, { cwd: excalidrawDir }); + execSync(`yarn run build:umd`, { cwd: excalidrawDir }); + } catch (err) { + console.error(err); + process.exit(1); + } +}; + +build();