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

@borngroup/born-build

v2.1.0

Published

Build tool for storefronts

Downloads

541

Readme

#BORN build process with Revolver

There are different scenarios covered by Revolver when working on a project with single or multiple store configurations. Revolver adapts to your setup depending on the parameters passed and which files are available.

##Multiple stores configurations with either a main or independent store cartridge(s):

Let’s say you have multiple stores and each has its own styles and own set of JS. To build the default store, all you need to run is:

npm run [task]

To build a specific store or cartridge, run:

npm run [task] --env.cartridge=cartridge_name

Note: replace “[task]” with the task you want to run, such as build or watch.

Now let's say you need your "main_cartridge" to leverage almost all of the JS functionality from your "base_cartridge". However, you'd like to modify a few files in your "main_cartridge" without having to copy all of the source code from "base_cartridge". You can achieve this by setting the revolverPath property on your package.json to follow the priority you need:

"scripts":  {
    [...]
},
"config":  {
    "cartridge": “main_cartridge”,
    "js": {
        "revolverPath": "main_cartridge, base_cartridge"
    }
}

Then simply run:

npm run [task]

This also works if you need to build a specific cartridge. Your revolverPath needs to include the extra cartridge:

"revolverPath": "cartridge_name, main_cartridge, base_cartridge"

And then you can run:

npm run [task] --env.cartridge=cartridge_name

You can override the resolverPath value at run time by passing it as a parameter:

npm run [task] --env.revolverPath=third_cartridge,fourth_cartridge

You can run parallel builds by specifying a list of cartridges on the cartridge variable:

npm run [task] --env.cartridge=main_cartridge,second_cartridge,third_cartridge

Note: When running a command, use commas and no spaces between cartridge names. This is a limitation with Node.

Each cartridge must have at least one app.js file (inside the js/ or js/born/ directories, or both). Otherwise it means this cartridge is not meant to host built files, so the build will dump the files into the cartridge specified in config.cartridge instead.

##Single store with single or multiple locales:

Create a style.scss file inside the respective locale. If you have more than one locale, @import all the partials you need from the default or specific locale, then just replace those that are different for your current locale.

Run:

npm run [task]

This assumes you've setup a default cartridge and an optional set of styles.inputPath and styles.outputPath (defaults to "cartridges/{cartridge}/cartridge/scss/**/*.scss" and "cartridges/{cartridge}/cartridge/static/{subDirectory}/css/{outputFile}.css" respectively) on your package.json

"scripts":  {
    [...]
},
"config":  {
    "cartridge": “your_main_cartridge”,
    "styles": {
      "inputPath": "cartridges/{cartridge}/cartridge/scss/**/*.scss",
      "outputPath": "cartridges/{cartridge}/cartridge/static/{subDirectory}/css/{outputFile}.css"
    }
},
"devDependencies": {
    [...]
}

###Styles object: |Property|Description| |--|--| |inputPath|(optional) is the input path to your .scss files. The string uses a combination of interpolation and glob's magic patterns to determine the exact file that needs to be parsed. This property accepts a dynamic value for the {cartridge}.|
|outputPath|(optional) is the output path of your built .css files. The string works similar to styles.inputPath, but in addition to having a {cartridge} dynamic value, you can also format your string using the {subDirectory} and {outputFile} values.|

###Styles object dynamic values: |Value|Description| |--|--| |{cartridge}|It's value gets replaced with the cartridge name being processed during build time. For example, if you pass --env.cartridge=your_main_cartridge,your_second_cartridge, then the value of {cartridge} will become each of the specified cartridges| |{subDirectory}|It's value will be equal to the sub-directory found by the build when expanding the glob pattern in the styles.inputPath, if any. For example, say your inputPath is "cartridges/{cartridge}/cartridge/scss/**/*.scss", which then becomes "cartridges/your_main_cartridge/cartridge/scss/en_US/main-styles.scss". In this example, the value of {subDirectory} will be "en_US". Note: Because CSS url references are relative to the file's location, built .css files will be placed in the specified output directory and will not carry their input sub-directory structure, other than the base {subDirectory}.| |{outputFile}|It's value will be equal to the file name found by the build when expanding the glob pattern in the styles.inputPath, if any. For example, say your inputPath is "cartridges/{cartridge}/cartridge/scss/**/*.scss", which then becomes "cartridges/your_main_cartridge/cartridge/scss/en_US/main-styles.scss". In this example, the value of {subDirectory} will be "main-styles".|