From 97db6af60d658af708da2db83fad6e506b5cc8cf Mon Sep 17 00:00:00 2001 From: Aleksei Koziatinskii Date: Thu, 20 Jun 2019 09:00:27 -0700 Subject: [PATCH] fix(build): build should bundle ${app}.js file Content of this file might be different for different apps, e.g. worker calls Runtime.startWorker instead of Runtime.startApplication. --- front_end/ndb.js | 2 +- package-lock.json | 6 +++--- scripts/builder.js | 4 +++- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/front_end/ndb.js b/front_end/ndb.js index cd437950..77959640 100644 --- a/front_end/ndb.js +++ b/front_end/ndb.js @@ -2,4 +2,4 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -Runtime.startApplication('ndb_app'); +Runtime.startApplication('ndb'); diff --git a/package-lock.json b/package-lock.json index 25319a8f..6dd6cb14 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1334,9 +1334,9 @@ "integrity": "sha1-1PRWKwzjaW5BrFLQ4ALlemNdxtw=" }, "process-nextick-args": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-2.0.0.tgz", - "integrity": "sha512-MtEC1TqN0EU5nephaJ4rAtThHtC86dNN9qCuEhtshvpVBkAW5ZO7BASN9REnF9eoXGcRub+pFuKEpOHE+HbEMw==" + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-2.0.1.tgz", + "integrity": "sha512-3ouUOpQhtgrbOa17J7+uxOTpITYWaGP7/AhoR3+A+/1e9skrzelGi/dXzEYyvbxubEF6Wn2ypscTKiKJFFn1ag==" }, "progress": { "version": "2.0.2", diff --git a/scripts/builder.js b/scripts/builder.js index af8eeac9..47478085 100644 --- a/scripts/builder.js +++ b/scripts/builder.js @@ -248,11 +248,13 @@ async function buildApp(appNames, pathFolders, outFolder, minifyJS = code => cod notAutoStartModules.add(module.name); }); + const appScript = await loadSource(pathFolders, appName + '.js'); + let scriptContent = ''; scriptContent += '/* Runtime.js */\n' + runtime + '\n'; scriptContent += `allDescriptors.push(...${JSON.stringify(moduleDescriptors)});\n`; scriptContent += `applicationDescriptor = ${JSON.stringify(appDescriptor)};\n`; - scriptContent += `Runtime.startApplication('${appName}');\n`; + scriptContent += appScript; const visitedModule = new Set(); for (const [, module] of autoStartModulesByName) scriptContent += writeModule(modules, module, autoStartModulesByName, visitedModule);