-
Notifications
You must be signed in to change notification settings - Fork 10
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
Rfc/issue 185 Transforms API (pt. 1) #422
Conversation
By default there is a
Fixed.
We're taking an array of the default transforms, we're combining it with an array of custom transforms from the greenwood.config.js we're filtering the default array based on what extension its building for. This for in the case where a custom plugin overrides a default plugin e.g.
|
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.
So I hate to be the bearer of bad news or have to say I told you so, but unfortunately all the server refactoring has to be reverted
I probably should have commented after our last team meeting, but the reason why there were two servers was very intentional and was explicit for a reason. The problem it was trying to solve was making sure the final build could be previewed in as faithful of a realistic (albeit hermetic) environment as possible, akin to using a simple web server like Apache, or npx http-server
.
What is happening now is that our production build is getting served by the same server that handles all our development transforms, routing, resolutions, etc which would never be possible running on a bare web server. This is effectively giving the false impression that things ara working, when in reality there are not, like double <slot>
rendering not happening or prismjs.css loading.
The point of prodServer was to be (intentionally) minimalistic by design to avoid false positives like can be seen here now.
To see what I mean, do this instead
$ rm -rf public
$ yarn build
$ cd public && npx http-server
and you should see all those "fixes" come back. The same would happen if deployed to Netlify.
Right so a typical web server would be running from /public and not configured to serve files how we want anyway. Okay I'll roll it back then. |
a83d8fc
to
5f9aba3
Compare
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.
Cool, this seems like a good first step and helps us identify issues and opportunities we will need to solve as we scale this API out to be more flexible and predictable for ourselves and most importantly our users.
I fully assume this design to continue to refine itself over the course of next steps identified in #185 (comment) and good design doesn't typically come fully formed the first time around, and so it's up to us to challenge ourselves to find that diamond in the rough, even if the work is hard. We have the vision at least, which is the most important part.
Will get this all merged up a little later on today.
…d into rfc/issue-355-transforms-api
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.
Did something happen with the merge? Are there supposed to be two copies of each transform?
It automatically merged those old transforms; I missed it. I only dealt with conflicts. |
closing and reopening to re-trigger all builds oh right: Netlify doesn't like non-master based PRs? |
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.
Cool, good to go. Left some thoughts on the next iteration of this design as well some next steps to consider.
* basic unbundled rendering of home page * got livereload working for all files * JSON support * import CSS support * disable eslint complexity * header working * ading banner and stylinh and fixed binary image loading * integrated evergreen deps * fully restored the home page in develop mode * wip getting serialization working * wip getting serialization working * clean up and refactor, serialize WIP * upgrade puppeteer to latest * a bit hacky but home page is now being built for production * render header navigation from graph * page template working for site in development * all pages working in develop * all pages serializing for prod * sort header and shelf * shelf expansion and table of contents * label fallback handling * fix index page rendering * clean up logging * favicon support * refactor server lifecycle to use compilation and expose devServer * built in serve command * serve docs * add support for app templates * pretty URLs * shelf working WIP * quick styling tweak for side nav * copy assets and graph.json in copy lifecycle * basic support for css files * fix copy error for nested folders * call rollup from JS API * rollup configuration sourced from compilation * make sure to await Promise.all * Rfc/issue 355 organize serve lifecycle (#419) * task: organize serve * fix: remove ctx from resolve * fix: refactor further * task: scope filters by file * linting * renable default tests and limited smoke tests * disable all tests enable subset of tests * task: add custom transforms API from koa context * fix: remove redundant line * fix: more descriptive var * meta specs * fix: merge conflict * enable custom title case * enable custom workspace spec * track missing dev dep * enabled workspace assets test case * fix link closing slash * content-outlet refactor * enabled getting started test case * enable nested directory test case * enable app template case * enable page template spec * enable user directory mapping case * update comments * task: standardize transforms * fix: prod render * task: adding disabled markdown transform * fix: cleanup class names * fix: cleanup class names * got code markdown rendering and added support for custom plugins from config * markdown plugins working including prism * default markdown specs * enable all tests * rename markdown case * syntax highlighting markdown spec * fix: transform fixes * task: add markdown and json transforms * fix: header rendering, comment out eve-container temp * fix: cleanup * fix: remove node_module seperate transform, instead use js/css with path resolver * task: remove old transforms * fix: immutability of compilation object * fix: tests, page-templates, defaults * fix: cleanup * fix: remove outdated transforms Co-authored-by: Owen Buckley <[email protected]>
* basic unbundled rendering of home page * got livereload working for all files * JSON support * import CSS support * disable eslint complexity * header working * ading banner and stylinh and fixed binary image loading * integrated evergreen deps * fully restored the home page in develop mode * wip getting serialization working * wip getting serialization working * clean up and refactor, serialize WIP * upgrade puppeteer to latest * a bit hacky but home page is now being built for production * render header navigation from graph * page template working for site in development * all pages working in develop * all pages serializing for prod * sort header and shelf * shelf expansion and table of contents * label fallback handling * fix index page rendering * clean up logging * favicon support * refactor server lifecycle to use compilation and expose devServer * built in serve command * serve docs * add support for app templates * pretty URLs * shelf working WIP * quick styling tweak for side nav * copy assets and graph.json in copy lifecycle * basic support for css files * fix copy error for nested folders * call rollup from JS API * rollup configuration sourced from compilation * make sure to await Promise.all * Rfc/issue 355 organize serve lifecycle (#419) * task: organize serve * fix: remove ctx from resolve * fix: refactor further * task: scope filters by file * linting * renable default tests and limited smoke tests * disable all tests enable subset of tests * task: add custom transforms API from koa context * fix: remove redundant line * fix: more descriptive var * meta specs * fix: merge conflict * enable custom title case * enable custom workspace spec * track missing dev dep * enabled workspace assets test case * fix link closing slash * content-outlet refactor * enabled getting started test case * enable nested directory test case * enable app template case * enable page template spec * enable user directory mapping case * update comments * task: standardize transforms * fix: prod render * task: adding disabled markdown transform * fix: cleanup class names * fix: cleanup class names * got code markdown rendering and added support for custom plugins from config * markdown plugins working including prism * default markdown specs * enable all tests * rename markdown case * syntax highlighting markdown spec * fix: transform fixes * task: add markdown and json transforms * fix: header rendering, comment out eve-container temp * fix: cleanup * fix: remove node_module seperate transform, instead use js/css with path resolver * task: remove old transforms * fix: immutability of compilation object * fix: tests, page-templates, defaults * fix: cleanup * fix: remove outdated transforms Co-authored-by: Owen Buckley <[email protected]>
Related Issue
#185
specifically this comment
Summary of Changes
shouldTransform()
condition returns true,applyTransform()
is called.example of a javascript transform:
By extending the transform interface, you will have access to:
shouldTransform()
function.