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

webpack-war-plugin

v1.0.0-beta.3

Published

Webpack plugin for bundling build outputs into a WAR archive

Downloads

1,192

Readme

Webpack WAR plugin

Build Status Coverage Status Gitter

This is a Webpack plugin which simplifies and automates the creation of a Web Application Archive (WAR) from your Webpack build outputs and other project files. This can be useful if you want to deploy your static / Single Page Web App or your applications web frontend to a Java (EE) Application server.

Installation

You can install the plugin via yarn

yarn add --dev webpack-war-plugin

or via npm

npm install --dev webpack-war-plugin

Usage

Basic Usage

To add the webpack-war-plugin to your build just add an instance of WebpackWarPlugin to the plugins section of your Webpack configuration

const { WebpackWarPlugin } = require('webpack-war-plugin');

module.exports = {
  ...,
  plugins: [
    new WebpackWarPlugin(),
    ...
  ],
  ...
};

By default an archive containing all emitted Webpack build outputs is generated in the output directory of your Webpack build. It is named like your project.

Configuration

You can influence the generated archive by supplying a configuration object of the following structure to the plugins constructor:

type WebpackWarPluginOptions = {
    archiveName?: string;
    webInf?: string;
    additionalElements?: {
        path: string;
        destPath?: string;
    }[];
};

| Option | Effect | | --- | --- | | archiveName [optional] | Sets the output name of the archive | | webInf [optional] | Specifies a path to a directory (or file) which will be included into the archive with the path WEB-INF | | additionalElements [optional] | Specifies multiple files or directories, which will be included in the archive. Each entry is a object with the following properties: path (The path of the source element), destPath ([optional] The path of the specified file / directory inside of the archive [by default path is used]) |

Example

The following plugin configuration:

const { WebpackWarPlugin } = require('webpack-war-plugin');

module.exports = {
  entry: {
    file1: './src/file1.js'
  },
  ...,
  plugins: [
    new WebpackWarPlugin({
      archiveName: 'archive',
      webInf: './web-inf',
      additionalElemens: [
        { path: 'context/context.xml', destPath: 'META-INF/context.xml'},
        { path: 'package.json' },
        { path: 'images', destPath: 'assets/images' }
      ]
    }),
    ...
  ],
  ...
};

generates an archive with the name archive.war in the Webpack output directory with the following structure:

archive.war
|
|\_ file1.js
|
|\_ WEB-INF
|          \_ web.xml
|
|\_ META-INF
|           \_ context.xml
|
|\_ package.json
|
 \_ assets
          \_ images
                   \_ img.png

Development

Typescript

The plugin is built with Typescript and the resulting package contains the corresponding typings.

Building

After checking out the project you can build transpile the Typescript via

yarn run build

The build output is stored in dist.

Testing

Unit tests

Unit tests are named [tested-component].spec.ts. They can be run via Mocha with

yarn run test

Test coverage is measured via nyc and can be triggered with

yarn run test:coverage

Functional tests

Functional test fixtures are located in functional_tests. To set up all fixtures run

yarn run test:functional:setup

To execute the tests via Mocha run

yarn run test:functional

Continuous integration

Continious integration is realized via Travis-CI. Coverage reports are shown on Coveralls. Deployments to NPM are automatically triggered via Git tags.

Licensing

The app is distributed under the MIT License (read LICENSE for more information). Copyright (c) 2017 Leo Lindhorst

Collaborating

I really appreciate any kind of collaboration! You can use the GitHub issue tracker for bugs and feature requests or create a pull request to submit changes. If you don't want to use these possibilities, you can also write me an email to [email protected].

Contact

If you have any questions, ideas, etc. feel free to contact me: DevWurm Email: [email protected] Jabber: [email protected] Twitter: @DevWurm