This one ended up being way more complicated than I'd hoped. Adding new CSS and then changing the templates fails the build because the snapshots need to be updated. But I couldn't figure out why my snapshots weren't matching in CI until I remembered that the tests run the built JS, so you have to build the JS before updating the snapshots:
npm run build-js
npx jest -u
Of course, this yielded a cryptic error:
> formio-sfds@9.2.7 build-js
> rollup -c
src/standalone.js → dist/formio-sfds.standalone.js...
[!] (plugin postcss) Error: You must provide the URL of lib/mappings.wasm by calling SourceMapConsumer.initialize({ 'lib/mappings.wasm': ... }) before using SourceMapConsumer
dist/formio-sfds.css
Error: You must provide the URL of lib/mappings.wasm by calling SourceMapConsumer.initialize({ 'lib/mappings.wasm': ... }) before using SourceMapConsumer
at readWasm (/Users/shawn.allen/sfds/formio-sfds/node_modules/@csstools/postcss-sass/node_modules/source-map/lib/read-wasm.js:8:13)
at wasm (/Users/shawn.allen/sfds/formio-sfds/node_modules/@csstools/postcss-sass/node_modules/source-map/lib/wasm.js:25:16)
at /Users/shawn.allen/sfds/formio-sfds/node_modules/@csstools/postcss-sass/node_modules/source-map/lib/source-map-consumer.js:264:14
at async Promise.all (index 0)
Until we figure out what's up with the safelist not working in https://github.com/SFDigitalServices/sfgov/pull/1462, we need to add these spacing utilities here to fix existing forms.
This one ended up being way more complicated than I'd hoped. Adding new CSS and then changing the templates fails the build because the snapshots need to be updated. But I couldn't figure out why my snapshots weren't matching in CI until I remembered that the tests run the built JS, so you have to build the JS before updating the snapshots:
Of course, this yielded a cryptic error:
I fixed this with
npm i -D source-map
, as suggested in https://github.com/mozilla/source-map/issues/432.Heads up to @aekong on this too 😄