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

born-build-n18

v1.0.6

Published

Born tool for builds that run on node 18

Downloads

11

Readme

Build Options & Settings

The build is setup in the main config property of your package.json file. The following example showcases the minimum configurations needed, all other options are optional:

//Not using Revolver:
"config": {
    "rootFiles": true,
    "cartridge": "app_accelerator_core",
    "js": {
	    "inputPath": "cartridges/{cartridge}/cartridge/client/default/js"
    },
    "styles": {
	    "inputPath": "cartridges/{cartridge}/cartridge/client/**/*.scss",
	    "aliasDirName": "scss"
    }
}

//Using Revolver:
"config": {
    "rootFiles": true,
    "revolverPath": "plugin_instorepickup, plugin_giftcertificate, app_accelerator_core::core, app_storefront_base::base",
    "buildDisable": "app_storefront_base",
    "js": {
	    "inputPath": "cartridges/{cartridge}/cartridge/client/default/js"
    },
    "styles": {
	    "inputPath": "cartridges/{cartridge}/cartridge/client/**/*.scss",
	    "aliasDirName": "scss"
    }
}

The js and the styles properties shown above accept any of the available Build API options. Use these to make configurations specifically for either JS or Style builds without affecting each other.

Build API

There are several options available for you to control how the build behaves.

|||| |--- |--- |--- | |Property Name|Type|Description| |rootFiles|Boolean|Default: true. Used for the JS build. Whether or not to parse and automatically build any JS files found at the root directory of the input path. This is necessary since SFRA expects files in that location to be built and placed into the equivalent /static directory.| |revolverPath|String|Default: plugin_instorepickup, plugin_giftcertificate, app_accelerator_core::core, app_storefront_base::base. Specify one or more cartridges to use as a priority access and fallback system. Learn more about it in the "Understanding the revolverPath" section of this page.| |buildDisable|String|Default: app_storefront_base. Specify one or more cartridge names you wish to skip the build on. This is important if you want to keep cartridges available for access from other cartridges, however you do not want to build those cartridges directly for one reason or the other.| |inputPath|String|Default (JS): cartridges/{cartridge}/cartridge/client/default/js Default (Styles): cartridges/{cartridge}/cartridge/client/**/*.scss. Specify where your JS and CSS files are located. Usually both JS and CSS have different input paths, it is possible set separate configurations within the individual js and styles properties of the config object.| |outputPath|String|Default (JS): cartridges/{cartridge}/cartridge/static/default/js Default (Styles): cartridges/{cartridge}/cartridge/static Specify where you want your files to be compiled to after they’re finished building. Usually both JS and CSS have different output paths, it is possible to set separate configurations within the individual js and styles properties of the config object in your package.json file.| |mainFiles|String|Default: main.js.Specify one or more files to attach to your main entry object for Webpack. This option is largely unnecessary if you’re setting rootFiles:true.| |mainEntryName|String|Default: main.Give a name to your main entry object for Webpack. This option is largely unnecessary if you’re setting rootFiles:true.| |mainDirName|String|Default: client. Set the name of the directory that contains the general “client-side files”, i.e. “js”, “scss”, and the locales.| |aliasDirName|String|Default: scss.Used for the Styles build only.Since Styles input paths can be more complex due to locale and subdirectory configurations, this property specified which is the “last directory before SCSS root”.| |keepOriginalLocation|Boolean|Default: false. Used for the Styles build only. SFRA is not sensitive about including static assets using relative paths within CSS (i.e. url(../path/to/file.png)). When this options is set to false the build process flattens the CSS file tree structure so that relative paths can be used reliably.| |useLocales|Boolean|Default: true. The build process can be used outside of SFRA. This flags allows working with file structures where there are no expected locale subdirectories.| |defaultLocale|String|Default: default. Specify the main locale for your site. Usually this does not need to be changed.| |includePaths|String|Used for the Styles build only. Specify one or more additional paths to add to SCSS' includePaths setting.| |clean|Boolean|Default: false. Deletes JS and CSS files found within the /static or output directories before starting a build.| |js|Object|It is possible to use any of the properties described in this API within this object. This allows to set options specifically for the JS build so that it doesn’t affect the Styles build. For example, you may want to have separate inputPaths, or possibly even different revolverPaths entirely for your JS vs your Styles build. "js": { "inputPath": "cartridges/{cartridge}/cartridge/client/default/js"}| |styles|Object|It is possible to use any of the properties described in this API within this object. This allows to set options specifically for the Styles build so that it doesn’t affect the JS build.For example, you may want to have separate inputPaths, or possibly even different revolverPaths entirely for your Styles vs your JS build. "styles": { "inputPath": "cartridges/{cartridge}/cartridge/client/**/*.scss", "aliasDirName": "scss"}|

Understanding the revolverPath

revolverPath provides an easy way to list your cartridges in the order in which they should inherit from each other. It also makes it so that it is possible to access files from one cartridge or the other using a simple syntax. If you’re familiar with SFCC’s Cartridge Path, then good news! This works exactly the same way.

Given a revolverPath of the following structure:

plugin_instorepickup, plugin_giftcertificate, app_accelerator_core, app_storefront_base

We can interpret it the following way:

  • The further to the left a cartridge appears in the path, the higher up in the chain they are.
  • Conversely, the further to the right a cartridge is, the lower down the chain they are.

Put differently, you can also look at the revolverPath as if they were stacking or overlaying each other:

  1. plugin_instorepickup
  2. plugin_giftcertificate
  3. app_accelerator_core::core
  4. app_storefront_base::base

This distinction is very important, because the order in which the cartridges are listed matters for both Relative and Super imports.

Note: Always remember to organize your revolverPath in the order you want your cartridges to overlay each other.