Nifty Poutine Meal

    @modus/gimbal
    TypeScript icon, indicating that this package has built-in type declarations

    1.2.6 • Public • Published
          ___                       ___                         ___
         /\__\                     /\  \         _____         /\  \
        /:/ _/_       ___         |::\  \       /::\  \       /::\  \
       /:/ /\  \     /\__\        |:|:\  \     /:/\:\  \     /:/\:\  \
      /:/ /::\  \   /:/__/      __|:|\:\  \   /:/ /::\__\   /:/ /::\  \   ___     ___
     /:/__\/\:\__\ /::\  \     /::::|_\:\__\ /:/_/:/\:|__| /:/_/:/\:\__\ /\  \   /\__\
     \:\  \ /:/  / \/\:\  \__  \:\~~\  \/__/ \:\/:/ /:/  / \:\/:/  \/__/ \:\  \ /:/  /
      \:\  /:/  /     \:\/\__\  \:\  \        \::/_/:/  /   \::/__/       \:\  /:/  /
       \:\/:/  /       \::/  /   \:\  \        \:\/:/  /     \:\  \        \:\/:/  /
        \::/  /        /:/  /     \:\__\        \::/  /       \:\__\        \::/  /
         \/__/         \/__/       \/__/         \/__/         \/__/         \/__/
    
      _                 __  __               _                    ____                         _
     | |__    _   _    |  \/  |   ___     __| |  _   _   ___     / ___|  _ __    ___    __ _  | |_    ___
     | '_ \  | | | |   | |\/| |  / _ \   / _` | | | | | / __|   | |     | '__|  / _ \  / _` | | __|  / _ \
     | |_) | | |_| |   | |  | | | (_) | | (_| | | |_| | \__ \   | |___  | |    |  __/ | (_| | | |_  |  __/
     |_.__/   \__, |   |_|  |_|  \___/   \__,_|  \__,_| |___/    \____| |_|     \___|  \__,_|  \__|  \___|
              |___/
    

    npm (scoped) npm CircleCI PRs Welcome MIT Licensed Powered by Modus_Create

    Gimbal - Web Performance Budgeting Automation

    Installation | Documentation | Contributing | Code of Conduct | Twitter

    Gimbal uses industry-standard audits to analyze application performance. Continuously track performance to ensure your apps are within acceptable performance budgets.

    Gimbal ❤️ CIs like Circle CI and Travis CI.

    Audits

    • Lighthouse
    • File sizes
    • Directory sizes
    • Heap memory
    • CSS and JS coverage

    Getting Started

    You can install Gimbal globally using npm or yarn:

    # with npm
    npm install --global @modus/gimbal
    
    # or with yarn
    yarn add global @modus/gimbal
    
    gimbal --help

    Now the gimbal is executable throughout your system for any projects you want to audit.

    You can also install it to a specific project as a development dependency.

    # with npm
    npm install --save-dev @modus/gimbal
    
    # or with yarn
    yarn add --dev @modus/gimbal

    You can execute it via a npm script: (package.json):

    {
      "scripts": {
        "audit": "gimbal audit"
      }
    }
    # with npm
    npm run audit
    
    # or with yarn
    yarn audit

    Usage Examples

    • ⚛️ Create React App: gimbal audit
    • 🎩 Gatsby: gimbal audit --build-dir ./public

    Prerequisites

    • You should be using Create React App
    • Make sure you've built the app (npm run build or yarn build)
    • build/ directory is assumed

    Sample Output

    Expand audits below for more detail.

    Size Checks (2 failures)

    Label Value Threshold Success
    .../build/precache-manifest.380adf610922866d450d1a7155a60b54.js 646 B 5 B x
    .../build/static/js/2.b41502e9.chunk.js 115.99 KB 50 KB x
    .../build/static/js/main.28647029.chunk.js 1.09 KB 50 KB
    .../build/static/js/runtime~main.a8a9905a.js 1.47 KB 30 KB
    .../build 479.43 KB 500 KB
    Lighthouse Audits (0 failures)

    Label Value Threshold Success
    Performance 99 95
    Accessibility 79 75
    Best Practices 100 95
    SEO 90 90
    Progressive Web App 58 50
    Unused Source Checks (3 failures)

    Label Value Threshold Success
    http://localhost:3000 41.77% 30% x
    ...static/css/main.584f321a.chunk.css 34.36% 30% x
    http://localhost:3000/ 25.40% 30%
    ...static/js/2.b41502e9.chunk.js 42.40% 30% x
    ...static/js/main.28647029.chunk.js 2.59% 30%
    Heap Snapshot Checks (0 failures)

    Label Value Threshold Success
    Documents 5
    Frames 2
    JSHeapTotalSize 4472832
    JSHeapUsedSize 3399040
    LayoutCount 3 5
    Nodes 55
    RecalcStyleCount 3

    Programmatic Usage

    You can use Gimbal from other node scripts as an external module. Note that configuration file will be automatically parsed.

    const { audit } = require('@modus/gimbal');
    
    async function customAudits() {
      const response = await audit({
        cwd: process.cwd(),
        buildDir: './public',
        comment: true,
        verbose: false,
        checkThresholds: true,
      });
    
      return response;
    }

    Configuration

    Gimbal supports configuration files in JavaScript, JSON and YAML formats. This configuration file will let Gimbal know what to execute, you can modify configurations for modules, and output reports in different formats (HTML, JSON, and Markdown). Just place a .gimbalrc.yml (or .gimbalrc.js or .gimbalrc.json) in the root of your project where you will execute Gimbal. An example configuration file would look like:

    configs:
      puppeteer:
        headless: false
    
    outputs:
      html: ./artifacts/gimbal.html
      json: ./artifacts/gimbal.json
      markdown: ./artifacts/gimbal.md

    More about configurations can be found on the individual documentation pages of each commands and modules.

    We recommend going through the entire 📖documentation section.

    Thresholds

    The main purpose of Gimbal is to run audits against an application. Each audit has it's own threshold or set of thresholds. Gimbal also comes configured by default to allow a create-react-app to pass. If you were to start with a React application created from CRA, you will need to adjust the thresholds as your application will inevitably grow in size. Each module can have it's thresholds configured via the configuration file. For example, the size module's thresholds are configured via an array of objects:

    configs:
      lighthouse:
        outputHtml: artifacts/lighthouse.html
        threshold:
          accessibility: 93
          'best-practices': 90
          performance: 50
          pwa: 75
          seo: 100
      heap-snapshot:
        threshold:
          Documents: 5
          Frames: 2
          JSHeapTotalSize: 23356000
          JSHeapUsedSize: 15068000
          Nodes: 800
          RecalcStyleCount: 9
      size:
        - path: ./build/precache-*.js
          maxSize: 500 B
        - path: ./build/static/js/*.chunk.js
          maxSize: 1 MB
        - path: ./build/static/js/runtime*.js
          maxSize: 10 KB
        - path: ./build/vendor.*.js
          maxSize: 250 KB
        - path: ./build/!(vendor).*.js
          maxSize: 200 KB
        - path: ./build/
          maxSize: 18 MB
      unused-source:
        threshold: 0%
      outputs:
        html: artifacts/results.html
        json: artifacts/results.json
        markdown: artifacts/results.md
      jobs:
        - audit

    More about configuring thresholds can be found on the individual documentation pages of each commands and modules.

    Available Plugins

    There are some plugins that are available that increase Gimbal's functionality:

    Continous Integration

    Feel free to use our sample configuration files for major CI systems.

    System Requirements

    Gimbal runs on any OS with Node.js (10.0.0+).

    Gimbal is built to support Cloud and CI environments. It can audit 1000 pages in under 10 seconds on AWS Lambda.

    Questions and Support

    If you have a problem running Gimbal, please submit an issue. The more information you give us the faster we can get back with a good answer.

    Modus Create

    Modus Create is a digital product consultancy. We use a distributed team of the best talent in the world to offer a full suite of digital product design-build services; ranging from consumer facing apps, to digital migration, to agile development training, and business transformation.

    Modus Create

    This project is part of Modus Labs.

    Modus Labs

    Licensing

    This project is MIT licensed.

    Install

    npm i @modus/gimbal

    DownloadsWeekly Downloads

    3

    Version

    1.2.6

    License

    MIT

    Unpacked Size

    266 kB

    Total Files

    124

    Last publish

    Collaborators

    • grgur
    • michaeltintiuc
    • mitchellsimoens-user