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

Method constructor

lib/stencil-bundle.js:44–84  ·  view source on GitHub ↗
(
        themePath,
        themeConfig,
        rawConfig,
        options = {},
        buildConfigManager = new BuildConfigManager(),
    )

Source from the content-addressed store, hash-verified

42
43class Bundle {
44 constructor(
45 themePath,
46 themeConfig,
47 rawConfig,
48 options = {},
49 buildConfigManager = new BuildConfigManager(),
50 ) {
51 const tasks = {};
52 this.options = options;
53 this.templatesPath = path.join(themePath, 'templates');
54 this.themePath = themePath;
55 this.themeConfig = themeConfig;
56 this.configuration = rawConfig;
57 this.validator = new BundleValidator(
58 this.themePath,
59 this.themeConfig,
60 this.options.marketplace !== true,
61 );
62 if (this.configuration.css_compiler) {
63 tasks.css = this.getCssAssembleTask(this.configuration.css_compiler);
64 }
65 tasks.templates = this.assembleTemplatesTask.bind(this);
66 tasks.lang = this.assembleLangTask.bind(this);
67 tasks.schema = this.assembleSchema.bind(this);
68 tasks.schemaTranslations = this.assembleSchemaTranslations.bind(this);
69 tasks.stencilContext = this.assembleStencilContextTask.bind(this);
70 if (typeof buildConfigManager.production === 'function') {
71 tasks.theme = (callback) => {
72 console.log('Theme task Started...');
73 buildConfigManager.initWorker().production((err) => {
74 if (err) {
75 return callback(err);
76 }
77 console.log(`${'ok'.green} -- Theme task Finished`);
78 return callback();
79 });
80 };
81 }
82 this.tasks = tasks;
83 this._getExternalLibs = this._getExternalLibs.bind(this);
84 }
85
86 /**
87 * Initializes bundling process and executes all required tasks.

Callers

nothing calls this directly

Calls 3

getCssAssembleTaskMethod · 0.95
logMethod · 0.80
initWorkerMethod · 0.80

Tested by

no test coverage detected