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

nordnet-release-plugin

v1.0.0

Published

Nordnet release plugin

Downloads

19

Readme

nordnet-release-plugin

NPM version Build Status Coveralls Status Dependency Status

Nordnet release plugin - webpack plugin for building releases of Javascript applications

Purpose

The purpose of this plugin is to simplify continuous integration with Javascript components in legacy websites. By placing a single <script> tag in legacy web it will automatically load latest version of the Javascript component after successful deployment, without requiring any change in the original script tag.

Installation

Install plugin as dev dependency

npm install nordnet-release-plugin --save-dev

Basic usage

Include plugin in webpack config

var NordnetReleasePlugin = require('nordnet-release-plugin');

plugins.push(new NordnetReleasePlugin({
  publicPath: '/sc/project-name/cache/v1'
}));

See webpack docs for more information on how to use plugins with webpack.

Plugin generates one Javascript file per entry point defined in Webpack config. These js files can be included on the page via <script></script> tag. Once loaded on the page it will dynamically inject <script></script> tag with link to an actual required entry point (according to webpack and nordnet-release-plugin settings).

For example, add <script> tag on html page where you want to run your Javascript application

<script src="init/index.js"></script>

index.js might have the following content (depending on your nordnet-release-plugin and webpack configuration)

document.write('<script charset="UTF-8" src="/sc/project-name/cache/v1/index.js"></script>');

Once index.js is loaded it will inject <script> tag on the page to load application entry point.

Note: If you have multiple entry points, then nordnet-release-plugin will generate the same number of JavaScript files respectively, e.g. init/contacts.js and init/blog.js for following webpack configuration:

var entry = {
  contacts: ['./contacts-page.jsx'],
  blog: ['./blog-page.jsx'],
};

Configuration

You can pass a hash of configuration options to nordnet-release-plugin.

var NordnetReleasePlugin = require('nordnet-release-plugin');

plugins.push(new NordnetReleasePlugin({
  initDir: './dist/init',
  publicPath: '/sc/project-name/cache/v1',
  ignoreChunks: [ 'async' ],
  async: false,
}));

Options

initDir:

Location where generated base.js should be saved. Defaults to './dist/init'

publicPath:

Path that should be used when creating links to entry points (path where your application is deployed, e.g. '/sc/project-name/cache/v1'). Defaults to '/'

ignoreChunks:

Array with chunk names that should be ignored. Defaults to empty array. If your application has multiple entry points and for some reason you want to exclude some of them then pass entry point names (as configured in webpack) to ignoreChunks array.

var entryPoints = {
  index: [ './index.js' ],
  admin: [ './admin.js' ],
};

plugins.push(new NordnetReleasePlugin({
  ignoreChunks: [ 'admin' ],
}));

If you are using require.ensure() to create split points and want to make sure that all of them don't end up in .js for your entry point then consider using set up describe below.

Define a code split point using require.ensure and provide a chunk name, see require.ensure for more details

function admin() {
  require.ensure([], function(require) {
    var admin = require('./admin');
    admin();
  }, 'admin');
}

Set up nordnet-release-plugin to ignore async chunk when generating base.js

plugins.push(new NordnetReleasePlugin({
  ignoreChunks: [ 'admin' ],
}));

async:

true | false When set to true then scripts will be dynamically injected on the page instead of using document.write. Defaults to false.

License

MIT © Nordnet Bank AB