npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

gitlab-compressed-size-action

v1.1.0

Published

A GitLab CI job that will post file-size changes on your pull-requests as comments

Downloads

198

Readme

gitlab-compressed-size-action

A GitLab CI job that will post file-size changes on your pull-requests as comments

Node CI codecov npm

This package was created to provide the same DX as the popular GitHub compressed-size-action when using GitLab. It's built on top of basic GitLab APIs and requires you to only provide a valid Access token with the scope api being set.

./.github/assets/example-report.png

Installation

npm i -D gitlab-compressed-size-action

Usage

First of all, create a GitLab Access token with the scope api, for demonstration purposes you can create one with your user account, in the long run it would make more sense to create a separate user account for this action.

In the project where you would like to integrate the action, simply add the token as a CI Environment variable in the project settings.

Once this is done, simply integrate the action in your .gitlab-ci.yml, e.g.

include:
  - remote: https://raw.githubusercontent.com/craft-interactive/gitlab-compressed-size-action/v1.1.0/.gitlab-ci.template.yml

report-file-size-changes:
  extends:
    - .report-file-size-changes
  # Adjust the `stage` and `needs` to your own requirements
  stage: build
  needs: [install_dependencies, build]
  variables:
    FILE_SIZE_CHANGE_PATTERN: "build/*"
    # IMPORTANT: Replace `MY_ACCESS_TOKEN_VARIABLE` with the name of your CI environment variable!
    FILE_SIZE_CHANGE_TOKEN: $MY_ACCESS_TOKEN_VARIABLE
    FILE_SIZE_CHANGE_OPTIONS: "--threshold 20mb"

Options

--auth <token>

The GitLab Access Token used to communicate with the API of your GitLab instance. If you use the gitlab-ci.template.yml as recommended above, you can specify the token as an environment variable, e.g. FILE_SIZE_CHANGE_TOKEN.

--out-file <file-path>

The file-path where the size report will be written to. If you use the gitlab-ci.template.yml as recommended above, this option can be safely ignored :-)

--reporters [reporter-ids...]

Optional list of reporters to execute after computing the results. Available reporters are ...

  • gitlab-pr-note (default)
  • stdout
--threshold [bytes]

An optional threshold which each file should respect, if reached the script will fail.

--threshold-overall [bytes]

An optional threshold for the sum of all files, if reached the script will fail.

--silent

In case you want to silence the log output, simply provide this option.

License

MIT