Skip to content
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

Fundamental instructions missing from documentation #242

Open
fregante opened this issue Sep 23, 2020 · 6 comments
Open

Fundamental instructions missing from documentation #242

fregante opened this issue Sep 23, 2020 · 6 comments

Comments

@fregante
Copy link

On both the readme and the site, these are the instructions:

Getting Started

Install the BundleWatch package:

  • NPM: npm install bundlewatch --save-dev
  • Yarn: yarn add bundlewatch --dev

Add some basic configuration to your package.json

{
    "name": "my package name",
    "version": "0.0.1",
    "bundlewatch": {
        "files": [
            {
                "path": "myfolder/*.js",
                "maxSize": "100kB"
            }
        ]
    }
}

Usage:

  • NPM: npm run bundlewatch
  • Yarn: yarn run bundlewatch

This will give you command line output. If you want BundleWatch to report build status on your pull requests, see below.

Now run the last command:

❯ npm run bundlewatch
npm ERR! missing script: bundlewatch
@fregante
Copy link
Author

fregante commented Sep 23, 2020

Also on the "Using bundlewatch" page nowhere does it say how and where to make the GitHub App work.

I assume that this piece information is missing:

In your CI that runs in every PR, run npm run bundlewatch after your build. For example on GitHub Actions:

      - uses: actions/checkout@v2
      - run: npm ci
      - run: npm run build
      - run: npm run bundlewatch
        env:
          BUNDLEWATCH_GITHUB_TOKEN: 8fc08494d51041a393beb

@fregante
Copy link
Author

And also the fundamental information that the token is actually a secret and should not be public.

@fregante
Copy link
Author

And also that before the PR Action starts working, it needs to be pushed to the default branch, otherwise you get this when trying to add it in a PR:

[INFO] Retrieving comparison
Error:  Unable to fetch fileDetails for baseBranch=master from https://service.bundlewatch.io/store code=Request failed with status code 404
[INFO] master !== bundlewatch, no results saved
[INFO] bundlewatch is not a branch to track, no results saved

@einSelbst
Copy link

Thank you @fregante! I was about to give up on this but have it now working to some extend. There is also that https://github.com/jackyef/bundlewatch-gh-action but I couldn't get it to work.

@aqueiros
Copy link

aqueiros commented Nov 11, 2020

Also, this information is misleading

Setup CI Variables Needed by BundleWatch:
The most efficient way to get this running is to ensure that some environment variables are available for BundleWatch to find.

CI_REPO_OWNER github.com/facebook/react
CI_REPO_NAME github.com/facebook/react
CI_COMMIT_SHA
CI_BRANCH
If you're using, Travis, CircleCI, Wrecker or Drone these should all work out of the box.

I am using Travis and I have no such variables. Definitely none prefixed with "CI". Also not according to Travis:
https://docs.travis-ci.com/user/environment-variables/#default-environment-variables

UPDATE: I now see that internally it uses some library called ci-env which abstracts fetching these env vars from many different CI services. This should be better explained anyhow as it made me lose much time

@rogersd
Copy link

rogersd commented Aug 4, 2021

It would also be super nice if the format of the .json file provided to --config were documented.

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

No branches or pull requests

4 participants