Skip to content

Commit

Permalink
fix(hub-common): handle undefined context.portal (#1248)
Browse files Browse the repository at this point in the history
* chore: add trigger for maint branches to release.yaml

* fix(hub-common): handle undefined context.portal

affects: @esri/hub-common

* chore: ignore discussions package for releases on this branch
  • Loading branch information
mjuniper authored Sep 27, 2023
1 parent 941550e commit 7008f9c
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 6 deletions.
1 change: 1 addition & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ on:
- beta
# - alpha disabled to allow push to alpha then merge to master w/o incurring a release
- next
- '[0-9]+.[0-9]+.x'
# Dont run if it's just markdown or doc files
paths-ignore:
- "**.md"
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
"@esri/arcgis-rest-portal": "^3.5.0",
"@esri/arcgis-rest-request": "^3.1.1",
"@esri/arcgis-rest-types": "^3.1.1",
"@semantic-release/changelog": "^6.0.1",
"@semantic-release/changelog": "^6.0.3",
"@semantic-release/git": "^10.0.1",
"@types/arcgis-js-api": "~4.26.0",
"@types/es6-promise": "0.0.32",
Expand Down Expand Up @@ -150,7 +150,7 @@
"y:push": "lerna run y:push",
"release:dry": "multi-semantic-release --dry-run --deps.prefix=^ --deps.bump=satisfy --deps.release=inherit --ignore-private-packages --debug",
"prerelease": "npm config set workspaces-update false",
"release": "multi-semantic-release --deps.prefix=^ --deps.bump=satisfy --deps.release=inherit --ignore-private-packages"
"release": "multi-semantic-release --deps.prefix=^ --deps.bump=satisfy --deps.release=inherit --ignore-packages=packages/discussions --ignore-private-packages"
},
"husky": {
"hooks": {
Expand Down Expand Up @@ -199,6 +199,7 @@
},
"release": {
"branches": [
"+([1-9])?(.{+([1-9]),x}).x",
"master",
{
"name": "next",
Expand Down
2 changes: 1 addition & 1 deletion packages/common/src/sites/HubSite.ts
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ export class HubSite
): IHubSite {
// ensure we have the orgUrlKey
if (!partialSite.orgUrlKey) {
partialSite.orgUrlKey = context.portal.urlKey;
partialSite.orgUrlKey = context.portal?.urlKey;
}
// extend the partial over the defaults
const pojo = { ...DEFAULT_SITE, ...partialSite } as IHubSite;
Expand Down
5 changes: 4 additions & 1 deletion packages/common/test/sites/HubSite.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,10 @@ describe("HubSite Class:", () => {
describe("static methods:", () => {
it("loads from minimal json", () => {
const createSpy = spyOn(HubSitesModule, "createSite");
const chk = HubSite.fromJson({ name: "Test Site" }, authdCtxMgr.context);
const chk = HubSite.fromJson(
{ name: "Test Site" },
unauthdCtxMgr.context
);

expect(createSpy).not.toHaveBeenCalled();
expect(chk.toJson().name).toEqual("Test Site");
Expand Down

0 comments on commit 7008f9c

Please sign in to comment.