UNPKG

899 BJavaScriptView Raw
1"use strict";
2Object.defineProperty(exports, "__esModule", { value: true });
3const main_1 = require("./main");
4//#region ---------- Hook Functions ----------
5async function realm_check(realm) {
6 const project = await main_1.getCurrentProject();
7 if (realm.project !== project) {
8 throw new Error(`Realm ${realm.name} with Context ${realm.context} should have project ${realm.project} but has ${project}
9 Do a 'npm run vdev realm ${realm.name}' to make sure all is set correctly`);
10 }
11}
12exports.realm_check = realm_check;
13async function realm_set_begin(realm, currentRealm) {
14 const project = await main_1.getCurrentProject();
15 if (realm.project && realm.project !== project) {
16 await main_1.setCurrentProject(realm.project);
17 return true;
18 }
19 return false;
20}
21exports.realm_set_begin = realm_set_begin;
22//#endregion ---------- /Hook Functions ----------