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

@pegakit/build-tools

v1.0.3

Published

A collection of front-end build tools + pre-packaged local front-end dev environment.

Downloads

21

Readme

PegaKit dependencies Status

PegaKit Build Tools

A collection of helpful front-end gulp tasks and build processes. Originally inspired by the awesome fourkitchens/fourk-gulp project.

How to use it

  • npm i --save-dev pega-digital/pegakit-build-tools
    • This will install the master branch. Please add #tag/branchname at the end if you need a certain branch/tag.
  • Add the following to your project's gulp file (ex. gulpfile.babel.js) in the root of your project. This will pass gulp and any local configuration overrides along to the newly installed build tasks.
const gulp = require('gulp-help')(require('gulp'));
const _ = require('lodash');
let localConfig = {},
    webpackConfig = {};

// Attempt to load an optional local configuration file.
try {
  localConfig = require('./local.gulp-config');
}
catch (e) {}

// Attempt to load an optional local configuration file.
try {
  webpackConfig = require('./local.webpack.config.js');
}
catch (e) {}

// Load all gulp tasks.
require('pegakit-build-tools')(gulp, localConfig, webpackConfig);
  • You'll now be able to execute any task in this repo. Run gulp help for more info on these tasks.

Default Webpack configuration

The default Webpack configuration bundled has a few assumptions that can be easily overwritten and customized by adding a local.webpack.config.js file to the root of your project.

Here's a few default settings currently set:

  1. Default Source Path: Any custom source code (that is, any JavaScript that isn't automatically installed via npm and required into your project) lives inside the source/scripts folder. In Webpack 1.x, this is configued by the context setting in your webpack.config.js file.
context: __dirname + "/../../source/scripts",
  1. Default Entry File: There's at least one JS entry file in your project. By default, we assume the main JS entry point file is called app.js and lives in the root of your scripts folder (ex. /source/scripts/app.js). Additional entry files (say, for separate bundles handling Critical JS vs Non-Critical JS) can be set in Webpack 1.x in the entry section of your local.webpack.config.js file:

Let's say we wanted to have 2 main JavaScript bundles: our main app.js bundle that includes any standalone JS modules we've created and a completely separate JS bundle for handling any critical logic that we want to inline on the page, critical.js:

entry: {
  app: './app.js',
  critical: './critical.js'
},
  1. Default Output Path Any JavaScript entry points specified are individually bundled and moved to the public/scripts folder, tacking on .built.js to the end of the file name. For example, our /source/scripts/app.js file will compile to /public/scripts/app.built.js.

In Webpack 1.x, this can be updated in the output section of our local.webpack.config.js file:

output: {
  path: path.resolve('public'),
  publicPath: '/scripts/',
  filename: '[name].built.js',
  chunkFilename: '[chunkhash].bundle.js'
},

Roadmap

  • @TODO: Add in ESLint default config + JS validation options
  • @TODO: Lint existing default configs + Gulp tasks
  • @TODO: Merge Webpack config with local Gulp config options.
  • @TODO: Refactor gulp tasks to actually USE the local config options. The Webpack configuration / overrides work however everything else is still hard-coded in the individual build tasks themselves.
  • @TODO: Document an example of adding additional build tasks to the default set of pre-defined tasks.
  • @TODO: Work through ways of auto-generating the initial gulpfile + config. Possibly via Yeoman...
  • @TODO: Document Webpack config + available options
  • @TODO: Document high-level summary of currently available gulp tasks (ex. what you get by running gulp help)