newjersey / njwds

NJ Web Design Standards
https://newjersey.github.io/njwds/
MIT License
9 stars 2 forks source link

feat: enable npm packaging of njwds dist assets #16

Closed bodnarbm closed 2 years ago

bodnarbm commented 2 years ago

Summary

To remove the need to use napa targeting the gh-pages branch to distribute the njwds assets and to enable future publishing of this package to the npm registry (allowing for version based installs of the design system), we need to build and package the dist files created as part of the build process for others to pull in.

This change replaces the postinstall lifecycle script with a prepare lifecycle script, allowing for builds to happen when packaging this library and when installing here within this repo. This will not run the build when installing the package from npm in the future; instead it will rely on the builds that occurred as part of the npm publish process. Installs using git urls (either directly or when using github repo shortcuts) will work though, as those will invoke the prepare script and download the devDependencies are part of installation. (See the npm install <git remote url>: section of https://docs.npmjs.com/cli/v8/commands/npm-install).

Additionally, to prevent npm from resolving unnecessary additional packages, this moves all the current dependencies to devDependencies are they are only needed at build and deploy time, and not needed as part of using the npm package itself.

Test Plan

I created a branch of newjersey/d4ad that removes the napa dependency and instead installs this library using a github url.

namanaman commented 2 years ago

Awesome