Skip to content

feat: allow overriding runtime path for bundle size check #652

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Oct 20, 2020

Conversation

achingbrain
Copy link
Member

@achingbrain achingbrain commented Oct 20, 2020

Not all modules built with aegir are destined to be consumed in a browser, but as currently implemented the size check will run for every package in a monorepo, which may then fail if one of those packages cannot be built as a browser bundle - if it uses node core modules, for example.

The change here is to allow passing a directory path in which to run the size check, this way monorepos can specify the modules they want tested by using a build matrix:

on:
  pull_request:
    branches:
      - '*'

name: Bundlesize
jobs:
  check:
    runs-on: ubuntu-latest
    strategy:
      matrix:
        node-version: [12.x]
        project:
          - packages/module-1
          - packages/module-2
          - packages/etc
    steps:
      - uses: actions/checkout@v2
      - name: Use Node.js ${{ matrix.node-version }}
        uses: actions/setup-node@v1
        with:
          node-version: ${{ matrix.node-version }}
      - name: Install dependencies
        run: npm install
      - name: Bundlesize ${{ matrix.project }}
        uses: ipfs/aegir/actions/bundle-size@feat/opt-in-to-size-check
        with:
          project: ${{ matrix.project }}
          github_token: ${{ secrets.GITHUB_TOKEN }}

@achingbrain achingbrain force-pushed the feat/opt-in-to-size-check branch 2 times, most recently from d066906 to 84fb39f Compare October 20, 2020 10:52
@achingbrain achingbrain marked this pull request as draft October 20, 2020 10:53
@achingbrain achingbrain changed the title feat: opt in to browser bundle size check feat: allow overriding runtime path for bundle size check Oct 20, 2020
@achingbrain achingbrain force-pushed the feat/opt-in-to-size-check branch 4 times, most recently from f3f8635 to 34c5906 Compare October 20, 2020 13:24
Not all modules built with aegir are destined to be consumed in a browser,
but as currently implemented the size check will run for every package in
a monorepo, which may then fail if one of those packages cannot be built
as a browser bundle - if it uses node core modules, for example.

The change here is to allow passing a directory path in which to run the
size check, this way monorepos can specify the modules they want tested
by using a build matrix:

```yaml
on:
  pull_request:
    branches:
      - '*'

name: Bundlesize
jobs:
  check:
    runs-on: ubuntu-latest
    strategy:
      matrix:
        node-version: [12.x]
        project:
          - packages/module-1
          - packages/module-2
          - packages/etc
    steps:
      - uses: actions/checkout@v2
      - name: Use Node.js ${{ matrix.node-version }}
        uses: actions/setup-node@v1
        with:
          node-version: ${{ matrix.node-version }}
      - name: Restore dependencies
        id: cache-modules
        uses: actions/checkout@v2
        with:
          path: node_modules
          key: ${{ matrix.node-version }}-${{ runner.OS }}-build-${{ hashFiles('package.json') }}
      - name: Install dependencies
        run: npm install
      - name: Bundlesize ${{ matrix.project }}
        uses: ipfs/aegir/actions/bundle-size@feat/opt-in-to-size-check
        with:
          project: ${{ matrix.project }}
          github_token: ${{ secrets.GITHUB_TOKEN }}
```
@achingbrain achingbrain force-pushed the feat/opt-in-to-size-check branch from abb635c to a00f1d6 Compare October 20, 2020 13:43
@achingbrain achingbrain marked this pull request as ready for review October 20, 2020 13:44
@achingbrain achingbrain requested a review from Gozala October 20, 2020 13:49
Copy link
Contributor

@Gozala Gozala left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good

@achingbrain achingbrain merged commit f2ad1b9 into master Oct 20, 2020
@achingbrain achingbrain deleted the feat/opt-in-to-size-check branch October 20, 2020 16:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants