forked from NullVoxPopuli/limber
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathenvironment.ts
37 lines (31 loc) · 1.03 KB
/
environment.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-expect-error
import { getGlobalConfig } from '@embroider/macros/src/addon/runtime';
interface Config {
isTesting?: boolean;
environment: string;
modulePrefix: string;
podModulePrefix?: string;
locationType: 'history' | 'hash' | 'none' | 'auto';
rootURL: string;
EmberENV?: Record<string, unknown>;
APP: Record<string, unknown> & { rootElement?: string; autoboot?: boolean };
}
const ENV: Config = {
modulePrefix: 'tutorial',
environment: import.meta.env.DEV ? 'development' : 'production',
rootURL: '/',
locationType: 'history',
EmberENV: {},
APP: {},
};
export default ENV;
export function enterTestMode() {
ENV.locationType = 'none';
ENV.APP.rootElement = '#ember-testing';
ENV.APP.autoboot = false;
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
const config = getGlobalConfig()['@embroider/macros'];
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
if (config) config.isTesting = true;
}