If you try to install the latest Cardstack plugins in this app, it causes errors. This is because v0.14 removed the branch param, which affected many APIs.
Strategy for ugprading from 0.13.x to 0.14.0 cardstack sdk:
- update deps with
yarn upgrade-interactive --latest --scope @cardstack
- search for the phrase "branch" and "master" to find areas that need refactor
- Address API changes below
API changes
@cardstack/hub/searchers.get() has been changed to:
- remove the branch parameter
- add a "repository" parameter that is currently hard-coded to "local-hub"
@cardstack/hub/searchers.getFromControllingBranch() has been removed. You can replace this with @cardstack/hub/searchers.get() and don't forget to add the hard coded "local-hub" repository name
@cardstack/hub/searchers.search() has been updated to remove the branch parameter. There is no need to add the repository "local-hub" in these calls, as when this is supported, those repository names will just be part of the search query.
@cardstack/hub/searchers.searchFromControllingBranch() has been removed, You can replace this with @cardstack/hub/searchers.search()
For any cardstack/indexer.js file that your cards may have, the following changes have been made:
- the
branches() hook of the indexer.js files is no longer necessary. You can delete this from your indexer.js file.
- the
beginUpdate() hook of the indexer.js files no longer accepts a branch parameter. You can remove this param in your indexer.js file.
The @cardstack/hub/controlling-branch.js (which is normally injected via DI as 'hub:controlling-branch') no longer exists. You can delete this from any modules that you have.
- The
@cardstack/hub/current-schema.forBranch() and @cardstack/hub/current-schema.forControllingBranch() have been removed. Instead call Instead call `@cardstack/hub/current-schema.getSchema().
- The
@cardstack/hub/writers.create() no longer takes a branch parameter. Just remove this param from invocations.
- The
@cardstack/hub/writers.update() no longer takes a branch parameter. Just remove this param from invocations.
Additionally, we need to configure TS linting for cardstack applications that use v0.14.x of the hub:
- add
'app-name/*/cardstack/**/*.js', to eslintrc
- add
"@typescript-eslint/eslint-plugin": "^1.7.0", "@typescript-eslint/parser": "^1.7.0", "typescript": "3.4.5" to devDependencies in package.json
- update the lint command in package.json to
"lint": "eslint . --cache --parser espree"
If you try to install the latest Cardstack plugins in this app, it causes errors. This is because v0.14 removed the
branchparam, which affected many APIs.Strategy for ugprading from 0.13.x to 0.14.0 cardstack sdk:
yarn upgrade-interactive --latest --scope @cardstackAPI changes
@cardstack/hub/searchers.get()has been changed to:@cardstack/hub/searchers.getFromControllingBranch()has been removed. You can replace this with@cardstack/hub/searchers.get()and don't forget to add the hard coded "local-hub" repository name@cardstack/hub/searchers.search()has been updated to remove the branch parameter. There is no need to add the repository "local-hub" in these calls, as when this is supported, those repository names will just be part of the search query.@cardstack/hub/searchers.searchFromControllingBranch()has been removed, You can replace this with@cardstack/hub/searchers.search()For any
cardstack/indexer.jsfile that your cards may have, the following changes have been made:branches()hook of the indexer.js files is no longer necessary. You can delete this from yourindexer.jsfile.beginUpdate()hook of theindexer.jsfiles no longer accepts abranchparameter. You can remove this param in yourindexer.jsfile.The @cardstack/hub/controlling-branch.js(which is normally injected via DI as 'hub:controlling-branch') no longer exists. You can delete this from any modules that you have.@cardstack/hub/current-schema.forBranch()and@cardstack/hub/current-schema.forControllingBranch()have been removed. Instead call Instead call `@cardstack/hub/current-schema.getSchema().@cardstack/hub/writers.create()no longer takes a branch parameter. Just remove this param from invocations.@cardstack/hub/writers.update()no longer takes a branch parameter. Just remove this param from invocations.Additionally, we need to configure TS linting for cardstack applications that use v0.14.x of the hub:
'app-name/*/cardstack/**/*.js',to eslintrc"@typescript-eslint/eslint-plugin": "^1.7.0", "@typescript-eslint/parser": "^1.7.0", "typescript": "3.4.5"to devDependencies in package.json"lint": "eslint . --cache --parser espree"