Socket
Book a DemoInstallSign in
Socket

browser-module-env

Package Overview
Dependencies
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

browser-module-env

Recycled environment & assets for making browser modules.

latest
Source
npmnpm
Version
0.1.3
Version published
Maintainers
1
Created
Source

browser-module-env

Recycled environment & assets for making browser modules.

Install

npm install --save-dev browser-module-env

Usage

After installing:

  • Create a flyfile.js in your root directory with the following:
process.env.OUTNAME = 'MyModule'; // module's name
process.env.OUTFILE = 'my-module.js'; // built file name
module.exports = require('browser-module-env/flyfile.js');

This will expose this module's pre-configured command scripts.

  • Connect this module's commands to your package.json file within "scripts":
"scripts": {
  "setup": "fly setup",
  "build": "fly build",
  "docs": "fly docs",
  "release": "fly release",
  "start": "fly release serve",
  "watch": "fly watch"
}

This will let you execute commands with npm.

For example, npm run watch.

  • Configure Fly so that it loads this environment. Add this to your package.json file:
"fly": {
  "pkg": "node_modules/browser-module-env"
}
  • Copy static assets to your docs directory.
npm run setup

If this works, you're ready to roll! :tada:

Commands

Each command takes the form: npm run {command}.

setup

Copies static demo assets (bg.jpg, chart.css, demo.css, demo.js) to your docs directory.

build

Builds the UMD module. Output is sent to build.

docs

Creates a browserify bundle, using docs/app.js as its entry file. Output is sent to docs/bundle.js.

release

Runs build and docs then minifies build/*.js and docs/bundle.js using Uglify JS.

Note: Your minified module will be saved with a .min.js extension in the build directory.

serve

Starts a local server on port 3000 using BrowserSync.

watch

Runs serve but will auto-compile & auto-reload the server after any file changes within docs directory.

License

MIT © Luke Edwards

FAQs

Package last updated on 15 Nov 2016

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts