0.0.2 • Published 4 years ago

@toptal/front-lock-guard v0.0.2

Weekly downloads
36
License
MIT
Repository
github
Last release
4 years ago

Front lock guard

This plugin locks bundle sizes and used packages in project to properly require approval on PR.

env

FORCE

  • Type: Boolean
  • Default: false

Whether to generate new file regardless of skipped deltas or skipped pacakages.

LOCK

  • Type: Boolean
  • Default: false

If sizes should be only checked or locked to the lock file.

DRY_RUN

  • Type: Boolean
  • Default: false

DRY_RUN=1 will check only for changed packages in this way it's easy to run it with lint as it doesn't try to build bundles and it is really fast.

options

options.fileName

  • Type: String
  • Default: front-guard.lock.yml

Output file where stats are written.

options.entryFilter

  • Type: RegExp | Function
  • Default: RegExp(/^.*$/)

Logic which entry points should be checked for stats.

options.chunkFilter

  • Type: RegExp | Function
  • Default: RegExp(/^.*$/)

Usually entries include also .map or .css chunks in bundle, so to be able to filter only .js chunks you can use new RegExp(/^.*\.js$/)

options.bloatDetect

  • Type: Function -> boolean
  • Call Params: bloatDetect(newSize, oldSize)
  • Default: 5% absolute && 5% relative increase

Callback which will decide if size is considered as bloating

 bloatDetect: (oldSize, newSize) => {
      const relative = Math.ceil(((newSize / oldSize) - 1) * 100)
      const absolute = newSize - oldSize
      return relative >= 5 && absolute >= 5
    }

options.packageWhitelist

  • Type: Array
  • Default: []

Packages which are treated as whitelisted. For those package there will be no hash changed in lock files even if they were updated. Used for internal packages or features bundled as separate packages.

options.reportingLevel

  • Type: String
  • Default value: 'error'

The level of reporting problems, like bundle bloating or dependency hash mismatch.

Possible values: 'error','warning'

  • 'error' level will stop the process with a non-zero exit code on the first spotted problem.
  • 'warning' level will just print the error message to the console
0.0.2

4 years ago

0.0.1

4 years ago