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

@joinbox/build-task

v3.2.4

Published

Re-usable esbuild/swc and Sass based build tasks for Joinbox Drupal projects

Downloads

202

Readme

Intro

Build task for Joinbox' Drupal projects that provides command line actions running with reasonable defaults for JavaScripts and SASS.

Tasks include multiple options, the ability to emit notifications on success and source maps.

Installation

npm i -D @joinbox/build-task core-js regenerator-runtime

core-js and regenerator-runtime are required to inline the corresponding polyfills.

Commands

Styles

  • Converts SASS to CSS
  • Adds autoprefixes through postcss
  • Accepts globs for input files; use quotation marks around paths in this case
  • Supports compression
  • Generates source maps
  • Creates output directory if it doesn't exist
  • Displays notification on success
  • Watches files

Command

npx @joinbox/build-task styles -n -c -s src/scss -d dist/css -w "**/*.scss, other-path/*.scss" "**/*.scss"

Make sure to use quotation marks around paths if you use globs (in order for them to be resolved through JS instead of CLI)

Options

To see all available options, call the styles build task with the help option (-h or --help):

npx @joinbox/build-task styles -h

Scripts

Command

npx @joinbox/build-task scripts -m -t es5 -e "ie 11" -s src/js -d dist/js -w "**/*.js, other-path/*.js" "**/*.js"

Make sure to use quotation marks around paths if you use globs (in order for them to be resolved through JS instead of CLI)

Options

To see all available options, call the scripts build task with the help option (-h or --help):

npx @joinbox/build-task scripts -h

Complete Build Task for Projects

Use the following setup for Drupal projects:

  1. Install all additional modules: npm i -D chokidar-cli npm-run-all @babel/eslint-parser @joinbox/eslint-config-joinbox eslint @joinbox/stylelint-config-joinbox stylelint svgo

  2. Add the following scripts property to your package.json:

    "scripts": {
        "dev:styles": "npm run lint:styles ; npx @joinbox/build-task styles -n -s src/scss -d dist/css -w \"src/scss/**/*.scss, template-library/**/*.scss\" main.scss",
        "live:styles": "npx @joinbox/build-task styles -n -c -s src/scss -d dist/css main.scss",
        "dev:scripts": "npm run lint:scripts ; npx @joinbox/build-task scripts -n -s src/js -d dist/js -w \"src/js/**/*.js, template-library/**/*.js\" main.js",
        "live:scripts": "npx @joinbox/build-task scripts -n -m -s src/js -d dist/js main.js",
        "copy:fonts": "mkdir -p dist/webfonts && cp -r src/webfonts dist",
        "watch:fonts": "npx chokidar \"src/webfonts/**/*.*\" -c \"npm run copy:fonts\"",
        "copy:media": "mkdir -p dist/media && rsync -rq src/media dist/media --exclude=\"*.svg\" && svgo -f src/media -o dist/media -r -q",
        "watch:media": "npx chokidar \"src/media/**/*.*\" -c \"npm run copy:media\"",
        "clean": "(rm -r dist || true)",
        "lint:styles": "npx stylelint \"src/**/*.scss\" \"template-library/**/*.scss\" --config .stylelintrc",
        "lint:scripts": "npx eslint \"src/**/*.js\" \"template-library/**/*.js\" -c node_modules/@joinbox/eslint-config-joinbox/index.js",
        "dev": "npm-run-all clean -p copy:* dev:* watch:*",
        "live": "npm-run-all clean -s copy:* live:*"
    }

    Use -s option for live script because -p brings down Cyon servers.

  3. Create a new file named .eslintrc in yout theme folder and add the following rules:

    {
       "extends": "@joinbox/joinbox",
       "root": true,
       "parser": "@babel/eslint-parser"
    }
  4. Create a new file named svgo.config.js in your theme folder and add the following rules:

    module.exports = {
       plugins: [
           {
               name: 'preset-default',
               params: {
                   overrides: {
                       removeViewBox: false,
                   },
               },
           },
           'removeDimensions'
       ]
     };

Update from Earlier Versions

If you update from earlier versions, make sure to

  • remove all unnecessary NPM packages from package.json (especially @babel/core, browser-sync, gulp, postcss)
  • remove unnecessary scripts from package.json
  • remove gulpfile.js
  • update @joinbox/build-task to newest version and follow this README's instructions