-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: remove dependency on packages that are fetched from GitHub
Corporate internal systems may not always allow access to GitHub. So, any dependencies that are fetched from GitHub (codeload.github.com) may be blocked, hance, failing the install process. Best uses an old version of `lwc-services` that has a dependency on one such package (i.e.: `lwc-jest-preset-ts-fix`¹) that was never published, and thus, needs to be fetched from GitHub. Newer versions of `lwc-services` no longer depend² on `lwc-jest-preset-ts-fix`. This commit fixes the issues described above by updating `lwc-services` to the latest available version (i.e. `v3.2.2`) and includes all the related changes required by the update. Note: Since `lwc-services` is now deprecated³, in the future, we will look into removing it altogether. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ¹ https://github.com/muenzpraeger/lwc-jest-preset-ts-fix ² salesforce/lwc-test#36 ³ https://www.npmjs.com/package/lwc-services
- Loading branch information
Showing
18 changed files
with
5,719 additions
and
6,067 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{ | ||
"modules": [ | ||
{ | ||
"dir": "src/client/modules" | ||
} | ||
] | ||
} |
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{ | ||
"modules": [ | ||
{ | ||
"dir": "src/modules" | ||
} | ||
] | ||
} |
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
62 changes: 38 additions & 24 deletions
62
packages/@best/frontend/src/modules/store/store/wire-adapter.js
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,30 +1,44 @@ | ||
import { register, ValueChangedEvent } from '@lwc/wire-service'; | ||
export class ConnectStore { | ||
connected = false; | ||
dataCallback; | ||
store; | ||
subscription; | ||
|
||
export function connectStore(store) { | ||
return store.getState(); | ||
} | ||
|
||
register(connectStore, (eventTarget) => { | ||
let store; | ||
let subscription; | ||
constructor(dataCallback) { | ||
this.dataCallback = dataCallback; | ||
} | ||
|
||
const notifyStateChange = () => { | ||
const state = store.getState(); | ||
eventTarget.dispatchEvent(new ValueChangedEvent(state)); | ||
}; | ||
connect() { | ||
this.connected = true; | ||
this.subscribeToStore(); | ||
} | ||
|
||
eventTarget.addEventListener('connect', () => { | ||
subscription = store.subscribe(notifyStateChange); | ||
notifyStateChange(); | ||
}); | ||
disconnect() { | ||
this.unsubscribeFromStore(); | ||
this.connected = false; | ||
} | ||
|
||
eventTarget.addEventListener('disconnect', () => { | ||
if (subscription) { | ||
subscription(); | ||
subscribeToStore() { | ||
if (this.connected && this.store) { | ||
const notifyStateChange = () => { | ||
const state = this.store.getState(); | ||
this.dataCallback(state); | ||
}; | ||
this.subscription = this.store.subscribe(notifyStateChange); | ||
notifyStateChange(); | ||
} | ||
}); | ||
} | ||
|
||
update(config) { | ||
this.unsubscribeFromStore(); | ||
this.store = config.store; | ||
this.subscribeToStore(); | ||
} | ||
|
||
eventTarget.addEventListener('config', (config) => { | ||
store = config.store; | ||
}); | ||
}); | ||
unsubscribeFromStore() { | ||
if (this.subscription) { | ||
this.subscription(); | ||
this.subscription = undefined; | ||
} | ||
} | ||
} |
This file contains 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
This file contains 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
This file contains 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
Oops, something went wrong.