-
Notifications
You must be signed in to change notification settings - Fork 161
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
Setup Monorepo #805
Setup Monorepo #805
Conversation
This is part of an arching plan to introduce Glimmer's rehydration/serializtion modes to Ember proper. There are 4 PR's that are all interwoven, of which, this is one. In order of need to land they are: Glimmer.js: glimmerjs/glimmer-vm#783 (comment) This resolves a rather intimate API problem. Glimmer-vm expects a very specific comment node to exist to know whether or not the rehydration element builder can do it's job properly. If it is not found on the first node from `rootElement` it throws. In fastboot however we are certain that there will already be existant elements in the way that will happen before rendered content. This PR just iterates through the nodes until it finds the expected comment node. And only throws if it never finds one. --- Ember.js: emberjs/ember.js#16227 This PR modifies the `visit` API to allow a private _renderMode to be set to either serialize or rehydrate. In SSR environments the assumption (as it is here in this fastboot PR) is that we'll set the visit API to serialize mode which ensures glimmer-vm's serialize element builder is used to build the API. The serialize element builder ensures that we have the necessary fidelty to rehydrate correctly and is mandatory input for rehydration. --- Fastboot: ember-fastboot/fastboot#185 This allows enviroment variable to set _renderMode to be used in Visit API. Fastboot must send content to browser made with the serialization element builder to ensure rehydration can be sucessful. --- EmberCLI Fastboot: ember-fastboot#580 Finally this does the fun part of disabling the current clear-double-render instance-initializer We first check to ensure we are in a non-fastboot environment. Then we ensure that we can find the expected comment node from glimmer-vm's serialize element builder. This ensures that this change will only effect peoeple who use ember-cli-fastboot with the serialized output from the currently experimental fastboot setup Then we ensure `ApplicationInstance#_bootSync` specifies the rehydrate _renderMode. This is done in `_bootSync` this way because visit is currently not used to boot ember applications. And we must instead set bootOptions this way instead. We also remove the markings for `fastboot-body-start` and `fastboot-body-end` to ensure clear-double render instance-initializer is never called.
…tion-serialization-from-glimmer Rehydration
Bump fastboot for rehydration release
Took me a bit to figure out if this was possible.
Allow html attributes
fastboot package upgrade to v1.2
When accessing a header, fastboot [will lowercase the string](https://github.com/ember-fastboot/fastboot/blob/master/src/fastboot-headers.js#L51-L57). However, when adding headers to the FastBootHeaders, the casing [is not changed](https://github.com/ember-fastboot/fastboot/blob/master/src/fastboot-headers.js#L20). This PR normalizes all headers as lower case strings, so `X-Headers` will be accessible on the `fastboot.request.headers` object.
Normalize headers to lower case
* issue ember-fastboot#193 * Added unit tests to check domContents.body includes boundary script tag
…te_body_in_domContents Moved the script tag fastboot-body-start boundary in _finalizeHTML method
funtion -> function
Fixed small typo
* 💥 remove v4 * add v8 and v10
Remove .babelrc configuration file
…-sync Remove usage of deprecated exists-sync
Update Node.js support matrix
# Conflicts: # packages/fastboot-express-middleware/package.json run tests in ci skip legacy mocha tests skip fastboot ci on windows fastboot ci test is not working correctly on windows
port fastboot test into integration-tests package
I squashed the commits, this commit contains the new test setup |
@rwjblue (friendly ping) can I get a review on this PR? |
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.
@xg-wang I have left a few comments describing which test packages the test should live in.
I prefer to move Any thoughts? For the PR description TODO item
It's my miss I have not written more ideas, and I think this is important for deciding where to have the tests in this PR. If you look at existing tests in each packages, all |
@kiwiupover that's in the repo moved into the monorepo (for example cd fastboot
mkdir -p ../packages/fastboot; mv .* * $_
mv ../packages .
mv packages/fastboot/.git .
git commit -m 'Monorepo setup: move to packages/fastboot'
# repeat for other repos
git remote add local/fastboot file://$HOME/Code/ember-fastboot/fastboot
git fetch local/fastboot
git merge local/fastboot/master --allow-unrelated-histories GitHub may have some issue displaying them, you can see it's the file move by doing |
add integration-test in ci rename lib to test-helper
Paired with @kiwiupover, we walked through the PR and listed out the things needed: Must:
After merge:
In follow-up PRs:
|
@@ -4,7 +4,7 @@ | |||
"version": "3.1.2", | |||
"repository": "", | |||
"scripts": { | |||
"test": "node lib/clean-dists.js && mocha" | |||
"test": "node helpers/clean-dists.js && mocha" |
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.
+1
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.
@xg-wang Great work Thomas!
@rwjblue this is ready to be merged! |
The tests were removed in this PR ember-fastboot#805
What it does
This PR sets up the monorepo for several repositories under
ember-fastboot
org, and internal test packages for easier testing across several repos:packages/fastboot
: a low-level tool for anything relying on rendering Ember app in node environment (e.g., custom fastboot-server, prember)packages/ember-cli-fastboot
: required for all SSR ember apppackages/fastboot-express-middleware
: low-level tool for building custom fastboot-serverpackages/fastboot-app-server
: sane default for serving production apptest-packages/*
: internal ember apps for acceptance & e2e testing, not publishedAll packages to be published are bumped to
3.1.2
, which is the largest among the packages' versions.Also converting several
fastboot
repo tests that rely onember-cli-fastboot
for building ember app intotest-packages/integration-tests/test/basic-test.js
.ember-cli-fastboot
is already usingrelease-it-yarn-workspace
to releaseember-cli-fastboot
; we can continue to use the release flow to release others.Context
ember-fastboot
org has multiple packages useful for server-side rendered ember apps.Although these packages can be used together with different versions combination (e.g., https://github.com/ember-fastboot/fastboot/blob/v3.1.2/src/fastboot-schema.js is explicitly designed for compatibility), it is usually desired to keep them in sync from maintainers' perspective and use a combination of versions known good from users'.
Currently, when bumping one package, several PRs need to cascade for other packages; it becomes even trickier when a fastboot contributor needs to make a change or write a test that interacts with different packages.
To merge these related packages into a monorepo, we can make maintaining and contributing to fastboot much easier.
The cons for doing monorepo is losing the flexibility to release different versions for each package and increasing the coupling, but they are not necessarily bad IMO.
Checklist
The monorepo setup needs to ensure a couple of things:
Next steps
test-packages
"node": "10.* || >=12"
whereas others are specifying"node": "10.* || 12.* || >= 14"