Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

STRWEB-113 expose 'build' command publicly #144

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from
Draft

Conversation

zburke
Copy link
Member

@zburke zburke commented Sep 17, 2024

DRAFT DRAFT DRAFT

Expose build as a bin script, allowing a platform to directly depend on this module and call the build API to generate a bundle without pulling in all the stripes-cli deps that are unrelated to producing a production bundle. This results in a 33% reduction in the volume of packages pulled down when constructing a build, significantly reducing the attack surface we are exposed to:

// resolved dependencies when building only with stripes-webpack
$ grep -c -e '^  resolved' yarn.lock 
1006

// resolved dependencies in an ordinary build with stripes-cli
$ grep -c -e '^  resolved' ./platform/yarn.lock 
1483

In a platform, remove existing dev-deps and replace them with

"@folio/stripes-webpack": "folio-org/stripes-webpack#STRWEB-113"

For the purposes of backwards compatibility while testing, this branch also exports a command named "stripes" so you can use the existing scripts in platform-complete#snapshot to do things like

yarn stripes build stripes.config.js // builds into './output'
yarn stripes build stripes.config.js /path/to/some/output/directory

Refs STRWEB-113

**DRAFT** **DRAFT** **DRAFT**

Expose `build` as a `bin` script, allowing a platform to directly depend
on this module and call the `build` API to generate a bundle without
pulling in all the stripes-cli deps that are unrelated to producing a
production bundle.

CSS isn't being correctly bundled/handled here, but the bundle is
otherwise functional. Hopefully, this is just a config glitch.

Refs STRWEB-113
@zburke zburke requested review from skomorokh, JohnC-80 and miso-soup-lover and removed request for miso-soup-lover September 17, 2024 15:33
@zburke
Copy link
Member Author

zburke commented Sep 17, 2024

Build output here looks like

WARNING in entrypoint size limit: The following entrypoint(s) combined asset size exceeds the recommended limit (244 KiB). This can impact web performance.
Entrypoints:
  css (6.94 MiB)
      bundle.stripes395188299109975646cd.js
  stripesConfig (6.94 MiB)
      bundle.stripes395188299109975646cd.js
      bundle.stripesConfigcd17ed5cc99920962f52.js
  index (6.94 MiB)
      bundle.stripes395188299109975646cd.js
      bundle.indexcc70d9a6fdeb6249daf6.js

whereas from a build with stripes-cli it looks like

Entrypoints:
  css (6.56 MiB)
      style.a3bb531eea63ecb56ec5.css
      bundle.stripes5b9072a0f36b64d97b85.js
  stripesConfig (6.56 MiB)
      style.a3bb531eea63ecb56ec5.css
      bundle.stripes5b9072a0f36b64d97b85.js
      bundle.stripesConfig8731d796ff68c4767508.js
  index (6.56 MiB)
      style.a3bb531eea63ecb56ec5.css
      bundle.stripes5b9072a0f36b64d97b85.js
      bundle.index012182c80803e905a512.js

so the missing style files are an obvious goof. @JohnC-80 , any thoughts on why that's getting dropped?

Copy link

Jest Unit Test Results

0 tests  ±0   0 ✅ ±0   0s ⏱️ ±0s
0 suites ±0   0 💤 ±0 
0 files   ±0   0 ❌ ±0 

Results for commit 212673d. ± Comparison against base commit 9db3b60.

Copy link

github-actions bot commented Sep 17, 2024

Jest Unit Test Results

0 tests  ±0   0 ✅ ±0   0s ⏱️ ±0s
0 suites ±0   0 💤 ±0 
0 files   ±0   0 ❌ ±0 

Results for commit 212673d. ± Comparison against base commit 9db3b60.

♻️ This comment has been updated with latest results.

@JohnC-80
Copy link
Contributor

JohnC-80 commented Sep 17, 2024

@zburke something not leading down the prod path / webpack.config.cli.prod.js not being used? That's where the styles files get added/configured for output via the MiniCssExtractPlugin .

Copy link

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants