(
themePath,
themeConfig,
rawConfig,
options = {},
buildConfigManager = new BuildConfigManager(),
)
| 42 | |
| 43 | class 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. |
nothing calls this directly
no test coverage detected