Skip to content

Commit

Permalink
Add lighthouse (#48)
Browse files Browse the repository at this point in the history
* Add lighthouse

* Update size-limit

* Push

* Try with custom action

* Add pr updater cron job

* Moving to CircleCI
  • Loading branch information
Michał Miszczyszyn authored Jun 2, 2020
1 parent dab12d0 commit 344877e
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 1,204 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Deploy
name: Deploy to production

on:
push:
Expand Down
239 changes: 0 additions & 239 deletions .github/workflows/pr_updater.yml

This file was deleted.

6 changes: 0 additions & 6 deletions .github/workflows/test-PR.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,3 @@ jobs:
- name: Run build
if: steps.cache-to-skip.outputs.cache-hit != 'true'
run: npm run build

- name: Sizelimit
uses: andresz1/size-limit-action@v1.3.1
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
skip_step: build
27 changes: 20 additions & 7 deletions .size-limit.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,19 @@ function readDirRecursively(paths) {
}

const base = ['.next', 'static'];
module.exports = readDirRecursively(base)
const pages = readDirRecursively(base)
.map((path) => {
// remove with or without trailing separator
const relativePath = path
.replace(Path.join(...base) + Path.sep, '')
.replace(Path.join(...base), '');
const segments = relativePath.split(Path.sep);

return { segments, path };
})
.filter(({ segments, path }) => {
return !['runtime', 'css', 'chunks'].includes(segments[0]);
})
.map(({ segments, path }) => {
// if it's longer than 8 then we assume it's the directory Next.js
// randomly generates and we want to skip its name
if (segments[0].length > 8) {
Expand All @@ -29,11 +34,7 @@ module.exports = readDirRecursively(base)
return { segments, path };
})
.filter(({ segments, path }) => {
// skip
if (['_buildManifest.js', '_ssgManifest.js'].includes(segments[0])) {
return false;
}
return true;
return !['_buildManifest.js', '_ssgManifest.js'].includes(segments[0]);
})
.map(({ segments, path }) => {
return {
Expand All @@ -43,3 +44,15 @@ module.exports = readDirRecursively(base)
gzip: true,
};
});

module.exports = [
...pages,
...['runtime', 'css', 'chunks'].map((name) => {
return {
path: Path.join(...base, name),
name,
running: false,
gzip: true,
};
}),
];
Loading

1 comment on commit 344877e

@vercel
Copy link

@vercel vercel bot commented on 344877e Jun 2, 2020

Choose a reason for hiding this comment

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

Please sign in to comment.