Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

@userfrosting/browserify-dependencies

userfrosting168MIT4.0.1TypeScript support: included

Run browserify against all dependencies defined in package.json

readme

browserify-dependencies

Branch Status
master Continuous Integration codecov

Runs browserify against compatible dependencies in node_modules or whichever other folder you specify, outputting the results as UMD bundles in a specified location. Makes no attempt to patch node internals, Browserify options may however be provided for this purpose.

Install

npm i -D @userfrosting/browserify-dependencies

Usage

IMPORTANT
This is an ES module package targeting NodeJS ^12.17.0 || >=13.2.0, refer to the NodeJS ESM docs regarding how to correctly import. ESM loaders like @babel/loader or esm likely won't work as expected.

import { browserifyDependencies } from "@userfrosting/browserify-dependencies";

const options = {
    dependencies: [
        "foo",
        "bar"
    ],
    inputDir: "./node_modules",
    outputDir: "./browser_modules"
};

browserifyDependencies(options)
    .then(() => console.log("Done! ✨"))
    .catch(() => console.log("Things have not gone according to plan... 🔥"));

Process modules are wrapped with UMD to allow consumption by most environments, exports in the browser are available via window.[normalized-package-name].

API

API documentation is regenerated for every release using API Extractor and API Documenter. The results reside in docs/api.

Release process

Generally speaking, all releases should first traverse through alpha, beta, and rc (release candidate) to catch missed bugs and gather feedback as appropriate. Aside from this however, there are a few steps that MUST always be done.

  1. Make sure CHANGELOG.md is up to date.
  2. Update version via npm like npm version 3.0.0 or npm version patch.
  3. npm publish.
  4. Create release on GitHub from tag made by npm version.

License

MIT

changelog

Changelog

All notable changes to this project will be documented in this file.

The format is based on Keep a Changelog and this project adheres to Semantic Versioning.

[Unreleased]

[4.0.1] - 2022-03-16

[4.0.0] - 2021-02-09

Changed

  • Switched to native ESM, raising NodeJS requirements to 12.17.0 as a result.
  • Switched from default to named export for more predictable behavior around tooling interactions.
  • Updated browserify from 16.5.2 to 17.0.0.

[3.1.0] - 2020-04-18

Added

  • Option to silently ignore errors, effectively skipping dependencies which cannot be processed.

[3.0.0] - 2020-03-14

Fixed

  • Existing defect where browserified code provided no exports. They are now available on window based on a camel cased version of the package name.

Changed

  • ono to @jsdevtools/ono, and bumped version to 7.1
  • Results will no longer be within their own folder, and have a file name in the form [dependency-name]_browserified.js.

[2.0.0] - 2020-01-22

Fixed

  • Workaround for malformed package main values of type array (thanks @silvioq)

Changed

  • Raised minimum node version from 8 to 10.12
  • Updated ono (thrown errors may have a different type)

Removed

  • Deprecated concurrency option

[1.1.0] - 2019-07-14

Added

  • Expanded test coverage to account for failure scenario.

Fixed

  • Errors while running browserify against dependency not getting hoisted up, resulting in silent failures.

Changed

  • Deprecated concurrency option citing lack of a tangible benefit in its current from and potential for issues in Browserify which isn't built to be run alongside other concurrent instances.
  • Updated dependencies.

[1.0.1] - 2019-06-05

Fixed

  • Failure on successive runs due to attempting to delete a file using directory methods. Scenario now addressed in unit tests.

Security

  • Updated dev dependency ava to address vulnerabilities in indirect dependencies tar and js-yaml.

[1.0.0] - 2019-03-12

First stable release.

[1.0.0-rc.1] - 2019-03-12

Fixed

  • Possible failure in directory tree creation.

[1.0.0-beta.1] - 2019-01-09

Initial release