-
Notifications
You must be signed in to change notification settings - Fork 600
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
feat(web-components): new build/test/docs setup #3156
feat(web-components): new build/test/docs setup #3156
Conversation
@@ -4,14 +4,15 @@ module.exports = { | |||
stories: ["../src/**/*.stories.ts"], | |||
webpackFinal: async config => { | |||
config.module.rules.push({ | |||
test: /\.(ts)$/, | |||
test: /\.(|ts|tsx)$/, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is tsx needed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ii think we can remove that. It's a vestigial copy paste oops. I take care of that real quick.
@nicholasrice @chrisdholt Any reason why my tests keep getting re-formatted? The tests are breaking because something is reformatting the string literals, which is rather important when verifying compiler tests. I added the specs to the prettier ignore, which seems to work when running at the project level, but for some reason it's breaking in the build. |
@EisenbergEffect Does the change get applied when you commit? In other words, is it getting malformed in by the pre-commit prettier process? |
@nicholasrice I believe that's what happened initially. I think I've got it fixed now as I haven't seen any other commits since a much older one that affect the files under question. |
// (undocumented) | ||
accentBaseColor: string; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@nicholasrice @EisenbergeEffect should we take a task to add typedoc comments to some of these?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think so. I plan to add a bunch to fast-element while I'm traveling on Tuesday. One of the benefits of the api report is that it will show us where we're missing docs. It also helps us to see when we make breaking changes to APIs. One thing the api-extractor team recommends is to actually use code-owners on the api-report file so that you can ensure that specific people review PRs that affect that file, since it represents changes to docs or public APIs. Seems like an interesting idea.
* chore(fast-components): new build/test/docs setup * chore(fast-components): add missing test files * fix(fast-components): use esm for node build and remove module pack type * fix(fast-components): remove unneeded files and fix import syntax * fix(fast-components): full rollup build of components * feat(fast-components): get all builds working * fix(fast-element): convert to using esm node plugin * fix(fast-foundation): switch to using esm node plugin and add script out * fix(fast-components-msft): build setup consistent with other wc packs * chore(fast-components): fix prettier issues * fix(web-components): story book config cleanup * fix(fast-element): once again correct some formatter's bad formatting Co-authored-by: EisenbergEffect <[email protected]>
* chore(fast-components): new build/test/docs setup * chore(fast-components): add missing test files * fix(fast-components): use esm for node build and remove module pack type * fix(fast-components): remove unneeded files and fix import syntax * fix(fast-components): full rollup build of components * feat(fast-components): get all builds working * fix(fast-element): convert to using esm node plugin * fix(fast-foundation): switch to using esm node plugin and add script out * fix(fast-components-msft): build setup consistent with other wc packs * chore(fast-components): fix prettier issues * fix(web-components): story book config cleanup * fix(fast-element): once again correct some formatter's bad formatting Co-authored-by: EisenbergEffect <[email protected]>
* chore(fast-components): new build/test/docs setup * chore(fast-components): add missing test files * fix(fast-components): use esm for node build and remove module pack type * fix(fast-components): remove unneeded files and fix import syntax * fix(fast-components): full rollup build of components * feat(fast-components): get all builds working * fix(fast-element): convert to using esm node plugin * fix(fast-foundation): switch to using esm node plugin and add script out * fix(fast-components-msft): build setup consistent with other wc packs * chore(fast-components): fix prettier issues * fix(web-components): story book config cleanup * fix(fast-element): once again correct some formatter's bad formatting Co-authored-by: EisenbergEffect <[email protected]>
* chore(fast-components): new build/test/docs setup * chore(fast-components): add missing test files * fix(fast-components): use esm for node build and remove module pack type * fix(fast-components): remove unneeded files and fix import syntax * fix(fast-components): full rollup build of components * feat(fast-components): get all builds working * fix(fast-element): convert to using esm node plugin * fix(fast-foundation): switch to using esm node plugin and add script out * fix(fast-components-msft): build setup consistent with other wc packs * chore(fast-components): fix prettier issues * fix(web-components): story book config cleanup * fix(fast-element): once again correct some formatter's bad formatting Co-authored-by: EisenbergEffect <[email protected]>
* chore(fast-components): new build/test/docs setup * chore(fast-components): add missing test files * fix(fast-components): use esm for node build and remove module pack type * fix(fast-components): remove unneeded files and fix import syntax * fix(fast-components): full rollup build of components * feat(fast-components): get all builds working * fix(fast-element): convert to using esm node plugin * fix(fast-foundation): switch to using esm node plugin and add script out * fix(fast-components-msft): build setup consistent with other wc packs * chore(fast-components): fix prettier issues * fix(web-components): story book config cleanup * fix(fast-element): once again correct some formatter's bad formatting Co-authored-by: EisenbergEffect <[email protected]>
* chore(fast-components): new build/test/docs setup * chore(fast-components): add missing test files * fix(fast-components): use esm for node build and remove module pack type * fix(fast-components): remove unneeded files and fix import syntax * fix(fast-components): full rollup build of components * feat(fast-components): get all builds working * fix(fast-element): convert to using esm node plugin * fix(fast-foundation): switch to using esm node plugin and add script out * fix(fast-components-msft): build setup consistent with other wc packs * chore(fast-components): fix prettier issues * fix(web-components): story book config cleanup * fix(fast-element): once again correct some formatter's bad formatting Co-authored-by: EisenbergEffect <[email protected]>
* chore(fast-components): new build/test/docs setup * chore(fast-components): add missing test files * fix(fast-components): use esm for node build and remove module pack type * fix(fast-components): remove unneeded files and fix import syntax * fix(fast-components): full rollup build of components * feat(fast-components): get all builds working * fix(fast-element): convert to using esm node plugin * fix(fast-foundation): switch to using esm node plugin and add script out * fix(fast-components-msft): build setup consistent with other wc packs * chore(fast-components): fix prettier issues * fix(web-components): story book config cleanup * fix(fast-element): once again correct some formatter's bad formatting Co-authored-by: EisenbergEffect <[email protected]>
Description
This PR puts in place the new build/test/docs setup for
fast-element
,fast-foundation
,fast-components
, andfast-components-msft
.Motivation & context
All four packages listed above now have the following commands:
npm run build
- First, this will build the TypeScript source into anesm
folder, with one JS file per TS file. It will also place the type definitions in adts
folder with one d.ts file per TS file. Next, it will output a concatenated single JS file build containing all source of the library and its dependencies, which can be used in ascript
tag oftype="module"
. Between these two outputs we can support Node (with esm module), browsers with script tag, and all major bundlers. Third, the build outputs a concatenated d.ts file in thedist
folder as well as a.api.json
file that contains a data representation of all types and documentation comments from the d.ts file. This is used to generate documentation pages (upcoming docs PR). Finally, this command outputs anapi-report.md
to thedocs
folder that documents which APIs are not documented as well as making it easy, via git diff, to see which API changes constitute breaking changes.npm run test*
- A collection of test commands for running tests in Node, Chrome, and FireFox, including watch and debug modes. By defaultnpm run test
will run in Node forfast-element
andfast-foundation
and in Chrome forfast-components
andfast-components-msft
. This is due to missing web components features in jsdom. We can change this in the future to either use browser for everything or adopt something like https://github.com/capricorn86/happy-dom instead of jsdom for Node testing of web components.Other items of note:
npm start
- Bothfast-components
andfast-components-msft
have Storybook configured to run with this command.esm
package has been installed to enable running our esm code directly in node. This is configured with Mocha for the Node tests and can be used by anyone who wants to execute our esm code in Node.fast-components
have been ported tochai
and now run in both Node and browser. The tests which were previously disabled were left that way. I commented out a few tests that used mocks/spies/fakes and will circle back later by either adding an appropriate library (e.g. sinon) or writing a simple mock or two by hand.Next Steps
Shortly, I'll have a PR coming that adds a new docs site to the repo based on Docusaurus 2. The site will pull in markdown docs from the above repos, aggregate them with custom site markdown, and also use each package's
.api.json
file to generate API docs. Once that's in, we can then discuss merging that with the new site home page work to form the unified site for launch.I validated the
fast-components
script file build and confirmed that one can simply add a script tag and use the components, with no extra setup, code, etc. I'll also be validating that this works correctly with Blazor and ASP.NET. I'll update my Webpack starter kit as well, to ensure that it doesn't have any issues. Each of these setups will be accompanied by docs.Issue type checklist
Process & policy checklist