Expose API for fastboot addons to update fastboot manifest.#374
Merged
rwjblue merged 1 commit intoember-fastboot:masterfrom Apr 21, 2017
kratiahuja:add-fastboot-assets-api
Merged
Expose API for fastboot addons to update fastboot manifest.#374rwjblue merged 1 commit intoember-fastboot:masterfrom kratiahuja:add-fastboot-assets-api
rwjblue merged 1 commit intoember-fastboot:masterfrom
kratiahuja:add-fastboot-assets-api
Conversation
34 tasks
Contributor
Author
|
Travis is failing due to unrelated ember-data issue |
Contributor
Author
|
@rwjblue and I discussed over slack. We should also handle usecase where you may want to prepend to updateFastBootManifest(manifest) {..}you get manifest as input (which maybe an updated version from prev addon) and you update and return and at the end we write it back Going to update this PR. |
Contributor
Author
|
@rwjblue @simonihmig updated PR and description with the discussed changes. Also tested it with multiple addons to make sure ordering is maintained as well. Please let me know your feedback. |
rwjblue
approved these changes
Apr 21, 2017
simonihmig
approved these changes
Apr 21, 2017
Contributor
Author
|
@rwjblue thank you! :) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation
Currently, FastBoot runs two ember builds to fork and build fastboot assets. When it runs the fastboot build it sets an environment variable
process.env.EMBER_CLI_FASTBOOTto betrue. At present a lot of addons are relying on this environment variable to append libraries into the fastboot assets (exampleember-network).Moreover another usecase is to allow addons like
ember-enginesto write and load additional assets in the FastBoot sandbox.With #360, this environment variable will no longer be exposed or valid. Therefore, we want to expose an API from
ember-cli-fastbootto allow other fastboot compatible addons to be able to provide paths underdistfrom where additionalvendororappspecific assets should be loaded in sandbox. With addons being able to leverage this API when the build issue is resolved they will automatically become backward compatible.How does it work
In order for an addon to load additional assets in the sandbox (in any order), they need to either update
vendorFilesorappFileskey in the fastboot manifest. Therefore, they will defineupdateFastBootManifesthook in theirindex.jswhich takes in themanifestas input, updates the manifest and returns it back:An addon can decide to update the manifest enteries however they like. If the
manifestkey is not returned, the build will fail with an error message as :<addon name> did not return the updated manifest from updateFastBootManifest hook.Example: See
ember-fastboot-build-exampleaddon for a simple example of how to load assetsTODO
cc: @rwjblue @tomdale @danmcclain @ryanone @tsubomii @arjansingh @simonihmig