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

Method _prodWorker

lib/BuildConfigManager.js:113–142  ·  view source on GitHub ↗
(done)

Source from the content-addressed store, hash-verified

111 }
112
113 _prodWorker(done) {
114 const callback = once(done);
115 if (!this._worker) {
116 process.nextTick(() => callback('worker initialization failed'));
117 return;
118 }
119 const timeoutId = setTimeout(() => {
120 this.stopWorker();
121 console.log(
122 'The process was timed out. Try to increase it by providing --timeout [number] option'
123 .yellow,
124 );
125 callback('worker timed out');
126 }, this.timeout);
127 this._onWorkerReady(() => {
128 clearTimeout(timeoutId);
129 // send a message to the worker to start bundling js
130 this._worker.send('production');
131 this._worker.on('message', (message) => {
132 if (message === 'done') {
133 this._worker.kill();
134 callback();
135 }
136 });
137 });
138 this._worker.on('close', () => {
139 callback('worker terminated');
140 clearTimeout(timeoutId);
141 });
142 }
143}
144export default BuildConfigManager;

Callers

nothing calls this directly

Calls 3

stopWorkerMethod · 0.95
_onWorkerReadyMethod · 0.95
logMethod · 0.80

Tested by

no test coverage detected