Redo the build process to address path and reference generation issues.
Review Request #13942 — Created June 5, 2024 and submitted
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:
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 anink
directory that wasn't going to consistently
exist in the build process between local builds and remote
consumption.We were generating bad sourcemaps due to what appears to be issues in
cleancss
, depending on where it's run.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 withinpackage.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 runningcleancss
, 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.
Summary | ID |
---|---|
e69a87d18012077b1b840103845e1b3c0b1683f7 |
Description | From | Last Updated |
---|---|---|
'lessIncludePath' is defined but never used. Column: 7 Error code: W098 |
reviewbot | |
'buildPath' is defined but never used. Column: 7 Error code: W098 |
reviewbot | |
Looks like the changes from /r/13939/ were included in this change. And this line in particular has a discrepancy between … |
maubin |