UNPKG

@communities-webruntime/services

Version:

If you would like to run Lightning Web Runtime without the CLI, we expose some of our programmatic APIs available in Node.js. If you're looking for the CLI documentation [you can find that here](https://www.npmjs.com/package/@communities-webruntime/cli).

80 lines 2.4 kB
/** @hidden */ /** * Copyright (c) 2019, salesforce.com, inc. * All rights reserved. * SPDX-License-Identifier: MIT * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT */ import path from 'path'; import { validateContext } from './context-validate.js'; const EMPTY_BASE_PATH = ''; const DEFAULT_LOCALE = 'en-US'; /** * Holds the template context configuration. * * The passed config is validated. * * templateDir is the only mandatory configuration, * all others can use default values. */ export default class WebruntimeContext { constructor(config) { this.config = { ...config }; if (this.config.basePath === '/') { this.config.basePath = ''; } validateContext(this); } get basePath() { return this.config.basePath || EMPTY_BASE_PATH; } set basePath(basePath) { this.config.basePath = basePath; } get isDesignMode() { return this.config.isDesignMode || false; } get isMobileAppMode() { return this.config.isMobileAppMode || false; } get labels() { return this.config.labels || `${this.templateDir}/src/labels.json`; } get locales() { return this.config.locales || `${this.templateDir}/src/locales.json`; } get defaultLocale() { return this.config.defaultLocale || DEFAULT_LOCALE; } get partials() { return this.config.partials || `${this.templateDir}/src/partials`; } get routes() { return this.config.routes || `${this.templateDir}/src/routes.json`; } get srcDir() { return this.config.srcDir || `${this.config.templateDir}/src`; } get templateDir() { return this.config.templateDir && path.resolve(this.config.templateDir); } get theme() { return this.config.theme || `${this.config.templateDir}/src/theme.json`; } get views() { return this.config.views || `${this.config.templateDir}/src/views`; } get versionKey() { return this.config.versionKey; } set versionKey(versionKey) { this.config.versionKey = versionKey; } get appOverrides() { return this.config.appOverrides || {}; } set appOverrides(appOverrides) { this.config.appOverrides = appOverrides; } } //# sourceMappingURL=webruntime-context.js.map