Skip to content

Commit

Permalink
chore: add size limit
Browse files Browse the repository at this point in the history
  • Loading branch information
lihbr committed Jan 6, 2022
1 parent 2f337a3 commit 8eb5170
Show file tree
Hide file tree
Showing 5 changed files with 652 additions and 7 deletions.
7 changes: 7 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,4 +45,11 @@ jobs:
run: npm run build

- name: Coverage
if: matrix.os == 'ubuntu-latest' && matrix.node == 14
uses: codecov/codecov-action@v1

- name: Size
if: github.event_name == 'pull_request' && matrix.os == 'ubuntu-latest' && matrix.node == 14
uses: andresz1/size-limit-action@v1
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
3 changes: 3 additions & 0 deletions .size-limit.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
const pkg = require("./package.json");

module.exports = [pkg.module, pkg.main].filter(Boolean).map(path => ({ path }));
17 changes: 11 additions & 6 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ git commit -m "short description of your changes"

## Processes

Processes refer to tasks that you may need to perform while working on this project.
Processes refer to tasks that you may need to perform while working on this project.

### Developing

Expand Down Expand Up @@ -72,6 +72,7 @@ npm run dev
### Building

Our build system is handled by [siroc][siroc], a near-zero-config build tool powered by [esbuild](https://github.com/evanw/esbuild). It takes care of:

- Generating a [CommonJS (`.cjs`)](https://nodejs.org/docs/latest/api/modules.html#modules_modules_commonjs_modules) bundle and its source map;
- Generating an [ECMAScript (`.mjs`)](https://nodejs.org/docs/latest/api/modules.html#modules_modules_commonjs_modules) bundle and its source map;
- Generating a TypeScript declaration (`.d.ts`) file.
Expand Down Expand Up @@ -299,7 +300,7 @@ This one is used to standardize the way pull requests are created on the reposit

**CI configuration (`.github/workflows/ci.yml`)**

Our CI workflow is configured to run against all commits and pull requests directed toward the `master` branch. It makes sure the project builds and passes all tests configured on it (lint, unit, e2e, etc.) Coverage is also collected by this workflow.
Our CI workflow is configured to run against all commits and pull requests directed toward the `master` branch. It makes sure the project builds and passes all tests configured on it (lint, unit, e2e, etc.) Coverage and bundle size are also collected by this workflow.

### 📁  `dist`

Expand Down Expand Up @@ -335,12 +336,14 @@ This folder contains utility functions used to test the project.

This folder contains snapshots generated by the test framework when using snapshot testing strategies. It should not be altered manually.

### 📄  `.editorconfig`, `.eslintrc.cjs`, `.prettierrc`, `.versionrc`, `ava.config.js`, `siroc.config.ts`, `tsconfig.json`
### 📄  `.editorconfig`, `.eslintrc.cjs`, `.prettierrc`, `.size-limit.json`, `.versionrc`, `ava.config.js`, `siroc.config.ts`, `tsconfig.json`

These files contain configuration for their eponymous tools:

- [EditorConfig][editor-config];
- [ESLint][eslint];
- [Prettier][prettier];
- [Size Limit][size-limit];
- [Standard Version][standard-version];
- [AVA][ava];
- [`siroc`][siroc];
Expand Down Expand Up @@ -389,7 +392,8 @@ The project's package definition file.
- `release:alpha:dry`: dry-run of the `release:alpha` script;
- `lint`: Runs ESLint on the project;
- `unit`: Runs AVA on the project;
- `test`: Runs the `lint` and `unit` scripts;
- `size`: Runs Size Limit on the project;
- `test`: Runs the `lint`, `unit`, and `size` scripts.

**Minimum Node version supported (`engines.node`)**

Expand All @@ -405,6 +409,7 @@ The minimum Node version supported by the project is stated under the `engines`
[editor-config]: https://editorconfig.org
[eslint]: https://eslint.org
[prettier]: https://prettier.io
[size-limit]: https://github.com/ai/size-limit
[standard-version]: https://github.com/conventional-changelog/standard-version
[ava]: https://github.com/avajs/ava
[siroc]: https://github.com/unjs/siroc
Expand All @@ -413,5 +418,5 @@ The minimum Node version supported by the project is stated under the `engines`
[template-issue]: https://github.com/prismicio/prismic-typescript-template/issues/new/choose
[changelog]: ./CHANGELOG.md
[forum-question]: https://community.prismic.io
[repo-issue]: https://github.com/prismicio/prismic-client/issues/new/choose
[repo-pull-requests]: https://github.com/prismicio/prismic-client/pulls
[repo-issue]: https://github.com/github_org_slash_github_repo/issues/new/choose
[repo-pull-requests]: https://github.com/github_org_slash_github_repo/pulls
Loading

0 comments on commit 8eb5170

Please sign in to comment.