Giter VIP home page Giter VIP logo

bundlemon's People

Contributors

dependabot[bot] avatar lironer avatar mourner avatar shwarcu avatar tleunen avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

bundlemon's Issues

Feature request: make "sub project" a dropdown

Is your feature request related to a problem? Please describe.

Running monorepo with a large number of subprojects (thank you for your explicit support of this configuration btw πŸ™ ), it can be difficult to remember the name of all subprojects associated with a parent project. Exposing this list as a dropdown would make it easy to quickly browse the status of each subproject.

Describe the solution you'd like

Screen Shot 2022-03-18 at 11 06 50 AM

Change the "subproject" text input in the report viewer to a dropdown that contains a list of all subprojects associated with the parent project ID.

Describe alternatives you've considered

Being smarter and having a better memory.

Screenshot of history in the service?

The free hosted service looks great. I've been using https://buildtracker.dev/ but exploring alternatives.

Could you share some screenshots of what it looks like? For example I'd definitely love to spot the commit from X weeks ago that bumped up sizes.

and maybe put one of these screenshots in a readme?

Feature proposal - json file output

Is your feature request related to a problem? Please describe.

I would like to process results gathered by bundlemon, I need an interface that would allow saving bundlemon results as a file or ability to attach custom output/reporter to process and save results. Application I am working with is build on a CI server and can't be build by Github Actions. This forces me to measure bundle sizes on the CI server and then process results further for example by sending them to some dashboard or github issue API.

Describe the solution you'd like
Ability to store result as json file. Optionally passing file name as parameter.

Describe alternatives you've considered
At the moment I could possibly scrap results from the console output but that's very hacky solution.

Additional context
I created a draft of a simple output that could possibly satisfy requirements of how bundlemon works, but I didn't test this solution yet. It's a raw draft for feature proposal.

import fs from 'fs';
import { Report } from 'bundlemon-utils';
import logger from '../../../common/logger';
import type { Output, OutputCreateParams, OutputInstance } from '../types';

const saveAsJson = (filename: string, payload: Report) => {
  fs.writeFile(`${filename}`, JSON.stringify(payload), (error: any) => {
    if (error) {
      logger.log('There was an error when saving a file');
      throw error;
    }
    logger.log(`${filename} saved.`);
  });
};

const output: Output = {
  name: 'json',
  create: (params: OutputCreateParams): OutputInstance | Promise<OutputInstance | undefined> | undefined => {
    const { filename } = params.options;
    const name = filename ? filename : 'bundlemon-results.json';
    return {
      generate: (report: Report): void => saveAsJson(name, report),
    };
  },
};

export default output;

validation failed due to missing branch property when trying to commit bundlemon record

Describe the bug

Suddenly, we are getting error when bundlemon tries to commit its record (without any change on our end)
getting this:

[DEBUG] github-pr output: branch: "dependabot/npm_and_yarn/ssri-6.0.2" target branch: "master" PR number: "1483"
[INFO] Start analyzing
[INFO] Finished analyzing
[INFO] Start generating report
[INFO] Save commit record for branch "dependabot/npm_and_yarn/ssri-6.0.2"
[ERROR] create commit record: validation failed
[
{
message: '"query.branch" is required',
path: [ 'query', 'branch' ],
type: 'any.required',
context: { label: 'query.branch', key: 'branch' }
}
]
[ERROR] Failed to save commit record

Expected behavior

seems like bundlemon cant recognise the branch name when trying to push the record to storage,
but as you can see the branch name exist in the first line of the output, but under the query object somehow its not valid.

Environment
BundleMon version: ^0.3.0-rc.1

Please run this command inside your project and paste its contents here (it automatically copies to your clipboard)
npx envinfo --system --binaries --markdown | npx clipboard-cli

Additional context

Error during commit record creation, when bundlemon runs on master branch / Travis

Hello πŸ‘‹

Describe the bug
We could not run bundlemon on master branch inside our project, because prNumber is false.
That makes createCommitRecord fail

Consequence to see in this PR : Total files change +3.96MB 0% in each PR.

Expected behavior

Same working process that in bundlemon project: inside Github Action last merge commit , it works.

Environment
BundleMon version: v1.3.0

The concerned .bundlemonrc :
https://github.com/cozy/cozy-drive/blob/master/.bundlemonrc

System:

  • OS: macOS 12.1
  • CPU: (8) x64 Intel(R) Core(TM) i5-8259U CPU @ 2.30GHz
  • Memory: 61.59 MB / 16.00 GB
  • Shell: 5.8 - /bin/zsh

Binaries:

  • Node: 12.22.9 - ~/.nvm/versions/node/v12.22.9/bin/node
  • Yarn: 1.22.17 - /usr/local/bin/yarn
  • npm: 6.14.15 - ~/.nvm/versions/node/v12.22.9/bin/npm
  • Watchman: 2022.02.28.00 - /usr/local/bin/watchman

Additional context

Here is the Travis error:

[ERROR] create commit record: validation failed
{
  "message": "A validation error occurred when validating the body",
  "errors": [
    {
      "keyword": "pattern",
      "dataPath": ".prNumber",
      "schemaPath": "#/properties/prNumber/pattern",
      "params": {
        "pattern": "^[0-9]*$"
      },
      "message": "should match pattern \"^[0-9]*$\""
    }
  ]
}
[ERROR] Failed to create commit record
[ERROR] Unhandled error
Error: Failed to generate report

Capture:
Capture d’écran 2022-03-09 aΜ€ 15 16 03

How can I configure Bundlemon to recognize hashes generated by Rollup 4?

Discussed in #191

Originally posted by goibon January 15, 2024
I'm using Bundlemon to keep track of my chunk sizes in a project that uses Vite which in turn uses Rollup to bundle. My chunks follow a naming convention of [name]-[hash].js which used to mean that they would be named something like chunkNameA-5fdd3f1d.js. After upgrading to Vite 5 which in turn upgraded Rollup from v3 to v4 the hashes are now different (as mentioned as a breaking change in Rollup release notes). The new hashes are no longer just hex characters but seem to include a-z, 0-9, _ and -. The use of - in hashes seems to cause some issues with file matching with bundlemon.
My bundlemon config uses a path setting that looks like: "path": "assets/*-<hash>.js", which ended up showing part of the hash in the bunldemon output, eg. assets/chunkNameA-Zxa-(hash).js where Zxa- is part of the hash but not recognized as such.
My initial first attempt at addressing this was to use a new chunk file naming in rollup [name].[hash].js and a new path in bundlemon: "path": "assets/*.<hash>.js", but this also does not properly match the files so if a file has a - in the hash then bundlemon reports it as being removed.
I realize that potentially I could also resolve this by finding a way of getting vite/rollup to output compatible hashes again but my initial attempts at figuring out how were unfruitful so I thought I'd ask here.

Is there any way I can get Bundlemon to properly match the new hashes?

Commit Message as part of the label on History Report

Discussed in #109

Originally posted by matt-franceschini-fw June 10, 2022
The history report feature would greatly benefit from having more information about the commit in the popover. It is very hard to pinpoint which commit lead to the increase/decrease in size. Can we pull information from the commit (ideally the message, as it is human readable)?

How to skip maxPercentIncrease for certain PR

Is your feature request related to a problem? Please describe.
Sometimes, binary size increases are expected. How do we bypass the maxPercentIncrease limit for the PR that introduces such change?

Describe the solution you'd like
Specify a keyword in the PR description or a label to skip the failing bundlemon test.

Describe alternatives you've considered
Use maxSize instead since we can update the bundlemon settings in the same PR. But maxPercentIncrease shouldn't change

Additional context

ability to post GitHub output only on failures

It would also be great to have a way to report the output differently in case of "failures".
For example, the report as PR comment can be very noisy in a monorepo with multiple projects reporting as PR comments, but if we can set the PR comment to be only in case of "failure", that would already be a lot less noisy.

Originally posted by @tleunen in #115 (comment)

BundleMon v2 project migration

BundleMon CLI v2 introduced some breaking changes.

If you are using BundleMon in GitHub actions you don't need to set project ID anymore, BundleMon will automatically create a new project linked to your repo on GitHub.

The old way of using project ID without an API key will stop working in a few months so it's important to upgrade.

If you want to keep your current project history you can reply with your details to this issue or send me an email ([email protected]) with the owner, repo name, and your current project id.

Example:
Owner: lironer
Repo: bundlemon
Project ID: aaaaaaaaaaaa

RangeError: Maximum call stack size exceeded

Describe the bug

After adding the library "polyfill-library": "^4.0.0",, when running the bundlemon analyzer it gives a Maximum call stack error and it breaks.

Expected behavior
It should not get this error.

Environment
BundleMon version: <1.3.0>

`

System:

  • OS: macOS 11.6.5
  • CPU: (12) x64 Intel(R) Core(TM) i7-9750H CPU @ 2.60GHz
  • Memory: 2.92 GB / 32.00 GB
  • Shell: 5.8 - /bin/zsh

Binaries:

  • Node: 16.0.0 - ~/.nvm/versions/node/v16.0.0/bin/node
  • Yarn: 1.22.10 - /usr/local/bin/yarn
  • npm: 7.10.0 - ~/.nvm/versions/node/v16.0.0/bin/npm

`
Additional context

Bundlemon config:

{ "files": [ { "maxPercentIncrease": 5, "maxSize": "200kb", "path": ".nuxt/dist/client/app.<hash>.js" }, { "maxPercentIncrease": 1, "maxSize": "160kb", "path": ".nuxt/dist/client/vendors/app.<hash>.js" } ] }
Screenshot 2022-04-27 at 12 03 39

This also breaks in our CI/CD pipeline

Ability to approve the changes to the bundle size

Is your feature request related to a problem? Please describe.
Firstly, thank you so much for this awesome tool!!!
I have gone through a few similar tools and this is definitely exactly what I needed.
The issue I am facing:

  • when a PR fails the bundle checks, then the check is marked as failed for the PR (which is obviously the correct behavior)
  • if this is an optional check then, as a reviewer, even though it has failed I can approve and merge the PR
  • BUT now, the check fails on the master/main branch, which makes it look like the build is failing
  • Also, it would be great to be able to mark this check as passing in a PR so that it does not block the PR if it is a required check.

Describe the solution you'd like
Potentially some sort of "Approve" or "Accept" facility on the check (or on the page that it leads to) that would allow for the status of
the check to no longer be marked as failing. This would be very useful for the case that I mentioned for a master commit, and for reviewing a PR.

I guess that this would only be available to a CODEOWNER or a moderator of the target repository.
Hopefully this auth aspect doesn't make things too difficult. One potential simple option here could be a configured approver list in the github app config, or some sort of secret key that could be shared with the relevant parties and they just copy paste after clicking the approve button.

I have seen this type of thing in CodeClimate: https://docs.codeclimate.com/docs/workflow#what-to-do-when-issues-are-found

Describe alternatives you've considered
I tried to use the github actions continue-on-error feature with the approvals feature to facilitate this workflow, but the check still marks the build as failing. (See: ngxs/store#1886)

Potentially also the "Approve" could be done using a comment in the PR by a moderator using the comment /bundlemon approve, but this doesn't solve the issue with the commit on master.

Additional context
Here is an example of a commit on master that fails after merging a PR with a bundle size change outside of the tolerances:
ngxs/store@80a3014

[Docs] Some pitfalls when developing on linux

This is a feature request for docs.

Issue 1.

npm script start:service is based on docker desktop
https://github.com/LironEr/bundlemon/blob/master/package.json#L10

On linux machines docker needs to be installed manually and it's not shipped with docker compose as one part. docker-compose needs to be installed manually and it's called with docker-compose.

Expected behavior
Maybe there should be additional npm script for linux machines or some smarty if-else in the existing one πŸ€”

Issue 2.

Main docker-compose config is using $PWD variable https://github.com/LironEr/bundlemon/blob/master/docker-compose.dev.yml#L30
And as explained here https://stackoverflow.com/a/61905266/3636524

$PWD will not work if you are running using sudo. Try the recommended settings from Docker for Linux https://docs.docker.com/engine/install/linux-postinstall/.

Expected behavior
When docs are created, it would be nice to have a note somewhere for people who use linux environment so that they can run docker-compose up with no error about $PWD not being set.
Alternatively $PWD may not be used at all so that project will work also on machines without post-installation steps done.

Environment
BundleMon version: master branch

System:

  • OS: Linux 5.13 Manjaro Linux
  • CPU: (16) x64 AMD Ryzen 7 2700X Eight-Core Processor
  • Memory: 722.61 MB / 31.28 GB
  • Container: Yes
  • Shell: 5.8 - /bin/zsh

Binaries:

  • Node: 14.17.5 - /var/lib/snapd/snap/bin/node
  • Yarn: 1.22.17 - /usr/local/bin/yarn
  • npm: 8.1.2 - /usr/local/bin/npm

Docker version:

Client:
 Version:           20.10.9
 API version:       1.41
 Go version:        go1.17.1
 Git commit:        c2ea9bc90b
 Built:             Mon Oct  4 19:13:02 2021
 OS/Arch:           linux/amd64
 Context:           default
 Experimental:      true

Server:
 Engine:
  Version:          20.10.9
  API version:      1.41 (minimum version 1.12)
  Go version:       go1.17.1
  Git commit:       79ea9d3080
  Built:            Mon Oct  4 19:12:03 2021
  OS/Arch:          linux/amd64
  Experimental:     false
 containerd:
  Version:          v1.5.7
  GitCommit:        8686ededfc90076914c5238eb96c883ea093a8ba.m
 runc:
  Version:          1.0.2
  GitCommit:        v1.0.2-0-g52b36a2d
 docker-init:
  Version:          0.19.0
  GitCommit:        de40ad0

Recent breaking changes in `/v1/projects/.../commit-records/.../outputs/github` endpoint?

Hi there, thanks for this great service :)

I recently created an alternative client for the Scala.js ecosystem that integrates with the Scala build tool. I hope you don't mind about this πŸ˜…
https://github.com/armanbilge/sbt-bundlemon

However, somehow in the last 48 hours or so the /v1/projects/.../commit-records/.../outputs/github endpoint has changed (?) and is 400-rejecting my requests.

Here is a log showing the failure:

[info] [info] HTTP/1.1 POST https://api.bundlemon.dev/v1/projects/id?authType=GITHUB_ACTIONS&runId=2811061031 Headers(Content-Length: 65, x-api-client-name: sbt-bundlemon, x-api-client-version: 0.1.1-4-a29c46c-SNAPSHOT, Content-Type: application/json, Accept: application/json) body="{"provider":"github","owner":"armanbilge","repo":"sbt-bundlemon"}"
[info] [info] HTTP/1.1 200 OK Headers(Content-Type: application/json; charset=utf-8, Connection: keep-alive, date: Sun, 07 Aug 2022 02:38:40 GMT, access-control-allow-origin: *, vary: Origin, content-length: 33, x-vercel-cache: MISS, server: Vercel, x-vercel-id: cle1::iad1::fgqt7-1659839919847-c014eb0553a1, strict-transport-security: max-age=63072000, cache-control: public, max-age=0, must-revalidate) body="{"id":"62d55e113fb165069416fa1b"}"
[info] [info] HTTP/1.1 POST https://api.bundlemon.dev/v1/projects/62d55e113fb165069416fa1b/commit-records?authType=GITHUB_ACTIONS&runId=2811061031 Headers(Content-Length: 247, x-api-client-name: sbt-bundlemon, x-api-client-version: 0.1.1-4-a29c46c-SNAPSHOT, Content-Type: application/json, Accept: application/json) body="{"subProject":"sbt-bundlemon-scripted-example_sjs1_2.12","files":[{"friendlyName":"main.js","pattern":"*.js","path":"main.js","size":2628,"compression":"brotli"}],"groups":[],"branch":"debug","commitSha":"a29c46c8dc26dcf75a0d029c8ba8526ecbaaa42f"}"
[info] [info] HTTP/1.1 200 OK Headers(Content-Type: application/json; charset=utf-8, Connection: keep-alive, date: Sun, 07 Aug 2022 02:38:40 GMT, access-control-allow-origin: *, vary: Origin, content-length: 481, x-vercel-cache: MISS, server: Vercel, x-vercel-id: cle1::iad1::fgqt7-1659839920319-e11a362da475, strict-transport-security: max-age=63072000, cache-control: public, max-age=0, must-revalidate) body="{"record":{"id":"62ef25b029bfb7ac0758962e","creationDate":"2022-08-07T02:38:40.849Z","subProject":"sbt-bundlemon-scripted-example_sjs1_2.12","files":[{"friendlyName":"main.js","pattern":"*.js","path":"main.js","size":2628,"compression":"brotli"}],"groups":[],"branch":"debug","commitSha":"a29c46c8dc26dcf75a0d029c8ba8526ecbaaa42f","projectId":"62d55e113fb165069416fa1b"},"linkToReport":"https://app.bundlemon.dev/projects/62d55e113fb165069416fa1b/reports/62ef25b029bfb7ac0758962e"}"
[info] [info] HTTP/1.1 POST https://api.bundlemon.dev/v1/projects/62d55e113fb165069416fa1b/commit-records/62ef25b029bfb7ac0758962e/outputs/github?authType=GITHUB_ACTIONS&runId=2811061031 Headers(Content-Length: 193, x-api-client-name: sbt-bundlemon, x-api-client-version: 0.1.1-4-a29c46c-SNAPSHOT, Content-Type: application/json, Accept: application/json) body="{"git":{"runId":"2811061031","owner":"armanbilge","repo":"sbt-bundlemon","commitSha":"a29c46c8dc26dcf75a0d029c8ba8526ecbaaa42f"},"output":{"checkRun":true,"commitStatus":true,"prComment":true}}"
[info] [info] HTTP/1.1 400 Bad Request Headers(Content-Type: application/json; charset=utf-8, Connection: keep-alive, date: Sun, 07 Aug 2022 02:38:41 GMT, access-control-allow-origin: *, vary: Origin, content-length: 227, x-vercel-cache: MISS, server: Vercel, x-vercel-id: cle1::iad1::fgqt7-1659839920932-cbdf63f64194, strict-transport-security: max-age=63072000, cache-control: public, max-age=0, must-revalidate) body=""
[info] [error] org.http4s.client.UnexpectedStatus: unexpected HTTP status: 400 Bad Request for request POST https://api.bundlemon.dev/v1/projects/62d55e113fb165069416fa1b/commit-records/62ef25b029bfb7ac0758962e/outputs/github?authType=GITHUB_ACTIONS&runId=2811061031

https://github.com/armanbilge/sbt-bundlemon/runs/7709128565

Here is a successful log from a couple weeks ago.

[info] [info] HTTP/1.1 POST https://api.bundlemon.dev/v1/projects/id?authType=GITHUB_ACTIONS&runId=2737290740 Headers(Content-Length: 65, x-api-client-name: sbt-bundlemon, x-api-client-version: 0.1.1-2-3d5e194-SNAPSHOT, Content-Type: application/json, Accept: application/json) body="{"provider":"github","owner":"armanbilge","repo":"sbt-bundlemon"}"
[info] [info] HTTP/1.1 200 OK Headers(Content-Type: application/json; charset=utf-8, Connection: keep-alive, date: Tue, 26 Jul 2022 05:53:31 GMT, access-control-allow-origin: *, vary: Origin, content-length: 33, x-vercel-cache: MISS, server: Vercel, x-vercel-id: cle1::iad1::cqdgl-1658814811188-2f34d3b69b0e, strict-transport-security: max-age=63072000, cache-control: public, max-age=0, must-revalidate) body="{"id":"62d55e113fb165069416fa1b"}"
[info] [info] HTTP/1.1 POST https://api.bundlemon.dev/v1/projects/62d55e113fb165069416fa1b/commit-records?authType=GITHUB_ACTIONS&runId=2737290740 Headers(Content-Length: 246, x-api-client-name: sbt-bundlemon, x-api-client-version: 0.1.1-2-3d5e194-SNAPSHOT, Content-Type: application/json, Accept: application/json) body="{"subProject":"sbt-bundlemon-scripted-example_sjs1_2.12","files":[{"friendlyName":"main.js","pattern":"*.js","path":"main.js","size":2628,"compression":"brotli"}],"groups":[],"branch":"main","commitSha":"3d5e1945bd6fc5d6a01513b37eafcab03fba0519"}"
[info] [info] HTTP/1.1 200 OK Headers(Content-Type: application/json; charset=utf-8, Connection: keep-alive, date: Tue, 26 Jul 2022 05:53:32 GMT, access-control-allow-origin: *, vary: Origin, content-length: 851, x-vercel-cache: MISS, server: Vercel, x-vercel-id: cle1::iad1::cqdgl-1658814811685-aa094d371b60, strict-transport-security: max-age=63072000, cache-control: public, max-age=0, must-revalidate) body="{"record":{"id":"62df815c3fb16506943958ad","creationDate":"2022-07-26T05:53:32.113Z","subProject":"sbt-bundlemon-scripted-example_sjs1_2.12","files":[{"friendlyName":"main.js","pattern":"*.js","path":"main.js","size":2628,"compression":"brotli"}],"groups":[],"branch":"main","commitSha":"3d5e1945bd6fc5d6a01513b37eafcab03fba0519","projectId":"62d55e113fb165069416fa1b"},"baseRecord":{"id":"62d5e8bc3fb165069457cd95","creationDate":"2022-07-18T23:11:56.487Z","subProject":"sbt-bundlemon-scripted-example_sjs1_2.12","files":[{"friendlyName":"main.js","pattern":"*.js","path":"main.js","size":2916,"compression":"gzip"}],"groups":[],"branch":"main","commitSha":"01fa4df681473a06307a0b89244590b5e95461f4","projectId":"62d55e113fb165069416fa1b"},"linkToReport":"https://app.bundlemon.dev/projects/62d55e113fb165069416fa1b/reports/62df815c3fb16506943958ad"}"
[info] [info] HTTP/1.1 POST https://api.bundlemon.dev/v1/projects/62d55e113fb165069416fa1b/commit-records/62df815c3fb16506943958ad/outputs/github?authType=GITHUB_ACTIONS&runId=2737290740 Headers(Content-Length: 193, x-api-client-name: sbt-bundlemon, x-api-client-version: 0.1.1-2-3d5e194-SNAPSHOT, Content-Type: application/json, Accept: application/json) body="{"git":{"runId":"2737290740","owner":"armanbilge","repo":"sbt-bundlemon","commitSha":"3d5e1945bd6fc5d6a01513b37eafcab03fba0519"},"output":{"checkRun":true,"commitStatus":true,"prComment":true}}"
[info] [info] HTTP/1.1 200 OK Headers(Content-Type: application/json; charset=utf-8, Connection: keep-alive, date: Tue, 26 Jul 2022 05:53:33 GMT, access-control-allow-origin: *, vary: Origin, content-length: 379, x-vercel-cache: MISS, server: Vercel, x-vercel-id: cle1::iad1::cqdgl-1658814812200-7a055da4e0f6, strict-transport-security: max-age=63072000, cache-control: public, max-age=0, must-revalidate) body="{"checkRun":{"result":"success","message":"Successfully created GitHub check run","metadata":{"id":7514154779,"url":"https://github.com/armanbilge/sbt-bundlemon/runs/7514154779"}},"commitStatus":{"result":"success","message":"Successfully created GitHub commit status","metadata":{"id":18493430976}},"prComment":{"result":"skipped","message":"Not a PR - ignore post PR comment"}}"

https://github.com/armanbilge/sbt-bundlemon/runs/7514135077

As far as I can tell the request is consistent with the relevant schema.

export const GithubOutputRequestSchema = {

I don't see any recent commits that seem related so I'm not sure what changed. Thanks in advance for your help, much appreciated!

Friendly name on groups

Discussed in #101

Originally posted by nuno-m May 9, 2022
Groups can sometimes have very complex glob patterns, which might make it harder for someone not familiar with the code base to correctly identify what it does/ is responsible for.
I had a case where I was grouping all my app JS files, with the exception of translations, third-party code and the main app.js file. The glob works as expected, but the generated reports make it difficult to understand.
My proposal is to extend the File type to also support a "friendy name" kind of property where we can name each group. That could also apply to single files too.

Exposing markdown report generator in bundlemon-utils package

Is your feature request related to a problem? Please describe.

I am working on custom notification process and notification channel for bundlemon results.
I would like to re-use existing code from

export function generateReportMarkdown({

in my code.

Describe the solution you'd like
Move

export function generateReportMarkdown({

to bundlemon-utils package so that it can be added as dependency and reused by other projects :)

Describe alternatives you've considered
For now I will copy implementation inside my private repo and I will try to open PR with suggested changes.
Additional context
I work in a project that needs some custom approaches to how we gather bundlemon metrics and how we process notifications for it. I can't use bundlemon github actions app so I am creating custom notifications service for it.

It would make my work 10x easier if I could import markdownReportGenerator from bundlemon-utils and reuse it. This would also make sure that I am always in-sync with Bundlemon data structures.

Failure in Groups throws unhandled exception: Cannot read 'failReasons' of undefined

Describe the bug

Failure in Groups throws unhandled exception: Cannot read 'failReasons' of undefined

Expected behavior

Graceful failure without unhandled exception.

Screenshot

image

Configuration

module.exports = {
  baseDir: "./dist",
  defaultCompression: "none",
  files: [
    {
      path: "halo.js",
      maxSize: "450 kB",
    },
    {
      path: "halo.css",
      maxSize: "70 kB",
    }
  ],
  groups: [
    {
      path: "*.module.*",
      maxSize: "520 kB"
    }
  ]
}

Environment
BundleMon version: 1.1.0

System:

  • OS: macOS 11.6
  • CPU: (32) x64 Intel(R) Xeon(R) W-3245 CPU @ 3.20GHz
  • Memory: 132.14 GB / 288.00 GB
  • Shell: 5.8 - /usr/local/bin/zsh

Binaries:

  • Node: 14.17.5 - ~/.nvm/versions/node/v14.17.5/bin/node
  • Yarn: 1.22.10 - /usr/local/bin/yarn
  • npm: 7.10.0 - /usr/local/bin/npm

Glob pattern with pipe character breaks Markdown report table

Describe the bug
Using glob patterns with the OR operator (|) breaks the generated Markdown report.
These characters are not currently being escaped and when used on a glob pattern, they are interpreted as part of the Markdown syntax.

Expected behavior
Glob pattern should be escaped on Markdown report to prevent characters such as | from breaking the table.

Additional context

Example Screenshot
image

Sidenote: I wanted to run this the project locally, and try to work on a fix for this issue, but I wasn't able to.
When running the yarn start:service command I get open [...]/bundlemon/service/.env: no such file or directory error.

History report - table header is displayed over poup for the latest date

Describe the bug
Screenshot 2021-10-29 at 10 51 50

When displaying pop for the last day on the history report, the table header is displayed over it (wrong z-index?) Found on Bundlemon history report.

Expected behaviour
Popup should be displayed above the table and its header.

Environment
BundleMon version: v1.1.1
https://app.bundlemon.dev/

System:

  • OS: macOS 11.6
  • CPU: (12) x64 Intel(R) Core(TM) i7-9750H CPU @ 2.60GHz
  • Memory: 3.95 GB / 32.00 GB
  • Shell: 5.8 - /bin/zsh

Binaries:

  • Node: 16.1.0 - ~/.nvm/versions/node/v16.1.0/bin/node
  • npm: 7.11.2 - ~/.nvm/versions/node/v16.1.0/bin/npm

Additional context
Looks like the issue is caused by table header cell having z-index: 2;

Bundlemon fails to produce the `checkRun` in v2

Describe the bug

I have a project which uses CircleCI to send the reports to BundleMon. Because of this, I added the github token for the tool. But now, it gives me this error with v2 rc1:

[ERROR] github output: Create GitHub "checkRun": failure - You must authenticate via a GitHub App.

With v1, everything worked fine using the github app, and without providing the token.

Environment
BundleMon version: 2.0.0-rc1

Ignore fails on base branch

  • when a PR fails the bundle checks, then the check is marked as failed for the PR (which is obviously the correct behavior)
  • if this is an optional check then, as a reviewer, even though it has failed I can approve and merge the PR
  • BUT now, the check fails on the master/main branch, which makes it look like the build is failing

Originally posted by @markwhitfeld in #115

Hey,

BUT now, the check fails on the master/main branch, which makes it look like the build is failing

If the target branch doesn't exist (meaning we are not in PR), BundleMon will compare your current commit to a previous commit in the same branch you currently are. This was implemented to show the correct message at the end of the run and in the commit status. But I think you are right and there is no need to fail the run if we are comparing commits in the same branch.

What do you think about adding a new flag to ignore fails in the same branch?

ignoreFailuresInSameBranch: true / false (default true)

The flag will only change the result to success

Originally posted by @LironEr in #115 (comment)

Super! Thank you so much for the response. Regarding the master branch, I don't know what is possible with checks, but potentially they could be represented as warnings and not failures? And for the setting name, I think that the terminology could potentially be "base" branch, because some might interpret commits within the PR branch as the "same" branch. Potentially the setting could be called: warnForFailuresOnBaseBranch: true/false Potentially making the default true might be an unexpected behaviour change (currently it would behave as if it was set to false). But it is up to you if you see the current failure on the base branch as a bug or a feature, so it is up to you πŸ‘

Just jotting down the progression of my thoughts here.....

An alternative setting name could be: baseBranchFailureHandling: 'error'/'warn'/'ignore' or baseBranchFailureStrategy: 'error'/'warn'/'ignore' or baseBranchCommitValidation: 'error'/'warn'/'ignore'

or even ignoreFailuresOnBranches: [ 'master', 'main', 'release' ] or warnOnlyForFailureOnBranches: [ 'master', 'main', 'release' ] or softFailureOnBranches: [ 'master', 'main', 'release' ]

or even this could be in the github reporter options like this

"reportOutput": [
  [
    "github",
    {
      "checkRun": false,
      "commitStatus": true,
      "prComment": true,
      "branchCheckHandling": {
          "master": { "reportFailureAs": "warning" }, 
          "dev": { "reportFailureAs": "error" }, 
          "release": { "reportFailureAs": "information" }, 
      }
    }
  ]
]

I think I like the configurable aspect of the last one. Obviously whether or not we can do warnings would affect the design.

Haha, really over-engineering now, Imagine if we could even have "reportFailureAs": [ "warning", "email" ], which would email the code owners. Hahaha, I think there is some serious scope creep here 🀣 .

Originally posted by @markwhitfeld in #115 (comment)

[Docs] some pitfalls when developing on linux

Issue 1.

npm script start:service is based on docker desktop
https://github.com/LironEr/bundlemon/blob/master/package.json#L10

On linux machines docker needs to be installed manually and it's not shipped with docker compose as one part. docker-compose needs to be installed manually and it's called with docker-compose.

Expected behavior
Maybe there should be additional npm script for linux machines or some smarty if-else in the existing one πŸ€”

Issue 2.

Main docker-compose config is using $PWD variable https://github.com/LironEr/bundlemon/blob/master/docker-compose.dev.yml#L30
And as explained here https://stackoverflow.com/a/61905266/3636524

$PWD will not work if you are running using sudo. Try the recommended settings from Docker for Linux https://docs.docker.com/engine/install/linux-postinstall/.

Expected behavior
When docs are created, it would be nice to have a note somewhere for people who use linux environment so that they can run docker-compose up with no error about $PWD not being set.
Alternatively $PWD may not be used at all so that project will work also on machines without post-installation steps done.

Environment
BundleMon version: master branch

System:

  • OS: Linux 5.13 Manjaro Linux
  • CPU: (16) x64 AMD Ryzen 7 2700X Eight-Core Processor
  • Memory: 722.61 MB / 31.28 GB
  • Container: Yes
  • Shell: 5.8 - /bin/zsh

Binaries:

  • Node: 14.17.5 - /var/lib/snapd/snap/bin/node
  • Yarn: 1.22.17 - /usr/local/bin/yarn
  • npm: 8.1.2 - /usr/local/bin/npm

Docker version:

Client:
 Version:           20.10.9
 API version:       1.41
 Go version:        go1.17.1
 Git commit:        c2ea9bc90b
 Built:             Mon Oct  4 19:13:02 2021
 OS/Arch:           linux/amd64
 Context:           default
 Experimental:      true

Server:
 Engine:
  Version:          20.10.9
  API version:      1.41 (minimum version 1.12)
  Go version:       go1.17.1
  Git commit:       79ea9d3080
  Built:            Mon Oct  4 19:12:03 2021
  OS/Arch:          linux/amd64
  Experimental:     false
 containerd:
  Version:          v1.5.7
  GitCommit:        8686ededfc90076914c5238eb96c883ea093a8ba.m
 runc:
  Version:          1.0.2
  GitCommit:        v1.0.2-0-g52b36a2d
 docker-init:
  Version:          0.19.0
  GitCommit:        de40ad0

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.