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

@wpackio/scripts

v6.4.0

Published

Main single dependency of @wpackio build tool.

Downloads

378

Readme

@wpackio/scripts

This is the main scripts package of wpack.io tool.

Please refer to the readme of this repo for usage instruction.

What is wpack.io?

Put simply, wpack.io is a nodejs based build tool to ease up using modern javascript in WordPress Themes and Plugins. It gives a fine Developer Experience (DX) and a single dependency for all your bundling requirement.

It is a fine-tuned webpack/browser-sync configuration made specifically for WordPress Theme and Plugin Development.

With the rise of Gutenberg editor, the usage of modern JavaScript and libraries like react is imminent. The goal of this tooling is to:

  • ✅ Provide out of the box compiling and bundling of all front-end assets.
  • ✅ Give best in class Developer Experience (DX).
    • Hot Module Replacement and Live Reload.
    • Compile files on save.
    • Work on any local development server.
  • ✅ Support modern and useful concepts like modules, tree-shaking, dynamic import etc.

and eliminate the pain points such as:

  • ❌ Boilerplate for setting up your project.
  • ❌ Doing a lot of configuration to setup webpack.
  • ❌ A lot of things to hook webpack with browsersync. We can not safely have webpack dev server because it doesn't reload for PHP files.
  • ❌ A lot of dependencies like babel, webpack loaders and what not.

What is supported out of the box

  • 👉 Have Create React App like developer experience for WordPress Plugin/Theme development.
  • 👉 Consume all the modern packages from npm registry.
  • 👉 Write javascript with modern ES2018 (ES6+) syntax and compile it down to ES5 (or in accordance to your .browserslistrc).
  • 👉 Automatically minify and bundle code with webpack.
  • 👉 Split large files automatically and have PHP library to wp_enqueue_script all generated parts.
  • 👉 Use SASS/SCSS language to create stylesheets.
  • 👉 Use postcss autoprefixer to automatically make your CSS work with needed vendor prefixes.
  • 👉 Implement all the above to your existing wamp, mamp, vvv (basically any) dev server.
  • 👉 Create production grade, super optimized and minified files with one command (hello CI).

Here are a few more bonus you get for using wpackio.

  • 😎 Using ES6 Modules you will never run into namespace collision.

    Remember when that third-party plugin was using that old version of foo library which caused your system to completely fail? No more!.

  • 😎 Zero configuration for a sane default of all the tooling involved (babel, sass, webpack).
  • 😎 Your CSS/SCSS changes will reflect instantly.
  • 😎 Typescript and Flowtype to take your js carrier to the next level. This tooling itself is written in typescript 😉.
  • 😎 All the stuff you need to start developing using react. Hello Gutenberg!

Getting Started

Everything is documented in our website.

TL;DR

  • Add @wpackio/scripts to a project by running this.
    npx @wpackio/cli
    and after that
    npm run bootstrap
  • Edit the wpackio.project.js file to write your javascript entry-points.
  • Use wpackio/enqueue from composer to consume the assets.
  • Start the server using npm start.
  • Create production file using npm run build.

How wpack.io solves the problems?

Behind the scene wpack.io uses webpack along with browsersync.

It doesn't concern itself with providing boilerplate or starter templates. It assumes that you (the awesome developer 👨‍💻 || 👩‍💻) is already doing that and what you want is a simple to configure, yet hackable to the core tooling for bundling all your frontend assets (js, css, images, svgs) in the most optimized way and make it work within your WordPress theme or plugin.

Keeping that in mind, wpack.io provides three dependencies for your projects:

  1. @wpackio/entrypoint - As main dependency of your package.json.
  2. @wpackio/scripts - As main dev dependency of your package.json.
  3. wpackio/enqueue - As main dependency of your composer.json.

The first handles all the tasks for building the assets and providing a damn good DX.

The second handles enqueuing the assets using WordPress' API (wp_enqueue_script and wp_enqueue_style).

Both the tools communicate with each other through the means of manifest.json file. The first tell the later which files to consume and the later publicPath to the first.

For more information do check the official documentation.

Development

This package has the same npm scripts as this monorepo. These should be run using lerna run <script>. More information can be found under CONTRIBUTION.md.

  • build: Use babel to build for nodejs 8.6+. Files inside src are compiled and put under lib. All type definitions are stripped and individual type declaration files are created.
  • prepare: Run build after yarn and before publish.
  • lint: Lint all files using eslint.
  • test: Run tests on files using jest.