Introduce schema version in FastBoot#114
Conversation
e7125ba to
0e3e5b0
Compare
0e3e5b0 to
1381ac5
Compare
|
Bump! @rwjblue can you please review this? |
| const LATEST_SCHEMA_VERSION = '1'; | ||
| // this allows fastboot lib to have unpublished features from ember-cli-fastboot but allows | ||
| // people to run integration tests in ember-cli-fastboot | ||
| const NEXT_SCHEMA_VERSION = '2'; |
There was a problem hiding this comment.
Perhaps the schema version should be represented as an integer, so NEXT_SCHEMA_VERSION can be LATEST_SCHEMA_VERSION++ and updating the version doesn't require editing two values?
There was a problem hiding this comment.
I agree it is cleaner to make it in an integer. Switched to that. However, with the new given scheme of things I don't think we should allow LATEST_SCHEMA_VERSION++ since it can accidentally cause issues. For example, someone changed the schema version and updated the manifest schema version to 3 while latest version that FastBoot server understands is 2. It will cause breakage.
| // TODO : remove after Fastboot 1.0 | ||
| debug("reading app file path from manifest"); | ||
| appFiles = [path.join(distPath, manifest.appFile)]; | ||
| if (schemaVersion !== LATEST_SCHEMA_VERSION && schemaVersion !== NEXT_SCHEMA_VERSION) { |
There was a problem hiding this comment.
I think we should only fail if the version of the schema in the manifest is newer than the current schema version. For example, if the manifest version is 57 and the latest the FastBoot server knows about is 13, then there may be information in the manifest we don't understand. In that case, we should fail. But if the version in the manifest is older, we know its characteristics and should be able to transform it into the latest manifest schema. That way people can still run older builds while keeping their FastBoot servers up-to-date with the latest version.
1381ac5 to
262a441
Compare
This is to maintain compatibility between `ember-cli-fastboot` and `fastboot` repos always.
262a441 to
80aad14
Compare
|
@tomdale Updated per our discussion during the fastboot meeting. |
Motivation
ember-cli-fastbootpublishes a package.json in the dist directory of any ember app that is used by thefastbootlibrary to read and load app/vendor files, serve the required html file etc. Thefastbootmicro library is highly dependent on the output format of the package.json. If there is a change in the format of package.json,fastbootlibrary needs to be compatible with it. In order to introduce the compatibility, the package.json will contain aschemaVersionfield. This field will be updated everytime there is an incompatible change fromember-cli-fastboot. If apps are using a manifest version that the fastboot library is not aware of (ie manifest version is greater than fastboot latest version), we will throw an error. If the version of fastboot is ahead than the manifest version used by the app we will simply do the backward compatible transformation.In the long run as we do major version bumps, we will support a limited set of manifest versions.
Description of changes:
This PR does the following:
ember-cli-fastbootchanges are herefastbootlibrary to be introduced early but only behind this version flag. The primary purpose of this is to publishfastbootlibrary changes early so thatember-cli-fastbootintegration tests can pass.cc: @rwjblue @tomdale