bazelbuild / rules_postcss

PostCSS rules for Bazel
Apache License 2.0
10 stars 13 forks source link

Prepare for npm publish, Upgrade rules_nodejs to 2.0.0 #42

Closed rzhw closed 3 years ago

rzhw commented 4 years ago

Publishing to npm addresses the version skew issue discussed internally at go/postcss-build-rules?disco=AAAADYbh_hE. This PR corresponds to #6, but let's not close that until we perform the publish.

Where publishing to npm is primarily useful is the usage of peerDependencies, such that downstream dependents are required/asked to avoid version skew of postcss as enforced by npm cli/yarn.

Also document installation of these build rules in the README - this partially addresses #34.

The plan is to publish this as version 0.5.0 (totally arbitrary version number - but it reflects progress made since initial publish), both on npm and GitHub such that http_archive can be used as well.

I've tested the npm package locally with the following steps:

  1. Run bazel build :npm_package, then go to another Bazel workspace with rules_nodejs set up
  2. Add "@bazel/postcss": "relative/path/to/rules_postcss/bazel-bin/npm_package", to package.json
  3. Call rules_postcss_dependencies from WORKSPACE
  4. Verify using postcss_binary etc. rules from @build_bazel_rules_postcss//:defs.bzl work as expected

If desired, I can put up my test repo (this may take time per go/releasing).

Here is the npm pack artifact created as a result of running bazel run :npm_package.pack: bazel-postcss-0.0.1.tgz.zip

rzhw commented 3 years ago

@alexeagle PTAL!

alexeagle commented 3 years ago

LGTM, we should have rules_nodejs 2.0 final on Monday or Tuesday.