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

@intouchgroup/es2020-boilerplate

v0.14.0

Published

Build processes for ES2020 and SCSS with IE11 support

Downloads

5

Readme

@intouchgroup/es2020-boilerplate

🔮 Build processes for ES2020 and SCSS with IE11 support

Goals

    🌈 Excellent developer experience     🚀 Powerful advanced tooling     🏛 Standardized project architecture

Simplicity

Provides cutting edge build, bundle, and polyfill capabilities with zero configuration required by default.

// webpack.config.js
const { createWebpackConfig } = require('@intouchgroup/es2020-boilerplate');

module.exports = (env, argv) => createWebpackConfig({ argv });

Webpack will look in the src directory for scripts/index.js, styles/styles.scss, and index.html.

Flexibility

Generate multiple output files with ease. Tweak input and output directories, turn off polyfilling, and add Webpack plugins with minimal configuration.

// webpack.config.js
const { createWebpackConfig, pluginCopyFiles } = require('@intouchgroup/es2020-boilerplate');

module.exports = (env, argv) => createWebpackConfig({
    argv,
    entries: {
        // Output files will be named according to their key and input file extension

        // Generates main.js
        main: './scripts/index.js',

        // Generates styles.css
        styles: './styles/styles.scss',

        // Generates test/styles.css
        'test/styles': './styles/test/test.scss',

        // Generates advanced/bundle.js without polyfills
        'advanced/bundle': {
            file: './scripts/index.js',
            plugins: [
                pluginCopyFiles({ from: 'assets', to: 'assets' }),
            ],
            polyfill: false,
        },
    },
    nodeModulesToBabel: [
        'react-spring',
    ],
});

Elegance

Exposes functions that can be used as building blocks to compose more complex build processes. The zero configuration build process was built using these functions.

// webpack.config.js
import { defineEntry, defineOutput, commonSettings, devServerSettings, rulesForScripts, rulesForStyles, pluginLintStyles, pluginExtractStyles, pluginOptimizeStyles, pluginCopyFiles } from '@intouchgroup/es2020-boilerplate';

module.exports = {
    ...defineEntry(doPolyfill, entryFilename),
    ...defineOutput(jsOutputFilename),
    ...commonSettings(devMode),
    ...devServerSettings(devMode),

    module: {
        rules: [
            ...rulesForScripts(devMode, nodeModuleToBabel),
            ...rulesForStyles(devMode),
        ],
    },

    plugins: [
        pluginLintStyles(),
        pluginExtractStyles(cssOutputFilename),
        pluginOptimizeStyles(devMode),
        pluginCopyFiles({ from: 'index.html', to: 'index.html' }),
    ],
};

Getting Started

New Project

  1. Install the module globally: npm i -g @intouchgroup/es2020-boilerplate

  2. Bootstrap a new project: es2020-boilerplate my-new-project

Existing Project

  1. Install the module as a dev dependency: npm i -D @intouchgroup/es2020-boilerplate

  2. Generate configuration files: es2020-boilerplate

  3. Update webpack.config.js as necessary

API Reference

A valid Webpack configuration has three main parts: settings, module rules, and plugins.

Calling createWebpackConfig with an optional settings object will generate a fully valid Webpack configuration.

You may also choose to build your own Webpack configuration using the available building block functions.

All of the settings and module rules functions use the spread operator. The generateConfig function is a good example of building a valid config.

Utility:

createWebpackConfig - create cutting edge Webpack configs

generateConfig - built out of the other functions below, and called by createWebpackConfig to generate the config object

Settings:

Some settings are required by Webpack. These settings are included automatically when using createWebpackConfig. You can also use these settings to build your own Webpack config.

defineEntry - includes input file setting, required

defineOutput - includes output file setting, required

commonSettings - includes default general settings for Webpack, recommended

devServerSettings - includes default settings for Webpack Dev Server

Module Rules:

At least one set of rules is required for Webpack to process any file type. These rules are included automatically when using createWebpackConfig. You can also use these rules to build your own Webpack config.

rulesForScripts - includes default rules for processing JS with Webpack loaders

rulesForStyles - includes default rules for processing CSS with Webpack loaders

Plugins:

Plugins are all optional. The style plugins are included automatically when using createWebpackConfig. Plugins can be passed with individual entries when using createWebpackConfig. You can also use these plugins to build your own Webpack config.

pluginCopyFiles - copy files from the source directory to the output directory

pluginIgnoreOutput - ignores files that Webpack tries to output with the specifies names

pluginLintStyles - lints styles with stylelint, runs by default when using createWebpackConfig

pluginExtractStyles - process CSS in JS and enable HMR, runs by default when using createWebpackConfig

pluginOptimizeStyles - minimize CSS and update source maps, runs by default when using createWebpackConfig