MCPcopy Create free account
hub / github.com/bigcommerce/stencil-cli / getConfig

Method getConfig

lib/theme-config.js:30–50  ·  view source on GitHub ↗

* Grab the config JSON string, parse it into an object, grab the current variation, * and then merge it into the top level settings. * * @returns {object}

()

Source from the content-addressed store, hash-verified

28 * @returns {object}
29 */
30 async getConfig() {
31 const config = await this.getRawConfig();
32 const variation = this._getVariation(config, this.variationIndex);
33 this.globalSettings = cloneDeep(config.settings);
34 if (!this.currentVariationSettings) {
35 this.currentVariationSettings = variation.settings;
36 }
37 // Set some defaults
38 config.css_compiler = config.css_compiler || 'scss';
39 config.autoprefixer_cascade = config.autoprefixer_cascade || true;
40 config.autoprefixer_browsers = config.autoprefixer_browsers || [
41 '> 1%',
42 'last 2 versions',
43 'Firefox ESR',
44 ];
45 // Merge in the variation settings and images objects
46 config.settings = defaultsDeep(this.currentVariationSettings, config.settings || {});
47 config.images = defaultsDeep(variation.images, config.images || {});
48 config.variationName = variation.name;
49 return config;
50 }
51
52 /**
53 * Updates the current variation settings

Callers 10

getVariationMethod · 0.95
getNameMethod · 0.95
getVersionMethod · 0.95
getVariationCountMethod · 0.95
runMethod · 0.80
_validateMetaImagesMethod · 0.80
runMethod · 0.80
renderer.module.jsFile · 0.80

Calls 2

getRawConfigMethod · 0.95
_getVariationMethod · 0.95

Tested by

no test coverage detected