@soundworks/core 3.3.0 → 3.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/server/Server.js +25 -4
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@soundworks/core",
3
- "version": "3.3.0",
3
+ "version": "3.3.1",
4
4
  "description": "full-stack javascript framework for distributed audio visual experiences on the web",
5
5
  "authors": [
6
6
  "Benjamin Matuszewski",
package/server/Server.js CHANGED
@@ -403,12 +403,23 @@ class Server {
403
403
  this.router.server = httpServer;
404
404
  return Promise.resolve();
405
405
  }).then(() => {
406
- if (this.templateEngine === null) {
407
- throw new Error('Undefined "server.templateEngine": please provide a valid template engine');
406
+ let nodeOnly = true; // do not throw if no browser clients are defined, very usefull for
407
+ // cleaning tests in particular
408
+
409
+ for (let clientType in this.config.app.clients) {
410
+ if (this.config.app.clients[clientType].target === 'browser') {
411
+ nodeOnly = false;
412
+ }
408
413
  }
409
414
 
410
- if (this.templateDirectory === null) {
411
- throw new Error('Undefined "server.templateDirectory": please provide a valid template directory');
415
+ if (!nodeOnly) {
416
+ if (this.templateEngine === null) {
417
+ throw new Error('Undefined "server.templateEngine": please provide a valid template engine');
418
+ }
419
+
420
+ if (this.templateDirectory === null) {
421
+ throw new Error('Undefined "server.templateDirectory": please provide a valid template directory');
422
+ }
412
423
  } // ------------------------------------------------------------
413
424
  // INIT ROUTING
414
425
  // ------------------------------------------------------------
@@ -427,6 +438,11 @@ class Server {
427
438
 
428
439
 
429
440
  for (let clientType in this._clientTypeActivitiesMap) {
441
+ // do nothing if client type is not registered in config
442
+ if (!(clientType in this.config.app.clients)) {
443
+ continue;
444
+ }
445
+
430
446
  if (clientType !== defaultClientType) {
431
447
  const clientTarget = this.config.app.clients[clientType].target;
432
448
 
@@ -441,6 +457,11 @@ class Server {
441
457
 
442
458
 
443
459
  for (let clientType in this._clientTypeActivitiesMap) {
460
+ // do nothing if client type is not registered in config
461
+ if (!(clientType in this.config.app.clients)) {
462
+ continue;
463
+ }
464
+
444
465
  if (clientType === defaultClientType) {
445
466
  const clientTarget = this.config.app.clients[clientType].target;
446
467