Redo the build process to address path and reference generation issues.

Review Request #13942 — Created June 5, 2024 and submitted — Latest diff uploaded

Information

Ink
master

Reviewers

The resulting Ink builds had bad image paths that were breaking any
post-processing, consumption or the build, and references to the images.
We have a couple images that we normally try to inline into the CSS, but
due to path issues in the build setup, we'd end up instead generating
CSS that referenced relative paths.

There were a couple things going wrong here:

  1. We had an @images-path variable in LessCSS that was used to link to
    the Ink images, but this could conflict with consumers and was
    referencing an ink directory that wasn't going to consistently
    exist in the build process between local builds and remote
    consumption.

  2. We were generating bad sourcemaps due to what appears to be issues in
    cleancss, depending on where it's run.

  3. We had some build configuration missing that impacted lookup of
    Spina from the global object.

This change redoes a lot of our build process to address this. We're now
using Rollup for all builds, rather than scripts within package.json.

We build the CSS at the same time we build our TypeScript types file. We
have to key off rules based on some JavaScript file, so we choose that,
since it only produces one output, ensuring we only do this work once.

The order of operations is more closely managed, as well as the
directory in which we're running cleancss, helping to resolve
previously-hidden warnings about sourcemaps.

For the image references, we now have an @ink-path variable that
points to @beanbag/ink/lib, which is what would be needed by consumers
of the LEss files. Paths are built off of this, rather than the old
@images-path.

For builds and for Storybook runtimes, this variable gets overridden to
point to the right place, ensuring we're accessing images from the right
place.

We're also now ensuring files are built before publishing, avoiding any
bad uploaded builds.

Through this, we should now have proper builds going forward, with paths
referenced correctly.

Built the package and compared to a released build. Verified that the only
changes made were fixes to the images and Spina references.

Commits

Files