1 | import { getCurrentProject, Realm, setCurrentProject } from './main';
|
2 |
|
3 |
|
4 |
|
5 | export async function realm_check(realm: Realm) {
|
6 |
|
7 | const project = await getCurrentProject();
|
8 |
|
9 | if (realm.project !== project) {
|
10 | throw new Error(`Realm ${realm.name} with Context ${realm.context} should have project ${realm.project} but has ${project}
|
11 | Do a 'npm run vdev realm ${realm.name}' to make sure all is set correctly`);
|
12 | }
|
13 | }
|
14 |
|
15 | export async function realm_set_begin(realm: Realm, currentRealm?: Realm) {
|
16 | const project = await getCurrentProject();
|
17 |
|
18 | if (realm.project && realm.project !== project) {
|
19 | await setCurrentProject(realm.project);
|
20 | return true;
|
21 | }
|
22 | return false;
|
23 | }
|
24 |
|
\ | No newline at end of file |