From 4161babce106a32fb1ac50034c84d6804206ea86 Mon Sep 17 00:00:00 2001
From: "p.mikolajczak@tkhtechnology.com"
Date: Tue, 4 Apr 2023 15:14:23 +0200
Subject: [PATCH 1/3] fix: Mitigate production vulnrabilities
---
.gitignore | 1 -
dist/bin/cli.js | 224 ++
dist/binaryModulesDetector.js | 80 +
dist/defaultDependencies.js | 8 +
dist/dependenciesManager.js | 181 ++
dist/desktop.js | 271 ++
dist/electron.js | 61 +
dist/electronApp.js | 876 ++++++
dist/electronAppScaffold.js | 142 +
dist/electronBuilder.js | 384 +++
dist/env.js | 239 ++
dist/index.js | 247 ++
dist/log.js | 75 +
dist/meteorApp.js | 923 ++++++
dist/meteorManager.js | 147 +
dist/packager.js | 142 +
dist/scripts/addToScripts.js | 24 +
dist/scripts/propagateVersion.js | 21 +
dist/scripts/utils/addScript.js | 50 +
dist/skeletonDependencies.js | 24 +
dist/utils.js | 328 +++
lib/electronApp.js | 21 +-
lib/meteorApp.js | 10 +-
package-lock.json | 2718 +++++++++++-------
package.json | 49 +-
plugins/bundler/bundler.js | 21 +-
tests/functional/electronApp.test.js | 2 +-
tests/functional/modules/localServer.test.js | 8 +-
tests/unit/meteorApp.test.js | 2 +-
29 files changed, 6164 insertions(+), 1115 deletions(-)
create mode 100644 dist/bin/cli.js
create mode 100644 dist/binaryModulesDetector.js
create mode 100644 dist/defaultDependencies.js
create mode 100644 dist/dependenciesManager.js
create mode 100644 dist/desktop.js
create mode 100644 dist/electron.js
create mode 100644 dist/electronApp.js
create mode 100644 dist/electronAppScaffold.js
create mode 100644 dist/electronBuilder.js
create mode 100644 dist/env.js
create mode 100644 dist/index.js
create mode 100644 dist/log.js
create mode 100644 dist/meteorApp.js
create mode 100644 dist/meteorManager.js
create mode 100644 dist/packager.js
create mode 100644 dist/scripts/addToScripts.js
create mode 100644 dist/scripts/propagateVersion.js
create mode 100644 dist/scripts/utils/addScript.js
create mode 100644 dist/skeletonDependencies.js
create mode 100644 dist/utils.js
diff --git a/.gitignore b/.gitignore
index fd027d5c..28f46c1a 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,6 +1,5 @@
node_modules
.idea
-dist
tests/_tmp_
tests/.__tmp_int
.npm
diff --git a/dist/bin/cli.js b/dist/bin/cli.js
new file mode 100644
index 00000000..683607e0
--- /dev/null
+++ b/dist/bin/cli.js
@@ -0,0 +1,224 @@
+#!/usr/bin/env node
+
+/* eslint-disable global-require */
+"use strict";
+
+var _fs = _interopRequireDefault(require("fs"));
+
+var _path = _interopRequireDefault(require("path"));
+
+var _assignIn = _interopRequireDefault(require("lodash/assignIn"));
+
+var _commander = _interopRequireDefault(require("commander"));
+
+var _shelljs = _interopRequireDefault(require("shelljs"));
+
+var _ = _interopRequireDefault(require("../.."));
+
+var _addScript = _interopRequireDefault(require("../scripts/utils/addScript"));
+
+function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
+
+const {
+ join
+} = _path.default;
+const cmd = process.argv[2];
+/* eslint-disable no-console */
+
+const {
+ log,
+ error,
+ info,
+ warn
+} = console;
+/* eslint-enable no-console */
+
+/**
+ * Looks for .meteor directory.
+ * @param {string} appPath - Meteor app path
+ */
+
+function isMeteorApp(appPath) {
+ const meteorPath = join(appPath, '.meteor');
+
+ try {
+ return _fs.default.statSync(meteorPath).isDirectory();
+ } catch (e) {
+ return false;
+ }
+}
+/**
+ * Just ensures a ddp url is set.
+ *
+ * @param {string|null} ddpUrl - the url that Meteor app connects to
+ * @returns {string|null}
+ */
+
+
+function getDdpUrl(ddpUrl = null) {
+ if (!ddpUrl && _commander.default.buildMeteor) {
+ info('no ddp_url specified, setting default: http://127.0.0.1:3000');
+ return 'http://127.0.0.1:3000';
+ }
+
+ return ddpUrl;
+} // --------------------------
+
+
+function collect(val, memo) {
+ memo.push(val);
+ return memo;
+}
+
+_commander.default.option('-b, --build-meteor', 'runs meteor to obtain the mobile build, kills it after').option('-t, --build-timeout ', 'timeout value when waiting for ' + 'meteor to build, default 600sec').option('-p, --port ', 'port on which meteor is running, when with -b this will be passed to meteor when obtaining the build').option('--production', 'builds meteor app with the production switch, uglifies contents ' + 'of .desktop, packs app to app.asar').option('-a, --android', 'force adding android as a mobile platform instead of ios').option('-s, --scaffold', 'will scaffold .desktop if not present').option('-i, --ignore-stderr [string]', 'only with -b, strings that when found will not terminate meteor build', collect, []).option('--meteor-settings ', 'only with -b, adds --settings options to meteor').option('--prod-debug', 'forces adding dev tools to a production build').option('--ia32', 'generate 32bit installer/package').option('--all-archs', 'generate 32bit and 64bit installers').option('--win', 'generate Windows installer').option('--linux', 'generate Linux installer').option('--mac', 'generate Mac installer').option('-d, --debug', 'run electron with debug switch');
+
+_commander.default.usage('[command] [options]').version(require('./../../package.json').version, '-V, --version').on('--help', () => {
+ log(' [ddp_url] - pass a ddp url if you want to use different one than used in meteor\'s --mobile-server');
+ log(' this will also work with -b');
+ log(' ');
+ log(' Examples:');
+ log('');
+ log(' ', ['# cd into meteor dir first', 'cd /your/meteor/app', 'meteor --mobile-server=127.0.0.1:3000', '', '# open new terminal, assuming you have done npm install --save-dev @meteor-community/meteor-desktop', 'npm run desktop -- init', 'npm run desktop'].join('\n '));
+ log('\n');
+});
+
+function verifyArgsSyntax() {
+ if (process.env.npm_config_argv) {
+ let npmArgv;
+
+ try {
+ const args = ['-b', '--build-meteor', '-t', '--build-timeout', '-p', '--port', '--production', '-a', '--android', '-s', '--scaffold', '--ia32', '--win', '--linux', '--all-archs', '--win', '--mac', '--meteor-settings'];
+ npmArgv = JSON.parse(process.env.npm_config_argv);
+
+ if (npmArgv.remain.length === 0 && npmArgv.original.length > 2) {
+ if (npmArgv.original.some(arg => !!~args.indexOf(arg))) {
+ warn('WARNING: seems that you might used the wrong console syntax, no ` --' + ' ` delimiter was found, be sure you are invoking meteor-desktop with' + ' it when passing commands or options -> ' + '`npm run desktop -- command --option`\n');
+ }
+ }
+ } catch (e) {// Not sure if `npm_config_argv` is always present...
+ }
+ }
+}
+
+function meteorDesktopFactory(ddpUrl, production = false) {
+ info(`METEOR-DESKTOP v${require('./../../package.json').version}\n`);
+ verifyArgsSyntax();
+ const input = process.cwd();
+
+ if (!isMeteorApp(input)) {
+ error(`not in a meteor app dir\n ${input}`);
+ process.exit();
+ }
+
+ if (!_commander.default.output) {
+ _commander.default.output = input;
+ }
+
+ if (production && !_commander.default.production) {
+ info('package/build-installer implies setting --production, setting it for you');
+ }
+
+ if (!_commander.default.buildMeteor) {
+ _commander.default.port = _commander.default.port || 3000;
+ info(`REMINDER: your Meteor project should be running now on port ${_commander.default.port}\n`);
+ }
+
+ if (_commander.default.prodDebug) {
+ info('!! WARNING: You are adding devTools to a production build !!\n');
+ }
+
+ const options = {
+ ddpUrl,
+ skipMobileBuild: _commander.default.buildMeteor ? !_commander.default.buildMeteor : true,
+ production: _commander.default.production || production
+ };
+ (0, _assignIn.default)(options, _commander.default);
+ return (0, _.default)(input, _commander.default.output, options);
+}
+
+function run(ddpUrl) {
+ meteorDesktopFactory(getDdpUrl(ddpUrl)).run();
+}
+
+function build(ddpUrl) {
+ meteorDesktopFactory(getDdpUrl(ddpUrl)).build();
+}
+
+function init() {
+ meteorDesktopFactory().init();
+}
+
+function justRun() {
+ meteorDesktopFactory().justRun();
+}
+
+function runPackager(ddpUrl) {
+ meteorDesktopFactory(getDdpUrl(ddpUrl), true).runPackager();
+}
+
+function buildInstaller(ddpUrl) {
+ meteorDesktopFactory(getDdpUrl(ddpUrl), true).buildInstaller();
+}
+
+function initTestsSupport() {
+ log('installing cross-env, ava, meteor-desktop-test-suite and spectron');
+ log('running `meteor npm install --save-dev cross-env ava spectron meteor-desktop-test-suite`');
+
+ const {
+ code
+ } = _shelljs.default.exec('meteor npm install --save-dev cross-env ava spectron meteor-desktop-test-suite');
+
+ if (code !== 0) {
+ warn('could not add cross-env, ava and spectron to your `devDependencies`, please do it' + ' manually');
+ }
+
+ const test = 'cross-env NODE_ENV=test ava .desktop/**/*.test.js -s --verbose';
+ const testWatch = 'cross-env NODE_ENV=test ava .desktop/**/*.test.js -s --verbose' + ' --watch --source .desktop';
+
+ function fail() {
+ error('\ncould not add entries to `scripts` in package.json');
+ log('please try to add it manually\n');
+ log(`test-desktop: ${test}`);
+ log(`test-desktop-watch: ${testWatch}`);
+ }
+
+ const packageJsonPath = _path.default.resolve(_path.default.join(process.cwd(), 'package.json'));
+
+ (0, _addScript.default)('test-desktop', test, packageJsonPath, fail);
+ (0, _addScript.default)('test-desktop-watch', testWatch, packageJsonPath, fail);
+ log('\nadded test-desktop and test-desktop-watch entries');
+ log('run the test with `npm run test-desktop`');
+}
+
+_commander.default.command('init').description('scaffolds .desktop dir in the meteor app').action(init);
+
+_commander.default.command('run [ddp_url]').description('(default) builds and runs desktop app').action(run);
+
+_commander.default.command('build [ddp_url]').description('builds your desktop app').action(build);
+
+_commander.default.command('build-installer [ddp_url]').description('creates the installer').action(buildInstaller);
+
+_commander.default.command('just-run').description('alias for running `electron .` in `.meteor/desktop-build`').action(justRun);
+
+_commander.default.command('package [ddp_url]').description('runs electron packager').action(runPackager);
+
+_commander.default.command('init-tests-support').description('prepares project for running functional tests of desktop app').action(initTestsSupport);
+
+if (process.argv.length === 2 || !~'-h|--help|run|init|build|build-installer|just-run|init-tests-support|package'.indexOf(cmd)) {
+ let {
+ argv
+ } = process;
+
+ if (process.argv.length === 2) {
+ argv.push('run');
+ } else {
+ let command = argv.splice(0, 2);
+ command = command.concat('run', argv);
+ argv = command;
+ }
+
+ _commander.default.parse(argv);
+} else {
+ _commander.default.parse(process.argv);
+}
+//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJuYW1lcyI6WyJqb2luIiwicGF0aCIsImNtZCIsInByb2Nlc3MiLCJhcmd2IiwibG9nIiwiZXJyb3IiLCJpbmZvIiwid2FybiIsImNvbnNvbGUiLCJpc01ldGVvckFwcCIsImFwcFBhdGgiLCJtZXRlb3JQYXRoIiwiZnMiLCJzdGF0U3luYyIsImlzRGlyZWN0b3J5IiwiZSIsImdldERkcFVybCI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vbW1hbmRdIFtvcHRpb25zXScpXG4gICAgLnZlcnNpb24ocmVxdWlyZSgnLi8uLi8uLi9wYWNrYWdlLmpzb24nKS52ZXJzaW9uLCAnLVYsIC0tdmVyc2lvbicpXG4gICAgLm9uKCctLWhlbHAnLCAoKSA9PiB7XG4gICAgICAgIGxvZygnICBbZGRwX3VybF0gLSBwYXNzIGEgZGRwIHVybCBpZiB5b3Ugd2FudCB0byB1c2UgZGlmZmVyZW50IG9uZSB0aGFuIHVzZWQgaW4gbWV0ZW9yXFwncyAtLW1vYmlsZS1zZXJ2ZXInKTtcbiAgICAgICAgbG9nKCcgICAgICAgICAgICAgIHRoaXMgd2lsbCBhbHNvIHdvcmsgd2l0aCAtYicpO1xuICAgICAgICBsb2coJyAgICAnKTtcbiAgICAgICAgbG9nKCcgIEV4YW1wbGVzOicpO1xuICAgICAgICBsb2coJycpO1xuICAgICAgICBsb2coXG4gICAgICAgICAgICAnICAgJyxcbiAgICAgICAgICAgIFtcbiAgICAgICAgICAgICAgICAnIyBjZCBpbnRvIG1ldGVvciBkaXIgZmlyc3QnLFxuICAgICAgICAgICAgICAgICdjZCAveW91ci9tZXRlb3IvYXBwJyxcbiAgICAgICAgICAgICAgICAnbWV0ZW9yIC0tbW9iaWxlLXNlcnZlcj0xMjcuMC4wLjE6MzAwMCcsXG4gICAgICAgICAgICAgICAgJycsXG4gICAgICAgICAgICAgICAgJyMgb3BlbiBuZXcgdGVybWluYWwsIGFzc3VtaW5nIHlvdSBoYXZlIGRvbmUgbnBtIGluc3RhbGwgLS1zYXZlLWRldiBAbWV0ZW9yLWNvbW11bml0eS9tZXRlb3ItZGVza3RvcCcsXG4gICAgICAgICAgICAgICAgJ25wbSBydW4gZGVza3RvcCAtLSBpbml0JyxcbiAgICAgICAgICAgICAgICAnbnBtIHJ1biBkZXNrdG9wJ1xuICAgICAgICAgICAgXS5qb2luKCdcXG4gICAgJylcbiAgICAgICAgKTtcbiAgICAgICAgbG9nKCdcXG4nKTtcbiAgICB9KTtcblxuXG5mdW5jdGlvbiB2ZXJpZnlBcmdzU3ludGF4KCkge1xuICAgIGlmIChwcm9jZXNzLmVudi5ucG1fY29uZmlnX2FyZ3YpIHtcbiAgICAgICAgbGV0IG5wbUFyZ3Y7XG4gICAgICAgIHRyeSB7XG4gICAgICAgICAgICBjb25zdCBhcmdzID0gWyctYicsICctLWJ1aWxkLW1ldGVvcicsICctdCcsICctLWJ1aWxkLXRpbWVvdXQnLCAnLXAnLCAnLS1wb3J0JyxcbiAgICAgICAgICAgICAgICAnLS1wcm9kdWN0aW9uJywgJy1hJywgJy0tYW5kcm9pZCcsICctcycsICctLXNjYWZmb2xkJywgJy0taWEzMicsICctLXdpbicsXG4gICAgICAgICAgICAgICAgJy0tbGludXgnLCAnLS1hbGwtYXJjaHMnLCAnLS13aW4nLCAnLS1tYWMnLCAnLS1tZXRlb3Itc2V0dGluZ3MnXTtcbiAgICAgICAgICAgIG5wbUFyZ3YgPSBKU09OLnBhcnNlKHByb2Nlc3MuZW52Lm5wbV9jb25maWdfYXJndik7XG4gICAgICAgICAgICBpZiAobnBtQXJndi5yZW1haW4ubGVuZ3RoID09PSAwICYmIG5wbUFyZ3Yub3JpZ2luYWwubGVuZ3RoID4gMikge1xuICAgICAgICAgICAgICAgIGlmIChucG1Bcmd2Lm9yaWdpbmFsLnNvbWUoYXJnID0+ICEhfmFyZ3MuaW5kZXhPZihhcmcpKSkge1xuICAgICAgICAgICAgICAgICAgICB3YXJuKCdXQVJOSU5HOiBzZWVtcyB0aGF0IHlvdSBtaWdodCB1c2VkIHRoZSB3cm9uZyBjb25zb2xlIHN5bnRheCwgbm8gYCAtLScgK1xuICAgICAgICAgICAgICAgICAgICAgICAgJyBgIGRlbGltaXRlciB3YXMgZm91bmQsIGJlIHN1cmUgeW91IGFyZSBpbnZva2luZyBtZXRlb3ItZGVza3RvcCB3aXRoJyArXG4gICAgICAgICAgICAgICAgICAgICAgICAnIGl0IHdoZW4gcGFzc2luZyBjb21tYW5kc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RUFDSDs7RUFDRHBELGtCQUFBLENBQVFpQixLQUFSLENBQWNoQyxJQUFkO0FBQ0gsQ0FYRCxNQVdPO0VBQ0hlLGtCQUFBLENBQVFpQixLQUFSLENBQWNqQyxPQUFPLENBQUNDLElBQXRCO0FBQ0gifQ==
\ No newline at end of file
diff --git a/dist/binaryModulesDetector.js b/dist/binaryModulesDetector.js
new file mode 100644
index 00000000..a074f7bb
--- /dev/null
+++ b/dist/binaryModulesDetector.js
@@ -0,0 +1,80 @@
+"use strict";
+
+Object.defineProperty(exports, "__esModule", {
+ value: true
+});
+exports.default = void 0;
+
+var _path = _interopRequireDefault(require("path"));
+
+var _isbinaryfile = _interopRequireDefault(require("isbinaryfile"));
+
+var _shelljs = _interopRequireDefault(require("shelljs"));
+
+var _log = _interopRequireDefault(require("./log"));
+
+function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
+
+_shelljs.default.config.fatal = true;
+/**
+ * Experimental module for detecting modules containing binary files.
+ * Based on the same functionality from electron-builder.
+ *
+ * @property {MeteorDesktop} $
+ * @class
+ */
+
+class BinaryModulesDetector {
+ /**
+ * @constructor
+ */
+ constructor(nodeModulesPath) {
+ this.log = new _log.default('binaryModulesDetector');
+ this.nodeModulesPath = nodeModulesPath;
+ } // TODO: make asynchronous
+
+
+ detect() {
+ this.log.verbose('detecting node modules with binary files');
+
+ const files = _shelljs.default.ls('-RAl', this.nodeModulesPath);
+
+ const extract = [];
+ files.forEach(file => {
+ const pathSplit = file.name.split(_path.default.posix.sep);
+ const dir = pathSplit[0];
+ const filename = pathSplit.pop();
+
+ if (extract.indexOf(dir) === -1 && !BinaryModulesDetector.shouldBeIgnored(dir, filename)) {
+ if (file.isFile()) {
+ let shouldUnpack = false;
+
+ if (file.name.endsWith('.dll') || file.name.endsWith('.exe') || file.name.endsWith('.dylib')) {
+ shouldUnpack = true;
+ } else if (_path.default.extname(file.name) === '') {
+ shouldUnpack = _isbinaryfile.default.sync(_path.default.join(this.nodeModulesPath, file.name));
+ }
+
+ if (shouldUnpack) {
+ this.log.debug(`binary file: ${file.name}`);
+ extract.push(dir);
+ }
+ }
+ }
+ });
+
+ if (extract.length > 0) {
+ this.log.verbose(`detected modules to be extracted: ${extract.join(', ')}`);
+ }
+
+ return extract;
+ }
+
+ static shouldBeIgnored(dir, filename) {
+ return dir === '.bin' || filename === '.DS_Store' || filename === 'LICENSE' || filename === 'README';
+ }
+
+}
+
+exports.default = BinaryModulesDetector;
+//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJuYW1lcyI6WyJzaGVsbCIsImNvbmZpZyIsImZhdGFsIiwiQmluYXJ5TW9kdWxlc0RldGVjdG9yIiwiY29uc3RydWN0b3IiLCJub2RlTW9kdWxlc1BhdGgiLCJsb2ciLCJMb2ciLCJkZXRlY3QiLCJ2ZXJib3NlIiwiZmlsZXMiLCJscyIsImV4dHJhY3QiLCJmb3JFYWNoIiwiZmlsZSIsInBhdGhTcGxpdCIsIm5hbWUiLCJzcGxpdCIsInBhdGgiLCJwb3NpeCIsInNlcCIsImRpciIsImZpbGVuYW1lIiwicG9wIiwiaW5kZXhPZiIsInNob3VsZEJlSWdub3JlZCIsImlzRmlsZSIsInNob3VsZFVucGFjayIsImVuZHNXaXRoIiwiZXh0bmFtZSIsImlzQmluYXJ5RmlsZSIsInN5bmMiLCJqb2luIiwiZGVidWciLCJwdXNoIiwibGVuZ3RoIl0sInNvdXJjZXMiOlsiLi4vbGliL2JpbmFyeU1vZHVsZXNEZXRlY3Rvci5qcyJdLCJzb3VyY2VzQ29udGVudCI6WyJpbXBvcnQgcGF0aCBmcm9tICdwYXRoJztcbmltcG9ydCBpc0JpbmFyeUZpbGUgZnJvbSAnaXNiaW5hcnlmaWxlJztcbmltcG9ydCBzaGVsbCBmcm9tICdzaGVsbGpzJztcblxuaW1wb3J0IExvZyBmcm9tICcuL2xvZyc7XG5cbnNoZWxsLmNvbmZpZy5mYXRhbCA9IHRydWU7XG4vKipc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XG4gICAgICAgICAgICBpZiAoZXh0cmFjdC5pbmRleE9mKGRpcikgPT09IC0xICYmXG4gICAgICAgICAgICAgICAgIUJpbmFyeU1vZHVsZXNEZXRlY3Rvci5zaG91bGRCZUlnbm9yZWQoZGlyLCBmaWxlbmFtZSlcbiAgICAgICAgICAgICkge1xuICAgICAgICAgICAgICAgIGlmIChmaWxlLmlzRmlsZSgpKSB7XG4gICAgICAgICAgICAgICAgICAgIGxldCBzaG91bGRVbnBhY2sgPSBmYWxzZTtcbiAgICAgICAgICAgICAgICAgICAgaWYgKGZpbGUubmFtZS5lbmRzV2l0aCgnLmRsbCcpIHx8IGZpbGUubmFtZS5lbmRzV2l0aCgnLmV4ZScpIHx8IGZpbGUubmFtZS5lbmRzV2l0aCgnLmR5bGliJykpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgIHNob3VsZFVucGFjayA9IHRydWU7XG4gICAgICAgICAgICAgICAgICAgIH0gZWxzZSBpZiAocGF0aC5leHRuYW1lKGZpbGUubmFtZSkgPT09ICcnKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICBzaG91bGRVbnBhY2sgPVxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlzQmluYXJ5RmlsZS5zeW5jKHBhdGguam9pbih0aGlzLm5vZGVNb2R1bGVzUGF0aCwgZmlsZS5uYW1lKSk7XG4gICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAgICAgaWYgKHNob3VsZFVucGFjaykge1xuICAgICAgICAgICAgICAgICAgICAgICAgdGhpcy5sb2cuZGVidWcoYGJpbmFyeSBmaWxlOiAke2ZpbGUubmFtZX1gKTtcbiAgICAgICAgICAgICAgICAgICAgICAgIGV4dHJhY3QucHVzaChkaXIpO1xuICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfVxuICAgICAgICB9KTtcbiAgICAgICAgaWYgKGV4dHJhY3QubGVuZ3RoID4gMCkge1xuICAgICAgICAgICAg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0JBQWVuQixJQUFJLENBQUNFLElBQUssRUFBekM7WUFDQUosT0FBTyxDQUFDc0IsSUFBUixDQUFhYixHQUFiO1VBQ0g7UUFDSjtNQUNKO0lBQ0osQ0F0QkQ7O0lBdUJBLElBQUlULE9BQU8sQ0FBQ3VCLE1BQVIsR0FBaUIsQ0FBckIsRUFBd0I7TUFDcEIsS0FBSzdCLEdBQUwsQ0FBU0csT0FBVCxDQUFrQixxQ0FBb0NHLE9BQU8sQ0FBQ29CLElBQVIsQ0FBYSxJQUFiLENBQW1CLEVBQXpFO0lBQ0g7O0lBQ0QsT0FBT3BCLE9BQVA7RUFDSDs7RUFFcUIsT0FBZmEsZUFBZSxDQUFDSixHQUFELEVBQU1DLFFBQU4sRUFBZ0I7SUFDbEMsT0FBT0QsR0FBRyxLQUFLLE1BQVIsSUFBa0JDLFFBQVEsS0FBSyxXQUEvQixJQUE4Q0EsUUFBUSxLQUFLLFNBQTNELElBQXdFQSxRQUFRLEtBQUssUUFBNUY7RUFDSDs7QUEvQ3NDIn0=
\ No newline at end of file
diff --git a/dist/defaultDependencies.js b/dist/defaultDependencies.js
new file mode 100644
index 00000000..c5232dcc
--- /dev/null
+++ b/dist/defaultDependencies.js
@@ -0,0 +1,8 @@
+"use strict";
+
+module.exports = {
+ electron: '11.5.0',
+ 'electron-builder': '23.3.1',
+ 'electron-packager': '15.4.0'
+};
+//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJuYW1lcyI6WyJtb2R1bGUiLCJleHBvcnRzIiwiZWxlY3Ryb24iXSwic291cmNlcyI6WyIuLi9saWIvZGVmYXVsdERlcGVuZGVuY2llcy5qcyJdLCJzb3VyY2VzQ29udGVudCI6WyJtb2R1bGUuZXhwb3J0cyA9IHtcbiAgICBlbGVjdHJvbjogJzExLjUuMCcsXG4gICAgJ2VsZWN0cm9uLWJ1aWxkZXInOiAnMjMuMy4xJyxcbiAgICAnZWxlY3Ryb24tcGFja2FnZXInOiAnMTUuNC4wJ1xufTtcbiJdLCJtYXBwaW5ncyI6Ijs7QUFBQUEsTUFBTSxDQUFDQyxPQUFQLEdBQWlCO0VBQ2JDLFFBQVEsRUFBRSxRQURHO0VBRWIsb0JBQW9CLFFBRlA7RUFHYixxQkFBcUI7QUFIUixDQUFqQiJ9
\ No newline at end of file
diff --git a/dist/dependenciesManager.js b/dist/dependenciesManager.js
new file mode 100644
index 00000000..d5d4ac90
--- /dev/null
+++ b/dist/dependenciesManager.js
@@ -0,0 +1,181 @@
+"use strict";
+
+Object.defineProperty(exports, "__esModule", {
+ value: true
+});
+exports.default = void 0;
+
+var _runtime = _interopRequireDefault(require("regenerator-runtime/runtime"));
+
+var _lodash = require("lodash");
+
+var _log = _interopRequireDefault(require("./log"));
+
+function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
+
+// eslint-disable-next-line no-unused-vars
+
+/**
+ * Utility class designed for merging dependencies list with simple validation and duplicate
+ * detection.
+ *
+ * @class
+ */
+class DependenciesManager {
+ /**
+ * @param {MeteorDesktop} $ - context
+ * @param {Object} defaultDependencies - core dependencies list
+ * @constructor
+ */
+ constructor($, defaultDependencies) {
+ this.log = new _log.default('dependenciesManager');
+ this.$ = $;
+ this.dependencies = defaultDependencies; // Regexes for matching certain types of dependencies version.
+ // https://docs.npmjs.com/files/package.json#dependencies
+
+ this.regexes = {
+ local: /^(\.\.\/|~\/|\.\/|\/)/,
+ git: /^git(\+(ssh|http)s?)?/,
+ github: /^\w+-?\w+(?!-)\//,
+ http: /^https?.+tar\.gz/,
+ file: /^file:/
+ }; // Check for commit hashes.
+
+ const gitCheck = {
+ type: 'regex',
+ regex: /#[a-f0-9]{7,40}/,
+ test: 'match',
+ message: 'git or github link must have a commit hash'
+ }; // Check for displaying warnings when npm package from local path is used.
+
+ const localCheck = {
+ onceName: 'localCheck',
+ type: 'warning',
+ message: 'using dependencies from local paths is permitted' + ' but dangerous - read more in README.md'
+ };
+ this.checks = {
+ local: localCheck,
+ file: localCheck,
+ git: gitCheck,
+ github: gitCheck,
+ version: {
+ type: 'regex',
+ // Matches all the semver ranges operators, empty strings and `*`.
+ regex: /[\^|><= ~-]|\.x|^$|^\*$/,
+ test: 'do not match',
+ message: 'semver ranges are forbidden, please specify exact version'
+ }
+ };
+ }
+ /**
+ * Just a public getter.
+ * @returns {Object}
+ */
+
+
+ getDependencies() {
+ return this.dependencies;
+ }
+ /**
+ * Returns local dependencies.
+ * @returns {Object}
+ */
+
+
+ getLocalDependencies() {
+ return Object.keys(this.dependencies).filter(dependency => this.regexes.local.test(this.dependencies[dependency]) || this.regexes.file.test(this.dependencies[dependency])).reduce((localDependencies, currentDependency) => Object.assign(localDependencies, {
+ [currentDependency]: this.dependencies[currentDependency]
+ }), {});
+ }
+ /**
+ * Returns remote dependencies.
+ * @returns {Object}
+ */
+
+
+ getRemoteDependencies() {
+ return Object.keys(this.dependencies).filter(dependency => !this.regexes.local.test(this.dependencies[dependency]) && !this.regexes.file.test(this.dependencies[dependency])).reduce((localDependencies, currentDependency) => Object.assign(localDependencies, {
+ [currentDependency]: this.dependencies[currentDependency]
+ }), {});
+ }
+ /**
+ * Merges dependencies into one list.
+ *
+ * @param {string} from - describes where the dependencies were set
+ * @param {Object} dependencies - dependencies list
+ */
+
+
+ mergeDependencies(from, dependencies) {
+ if (this.validateDependenciesVersions(from, dependencies)) {
+ this.detectDuplicatedDependencies(from, dependencies);
+ (0, _lodash.assignIn)(this.dependencies, dependencies);
+ }
+ }
+ /**
+ * Detects dependency version type.
+ * @param {string} version - version string of the dependency
+ * @return {string}
+ */
+
+
+ detectDependencyVersionType(version) {
+ const type = Object.keys(this.regexes).find(dependencyType => this.regexes[dependencyType].test(version));
+ return type || 'version';
+ }
+ /**
+ * Validates semver and detect ranges.
+ *
+ * @param {string} from - describes where the dependencies were set
+ * @param {Object} dependencies - dependencies list
+ */
+
+
+ validateDependenciesVersions(from, dependencies) {
+ const warningsShown = {};
+ (0, _lodash.forEach)(dependencies, (version, name) => {
+ const type = this.detectDependencyVersionType(version);
+
+ if (this.checks[type]) {
+ const check = this.checks[type];
+
+ if (check.type === 'regex') {
+ const checkResult = check.test === 'match' ? this.checks[type].regex.test(version) : !this.checks[type].regex.test(version);
+
+ if (!checkResult) {
+ throw new Error(`dependency ${name}:${version} from ${from} failed version ` + `check with message: ${this.checks[type].message}`);
+ }
+ }
+
+ if (check.type === 'warning' && !warningsShown[check.onceName]) {
+ warningsShown[check.onceName] = true;
+ this.log.warn(`dependency ${name}:${version} from ${from} caused a` + ` warning: ${check.message}`);
+ }
+ }
+ });
+ return true;
+ }
+ /**
+ * Detects duplicates.
+ *
+ * @param {string} from - describes where the dependencies were set
+ * @param {Object} dependencies - dependencies list
+ */
+
+
+ detectDuplicatedDependencies(from, dependencies) {
+ const duplicates = (0, _lodash.intersection)(Object.keys(dependencies), Object.keys(this.dependencies));
+
+ if (duplicates.length > 0) {
+ duplicates.forEach(name => {
+ if (dependencies[name] !== this.dependencies[name]) {
+ throw new Error(`While processing dependencies from ${from}, a dependency ` + `${name}: ${dependencies[name]} was found to be conflicting with a ` + `dependency (${this.dependencies[name]}) that was already declared in ` + 'other module or it is used in core of the electron app.');
+ }
+ });
+ }
+ }
+
+}
+
+exports.default = DependenciesManager;
+//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJuYW1lcyI6WyJEZXBlbmRlbmNpZXNNYW5hZ2VyIiwiY29uc3RydWN0b3IiLCIkIiwiZGVmYXVsdERlcGVuZGVuY2llcyIsImxvZyIsIkxvZyIsImRlcGVuZGVuY2llcyIsInJlZ2V4ZXMiLCJsb2NhbCIsImdpdCIsImdpdGh1YiIsImh0dHAiLCJmaWxlIiwiZ2l0Q2hlY2siLCJ0eXBlIiwicmVnZXgiLCJ0ZXN0IiwibWVzc2FnZSIsImxvY2FsQ2hlY2siLCJvbmNlTmFtZSIsImNoZWNrcyIsInZlcnNpb24iLCJnZXREZXBlbmRlbmNpZXMiLCJnZXRMb2NhbERl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HR5cGU6ICdyZWdleCcsXG4gICAgICAgICAgICByZWdleDogLyNbYS1mMC05XXs3LDQwfS8sXG4gICAgICAgICAgICB0ZXN0OiAnbWF0Y2gnLFxuICAgICAgICAgICAgbWVzc2FnZTogJ2dpdCBvciBnaXRodWIgbGluayBtdXN0IGhhdmUgYSBjb21taXQgaGFzaCdcbiAgICAgICAgfTtcblxuICAgICAgICAvLyBDaGVjayBmb3IgZGlzcGxheWluZyB3YXJuaW5ncyB3aGVuIG5wbSBwYWNrYWdlIGZyb20gbG9jYWwgcGF0aCBpcyB1c2VkLlxuICAgICAgICBjb25zdCBsb2NhbENoZWNrID0ge1xuICAgICAgICAgICAgb25jZU5hbWU6ICdsb2NhbENoZWNrJyxcbiAgICAgICAgICAgIHR5cGU6ICd3YXJuaW5nJyxcbiAgICAgICAgICAgIG1lc3NhZ2U6ICd1c2luZyBkZXBlbmRlbmNpZXMgZnJvbSBsb2NhbCBwYXRocyBpcyBwZXJtaXR0ZWQnICtcbiAgICAgICAgICAgICcgYnV0IGRhbmdlcm91cyAtIHJlYWQgbW9yZSBpbiBSRUFETUUubWQnXG4gICAgICAgIH07XG5cbiAgICAgICAgdGhpcy5jaGVja3MgPSB7XG4gICAgICAgICAgICBsb2NhbDogbG9jYWxDaGVjayxcbiAgICAgICAgICAgIGZpbGU6IGxvY2FsQ2hlY2ssXG4gICAgICAgICAgICBnaXQ6IGdpdENoZWNrLFxuICAgICAgICAgICAgZ2l0aHViOiBnaXRDaGVjayxcbiAgICAgICAgICAgIHZlcnNpb246IHtcbiAgICAgICAgICAgICAgICB0eXBlOiAncmVnZXgnLFxuICAgICAgICAgICAgICAgIC8vIE1hdGNoZXMgYWxsIHRoZSBzZW12ZXIgcmFuZ2VzIG9wZXJhdG9ycywgZW1wdHkgc3RyaW5ncyBhbmQgYCpgLlxuICAgICAgICAgICAgICAgIHJlZ2V4OiAvW1xcXnw+PD0gfi1dfFxcLnh8XiR8XlxcKiQvLFxuICAgICAgICAgICAgICAgIHRlc3Q6ICdkbyBub3QgbWF0Y2gnLFxuICAgICAgICAgICAgICAgIG1lc3NhZ2U6ICdzZW12ZXIgcmFuZ2VzIGFyZSBmb3JiaWRkZW4sIHBsZWFzZSBzcGVjaWZ5IGV4YWN0IHZlcnNpb24nXG4gICAgICAgICAgICB9XG4gICAgICAgIH07XG4gICAgfVxuXG4gICAgLyoqXG4gICAgICogSnVzdCBhIHB1YmxpYyBnZXR0ZXIuXG4gICAgICogQHJldHVybnMge09iamVjdH1cbiAgICAgKi9cbiAgICBnZXREZXBlbmRlbmNpZXMoKSB7XG4gICAgICAgIHJldHVybiB0aGlzLmRlcGVuZGVuY2llcztcbiAgICB9XG5cbiAgICAvKipcbiAgICAgKiBSZXR1cm5zIGxvY2FsIGRlcGVuZGVuY2llcy5cbiAgICAgKiBAcmV0dXJucyB7T2JqZWN0fVxuICAgICAqL1xuICAgIGdldExvY2FsRGVwZW5kZW5jaWVzKCkge1xuICAgICAgICByZXR1cm4gT2JqZWN0XG4gICAgICAgICAgICAua2V5cyh0aGlzLmRlcGVuZGVuY2llcylcbiAgICAgICAgICAgIC5maWx0ZXIoXG4gICAgICAgICAgICAgICAgZGVwZW5kZW5jeSA9PlxuICAgICAgICAgICAgICAgICAgICB0aGlzLnJlZ2V4ZXMubG9jYWwudGVzdCh0aGlzLmRlcGVuZGVuY2llc1tkZXBlbmRlbmN5XSkgfHxcbiAgICAgICAgICAgICAgICAgICAgdGhpcy5yZWdleGVzLmZpbGUudGVzdCh0aGlzLmRlcGVuZGVuY2llc1tkZXBlbmRlbmN5XSlcbiAgICAgICAgICAgIClcbiAgICAgICAgICAgIC5yZWR1Y2UoXG4gICAgICAgICAgICAgICAgKGxvY2FsRGVwZW5kZW5jaWVzLCBjdXJyZW50RGVwZW5kZW5jeSkgPT5cbiAgICAgICAgICAgICAgICAgICAgT2JqZWN0LmFzc2lnbihcbiAgICAgICAgICAgICAgICAgICAgICAgIGxvY2FsRGVwZW5kZW5jaWVzLFxuICAgICAgICAgICAgICAgICAgICAgICAgeyBbY3VycmVudERlcGVuZGVuY3ldOiB0aGlzLmRlcGVuZGVuY2llc1tjdXJyZW50RGVwZW5kZW5jeV0gfVxuICAgICAgICAgICAgICAgICAgICApLFxuICAgICAgICAgICAgICAgIHt9XG4gICAgICAgICAgICApO1xuICAgIH1cblxuICAgIC8qKlxuICAgICAqIFJldHVybnMgcmVtb3RlIGRlcGVuZGVuY2llcy5cbiAgICAgKiBAcmV0dXJucyB7T2JqZWN0fVxuICAgICAqL1xuICAgIGdldFJlbW90ZURlcGVuZGVuY2llcygpIHtcbiAgICAgICAgcmV0dXJuIE9iamVjdFxuICAgICAgICAgICAgLmtleXModGhpcy5kZXBlbmRlbmNpZXMpXG4gICAgICAgICAgICAuZmlsdGVyKFxuICAgICAgICAgICAgICAgIGRlcGVuZGVuY3kgPT5cbiAgICAgICAgICAgICAgICAgICAgIXRoaXMucmVnZXhlcy5sb2NhbC50ZXN0KHRoaXMuZGVwZW5kZW5jaWVzW2RlcGVuZGVuY3ldKSAmJlxuICAgICAgICAgICAgICAgICAgICAhdGhpcy5yZWdleGVzLmZpbGUudGVzdCh0aGlzLmRlcGVuZGVuY2llc1tkZXBlbmRlbmN5XSlcbiAgICAgICAgICAgIClcbiAgICAgICAgICAgIC5yZWR1Y2UoXG4gICAgICAgICAgICAgICAgKGxvY2FsRGVwZW5kZW5jaWVzLCBjdXJyZW50RGVwZW5kZW5jeSkgPT5cbiAgICAgICAgICAgICAgICAgICAgT2JqZWN0LmFzc2lnbihcbiAgICAgICAgICAgICAgICAgICAgICAgIGxvY2FsRGVwZW5kZW5jaWVzLFxuICAgICAgICAgICAgICAgICAgICAgICAgeyBbY3VycmVudERlcGVuZGVuY3ldOiB0aGlzLmRlcGVuZGVuY2llc1tjdXJyZW50RGVwZW5kZW5jeV0gfVxuICAgICAgICAgICAgICAgICAgICApLFxuICAgICAgICAgICAgICAgIHt9XG4gICAgICAgICAgICApO1xuICAgIH1cblxuICAgIC8qKlxuICAg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jeSAke25hbWV9OiR7dmVyc2lvbn0gZnJvbSAke2Zyb219IGZhaWxlZCB2ZXJzaW9uIGAgK1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGBjaGVjayB3aXRoIG1lc3NhZ2U6ICR7dGhpcy5jaGVja3NbdHlwZV0ubWVzc2FnZX1gKTtcbiAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICBpZiAoY2hlY2sudHlwZSA9PT0gJ3dhcm5pbmcnICYmICF3YXJuaW5nc1Nob3duW2NoZWNrLm9uY2VOYW1lXSkge1xuICAgICAgICAgICAgICAgICAgICB3YXJuaW5nc1Nob3duW2NoZWNrLm9uY2VOYW1lXSA9IHRydWU7XG4gICAgICAgICAgICAgICAgICAgIHRoaXMubG9nLndhcm4oYGRlcGVuZGVuY3kgJHtuYW1lfToke3ZlcnNpb259IGZyb20gJHtmcm9tfSBjYXVzZWQgYWAgK1xuICAgICAgICAgICAgICAgICAgICAgICAgYCB3YXJuaW5nOiAke2NoZWNrLm1lc3NhZ2V9YCk7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfVxuICAgICAgICB9KTtcbiAgICAgICAgcmV0dXJuIHRydWU7XG4gICAgfVxuXG4gICAgLyoqXG4gICAgICogRGV0ZWN0cyBkdXBsaWNhdGVzLlxuICAgICAqXG4gICAgICogQHBhcmFtIHtzdHJpbmd9IGZyb20gICAgICAgICAtIGRlc2NyaWJlcyB3aGVyZSB0aGUgZGVwZW5kZW5jaWVzIHdlcmUgc2V0XG4gICAgICogQHBhcmFtIHtPYmplY3R9IGRlcGVuZGVuY2llcyAtIGRlcGVuZGVuY2llcyBsaXN0XG4gICAgICovXG4gICAgZGV0ZWN0RHVwbGljYXRlZERlcGVuZGVuY2llcyhmcm9tLCBkZXBlbmRlbmNpZXMpIHtcbiAgICAgICAgY29uc3QgZHVwbGljYXRlcyA9IGludGVyc2VjdGlvbihPYmplY3Qua2V5cyhkZXBlb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QUFPLElBQVA7RUFDSDtFQUVEO0FBQ0o7QUFDQTtBQUNBO0FBQ0E7QUFDQTs7O0VBQ0ltQiw0QkFBNEIsQ0FBQ0YsSUFBRCxFQUFPNUIsWUFBUCxFQUFxQjtJQUM3QyxNQUFNMEMsVUFBVSxHQUFHLElBQUFDLG9CQUFBLEVBQWF6QixNQUFNLENBQUNDLElBQVAsQ0FBWW5CLFlBQVosQ0FBYixFQUF3Q2tCLE1BQU0sQ0FBQ0MsSUFBUCxDQUFZLEtBQUtuQixZQUFqQixDQUF4QyxDQUFuQjs7SUFDQSxJQUFJMEMsVUFBVSxDQUFDRSxNQUFYLEdBQW9CLENBQXhCLEVBQTJCO01BQ3ZCRixVQUFVLENBQUNOLE9BQVgsQ0FBb0JDLElBQUQsSUFBVTtRQUN6QixJQUFJckMsWUFBWSxDQUFDcUMsSUFBRCxDQUFaLEtBQXVCLEtBQUtyQyxZQUFMLENBQWtCcUMsSUFBbEIsQ0FBM0IsRUFBb0Q7VUFDaEQsTUFBTSxJQUFJRyxLQUFKLENBQVcsc0NBQXFDWixJQUFLLGlCQUEzQyxHQUNYLEdBQUVTLElBQUssS0FBSXJDLFlBQVksQ0FBQ3FDLElBQUQsQ0FBTyxzQ0FEbkIsR0FFWCxlQUFjLEtBQUtyQyxZQUFMLENBQWtCcUMsSUFBbEIsQ0FBd0IsaUNBRjNCLEdBR1oseURBSEUsQ0FBTjtRQUlIO01BQ0osQ0FQRDtJQVFIO0VBQ0o7O0FBakxvQyJ9
\ No newline at end of file
diff --git a/dist/desktop.js b/dist/desktop.js
new file mode 100644
index 00000000..3a5f1cd9
--- /dev/null
+++ b/dist/desktop.js
@@ -0,0 +1,271 @@
+"use strict";
+
+Object.defineProperty(exports, "__esModule", {
+ value: true
+});
+exports.default = void 0;
+
+var _runtime = _interopRequireDefault(require("regenerator-runtime/runtime"));
+
+var _shelljs = _interopRequireDefault(require("shelljs"));
+
+var _fs = _interopRequireDefault(require("fs"));
+
+var _path = _interopRequireDefault(require("path"));
+
+var _log = _interopRequireDefault(require("./log"));
+
+function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
+
+// eslint-disable-next-line no-unused-vars
+_shelljs.default.config.fatal = true;
+/**
+ * Checks if the path is empty.
+ * @param {string} searchPath
+ * @returns {boolean}
+ */
+
+function isEmptySync(searchPath) {
+ let stat;
+
+ try {
+ stat = _fs.default.statSync(searchPath);
+ } catch (e) {
+ return true;
+ }
+
+ if (stat.isDirectory()) {
+ const items = _fs.default.readdirSync(searchPath);
+
+ return !items || !items.length;
+ }
+
+ return false;
+}
+/**
+ * Represents the .desktop directory.
+ * @class
+ * @property {desktopSettings} settings
+ */
+
+
+class Desktop {
+ /**
+ * @param {MeteorDesktop} $ - context
+ *
+ * @constructor
+ */
+ constructor($) {
+ this.$ = $;
+ this.log = new _log.default('desktop');
+ this.settings = null;
+ this.dependencies = null;
+ }
+ /**
+ * Tries to read and returns settings.json contents from .desktop dir.
+ *
+ * @returns {desktopSettings|null}
+ */
+
+
+ getSettings() {
+ if (!this.settings) {
+ try {
+ this.settings = JSON.parse(_fs.default.readFileSync(this.$.env.paths.desktop.settings, 'UTF-8'));
+ } catch (e) {
+ this.log.error('error while trying to read \'.desktop/settings.json\': ', e);
+ process.exit(1);
+ }
+ }
+
+ return this.settings;
+ }
+ /**
+ * Returns a version hash representing current .desktop contents.
+ * @returns {string}
+ */
+
+
+ async getHashVersion() {
+ this.log.info('calculating hash version from .desktop contents');
+ const version = await this.$.utils.readFilesAndComputeHash(this.$.env.paths.desktop.root);
+ this.log.verbose(`calculated .desktop hash version is ${version.hash}`);
+ return version.hash;
+ }
+ /**
+ * Tries to read a module.json file from a module at provided path.
+ *
+ * @param {string} modulePath - path to the module dir
+ * @returns {Object}
+ */
+
+
+ getModuleConfig(modulePath) {
+ let moduleConfig = {};
+
+ try {
+ moduleConfig = JSON.parse(_fs.default.readFileSync(_path.default.join(modulePath, 'module.json'), 'UTF-8'));
+ } catch (e) {
+ this.log.error(`error while trying to read 'module.json' from '${modulePath}' module: `, e);
+ process.exit(1);
+ }
+
+ if (!('name' in moduleConfig)) {
+ this.log.error(`no 'name' field defined in 'module.json' in '${modulePath}' module.`);
+ process.exit(1);
+ }
+
+ return moduleConfig;
+ }
+ /**
+ * Scans all modules for module.json and gathers this configuration altogether.
+ *
+ * @returns {[]}
+ */
+
+
+ gatherModuleConfigs() {
+ const configs = [];
+
+ if (!isEmptySync(this.$.env.paths.desktop.modules)) {
+ _shelljs.default.ls('-d', _path.default.join(this.$.env.paths.desktop.modules, '*')).forEach(module => {
+ if (_fs.default.lstatSync(module).isDirectory()) {
+ const moduleConfig = this.getModuleConfig(module);
+ moduleConfig.dirName = _path.default.parse(module).name;
+ configs.push(moduleConfig);
+ }
+ });
+ }
+
+ return configs;
+ }
+ /**
+ * Summarizes all dependencies defined in .desktop.
+ *
+ * @params {Object} settings - settings.json
+ * @params {boolean} checkModules - whether to gather modules dependencies
+ * @params {boolean} refresh - recompute
+ * @returns {{fromSettings: {}, plugins: {}, modules: {}}}
+ */
+
+
+ getDependencies(settings = null, checkModules = true, refresh = false) {
+ if (!refresh && this.dependencies) {
+ return this.dependencies;
+ }
+
+ const dependencies = {
+ fromSettings: {},
+ plugins: {},
+ modules: {}
+ };
+ /** @type {desktopSettings} * */
+
+ const settingsJson = settings || this.getSettings(); // Settings can have a 'dependencies' field.
+
+ if ('dependencies' in settingsJson) {
+ dependencies.fromSettings = settingsJson.dependencies;
+ } // Plugins are also a npm packages.
+
+
+ if ('plugins' in settingsJson) {
+ dependencies.plugins = Object.keys(settingsJson.plugins).reduce((plugins, plugin) => {
+ /* eslint-disable no-param-reassign */
+ if (typeof settingsJson.plugins[plugin] === 'object') {
+ plugins[plugin] = settingsJson.plugins[plugin].version;
+ } else {
+ plugins[plugin] = settingsJson.plugins[plugin];
+ }
+
+ return plugins;
+ }, {});
+ } // Each module can have its own dependencies defined.
+
+
+ const moduleDependencies = {};
+
+ if (checkModules) {
+ const configs = this.gatherModuleConfigs();
+ configs.forEach(moduleConfig => {
+ if (!('dependencies' in moduleConfig)) {
+ moduleConfig.dependencies = {};
+ }
+
+ if (moduleConfig.name in moduleDependencies) {
+ this.log.error(`duplicate name '${moduleConfig.name}' in 'module.json' in ` + `'${moduleConfig.dirName}' - another module already registered the same name.`);
+ process.exit(1);
+ }
+
+ moduleDependencies[moduleConfig.name] = moduleConfig.dependencies;
+ });
+ }
+
+ dependencies.modules = moduleDependencies;
+ this.dependencies = dependencies;
+ return dependencies;
+ }
+ /**
+ * Copies the .desktop scaffold into the meteor app dir.
+ * Adds entry to .meteor/.gitignore.
+ */
+
+
+ scaffold() {
+ this.log.info('creating .desktop scaffold in your project');
+
+ if (this.$.utils.exists(this.$.env.paths.desktop.root)) {
+ this.log.warn('.desktop already exists - delete it if you want a new one to be ' + 'created');
+ return;
+ }
+
+ _shelljs.default.cp('-r', this.$.env.paths.scaffold, this.$.env.paths.desktop.root);
+
+ _shelljs.default.mkdir(this.$.env.paths.desktop.import);
+
+ this.log.info('.desktop directory prepared');
+ }
+ /**
+ * Verifies if all mandatory files are present in the .desktop.
+ *
+ * @returns {boolean}
+ */
+
+
+ check() {
+ this.log.verbose('checking .desktop existence');
+ return !!(this.$.utils.exists(this.$.env.paths.desktop.root) && this.$.utils.exists(this.$.env.paths.desktop.settings) && this.$.utils.exists(this.$.env.paths.desktop.desktop));
+ }
+
+}
+/**
+ * @typedef {Object} desktopSettings
+ * @property {string} name
+ * @property {string} projectName
+ * @property {boolean} devTools
+ * @property {boolean} devtron
+ * @property {boolean} desktopHCP
+ * @property {Object} squirrel
+ * @property {string} squirrel.autoUpdateFeedUrl
+ * @property {Object} squirrel.autoUpdateFeedHeaders
+ * @property {Object} squirrel.autoUpdateCheckOnStart
+ * @property {Object} desktopHCPSettings
+ * @property {boolean} desktopHCPSettings.ignoreCompatibilityVersion
+ * @property {boolean} desktopHCPSettings.blockAppUpdateOnDesktopIncompatibility
+ * @property {number} webAppStartupTimeout
+ * @property {Array} linkPackages
+ * @property {Array} exposedModules
+ * @property {Object} window
+ * @property {Object} windowDev
+ * @property {Object} packageJsonFields
+ * @property {Object} builderOptions
+ * @property {Object} builderCliOptions
+ * @property {Object} packagerOptions
+ * @property {Object} plugins
+ * @property {Object} dependencies
+ * @property {boolean} uglify
+ * @property {string} version
+ * */
+
+
+exports.default = Desktop;
+//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJuYW1lcyI6WyJzaGVsbCIsImNvbmZpZyIsImZhdGFsIiwiaXNFbXB0eVN5bmMiLCJzZWFyY2hQYXRoIiwic3RhdCIsImZzIiwic3RhdFN5bmMiLCJlIiwiaXNEaXJlY3RvcnkiLCJpdGVtcyIsInJlYWRkaXJTeW5jIiwibGVuZ3RoIiwiRGVza3RvcCIsImNvbnN0cnVjdG9yIiwiJCIsImxvZyIsIkxvZyIsInNldHRpbmdzIiwiZGVwZW5kZW5jaWVzIiwiZ2V0U2V0dGluZ3MiLCJKU09OIiwicGFyc2UiLCJyZWFkRmlsZVN5bmMiLCJlbnYiLCJwYXRocyIsImRlc2t0b3AiLCJlcnJvciIsInByb2Nlc3MiLCJleGl0IiwiZ2V0SGFzaFZlcnNpb24iLCJpbmZvIiwidmVyc2lvbiIsInV0aWxzIiwicmVhZEZpbGVzQW5kQ29tcHV0ZUhhc2giLCJyb290IiwidmVyYm9zZSIsImhhc2giLCJnZXRNb2R1bGVDb25maWciLCJtb2R1bGVQYXRoIiwibW9kdWxlQ29uZmlnIiwicGF0aCIsImpvaW4iLCJnYXRoZXJNb2R1bGVDb25maWdzIiwiY29uZmlncyIsIm1vZHVsZXMiLCJscyIsImZvckVhY2giLCJtb2R1bGUiLCJsc3RhdFN5bmMiLCJkaXJOYW1lIiwibmFtZSIsInB1c2giLCJnZXREZXBlbmRlbmNpZXMiLCJjaGVja01vZHVsZXMiLCJyZWZyZXNoIiwiZnJvbVNldHRpbmdzIiwicGx1Z2lucyIsInNldHRpbmdzSnNvbiIsIk9iamV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UmVwcmVzZW50cyB0aGUgLmRlc2t0b3AgZGlyZWN0b3J5LlxuICogQGNsYXNzXG4gKiBAcHJvcGVydHkge2Rlc2t0b3BTZXR0aW5nc30gc2V0dGluZ3NcbiAqL1xuZXhwb3J0IGRlZmF1bHQgY2xhc3MgRGVza3RvcCB7XG4gICAgLyoqXG4gICAgICogQHBhcmFtIHtNZXRlb3JEZXNrdG9wfSAkIC0gY29udGV4dFxuICAgICAqXG4gICAgICogQGNvbnN0cnVjdG9yXG4gICAgICovXG4gICAgY29uc3RydWN0b3IoJCkge1xuICAgICAgICB0aGlzLiQgPSAkO1xuICAgICAgICB0aGlzLmxvZyA9IG5ldyBMb2coJ2Rlc2t0b3AnKTtcbiAgICAgICAgdGhpcy5zZXR0aW5ncyA9IG51bGw7XG4gICAgICAgIHRoaXMuZGVwZW5kZW5jaWVzID0gbnVsbDtcbiAgICB9XG5cbiAgICAvKipcbiAgICAgKiBUcmllcyB0byByZWFkIGFuZCByZXR1cm5zIHNldHRpbmdzLmpzb24gY29udGVudHMgZnJvbSAuZGVza3RvcCBkaXIuXG4gICAgICpcbiAgICAgKiBAcmV0dXJucyB7ZGVza3RvcFNldHRpbmdzfG51bGx9XG4gICAgICovXG4gICAgZ2V0U2V0dGluZ3MoKSB7XG4gICAgICAgIGlmICghdGhpcy5zZXR0aW5ncykge1xuICAgICAgICAgICAgdHJ5IHtcbiAgICAgICAgICAgICAgICB0aGlzLnNldHRpbmdzID0gSlNPTi5wYXJzZShcbiAgICAgICAgICAgICAgICAgICAgZnMucmVhZEZpbGVTeW5jKHRoaXMuJC5lbnYucGF0aHMuZGVza3RvcC5zZXR0aW5ncywgJ1VURi04JylcbiAgICAgICAgICAgICAgICApO1xuICAgICAgICAgICAgfSBjYXRjaCAoZSkge1xuICAgICAgICAgICAgICAgIHRoaXMubG9nLmVycm9yKCdlcnJvciB3aGlsZSB0cnlpbmcgdG8gcmVhZCBcXCcuZGVza3RvcC9zZXR0aW5ncy5qc29uXFwnOiAn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dWxlQ29uZmlnID0gSlNPTi5wYXJzZShcbiAgICAgICAgICAgICAgICBmcy5yZWFkRmlsZVN5bmMocGF0aC5qb2luKG1vZHVsZVBhdGgsICdtb2R1bGUuanNvbicpLCAnVVRGLTgnKVxuICAgICAgICAgICAgKTtcbiAgICAgICAgfSBjYXRjaCAoZSkge1xuICAgICAgICAgICAgdGhpcy5sb2cuZXJyb3IoXG4gICAgICAgICAgICAgICAgYGVycm9yIHdoaWxlIHRyeWluZyB0byByZWFkICdtb2R1bGUuanNvbicgZnJvbSAnJHttb2R1bGVQYXRofScgbW9kdWxlOiBgLFxuICAgICAgICAgICAgICAgIGVcbiAgICAgICAgICAgICk7XG4gICAgICAgICAgICBwcm9jZXNzLmV4aXQoMSk7XG4gICAgICAgIH1cbiAgICAgICAgaWYgKCEoJ25hbWUnIGluIG1vZHVsZUNvbmZpZykpIHtcbiAgICAgICAgICAgIHRoaXMubG9nLmVycm9yKGBubyAnbmFtZScgZmllbGQgZGVmaW5lZCBpbiAnbW9kdWxlLmpzb24nIGluICcke21vZHVsZVBhdGh9JyBtb2R1bGUuYCk7XG4gICAgICAgICAgICBwcm9jZXNzLmV4aXQoMSk7XG4gICAgICAgIH1cbiAgICAgICAgcmV0dXJuIG1vZHVsZUNvbmZpZztcbiAgICB9XG5cbiAgICAvKipcbiAgICAgKiBTY2FucyBhbGwgbW9kdWxlcyBmb3IgbW9kdWxlLmpzb24gYW5kIGdhdGhlcnMgdGhpcyBjb25maWd1cmF0aW9uIGFsdG9nZXRoZXIuXG4gICAgICpcbiAgICAgKiBAcmV0dXJucyB7W119XG4gICAgICovXG4gICAgZ2F0aGVyTW9kdWxlQ29uZmlncygpIHtcbiAgICAgICAgY29uc3QgY29uZmlncyA9IFtdO1xuXG4gICAgICAgIGlmICghaXNFbXB0eVN5bmModGhpcy4kLmVudi5wYXRocy5kZXNrdG9wLm1vZHVsZXMpKSB7XG4gICAgICAgICAgICBzaGVsbC5scygnLWQnLCBwYXRoLmpvaW4odGhpcy4kLmVudi5wYXRocy5kZXNrdG9wLm1vZHVsZXMsICcqJykpLmZvckVhY2goXG4gICAgICAgICAgICAgICAgKG1vZHVsZSkgPT4ge1xuICAgICAgICAgICAgICAgICAgICBpZiAoZnMubHN0YXRTeW5jKG1vZHVsZSkuaXNEaXJlY3RvcnkoKSkge1xuICAgICAgICAgICAgICAgICAgICAgICAgY29uc3QgbW9kdWxlQ29uZmlnID0gdGhpcy5nZXRNb2R1bGVDb25maWcobW9kdWxlKTtcbiAgICAgICAgICAgICAgICAgICAgICAgIG1vZHVsZUNvbmZpZy5kaXJOYW1lID0gcGF0aC5wYXJzZShtb2R1bGUpLm5hbWU7XG4gICAgICAgICAgICAgICAgICAgICAgICBjb25maWdzLnB1c2gobW9kdWxlQ29uZmlnKTtcbiAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICk7XG4gICAgICAgIH1cbiAgICAgICAgcmV0dXJuIGNvbmZpZ3M7XG4gICAgfVxuXG4gICAgLyoqXG4gICAgICogU3VtbWFyaXplcyBhbGwgZGVwZW5kZW5jaWVzIGRlZmluZWQgaW4gLmRlc2t0b3AuXG4gICAgICpcbiAgICAgKiBAcGFyYW1zIHtPYmplY3R9IHNldHRpbmdzICAgICAgLSBzZXR0aW5ncy5qc29uXG4gICAgICogQHBhcmFtcyB7Ym9vbGVhbn0gY2hlY2tNb2R1bGVzIC0gd2hldGhlciB0byBnYXRoZXIgbW9kdWxlcyBkZXBlbmRlbmNpZXNcbiAgICAgKiBAcGFyYW1zIHtib29sZWFufSByZWZyZXNoICAgICAgLSByZWNvbXB1dGVcbiAgICAgKiBAcmV0dXJucyB7e2Zyb21TZXR0aW5nczoge30sIHBsdWdpbnM6IHt9LCBtb2R1bGVzOiB7fX19XG4gICAgICovXG4gICAgZ2V0RGVwZW5kZW5jaWVzKHNldHRpbmdzID0gbnVsbCwgY2hlY2tNb2R1bGVzID0gdHJ1ZSwgcmVmcmVzaCA9IGZ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4gICAgICAgICAgICAgICAgICAgIHBsdWdpbnNbcGx1Z2luXSA9IHNldHRpbmdzSnNvbi5wbHVnaW5zW3BsdWdpbl0udmVyc2lvbjtcbiAgICAgICAgICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgICAgICAgICBwbHVnaW5zW3BsdWdpbl0gPSBzZXR0aW5nc0pzb24ucGx1Z2luc1twbHVnaW5dO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICByZXR1cm4gcGx1Z2lucztcbiAgICAgICAgICAgIH0sIHt9KTtcbiAgICAgICAgfVxuXG4gICAgICAgIC8vIEVhY2ggbW9kdWxlIGNhbiBoYXZlIGl0cyBvd24gZGVwZW5kZW5jaWVzIGRlZmluZWQuXG4gICAgICAgIGNvbnN0IG1vZHVsZURlcGVuZGVuY2llcyA9IHt9O1xuICAgICAgICBpZiAoY2hlY2tNb2R1bGVzKSB7XG4gICAgICAgICAgICBjb25zdCBjb25maWdzID0gdGhpcy5nYXRoZXJNb2R1bGVDb25maWdzKCk7XG5cbiAgICAgICAgICAgIGNvbmZpZ3MuZm9yRWFjaChcbiAgICAgICAgICAgICAgICAobW9kdWxlQ29uZmlnKSA9PiB7XG4gICAgICAgICAgICAgICAgICAgIGlmICghKCdkZXBlbmRlbmNpZXMnIGluIG1vZHVsZUNvbmZpZykpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgIG1vZHVsZUNvbmZpZy5kZXBlbmRlbmNpZXMgPSB7fTtcbiAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgICBpZiAobW9kdWxlQ29uZmlnLm5hbWUgaW4gbW9kdWxlRGVwZW5kZW5jaWVzKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICB0aGlzLmxvZy5lcnJvcihgZHVwbGljYXRlIG5hbWUgJyR7bW9kdWxlQ29uZmlnLm5hbWV9JyBpbiAnbW9kdWxlLmpzb24nIGluIGAgK1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGA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O0VBQ0l1QyxLQUFLLEdBQUc7SUFDSixLQUFLdEQsR0FBTCxDQUFTb0IsT0FBVCxDQUFpQiw2QkFBakI7SUFDQSxPQUFPLENBQUMsRUFBRSxLQUFLckIsQ0FBTCxDQUFPa0IsS0FBUCxDQUFhZ0MsTUFBYixDQUFvQixLQUFLbEQsQ0FBTCxDQUFPUyxHQUFQLENBQVdDLEtBQVgsQ0FBaUJDLE9BQWpCLENBQXlCUyxJQUE3QyxLQUNOLEtBQUtwQixDQUFMLENBQU9rQixLQUFQLENBQWFnQyxNQUFiLENBQW9CLEtBQUtsRCxDQUFMLENBQU9TLEdBQVAsQ0FBV0MsS0FBWCxDQUFpQkMsT0FBakIsQ0FBeUJSLFFBQTdDLENBRE0sSUFFTixLQUFLSCxDQUFMLENBQU9rQixLQUFQLENBQWFnQyxNQUFiLENBQW9CLEtBQUtsRCxDQUFMLENBQU9TLEdBQVAsQ0FBV0MsS0FBWCxDQUFpQkMsT0FBakIsQ0FBeUJBLE9BQTdDLENBRkksQ0FBUjtFQUdIOztBQXpMd0I7QUE0TDdCO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBIn0=
\ No newline at end of file
diff --git a/dist/electron.js b/dist/electron.js
new file mode 100644
index 00000000..4b4a584d
--- /dev/null
+++ b/dist/electron.js
@@ -0,0 +1,61 @@
+"use strict";
+
+Object.defineProperty(exports, "__esModule", {
+ value: true
+});
+exports.default = void 0;
+
+var _runtime = _interopRequireDefault(require("regenerator-runtime/runtime"));
+
+var _crossSpawn = _interopRequireDefault(require("cross-spawn"));
+
+var _log = _interopRequireDefault(require("./log"));
+
+var _defaultDependencies = _interopRequireDefault(require("./defaultDependencies"));
+
+function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
+
+/**
+ * Simple Electron runner. Runs the project with the bin provided by the 'electron' package.
+ * @class
+ */
+class Electron {
+ constructor($) {
+ this.log = new _log.default('electron');
+ this.$ = $;
+ }
+
+ async init() {
+ this.electron = await this.$.getDependency('electron', _defaultDependencies.default.electron);
+ }
+
+ run() {
+ // Until: https://github.com/electron-userland/electron-prebuilt/pull/118
+ const {
+ env
+ } = process;
+ env.ELECTRON_ENV = 'development';
+ const cmd = [];
+
+ if (this.$.env.options.debug) {
+ cmd.push('--debug=5858');
+ }
+
+ cmd.push('.');
+ const child = (0, _crossSpawn.default)(this.electron.dependency, cmd, {
+ cwd: this.$.env.paths.electronApp.root,
+ env
+ }); // TODO: check if we can configure piping in spawn options
+
+ child.stdout.on('data', chunk => {
+ process.stdout.write(chunk);
+ });
+ child.stderr.on('data', chunk => {
+ process.stderr.write(chunk);
+ });
+ }
+
+}
+
+exports.default = Electron;
+//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJuYW1lcyI6WyJFbGVjdHJvbiIsImNvbnN0cnVjdG9yIiwiJCIsImxvZyIsIkxvZyIsImluaXQiLCJlbGVjdHJvbiIsImdldERlcGVuZGVuY3kiLCJkZWZhdWx0RGVwZW5kZW5jaWVzIiwicnVuIiwiZW52IiwicHJvY2VzcyIsIkVMRUNUUk9OX0VOViIsImNtZCIsIm9wdGlvbnMiLCJkZWJ1ZyIsInB1c2giLCJjaGlsZCIsInNwYXduIiwiZGVwZW5kZW5jeSIsImN3ZCIsInBhdGhzIiwiZWxlY3Ryb25BcHAiLCJyb290Iiwic3Rkb3V0Iiwib24iLCJjaHVuayIsIndyaXRlIiwic3RkZXJyIl0sInNvdXJjZXMiOlsiLi4vbGliL2VsZWN0cm9uLmpzIl0sInNvdXJjZXNDb250ZW50IjpbImltcG9ydCByZWdlbmVyYXRvclJ1bnRpbWUgZnJvbSAncmVnZW5lcmF0b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LFlBQUosR0FBbUIsYUFBbkI7SUFFQSxNQUFNQyxHQUFHLEdBQUcsRUFBWjs7SUFFQSxJQUFJLEtBQUtYLENBQUwsQ0FBT1EsR0FBUCxDQUFXSSxPQUFYLENBQW1CQyxLQUF2QixFQUE4QjtNQUMxQkYsR0FBRyxDQUFDRyxJQUFKLENBQVMsY0FBVDtJQUNIOztJQUVESCxHQUFHLENBQUNHLElBQUosQ0FBUyxHQUFUO0lBRUEsTUFBTUMsS0FBSyxHQUFHLElBQUFDLG1CQUFBLEVBQU0sS0FBS1osUUFBTCxDQUFjYSxVQUFwQixFQUFnQ04sR0FBaEMsRUFBcUM7TUFDL0NPLEdBQUcsRUFBRSxLQUFLbEIsQ0FBTCxDQUFPUSxHQUFQLENBQVdXLEtBQVgsQ0FBaUJDLFdBQWpCLENBQTZCQyxJQURhO01BRS9DYjtJQUYrQyxDQUFyQyxDQUFkLENBYkUsQ0FrQkY7O0lBQ0FPLEtBQUssQ0FBQ08sTUFBTixDQUFhQyxFQUFiLENBQWdCLE1BQWhCLEVBQXlCQyxLQUFELElBQVc7TUFDL0JmLE9BQU8sQ0FBQ2EsTUFBUixDQUFlRyxLQUFmLENBQXFCRCxLQUFyQjtJQUNILENBRkQ7SUFHQVQsS0FBSyxDQUFDVyxNQUFOLENBQWFILEVBQWIsQ0FBZ0IsTUFBaEIsRUFBeUJDLEtBQUQsSUFBVztNQUMvQmYsT0FBTyxDQUFDaUIsTUFBUixDQUFlRCxLQUFmLENBQXFCRCxLQUFyQjtJQUNILENBRkQ7RUFHSDs7QUFuQ3lCIn0=
\ No newline at end of file
diff --git a/dist/electronApp.js b/dist/electronApp.js
new file mode 100644
index 00000000..6e7966c3
--- /dev/null
+++ b/dist/electronApp.js
@@ -0,0 +1,876 @@
+"use strict";
+
+Object.defineProperty(exports, "__esModule", {
+ value: true
+});
+exports.default = void 0;
+
+var _runtime = _interopRequireDefault(require("regenerator-runtime/runtime"));
+
+var _asar = _interopRequireDefault(require("@electron/asar"));
+
+var _assignIn = _interopRequireDefault(require("lodash/assignIn"));
+
+var _lodash = _interopRequireDefault(require("lodash"));
+
+var _installLocal = require("install-local");
+
+var _core = require("@babel/core");
+
+var _crypto = _interopRequireDefault(require("crypto"));
+
+var _del = _interopRequireDefault(require("del"));
+
+var _presetEnv = _interopRequireDefault(require("@babel/preset-env"));
+
+var _fs = _interopRequireDefault(require("fs"));
+
+var _path = _interopRequireDefault(require("path"));
+
+var _shelljs = _interopRequireDefault(require("shelljs"));
+
+var _semver = _interopRequireDefault(require("semver"));
+
+var _terser = _interopRequireDefault(require("terser"));
+
+var _log = _interopRequireDefault(require("./log"));
+
+var _electronAppScaffold = _interopRequireDefault(require("./electronAppScaffold"));
+
+var _dependenciesManager = _interopRequireDefault(require("./dependenciesManager"));
+
+var _binaryModulesDetector = _interopRequireDefault(require("./binaryModulesDetector"));
+
+function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
+
+// eslint-disable-next-line no-unused-vars
+_shelljs.default.config.fatal = true;
+/**
+ * Represents the .desktop dir scaffold.
+ * @class
+ */
+
+class ElectronApp {
+ /**
+ * @param {MeteorDesktop} $ - context
+ * @constructor
+ */
+ constructor($) {
+ this.log = new _log.default('electronApp');
+ this.scaffold = new _electronAppScaffold.default($);
+ this.depsManager = new _dependenciesManager.default($, this.scaffold.getDefaultPackageJson().dependencies);
+ this.$ = $;
+ this.meteorApp = this.$.meteorApp;
+ this.packageJson = null;
+ this.version = null;
+ this.compatibilityVersion = null;
+ this.deprectatedPlugins = ['meteor-desktop-localstorage'];
+ }
+ /**
+ * Makes an app.asar from the skeleton app.
+ * @property {Array} excludeFromDel - list of paths to exclude from deleting
+ * @returns {Promise}
+ */
+
+
+ packSkeletonToAsar(excludeFromDel = []) {
+ this.log.info('packing skeleton app and node_modules to asar archive');
+ return new Promise(resolve => {
+ const extract = this.getModulesToExtract(); // We want to pack skeleton app and node_modules together, so we need to temporarily
+ // move node_modules to app dir.
+
+ this.log.debug('moving node_modules to app dir');
+
+ _fs.default.renameSync(this.$.env.paths.electronApp.nodeModules, _path.default.join(this.$.env.paths.electronApp.appRoot, 'node_modules'));
+
+ let extracted = false;
+ extracted = this.extractModules(extract);
+ this.log.debug('packing');
+
+ _asar.default.createPackage(this.$.env.paths.electronApp.appRoot, this.$.env.paths.electronApp.appAsar).then(() => {
+ // Lets move the node_modules back.
+ this.log.debug('moving node_modules back from app dir');
+
+ _shelljs.default.mv(_path.default.join(this.$.env.paths.electronApp.appRoot, 'node_modules'), this.$.env.paths.electronApp.nodeModules);
+
+ if (extracted) {
+ // We need to create a full node modules back. In other words we want
+ // the extracted modules back.
+ extract.forEach(module => _shelljs.default.cp('-rf', _path.default.join(this.$.env.paths.electronApp.extractedNodeModules, module), _path.default.join(this.$.env.paths.electronApp.nodeModules, module))); // Get the .bin back.
+
+ if (this.$.utils.exists(this.$.env.paths.electronApp.extractedNodeModulesBin)) {
+ _shelljs.default.cp(_path.default.join(this.$.env.paths.electronApp.extractedNodeModulesBin, '*'), _path.default.join(this.$.env.paths.electronApp.nodeModules, '.bin'));
+ }
+ }
+
+ this.log.debug('deleting source files');
+ const exclude = [this.$.env.paths.electronApp.nodeModules].concat([this.$.env.paths.electronApp.appAsar, this.$.env.paths.electronApp.packageJson], excludeFromDel);
+
+ _del.default.sync([`${this.$.env.paths.electronApp.root}${_path.default.sep}*`].concat(exclude.map(pathToExclude => `!${pathToExclude}`)), {
+ force: true
+ });
+
+ resolve();
+ });
+ });
+ }
+ /**
+ * Moves specified node modules to a separate directory.
+ * @param {Array} extract
+ * @returns {boolean}
+ */
+
+
+ extractModules(extract) {
+ const ext = ['.js', '.bat', '.sh', '.cmd', ''];
+
+ if (extract.length > 0) {
+ if (this.$.utils.exists(this.$.env.paths.electronApp.extractedNodeModules)) {
+ _shelljs.default.rm('-rf', this.$.env.paths.electronApp.extractedNodeModules);
+ }
+
+ _fs.default.mkdirSync(this.$.env.paths.electronApp.extractedNodeModules);
+
+ _fs.default.mkdirSync(this.$.env.paths.electronApp.extractedNodeModulesBin);
+
+ extract.forEach(module => {
+ _fs.default.renameSync(_path.default.join(this.$.env.paths.electronApp.appRoot, 'node_modules', module), _path.default.join(this.$.env.paths.electronApp.extractedNodeModules, module)); // Move bins.
+
+
+ this.extractBin(module, ext);
+ });
+ return true;
+ }
+
+ return false;
+ }
+ /**
+ * Extracts the bin files associated with a certain node modules.
+ *
+ * @param module
+ * @param ext
+ */
+
+
+ extractBin(module, ext) {
+ let packageJson;
+
+ try {
+ packageJson = JSON.parse(_fs.default.readFileSync(_path.default.join(this.$.env.paths.electronApp.extractedNodeModules, module, 'package.json'), 'utf8'));
+ } catch (e) {
+ packageJson = {};
+ }
+
+ const bins = 'bin' in packageJson && typeof packageJson.bin === 'object' ? Object.keys(packageJson.bin) : [];
+
+ if (bins.length > 0) {
+ bins.forEach(bin => {
+ ext.forEach(extension => {
+ const binFilePath = _path.default.join(this.$.env.paths.electronApp.appRoot, 'node_modules', '.bin', `${bin}${extension}`);
+
+ if (this.$.utils.exists(binFilePath) || this.$.utils.symlinkExists(binFilePath)) {
+ _fs.default.renameSync(binFilePath, _path.default.join(this.$.env.paths.electronApp.extractedNodeModulesBin, `${bin}${extension}`));
+ }
+ });
+ });
+ }
+ }
+ /**
+ * Merges the `extract` field with automatically detected modules.
+ */
+
+
+ getModulesToExtract() {
+ const binaryModulesDetector = new _binaryModulesDetector.default(this.$.env.paths.electronApp.nodeModules);
+ const toBeExtracted = binaryModulesDetector.detect();
+ let {
+ extract
+ } = this.$.desktop.getSettings();
+
+ if (!Array.isArray(extract)) {
+ extract = [];
+ }
+
+ const merge = {};
+ toBeExtracted.concat(extract).forEach(module => {
+ merge[module] = true;
+ });
+ extract = Object.keys(merge);
+
+ if (extract.length > 0) {
+ this.log.verbose(`resultant modules to extract list is: ${extract.join(', ')}`);
+ }
+
+ return extract;
+ }
+ /**
+ * Calculates a md5 from all dependencies.
+ */
+
+
+ calculateCompatibilityVersion() {
+ this.log.verbose('calculating compatibility version');
+ const settings = this.$.desktop.getSettings();
+
+ if ('desktopHCPCompatibilityVersion' in settings) {
+ this.compatibilityVersion = `${settings.desktopHCPCompatibilityVersion}`;
+ this.log.warn(`compatibility version overridden to ${this.compatibilityVersion}`);
+ return;
+ }
+
+ const md5 = _crypto.default.createHash('md5');
+
+ let dependencies = this.depsManager.getDependencies();
+ const dependenciesSorted = Object.keys(dependencies).sort();
+ dependencies = dependenciesSorted.map(dependency => `${dependency}:${dependencies[dependency]}`);
+ const mainCompatibilityVersion = this.$.getVersion().split('.');
+ this.log.debug('meteor-desktop compatibility version is ', `${mainCompatibilityVersion[0]}`);
+ dependencies.push(`meteor-desktop:${mainCompatibilityVersion[0]}`);
+ const desktopCompatibilityVersion = settings.version.split('.')[0];
+ this.log.debug('.desktop compatibility version is ', desktopCompatibilityVersion);
+ dependencies.push(`desktop-app:${desktopCompatibilityVersion}`);
+
+ if (process.env.METEOR_DESKTOP_DEBUG_DESKTOP_COMPATIBILITY_VERSION || process.env.METEOR_DESKTOP_DEBUG) {
+ this.log.debug(`compatibility version calculated from ${JSON.stringify(dependencies)}`);
+ }
+
+ md5.update(JSON.stringify(dependencies));
+ this.compatibilityVersion = md5.digest('hex');
+ }
+
+ async init() {
+ try {
+ await this.$.electron.init();
+ await this.$.electronBuilder.init();
+ } catch (e) {
+ this.log.warn('error occurred while initialising electron and electron-builder integration', e);
+ process.exit(1);
+ }
+ }
+ /**
+ * Runs all necessary tasks to build the desktopified app.
+ */
+
+
+ async build(run = false) {
+ // TODO: refactor to a task runner
+ this.log.info('scaffolding');
+
+ if (!this.$.desktop.check()) {
+ if (!this.$.env.options.scaffold) {
+ this.log.error('seems that you do not have a .desktop dir in your project or it is' + ' corrupted. Run \'npm run desktop -- init\' to get a new one.'); // Do not fail, so that npm will not print his error stuff to console.
+
+ process.exit(0);
+ } else {
+ this.$.desktop.scaffold();
+ this.$.meteorApp.updateGitIgnore();
+ }
+ }
+
+ await this.init();
+
+ try {
+ this.$.meteorApp.updateGitIgnore();
+ } catch (e) {
+ this.log.warn(`error occurred while adding ${this.$.env.paths.electronApp.rootName}` + 'to .gitignore: ', e);
+ }
+
+ try {
+ await this.$.meteorApp.removeDeprecatedPackages();
+ } catch (e) {
+ this.log.error('error while removing deprecated packages: ', e);
+ process.exit(1);
+ }
+
+ try {
+ await this.$.meteorApp.ensureDesktopHCPPackages();
+ } catch (e) {
+ this.log.error('error while checking for required packages: ', e);
+ process.exit(1);
+ }
+
+ try {
+ await this.scaffold.make();
+ } catch (e) {
+ this.log.error('error while scaffolding: ', e);
+ process.exit(1);
+ }
+
+ try {
+ const fileName = '.npmrc';
+ const dirName = '.meteor/desktop-build';
+
+ if (_fs.default.existsSync(dirName) && _fs.default.existsSync(fileName)) {
+ _fs.default.copyFileSync(fileName, `${dirName}/${fileName}`);
+ }
+ } catch (e) {
+ this.log.warn('error while copying .npmrc', e);
+ }
+
+ try {
+ await this.exposeElectronModules();
+ } catch (e) {
+ this.log.error('error while exposing electron modules: ', e);
+ process.exit(1);
+ }
+
+ try {
+ this.updatePackageJsonFields();
+ } catch (e) {
+ this.log.error('error while updating package.json: ', e);
+ }
+
+ try {
+ this.updateDependenciesList();
+ } catch (e) {
+ this.log.error('error while merging dependencies list: ', e);
+ }
+
+ try {
+ this.calculateCompatibilityVersion();
+ } catch (e) {
+ this.log.error('error while calculating compatibility version: ', e);
+ process.exit(1);
+ }
+
+ try {
+ await this.handleTemporaryNodeModules();
+ } catch (e) {
+ this.log.error('error occurred while handling temporary node_modules: ', e);
+ process.exit(1);
+ }
+
+ let nodeModulesRemoved;
+
+ try {
+ nodeModulesRemoved = await this.handleStateOfNodeModules();
+ } catch (e) {
+ this.log.error('error occurred while clearing node_modules: ', e);
+ process.exit(1);
+ }
+
+ try {
+ await this.rebuildDeps(true);
+ } catch (e) {
+ this.log.error('error occurred while installing node_modules: ', e);
+ process.exit(1);
+ }
+
+ if (!nodeModulesRemoved) {
+ try {
+ await this.rebuildDeps();
+ } catch (e) {
+ this.log.error('error occurred while rebuilding native node modules: ', e);
+ process.exit(1);
+ }
+ }
+
+ try {
+ await this.linkNpmPackages();
+ } catch (e) {
+ this.log.error(`linking packages failed: ${e}`);
+ process.exit(1);
+ }
+
+ try {
+ await this.installLocalNodeModules();
+ } catch (e) {
+ this.log.error('error occurred while installing local node modules: ', e);
+ process.exit(1);
+ }
+
+ try {
+ await this.ensureMeteorDependencies();
+ } catch (e) {
+ this.log.error('error occurred while ensuring meteor dependencies are installed: ', e);
+ process.exit(1);
+ }
+
+ if (this.$.env.isProductionBuild()) {
+ try {
+ await this.packSkeletonToAsar();
+ } catch (e) {
+ this.log.error('error while packing skeleton to asar: ', e);
+ process.exit(1);
+ }
+ } // TODO: find a way to avoid copying .desktop to a temp location
+
+
+ try {
+ this.copyDesktopToDesktopTemp();
+ } catch (e) {
+ this.log.error('error while copying .desktop to a temporary location: ', e);
+ process.exit(1);
+ }
+
+ try {
+ await this.updateSettingsJsonFields();
+ } catch (e) {
+ this.log.error('error while updating settings.json: ', e);
+ process.exit(1);
+ }
+
+ try {
+ await this.excludeFilesFromArchive();
+ } catch (e) {
+ this.log.error('error while excluding files from packing to asar: ', e);
+ process.exit(1);
+ }
+
+ try {
+ await this.transpileAndMinify();
+ } catch (e) {
+ this.log.error('error while transpiling or minifying: ', e);
+ }
+
+ try {
+ await this.packDesktopToAsar();
+ } catch (e) {
+ this.log.error('error occurred while packing .desktop to asar: ', e);
+ process.exit(1);
+ }
+
+ try {
+ await this.getMeteorClientBuild();
+ } catch (e) {
+ this.log.error('error occurred during getting meteor mobile build: ', e);
+ }
+
+ if (run) {
+ this.log.info('running');
+ this.$.electron.run();
+ } else {
+ this.log.info('built');
+ }
+ }
+ /**
+ * Copies the `exposedModules` setting from `settings.json` into `preload.js` modifying its code
+ * so that the script will have it hardcoded.
+ */
+
+
+ exposeElectronModules() {
+ const {
+ exposedModules
+ } = this.$.desktop.getSettings();
+
+ if (exposedModules && Array.isArray(exposedModules) && exposedModules.length > 0) {
+ let preload = _fs.default.readFileSync(this.$.env.paths.electronApp.preload, 'utf8');
+
+ const modules = this.$.desktop.getSettings().exposedModules.reduce( // eslint-disable-next-line no-return-assign,no-param-reassign
+ (prev, module) => (prev += `'${module}', `, prev), '');
+ preload = preload.replace('const exposedModules = [', `const exposedModules = [${modules}`);
+
+ _fs.default.writeFileSync(this.$.env.paths.electronApp.preload, preload);
+ }
+ }
+ /**
+ * Ensures all required dependencies are added to the Meteor project.
+ * @returns {Promise.}
+ */
+
+
+ async ensureMeteorDependencies() {
+ let packages = [];
+ const packagesWithVersion = [];
+ let plugins = 'plugins [';
+ Object.keys(this.$.desktop.getDependencies().plugins).forEach(plugin => {
+ // Read package.json of the plugin.
+ const packageJson = JSON.parse(_fs.default.readFileSync(_path.default.join(this.$.env.paths.electronApp.nodeModules, plugin, 'package.json'), 'utf8'));
+
+ if ('meteorDependencies' in packageJson && typeof packageJson.meteorDependencies === 'object') {
+ plugins += `${plugin}, `;
+ packages.unshift(...Object.keys(packageJson.meteorDependencies));
+ packagesWithVersion.unshift(...packages.map(packageName => {
+ if (packageJson.meteorDependencies[packageName] === '@version') {
+ return `${packageName}@${packageJson.version}`;
+ }
+
+ return `${packageName}@${packageJson.meteorDependencies[packageName]}`;
+ }));
+ }
+ });
+ const packagesCount = packages.length;
+ packages = packages.filter(value => !this.deprectatedPlugins.includes(value));
+
+ if (packagesCount !== packages.length) {
+ this.log.warn('you have some deprecated meteor desktop plugins in your settings, please remove ' + `them (deprecated plugins: ${this.deprectatedPlugins.join(', ')})`);
+ }
+
+ if (packages.length > 0) {
+ plugins = `${plugins.substr(0, plugins.length - 2)}]`;
+
+ try {
+ await this.$.meteorApp.meteorManager.ensurePackages(packages, packagesWithVersion, plugins);
+ } catch (e) {
+ throw new Error(e);
+ }
+ }
+ }
+ /**
+ * Builds meteor app.
+ */
+
+
+ async getMeteorClientBuild() {
+ await this.$.meteorApp.build();
+ }
+ /**
+ * Removes node_modules if needed.
+ * @returns {Promise}
+ */
+
+
+ async handleStateOfNodeModules() {
+ if (this.$.env.isProductionBuild() || this.$.env.options.ia32) {
+ if (!this.$.env.isProductionBuild()) {
+ this.log.info('clearing node_modules because we need to have it clear for ia32 rebuild');
+ } else {
+ this.log.info('clearing node_modules because this is a production build');
+ }
+
+ try {
+ await this.$.utils.rmWithRetries('-rf', this.$.env.paths.electronApp.nodeModules);
+ } catch (e) {
+ throw new Error(e);
+ }
+
+ return true;
+ }
+
+ return false;
+ }
+ /**
+ * If there is a temporary node_modules folder and no node_modules folder, we will
+ * restore it, as it might be a leftover from an interrupted flow.
+ * @returns {Promise}
+ */
+
+
+ async handleTemporaryNodeModules() {
+ if (this.$.utils.exists(this.$.env.paths.electronApp.tmpNodeModules)) {
+ if (!this.$.utils.exists(this.$.env.paths.electronApp.nodeModules)) {
+ this.log.debug('moving temp node_modules back');
+
+ _shelljs.default.mv(this.$.env.paths.electronApp.tmpNodeModules, this.$.env.paths.electronApp.nodeModules);
+ } else {
+ // If there is a node_modules folder, we should clear the temporary one.
+ this.log.debug('clearing temp node_modules because new one is already created');
+
+ try {
+ await this.$.utils.rmWithRetries('-rf', this.$.env.paths.electronApp.tmpNodeModules);
+ } catch (e) {
+ throw new Error(e);
+ }
+ }
+ }
+ }
+ /**
+ * Runs npm link for every package specified in settings.json->linkPackages.
+ */
+
+
+ async linkNpmPackages() {
+ if (this.$.env.isProductionBuild()) {
+ return;
+ }
+
+ const settings = this.$.desktop.getSettings();
+ const promises = [];
+
+ if ('linkPackages' in this.$.desktop.getSettings()) {
+ if (Array.isArray(settings.linkPackages)) {
+ settings.linkPackages.forEach(packageName => promises.push(this.$.meteorApp.runNpm(['link', packageName], undefined, this.$.env.paths.electronApp.root)));
+ }
+ }
+
+ await Promise.all(promises);
+ }
+ /**
+ * Runs npm in the electron app to get the dependencies installed.
+ * @returns {Promise}
+ */
+
+
+ async ensureDeps() {
+ this.log.info('installing dependencies');
+
+ if (this.$.utils.exists(this.$.env.paths.electronApp.nodeModules)) {
+ this.log.debug('running npm prune to wipe unneeded dependencies');
+
+ try {
+ await this.runNpm(['prune']);
+ } catch (e) {
+ throw new Error(e);
+ }
+ }
+
+ try {
+ await this.runNpm(['install'], this.$.env.stdio);
+ } catch (e) {
+ throw new Error(e);
+ }
+ }
+ /**
+ * Warns if plugins version are outdated in compare to the newest scaffold.
+ * @param {Object} pluginsVersions - current plugins versions from settings.json
+ */
+
+
+ checkPluginsVersion(pluginsVersions) {
+ const settingsJson = JSON.parse(_fs.default.readFileSync(_path.default.join(this.$.env.paths.scaffold, 'settings.json')));
+ const scaffoldPluginsVersion = this.$.desktop.getDependencies(settingsJson, false).plugins;
+ Object.keys(pluginsVersions).forEach(pluginName => {
+ if (pluginName in scaffoldPluginsVersion && scaffoldPluginsVersion[pluginName] !== pluginsVersions[pluginName] && _semver.default.lt(pluginsVersions[pluginName], scaffoldPluginsVersion[pluginName])) {
+ this.log.warn(`you are using outdated version ${pluginsVersions[pluginName]} of ` + `${pluginName}, the suggested version to use is ` + `${scaffoldPluginsVersion[pluginName]}`);
+ }
+ });
+ }
+ /**
+ * Merges core dependency list with the dependencies from .desktop.
+ */
+
+
+ updateDependenciesList() {
+ this.log.info('updating list of package.json\'s dependencies');
+ const desktopDependencies = this.$.desktop.getDependencies();
+ this.checkPluginsVersion(desktopDependencies.plugins);
+ this.log.debug('merging settings.json[dependencies]');
+ this.depsManager.mergeDependencies('settings.json[dependencies]', desktopDependencies.fromSettings);
+ this.log.debug('merging settings.json[plugins]');
+ this.depsManager.mergeDependencies('settings.json[plugins]', desktopDependencies.plugins);
+ this.log.debug('merging dependencies from modules');
+ Object.keys(desktopDependencies.modules).forEach(module => this.depsManager.mergeDependencies(`module[${module}]`, desktopDependencies.modules[module]));
+ this.packageJson.dependencies = this.depsManager.getRemoteDependencies();
+ this.packageJson.localDependencies = this.depsManager.getLocalDependencies();
+ this.log.debug('writing updated package.json');
+
+ _fs.default.writeFileSync(this.$.env.paths.electronApp.packageJson, JSON.stringify(this.packageJson, null, 2));
+ }
+ /**
+ * Install node modules from local paths using local-install.
+ *
+ * @param {string} arch
+ * @returns {Promise}
+ */
+
+
+ installLocalNodeModules(arch = this.$.env.options.ia32 || process.arch === 'ia32' ? 'ia32' : 'x64') {
+ const localDependencies = _lodash.default.values(this.packageJson.localDependencies);
+
+ if (localDependencies.length === 0) {
+ return Promise.resolve();
+ }
+
+ this.log.info('installing local node modules');
+ const lastRebuild = this.$.electronBuilder.prepareLastRebuildObject(arch);
+ const env = this.$.electronBuilder.getGypEnv(lastRebuild.frameworkInfo, lastRebuild.platform, lastRebuild.arch);
+ const installer = new _installLocal.LocalInstaller({
+ [this.$.env.paths.electronApp.root]: localDependencies
+ }, {
+ npmEnv: env
+ });
+ (0, _installLocal.progress)(installer);
+ return installer.install();
+ }
+ /**
+ * Rebuild binary dependencies against Electron's node headers.
+ * @returns {Promise}
+ */
+
+
+ rebuildDeps(install = false) {
+ if (install) {
+ this.log.info('issuing node_modules install from electron-builder');
+ } else {
+ this.log.info('issuing native modules rebuild from electron-builder');
+ }
+
+ const arch = this.$.env.options.ia32 || process.arch === 'ia32' ? 'ia32' : 'x64';
+
+ if (this.$.env.options.ia32) {
+ this.log.verbose('forcing rebuild for 32bit');
+ } else {
+ this.log.verbose(`rebuilding for ${arch}`);
+ }
+
+ return this.$.electronBuilder.installOrRebuild(arch, undefined, install);
+ }
+ /**
+ * Update package.json fields accordingly to what is set in settings.json.
+ *
+ * packageJson.name = settings.projectName
+ * packageJson.version = settings.version
+ * packageJson.* = settings.packageJsonFields
+ */
+
+
+ updatePackageJsonFields() {
+ this.log.verbose('updating package.json fields');
+ const settings = this.$.desktop.getSettings();
+ /** @type {desktopSettings} */
+
+ const packageJson = this.scaffold.getDefaultPackageJson();
+ packageJson.version = settings.version;
+
+ if ('packageJsonFields' in settings) {
+ (0, _assignIn.default)(packageJson, settings.packageJsonFields);
+ }
+
+ (0, _assignIn.default)(packageJson, {
+ name: settings.projectName
+ });
+ this.log.debug('writing updated package.json');
+
+ _fs.default.writeFileSync(this.$.env.paths.electronApp.packageJson, JSON.stringify(packageJson, null, 4));
+
+ this.packageJson = packageJson;
+ }
+ /**
+ * Updates settings.json with env (prod/dev) information and versions.
+ */
+
+
+ async updateSettingsJsonFields() {
+ this.log.debug('updating settings.json fields');
+ const settings = this.$.desktop.getSettings(); // Save versions.
+
+ settings.compatibilityVersion = this.compatibilityVersion; // Pass information about build type to the settings.json.
+
+ settings.env = this.$.env.isProductionBuild() ? 'prod' : 'dev';
+ const version = await this.$.desktop.getHashVersion();
+ settings.desktopVersion = `${version}_${settings.env}`;
+ settings.meteorDesktopVersion = this.$.getVersion();
+
+ if (this.$.env.options.prodDebug) {
+ settings.prodDebug = true;
+ }
+
+ _fs.default.writeFileSync(this.$.env.paths.desktopTmp.settings, JSON.stringify(settings, null, 4));
+ }
+ /**
+ * Copies files from prepared .desktop to desktop.asar in electron app.
+ */
+
+
+ packDesktopToAsar() {
+ this.log.info('packing .desktop to asar');
+ return new Promise((resolve, reject) => {
+ _asar.default.createPackage(this.$.env.paths.desktopTmp.root, this.$.env.paths.electronApp.desktopAsar).then(() => {
+ this.log.verbose('clearing temporary .desktop');
+ this.$.utils.rmWithRetries('-rf', this.$.env.paths.desktopTmp.root).then(() => {
+ resolve();
+ }).catch(e => {
+ reject(e);
+ });
+ resolve();
+ });
+ });
+ }
+ /**
+ * Makes a temporary copy of .desktop.
+ */
+
+
+ copyDesktopToDesktopTemp() {
+ this.log.verbose('copying .desktop to temporary location');
+
+ _shelljs.default.cp('-rf', this.$.env.paths.desktop.root, this.$.env.paths.desktopTmp.root); // Remove test files.
+
+
+ _del.default.sync([_path.default.join(this.$.env.paths.desktopTmp.root, '**', '*.test.js')], {
+ force: true
+ });
+ }
+ /**
+ * Runs babel and uglify over .desktop if requested.
+ */
+
+
+ async transpileAndMinify() {
+ this.log.info('transpiling and uglifying');
+ const settings = this.$.desktop.getSettings();
+ const options = 'uglifyOptions' in settings ? settings.uglifyOptions : {};
+ const uglifyingEnabled = 'uglify' in settings && !!settings.uglify;
+ const preset = (0, _presetEnv.default)({
+ assertVersion: () => {}
+ }, {
+ targets: {
+ node: '12'
+ }
+ });
+ const {
+ data: files
+ } = await this.$.utils.readDir(this.$.env.paths.desktopTmp.root);
+ files.forEach(file => {
+ if (file.endsWith('.js')) {
+ let {
+ code
+ } = (0, _core.transformFileSync)(file, {
+ presets: [preset]
+ });
+ let error;
+
+ if (settings.env === 'prod' && uglifyingEnabled) {
+ ({
+ code,
+ error
+ } = _terser.default.minify(code, options));
+ }
+
+ if (error) {
+ throw new Error(error);
+ }
+
+ _fs.default.writeFileSync(file, code);
+ }
+ });
+ }
+ /**
+ * Moves all the files that should not be packed into asar into a safe location which is the
+ * 'extracted' dir in the electron app.
+ */
+
+
+ async excludeFilesFromArchive() {
+ this.log.info('excluding files from packing'); // Ensure empty `extracted` dir
+
+ try {
+ await this.$.utils.rmWithRetries('-rf', this.$.env.paths.electronApp.extracted);
+ } catch (e) {
+ throw new Error(e);
+ }
+
+ _shelljs.default.mkdir(this.$.env.paths.electronApp.extracted);
+
+ const configs = this.$.desktop.gatherModuleConfigs(); // Move files that should not be asar'ed.
+
+ configs.forEach(config => {
+ const moduleConfig = config;
+
+ if ('extract' in moduleConfig) {
+ if (!Array.isArray(moduleConfig.extract)) {
+ moduleConfig.extract = [moduleConfig.extract];
+ }
+
+ moduleConfig.extract.forEach(file => {
+ this.log.debug(`excluding ${file} from ${config.name}`);
+
+ const filePath = _path.default.join(this.$.env.paths.desktopTmp.modules, moduleConfig.dirName, file);
+
+ const destinationPath = _path.default.join(this.$.env.paths.electronApp.extracted, moduleConfig.dirName);
+
+ if (!this.$.utils.exists(destinationPath)) {
+ _shelljs.default.mkdir(destinationPath);
+ }
+
+ _shelljs.default.mv(filePath, destinationPath);
+ });
+ }
+ });
+ }
+
+}
+
+exports.default = ElectronApp;
+//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJuYW1lcyI6WyJzaGVsbCIsImNvbmZpZyIs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ICAgICBhc2FyLmNyZWF0ZVBhY2thZ2UoXG4gICAgICAgICAgICAgICAgdGhpcy4kLmVudi5wYXRocy5lbGVjdHJvbkFwcC5hcHBSb290LFxuICAgICAgICAgICAgICAgIHRoaXMuJC5lbnYucGF0aHMuZWxlY3Ryb25BcHAuYXBwQXNhclxuICAgICAgICAgICAgKVxuICAgICAgICAgICAgICAgIC50aGVuKCgpID0+IHtcbiAgICAgICAgICAgICAgICAgICAgLy8gTGV0cyBtb3ZlIHRoZSBub2RlX21vZHVsZXMgYmFjay5cbiAgICAgICAgICAgICAgICAgICAgdGhpcy5sb2cuZGVidWcoJ21vdmluZyBub2RlX21vZHVsZXMgYmFjayBmcm9tIGFwcCBkaXInKTtcblxuICAgICAgICAgICAgICAgICAgICBzaGVsbC5tdihcbiAgICAgICAgICAgICAgICAgICAgICAgIHBhdGguam9pbih0aGlzLiQuZW52LnBhdGhzLmVsZWN0cm9uQXBwLmFwcFJvb3QsICdub2RlX21vZHVsZXMnKSxcbiAgICAgICAgICAgICAgICAgICAgICAgIHRoaXMuJC5lbnYucGF0aHMuZWxlY3Ryb25BcHAubm9kZU1vZHVsZXNcbiAgICAgICAgICAgICAgICAgICAgKTtcblxuICAgICAgICAgICAgICAgICAgICBpZiAoZXh0cmFjdGVkKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICAvLyBXZSBuZWVkIHRvIGNyZWF0ZSBhIGZ1bGwgbm9kZSBtb2R1bGVzIGJhY2suIEluIG90aGVyIHdvcmRzIHdlIHdhbnRcbiAgICAgICAgICAgICAgICAgICAgICAgIC8vIHRoZSBleHRyYWN0ZWQgbW9kdWxlcyBiYWNrLlxuICAgICAgICAgICAgICAgICAgICAgICAgZXh0cmFjdC5mb3JFYWNoKG1vZHVsZSA9PiBzaGVsbC5jcChcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAnLXJmJyxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBwYXRoLmpvaW4odGhpcy4kLmVudi5wYXRocy5lbGVjdHJvbkFwcC5leHRyYWN0ZWROb2RlTW9kdWxlcywgbW9kdWxlKSxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBwYXRoLmpvaW4odGhpcy4kLmVudi5wYXRocy5lbGVjdHJvbkFwcC5ub2RlTW9kdWxlcywgbW9kdWxlKVxuICAgICAgICAgICAgICAgICAgICAgICAgKSk7XG5cbiAgICAgICAgICAgICAgICAgICAgICAgIC8vIEdldCB0aGUgLmJpbiBiYWNrLlxuICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHRoaXMuJC51dGlscy5leGlzdHMoXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhpcy4kLmVudi5wYXRocy5lbGVjdHJvbkFwcC5leHRyYWN0ZWROb2RlTW9kdWxlc0JpblxuICAgICAgICAgICAgICAgICAgICAgICAgKSkge1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNoZWxsLmNwKFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBwYXRoLmpvaW4odGhpcy4kLmVudi5wYXRocy5lbGVjdHJvbkFwcC5leHRyYWN0ZWROb2RlTW9kdWxlc0JpbiwgJyonKSxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcGF0aC5qb2luKHRoaXMuJC5lbnYucGF0aHMuZWxlY3Ryb25BcHAubm9kZU1vZHVsZXMsICcuYmluJylcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICApO1xuICAgICAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgICB9XG5cbiAgICAgICAgICAgICAgICAgICAgdGhpcy5sb2cuZGVidWcoJ2RlbGV0aW5nIHNvdXJjZSBmaWxlcycpO1xuICAgICAgICAgICAgICAgICAgICBjb25zdCBleGNsdWRlID0gW3RoaXMuJC5lbnYucGF0aHMuZWxlY3Ryb25BcHAubm9kZU1vZHVsZXNdLmNvbmNhdChcbiAgICAgICAgICAgICAgICAgICAgICAgIFtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aGlzLiQuZW52LnBhdGhzLmVsZWN0cm9uQXBwLmFwcEFzYXIsXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhpcy4kLmVudi5wYXRocy5lbGVjdHJvbkFwcC5wYWNrYWdlSnNvblxuICAgICAgICAgICAgICAgICAgICAgICAgXSxcbiAgICAgICAgICAgICAgICAgICAgICAgIGV4Y2x1ZGVGcm9tRGVsXG4gICAgICAgICAgICAgICAgICAgICk7XG5cbiAgICAgICAgICAgICAgICAgICAgZGVsLnN5bmMoXG4gICAgICAgICAgICAgICAgICAgICAgICBbYCR7dGhpcy4kLmVudi5wYXRocy5lbGVjdHJvbkFwcC5yb290fSR7cGF0aC5zZXB9KmBdLmNvbmNhdChcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBleGNsdWRlLm1hcChwYXRoVG9FeGNsdWRlID0+IGAhJHtwYXRoVG9FeGNsdWRlfWApXG4gICAgICAgICAgICAgICAgICAgICAgICApLFxuICAgICAgICAgICAgICAgICAgICAgICAgeyBmb3JjZTogdHJ1ZSB9XG4gICAgICAgICAgICAgICAgICAgICk7XG4gICAgICAgICAgICAgICAgICAgIHJlc29sdmUoKTtcbiAgICAgICAgICAgICAgICB9KTtcbiAgICAgICAgfSk7XG4gICAgfVxuXG4gICAgLyoqXG4gICAgICogTW92ZXMgc3BlY2lmaWVkIG5vZGUgbW9kdWxlcyB0byBhIHNlcGFyYXRlIGRpcmVjdG9yeS5cbiAgICAgKiBAcGFyYW0ge0FycmF5fSBleHRyYWN0XG4gICAgICogQHJldHVybnMge2Jvb2xlYW59XG4gICAgICovXG4gICAgZXh0cmFjdE1vZHVsZXMoZXh0cmFjdCkge1xuICAgICAgICBjb25zdCBleHQgPSBbJy5qcycsICcuYmF0JywgJy5zaCcsICcuY21kJywgJyddO1xuXG4gICAgICAgIGlmIChleHRyYWN0Lmxlbmd0aCA+IDApIHtcbiAgICAgICAgICAgIGlmICh0aGlzLiQudXRpbHMuZXhpc3RzKHRoaXMuJC5lbnYucGF0aHMuZWxlY3Ryb25BcHAuZXh0cmFjdGVkTm9kZU1vZHVsZXMpKSB7XG4gICAgICAgICAgICAgICAgc2hlbGwucm0oJy1yZicsIHRoaXMuJC5lbnYucGF0aHMuZWxlY3Ryb25BcHAuZXh0cmFjdGVkTm9kZU1vZHVsZXMpO1xuICAgICAgICAgICAgfVxuICAgICAgICAgICAgZnMubWtkaXJTeW5jKHRoaXMuJC5lbnYucGF0aHMuZWxlY3Ryb25BcHAuZXh0cmFjdGVkTm9kZU1vZHVsZXMpO1xuICAgICAgICAgICAgZnMubWtkaXJTeW5jKHRoaXMuJC5lbnYucGF0aHMuZWxlY3Ryb25BcHAuZXh0cmFjdGVkTm9kZU1vZHVsZXNCaW4pO1xuXG4gICAgICAgICAgICBleHRyYWN0LmZvckVhY2goKG1vZHVsZSkgPT4ge1xuICAgICAgICAgICAgICAgIGZzLnJlbmFtZVN5bmMoXG4gICAgICAgICAgICAgICAgICAgIHBhdGguam9pbih0aGlzLiQuZW52LnBhdGhzLmVsZWN0cm9uQXBwLmFwcFJvb3QsICdub2RlX21vZHVsZXMnLCBtb2R1bGUpLFxuICAgICAgICAgICAgICAgICAgICBwYXRoLmpvaW4odGhpcy4kLmVudi5wYXRocy5lbGVjdHJvbkFwcC5leHRyYWN0ZWROb2RlTW9kdWxlcywgbW9kdWxlKSxcbiAgICAgICAgICAgICAgICApO1xuICAgICAgICAgICAgICAgIC8vIE1vdmUgYmlucy5cbiAgICAgICAgICAgICAgICB0aGlzLmV4dHJhY3RCaW4obW9kdWxlLCBleHQpO1xuICAgICAgICAgICAgfSk7XG5cbiAgICAgICAgICAgIHJldHVybiB0cnVlO1xuICAgICAgICB9XG4gICAgICAgIHJldHVybiBmYWxzZTtcbiAgICB9XG5cbiAgICAvKipcbiAgICAgKiBFeHRyYWN0cyB0aGUgYmluIGZpbGVzIGFzc29jaWF0ZWQgd2l0aCBhIGNlcnRhaW4gbm9kZSBtb2R1bGVzLlxuICAgICAqXG4gICAgICogQHBhcmFtIG1vZHVsZVxuICAgICAqIEBwYXJhbSBleHRcbiAgICAgKi9cbiAgICBleHRyYWN0QmluKG1vZHVsZSwgZXh0KSB7XG4gICAgICAgIGxldCBwYWNrYWdlSnNvbjtcbiAgICAgICAgdHJ5IHtcbiAgICAgICAgICAgIHBhY2thZ2VKc29uID0gSlNPTi5wYXJzZShcbiAgICAgICAgICAgICAgICBmcy5yZWFkRmlsZVN5bmMoXG4gICAgICAgICAgICAgICAgICAgIHBhdGguam9pbihcbiAgICAgICAgICAgICAgICAgICAgICAgIHRoaXMuJC5lbnYucGF0aHMuZWxlY3Ryb25BcHAuZXh0cmFjdGVkTm9kZU1vZHVsZXMsIG1vZHVsZSwgJ3BhY2thZ2UuanNvbidcbiAgICAgICAgICAgICAgICAgICAgKSxcbiAgICAgICAgICAgICAgICAgICAgJ3V0ZjgnXG4gICAgICAgICAgICAgICAgKVxuICAgICAgICAgICAgKTtcbiAgICAgICAgfSBjYXRjaCAoZSkge1xuICAgICAgICAgICAgcGFja2FnZUpzb24gPSB7fTtcbiAgICAgICAgfVxuXG5cbiAgICAgICAgY29uc3QgYmlucyA9ICgnYmluJyBpbiBwYWNrYWdlSnNvbiAmJiB0eXBlb2YgcGFja2FnZUpzb24uYmluID09PSAnb2JqZWN0JykgPyBPYmplY3Qua2V5cyhwYWNrYWdlSnNvbi5iaW4pIDogW107XG5cbiAgICAgICAgaWYgKGJpbnMubGVuZ3RoID4gMCkge1xuICAgICAgICAgICAgYmlucy5mb3JFYWNoKChiaW4pID0+IHtcbiAgICAgICAgICAgICAgICBleHQuZm9yRWFjaCgoZXh0ZW5zaW9uKSA9PiB7XG4gICAgICAgICAgICAgICAgICAgIGNvbnN0IGJpbkZpbGVQYXRoID0gcGF0aC5qb2luKFxuICAgICAgICAgICAgICAgICAgICAgICAgdGhpcy4kLmVudi5wYXRocy5lbGVjdHJvbkFwcC5hcHBSb290LFxuICAgICAgICAgICAgICAgICAgICAgICAgJ25vZGVfbW9kdWxlcycsXG4gICAgICAgICAgICAgICAgICAgICAgICAnLmJpbicsXG4gICAgICAgICAgICAgICAgICAgICAgICBgJHtiaW59JHtleHRlbnNpb259YFxuICAgICAgICAgICAgICAgICAgICApO1xuICAgICAgICAgICAgICAgICAgICBpZiAodGhpcy4kLnV0aWxzLmV4aXN0cyhiaW5GaWxlUGF0aCkgfHxcbiAgICAgICAgICAgICAgICAgICAgICAgIHRoaXMuJC51dGlscy5zeW1saW5rRXhpc3RzKGJpbkZpbGVQYXRoKVxuICAgICAgICAgICAgICAgICAgICApIHtcbiAgICAgICAgICAgICAgICAgICAgICAgIGZzLnJlbmFtZVN5bmMoXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgYmluRmlsZVBhdGgsXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgcGF0aC5qb2luKFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aGlzLiQuZW52LnBhdGhzLmVsZWN0cm9uQXBwLmV4dHJhY3RlZE5vZGVNb2R1bGVzQmluLFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBgJHtiaW59JHtleHRlbnNpb259YFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIClcbiAgICAgICAgICAgICAgICAgICAgICAgICk7XG4gICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICB9KTtcbiAgICAgICAgICAgIH0pO1xuICAgICAgICB9XG4gICAgfVxuXG4gICAgLyoqXG4gICAgICogTWVyZ2VzIHRoZSBgZXh0cmFjdGAgZmllbGQgd2l0aCBhdXRvbWF0aWNhbGx5IGRldGVjdGVkIG1vZHVsZXMuXG4gICAgICovXG4gICAgZ2V0TW9kdWxlc1RvRXh0cmFjdCgpIHtcbiAgICAgICAgY29uc3QgYmluYXJ5TW9kdWxlc0RldGVjdG9yID1cbiAgICAgICAgICAgIG5ldyBCaW5hcnlNb2R1bGVEZXRlY3Rvcih0aGlzLiQuZW52LnBhdGhzLmVsZWN0cm9uQXBwLm5vZ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NoIChlKSB7XG4gICAgICAgICAgICB0aGlzLmxvZy5lcnJvcignZXJyb3Igd2hpbGUgc2NhZmZvbGRpbmc6ICcsIGUpO1xuICAgICAgICAgICAgcHJvY2Vzcy5leGl0KDEpO1xuICAgICAgICB9XG5cbiAgICAgICAgdHJ5IHtcbiAgICAgICAgICAgIGNvbnN0IGZpbGVOYW1lID0gJy5ucG1yYyc7XG4gICAgICAgICAgICBjb25zdCBkaXJOYW1lID0gJy5tZXRlb3IvZGVza3RvcC1idWlsZCc7XG4gICAgICAgICAgICBpZiAoZnMuZXhpc3RzU3luYyhkaXJOYW1lKSAmJiBmcy5leGlzdHNTeW5jKGZpbGVOYW1lKSkge1xuICAgICAgICAgICAgICAgIGZzLmNvcHlGaWxlU3luYyhmaWxlTmFtZSwgYCR7ZGlyTmFtZX0vJHtmaWxlTmFtZX1gKTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgfSBjYXRjaCAoZSkge1xuICAgICAgICAgICAgdGhpcy5sb2cud2FybignZXJyb3Igd2hpbGUgY29weWluZyAubnBtcmMnLCBlKTtcbiAgICAgICAgfVxuXG4gICAgICAgIHRyeSB7XG4gICAgICAgICAgICBhd2FpdCB0aGlzLmV4cG9zZUVsZWN0cm9uTW9kdWxlcygpO1xuICAgICAgICB9IGNhdGNoIChlKSB7XG4gICAgICAgICAgICB0aGlzLmxvZy5lcnJvcignZXJyb3Igd2hpbGUgZXhwb3NpbmcgZWxlY3Ryb24gbW9kdWxlczogJywgZSk7XG4gICAgICAgICAgICBwcm9jZXNzLmV4aXQoMSk7XG4gICAgICAgIH1cblxuICAgICAgICB0cnkge1xuICAgICAgICAgICAgdGhpcy51cGRhdGVQYWNrYWdlSnNvbkZpZWxkcygpO1xuICAgICAgICB9IGNhdGNoIChlKSB7XG4gICAgICAgICAgICB0aGlzLmxvZy5lcnJvcignZXJyb3Igd2hpbGUgdXBkYXRpbmcgcGFja2FnZS5qc29uOiAnLCBlKTtcbiAgICAgICAgfVxuXG4gICAgIC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AgICAgICAgICBwcm9jZXNzLmV4aXQoMSk7XG4gICAgICAgIH1cblxuICAgICAgICB0cnkge1xuICAgICAgICAgICAgYXdhaXQgdGhpcy5yZWJ1aWxkRGVwcyh0cnVlKTtcbiAgICAgICAgfSBjYXRjaCAoZSkge1xuICAgICAgICAgICAgdGhpcy5sb2cuZXJyb3IoJ2Vycm9yIG9jY3VycmVkIHdoaWxlIGluc3RhbGxpbmcgbm9kZV9tb2R1bGVzOiAnLCBlKTtcbiAgICAgICAgICAgIHByb2Nlc3MuZXhpdCgxKTtcbiAgICAgICAgfVxuXG4gICAgICAgIGlmICghbm9kZU1vZHVsZXNSZW1vdmVkKSB7XG4gICAgICAgICAgICB0cnkge1xuICAgICAgICAgICAgICAgIGF3YWl0IHRoaXMucmVidWlsZERlcHMoKTtcbiAgICAgICAgICAgIH0gY2F0Y2ggKGUpIHtcbiAgICAgICAgICAgICAgICB0aGlzLmxvZy5lcnJvcignZXJyb3Igb2NjdXJyZWQgd2hpbGUgcmVidWlsZGluZyBuYXRpdmUgbm9kZSBtb2R1bGVzOiAnLCBlKTtcbiAgICAgICAgICAgICAgICBwcm9jZXNzLmV4aXQoMSk7XG4gICAgICAgICAgICB9XG4gICAgICAgIH1cblxuICAgICAgICB0cnkge1xuICAgICAgICAgICAgYXdhaXQgdGhpcy5saW5rTnBtUGFja2FnZXMoKTtcbiAgICAgICAgfSBjYXRjaCAoZSkge1xuICAgICAgICAgICAgdGhpcy5sb2cuZXJyb3IoYGxpbmtpbmcgcGFja2FnZXMgZmFpbGVkOiAke2V9YCk7XG4gICAgICAgICAgICBwcm9jZXNzLmV4aXQoMSk7XG4gICAgICAgIH1cblxuICAgICAgICB0cnkge1xuICAgICAgICAgICAgYXdhaXQgdGhpcy5pbnN0YWxsTG9jYWxOb2RlTW9kdWxlcygpO1xuICAgICAgICB9IGNhdGNoIChlKSB7XG4gICAgICAgICAgICB0aGlzLmxvZy5lcnJvcignZXJyb3Igb2NjdXJyZWQgd2hpbGUga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RWFjaCgocGx1Z2luKSA9PiB7XG4gICAgICAgICAgICAvLyBSZWFkIHBhY2thZ2UuanNvbiBvZiB0aGUgcGx1Z2luLlxuICAgICAgICAgICAgY29uc3QgcGFja2FnZUpzb24gPVxuICAgICAgICAgICAgICAgIEpTT04ucGFyc2UoXG4gICAgICAgICAgICAgICAgICAgIGZzLnJlYWRGaWxlU3luYyhcbiAgICAgICAgICAgICAgICAgICAgICAgIHBhdGguam9pbihcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aGlzLiQuZW52LnBhdGhzLmVsZWN0cm9uQXBwLm5vZGVNb2R1bGVzLCBwbHVnaW4sICdwYWNrYWdlLmpzb24nXG4gICAgICAgICAgICAgICAgICAgICAgICApLFxuICAgICAgICAgICAgICAgICAgICAgICAgJ3V0ZjgnXG4gICAgICAgICAgICAgICAgICAgIClcbiAgICAgICAgICAgICAgICApO1xuXG4gICAgICAgICAgICBpZiAoJ21ldGVvckRlcGVuZGVuY2llcycgaW4gcGFja2FnZUpzb24gJiYgdHlwZW9mIHBhY2thZ2VKc29uLm1ldGVvckRlcGVuZGVuY2llcyA9PT0gJ29iamVjdCcpIHtcbiAgICAgICAgICAgICAgICBwbHVnaW5zICs9IGAke3BsdWdpbn0sIGA7XG4gICAgICAgICAgICAgICAgcGFja2FnZXMudW5zaGlmdCguLi5PYmplY3Qua2V5cyhwYWNrYWdlSnNvbi5tZXRlb3JEZXBlbmRlbmNpZXMpKTtcbiAgICAgICAgICAgICAgICBwYWNrYWdlc1dpdGhWZXJzaW9uLnVuc2hpZnQoLi4ucGFja2FnZXMubWFwKChwYWNrYWdlTmFtZSkgPT4ge1xuICAgICAgICAgICAgICAgICAgICBpZiAocGFja2FnZUpzb24ubWV0ZW9yRGVwZW5kZW5jaWVzW3BhY2thZ2VOYW1lXSA9PT0gJ0B2ZXJzaW9uJykge1xuICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGAke3BhY2thZ2VOYW1lfUAke3BhY2thZ2VKc29uL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GVzXG4gICAgICAgICAgICAgICAgKTtcbiAgICAgICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICAgICAgLy8gSWYgdGhlcmUgaXMgYSBub2RlX21vZHVsZXMgZm9sZGVyLCB3ZSBzaG91bGQgY2xlYXIgdGhlIHRlbXBvcmFyeSBvbmUuXG4gICAgICAgICAgICAgICAgdGhpcy5sb2cuZGVidWcoJ2NsZWFyaW5nIHRlbXAgbm9kZV9tb2R1bGVzIGJlY2F1c2UgbmV3IG9uZSBpcyBhbHJlYWR5IGNyZWF0ZWQnKTtcbiAgICAgICAgICAgICAgICB0cnkge1xuICAgICAgICAgICAgICAgICAgICBhd2FpdCB0aGlzLiQudXRpbHMucm1XaXRoUmV0cmllcyhcbiAgICAgICAgICAgICAgICAgICAgICAgICctcmYnLCB0aGlzLiQuZW52LnBhdGhzLmVsZWN0cm9uQXBwLnRtcE5vZGVNb2R1bGVzXG4gICAgICAgICAgICAgICAgICAgICk7XG4gICAgICAgICAgICAgICAgfSBjYXRjaCAoZSkge1xuICAgICAgICAgICAgICAgICAgICB0aHJvdyBuZXcgRXJyb3IoZSk7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfVxuICAgICAgICB9XG4gICAgfVxuXG4gICAgLyoqXG4gICAgICogUnVucyBucG0gbGluayBmb3IgZXZlcnkgcGFja2FnZSBzcGVjaWZpZWQgaW4gc2V0dGluZ3MuanNvbi0+bGlua1BhY2thZ2VzLlxuICAgICAqL1xuICAgIGFzeW5jIGxpbmtOcG1QYWNrYWdlcygpIHtcbiAgICAgICAgaWYgKHRoaXMuJC5lbnYuaXNQcm9kdWN0aW9uQnVpbGQoKSkge1xuICAgICAgICAgICAgcmV0dXJuO1xuICAgICAgICB9XG4gICAgICAgIGNvbnN0IHNldHRpbmdzID0gdGhpcy4kLmRlc2t0b3AuZ2V0U2V0dGluZ3MoKTtcbiAgICAgICAgY29uc3QgcHJvbWlzZXMgPSBbXTtcbiAgICAgICAgaWYgKCdsaW5rUGFja2FnZXMnIGluIHRoaXMuJC5kZXNrdG9wLmdldFNldHRpbmdzKCkpIHtcbiAgICAgICAgICAgIGlmIChBcnJheS5pc0FycmF5KHNldHRpbmdzLmxpbmtQYWNrYWdlcykpIHtcbiAgICAgICAgICAgICAgICBzZXR0aW5ncy5saW5rUGFja2FnZXMuZm9yRWFjaChwYWNrYWdlTmFtZSA9PlxuICAgICAgICAgICAgICAgICAgICBwcm9taXNlcy5wdXNoKFxuICAgICAgICAgICAgICAgICAgICAgICAgdGhpcy4kLm1ldGVvckFwcC5ydW5OcG0oXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgWydsaW5rJywgcGFja2FnZU5hbWVdLFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHVuZGVmaW5lZCxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aGlzLiQuZW52LnBhdGhzLmVsZWN0cm9uQXBwLnJvb3RcbiAgICAgICAgICAgICAgICAgICAgICAgIClcbiAgICAgICAgICAgICAgICAgICAgKSk7XG4gICAgICAgICAgICB9XG4gICAgICAgIH1cbiAgICAgICAgYXdhaXQgUHJvbWlzZS5hbGwocHJvbWlzZXMpO1xuICAgIH1cblxuICAgIC8qKlxuICAgICAqIFJ1bnMgbnBtIGluIHRoZSBlbGVjdHJvbiBhcHAgdG8gZ2V0IHRoZSBkZXBlbmRlbmNpZXMgaW5zdGFsbGVkLlxuICAgICAqIEByZXR1cm5zIHtQcm9taXNlfVxuICAgICAqL1xuICAgIGFzeW5jIGVuc3VyZURlcHMoKSB7XG4gICAgICAgIHRoaXMubG9nLmluZm8oJ2luc3RhbGxpbmcgZGVwZW5kZW5jaWVzJyk7XG4gICAgICAgIGlmICh0aGlzLiQudXRpbHMuZXhpc3RzKHRoaXMuJC5lbnYucGF0aHMuZWxlY3Ryb25BcHAubm9kZU1vZHVsZXMpKSB7XG4gICAgICAgICAgICB0aGlzLmxvZy5kZWJ1ZygncnVubmluZyBucG0gcHJ1bmUgdG8gd2lwZSB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pID0+IHtcbiAgICAgICAgICAgIGFzYXIuY3JlYXRlUGFja2FnZShcbiAgICAgICAgICAgICAgICB0aGlzLiQuZW52LnBhdGhzLmRlc2t0b3BUbXAucm9vdCxcbiAgICAgICAgICAgICAgICB0aGlzLiQuZW52LnBhdGhzLmVsZWN0cm9uQXBwLmRlc2t0b3BBc2FyXG4gICAgICAgICAgICApXG4gICAgICAgICAgICAgICAgLnRoZW4oKCkgPT4ge1xuICAgICAgICAgICAgICAgICAgICB0aGlzLmxvZy52ZXJib3NlKCdjbGVhcmluZyB0ZW1wb3JhcnkgLmRlc2t0b3AnKTtcbiAgICAgICAgICAgICAgICAgICAgdGhpcy4kLnV0aWxzXG4gICAgICAgICAgICAgICAgICAgICAgICAucm1XaXRoUmV0cmllcygnLXJmJywgdGhpcy4kLmVudi5wYXRocy5kZXNrdG9wVG1wLnJvb3QpXG4gICAgICAgICAgICAgICAgICAgICAgICAudGhlbigoKSA9PiB7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgcmVzb2x2ZSgpO1xuICAgICAgICAgICAgICAgICAgICAgICAgfSlcbiAgICAgICAgICAgICAgICAgICAgICAgIC5jYXRjaCgoZSkgPT4ge1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJlamVjdChlKTtcbiAgICAgICAgICAgICAgICAgICAgICAgIH0pO1xuICAgICAgICAgICAgICAgICAgICByZXNvbHZlKCk7XG4gICAgICAgICAgICAgICAgfSk7XG4gICAgICAgIH0pO1xuICAgIH1cblxuICAgIC8qKlxuICAgICAqIE1ha2VzIGEgdGVtcG9yYXJ5IGNvcHkgb2YgLmRlc2t0b3AuXG4gICAgICovXG4gICAgY29weURlc2t0b3BUb0Rlc2t0b3BUZW1wKCkge1xuICAgICAgICB0aGlzLmxvZy52ZXJib3NlKCdjb3B5aW5nIC5kZXNrdG9wIHRvIHRlbXBvcmFyeSBsb2NhdGlvbicpO1xuICAgICAgICBzaGVsbC5jcCgnLXJmJywgdGhpcy4kLmVudi5wYXR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FjaCgoZmlsZSkgPT4ge1xuICAgICAgICAgICAgaWYgKGZpbGUuZW5kc1dpdGgoJy5qcycpKSB7XG4gICAgICAgICAgICAgICAgbGV0IHsgY29kZSB9ID0gdHJhbnNmb3JtRmlsZVN5bmMoZmlsZSwge1xuICAgICAgICAgICAgICAgICAgICBwcmVzZXRzOiBbcHJlc2V0XVxuICAgICAgICAgICAgICAgIH0pO1xuICAgICAgICAgICAgICAgIGxldCBlcnJvcjtcbiAgICAgICAgICAgICAgICBpZiAoc2V0dGluZ3MuZW52ID09PSAncHJvZCcgJiYgdWdsaWZ5aW5nRW5hYmxlZCkge1xuICAgICAgICAgICAgICAgICAgICAoeyBjb2RlLCBlcnJvciB9ID0gdWdsaWZ5Lm1pbmlmeShjb2RlLCBvcHRpb25zKSk7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIGlmIChlcnJvcikge1xuICAgICAgICAgICAgICAgICAgICB0aHJvdyBuZXcgRXJyb3IoZXJyb3IpO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICBmcy53cml0ZUZpbGVTeW5jKGZpbGUsIGNvZGUpO1xuICAgICAgICAgICAgfVxuICAgICAgICB9KTtcbiAgICB9XG5cbiAgICAvKipcbiAgICAgKiBNb3ZlcyBhbGwgdGhlIGZpbGVzIHRoYXQgc2hvdWxkIG5vdCBiZSBwYWNrZWQgaW50byBhc2FyIGludG8gYSBzYWZlIGxvY2F0aW9uIHdoaWNoIGlzIHRoZVxuICAgICAqICdleHRyYWN0ZWQnIGRpciBpbiB0aGUgZWxlY3Ryb24gYXBwLlxuICAgICAqL1xuICAgIGFzeW5jIGV4Y2x1ZGVGaWxlc0Zyb21BcmNoaXZlKCkge1xuICAgICAgICB0aGlzLmxvZy5pbmZvKCdleGNsdWRpbmcgZmlsZXMgZnJvbSBwYWNraW5nJyk7XG5cbiAgICAgICAgLy8gRW5zdXJlIGVtcHR5IGBleHRyYWN0ZWRgIGRpclxuXG4gICAgICAgIHRyeSB7XG4gICAgICAgICAgICBhd2FpdCB0aGlzLiQudXRpbHMucm1XaXRoUmV0cmllcygnLXJmJywgdGhpcy4kLmVudi5wYXRocy5lbGVjdHJvbkFwcC5leHRyYWN0ZWQpO1xuICAgICAgICB9IGNhdGNoIChlKSB7XG4gICAgICAgICAgICB0aHJvdyBuZXcgRXJyb3IoZSk7XG4gICAgICAgIH1cblxuICAgICAgICBzaGVsbC5ta2Rpcih0aGlzLiQuZW52LnBhdGhzLmVsZWN0cm9uQXBwLmV4dHJhY3RlZCk7XG5cbiAgICAgICAgY29uc3QgY29uZmlncyA9IHRoaXMuJC5kZXNrdG9wLmdhdGhlck1vZHVsZUNvbmZpZ3MoKTtcblxuICAgICAgICAvLyBNb3ZlIGZpbGVzIHRoYXQgc2hvdWxkIG5vdCBiZSBhc2FyJ2VkLlxuICAgICAgICBjb25maWdzLmZvckVhY2goKGNvbmZpZykgPT4ge1xuICAgICAgICAgICAgY29uc3QgbW9kdWxlQ29uZmlnID0gY29uZmlnO1xuICAgICAgICAgICAgaWYgKCdleHRyYWN0JyBpbiBtb2R1bGVDb25maWcpIHtcbiAgICAgICAgICAgICAgICBpZiAoIUFycmF5LmlzQXJyYXkobW9kdWxlQ29uZmlnLmV4dHJhY3QpKSB7XG4gICAgICAgICAgICAgICAgICAgIG1vZHVsZUNvbmZpZy5leHRyYWN0ID0gW21vZHVsZUNvbmZpZy5leHRyYWN0XTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgbW9kdWxlQ29uZmlnLmV4dHJhY3QuZm9yRWFjaCgoZmlsZSkgPT4ge1xuICAgICAgICAgICAgICAgICAgICB0aGlzLmxvZy5kZWJ1ZyhgZXhjbHVkaW5nICR7ZmlsZX0gZnJvbSAke2NvbmZpZy5uYW1lfWApO1xuICAgICAgICAgICAgICAgICAgICBjb25zdCBmaWxlUGF0aCA9IHBhdGguam9pbihcbiAgICAgICAgICAgICAgICAgICAgICAgIHRoaXMuJC5lbnYucGF0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0FDYixLQUFLN0IsQ0FBTCxDQUFPd0IsR0FBUCxDQUFXQyxLQUFYLENBQWlCbUwsVUFBakIsQ0FBNEJqRSxPQURmLEVBQ3dCeUYsWUFBWSxDQUFDL0csT0FEckMsRUFDOENzRyxJQUQ5QyxDQUFqQjs7VUFHQSxNQUFNVyxlQUFlLEdBQUcxTSxhQUFBLENBQUtDLElBQUwsQ0FDcEIsS0FBSzdCLENBQUwsQ0FBT3dCLEdBQVAsQ0FBV0MsS0FBWCxDQUFpQkMsV0FBakIsQ0FBNkJLLFNBRFQsRUFDb0JxTSxZQUFZLENBQUMvRyxPQURqQyxDQUF4Qjs7VUFJQSxJQUFJLENBQUMsS0FBS3JILENBQUwsQ0FBTzBDLEtBQVAsQ0FBYUMsTUFBYixDQUFvQjJMLGVBQXBCLENBQUwsRUFBMkM7WUFDdkMzTyxnQkFBQSxDQUFNc08sS0FBTixDQUFZSyxlQUFaO1VBQ0g7O1VBQ0QzTyxnQkFBQSxDQUFNMEMsRUFBTixDQUFTZ00sUUFBVCxFQUFtQkMsZUFBbkI7UUFDSCxDQWJEO01BY0g7SUFDSixDQXJCRDtFQXNCSDs7QUExM0I0QiJ9
\ No newline at end of file
diff --git a/dist/electronAppScaffold.js b/dist/electronAppScaffold.js
new file mode 100644
index 00000000..d108be14
--- /dev/null
+++ b/dist/electronAppScaffold.js
@@ -0,0 +1,142 @@
+"use strict";
+
+Object.defineProperty(exports, "__esModule", {
+ value: true
+});
+exports.default = void 0;
+
+var _runtime = _interopRequireDefault(require("regenerator-runtime/runtime"));
+
+var _fs = _interopRequireDefault(require("fs"));
+
+var _del = _interopRequireDefault(require("del"));
+
+var _shelljs = _interopRequireDefault(require("shelljs"));
+
+var _path = _interopRequireDefault(require("path"));
+
+var _log = _interopRequireDefault(require("./log"));
+
+var _skeletonDependencies = _interopRequireDefault(require("./skeletonDependencies"));
+
+function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
+
+// eslint-disable-next-line no-unused-vars
+const {
+ join
+} = _path.default;
+_shelljs.default.config.fatal = true;
+/**
+ * Represents the .desktop dir scaffold.
+ */
+
+class ElectronAppScaffold {
+ /**
+ * @param {MeteorDesktop} $ - context
+ * @constructor
+ */
+ constructor($) {
+ this.log = new _log.default('electronAppScaffold');
+ this.$ = $;
+ this.packageJson = {
+ name: 'MyMeteorApp',
+ main: this.$.env.isProductionBuild() ? 'app.asar/index.js' : 'app/index.js',
+ dependencies: Object.assign({}, _skeletonDependencies.default)
+ };
+
+ if (!this.$.env.isProductionBuild() || this.$.env.options.prodDebug) {
+ this.packageJson.dependencies.devtron = '1.4.0';
+ this.packageJson.dependencies['electron-debug'] = '1.5.0';
+ }
+ }
+ /**
+ * Just a public getter from the default package.json object.
+ * @returns {Object}
+ */
+
+
+ getDefaultPackageJson() {
+ return Object.assign({}, this.packageJson);
+ }
+ /**
+ * Clear the electron app. Removes everything except the node_modules which would be a waste
+ * to delete. Later `npm prune` will keep it clear.
+ */
+
+
+ clear() {
+ if (!this.$.utils.exists(this.$.env.paths.electronApp.root)) {
+ this.log.verbose(`creating ${this.$.env.paths.electronApp.rootName}`);
+
+ _shelljs.default.mkdir(this.$.env.paths.electronApp.root);
+ }
+
+ return (0, _del.default)([`${this.$.env.paths.electronApp.root}${_path.default.sep}*`, `!${this.$.env.paths.electronApp.nodeModules}`], {
+ force: true
+ });
+ }
+ /**
+ * Just copies the Skeleton App into the electron app.
+ */
+
+
+ copySkeletonApp() {
+ this.log.verbose('copying skeleton app');
+
+ try {
+ _shelljs.default.cp('-rf', join(this.$.env.paths.meteorDesktop.skeleton, '*'), this.$.env.paths.electronApp.appRoot + _path.default.sep);
+ } catch (e) {
+ this.log.error('error while copying skeleton app:', e);
+ process.exit(1);
+ }
+ }
+ /**
+ * After clearing the electron app path, copies a fresh skeleton.
+ */
+
+
+ async make() {
+ try {
+ this.log.verbose(`clearing ${this.$.env.paths.electronApp.rootName}`);
+ await this.clear();
+ } catch (e) {
+ this.log.error(`error while removing ${this.$.env.paths.electronApp.root}: `, e);
+ process.exit(1);
+ }
+
+ this.createAppRoot();
+ this.copySkeletonApp(); // TODO: hey, wait, .gitignore is not needed - right?
+
+ /*
+ this.log.debug('creating .gitignore');
+ fs.writeFileSync(this.$.env.paths.electronApp.gitIgnore, [
+ 'node_modules'
+ ].join('\n'));
+ */
+
+ this.log.verbose('writing package.json');
+
+ _fs.default.writeFileSync(this.$.env.paths.electronApp.packageJson, JSON.stringify(this.packageJson, null, 2));
+ }
+ /**
+ * Creates the app directory in the electron app.
+ */
+
+
+ createAppRoot() {
+ try {
+ this.log.verbose(`creating ${this.$.env.paths.electronApp.appRoot}`);
+
+ _fs.default.mkdirSync(this.$.env.paths.electronApp.appRoot);
+ } catch (e) {
+ if (e.code !== 'EEXIST') {
+ this.log.error(`error while creating dir: ${this.$.env.paths.electronApp.appRoot}: `, e);
+ process.exit(1);
+ }
+ }
+ }
+
+}
+
+exports.default = ElectronAppScaffold;
+//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJuYW1lcyI6WyJqb2luIiwicGF0aCIsInNoZWxsIiwiY29uZmlnIiwiZmF0YWwiLCJFbGVjdHJvbkFwcFNjYWZmb2xkIiwiY29uc3RydWN0b3IiLCIkIiwibG9nIiwiTG9nIiwicGFja2FnZUpzb24iLCJuYW1lIiwibWFpbiIsImVudiIsImlzUHJvZHVjdGlvbkJ1aWxkIiwiZGVwZW5kZW5jaWVzIiwiT2JqZWN0IiwiYXNzaWduIiwib3B0aW9ucyIsInByb2REZWJ1ZyIsImRldnRyb24iLCJnZXREZWZhdWx0UGFja2FnZUpzb24iLCJjbGVhciIsInV0aWxzIiwiZXhpc3RzIiwicGF0aHMiLCJlbGVjdHJvbkFwcCIsInJvb3QiLCJ2ZXJib3NlIiwicm9vdE5hbWUiLCJta2RpciIsImRlbCIsInNlcCIsIm5vZGVNb2R1bGVzIiwiZm9yY2UiLCJjb3B5U2tlbGV0b25BcHAiLCJjcCIsIm1ldG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GF0ZXIgYG5wbSBwcnVuZWAgd2lsbCBrZWVwIGl0IGNsZWFyLlxuICAgICAqL1xuICAgIGNsZWFyKCkge1xuICAgICAgICBpZiAoIXRoaXMuJC51dGlscy5leGlzdHModGhpcy4kLmVudi5wYXRocy5lbGVjdHJvbkFwcC5yb290KSkge1xuICAgICAgICAgICAgdGhpcy5sb2cudmVyYm9zZShgY3JlYXRpbmcgJHt0aGlzLiQuZW52LnBhdGhzLmVsZWN0cm9uQXBwLnJvb3ROYW1lfWApO1xuICAgICAgICAgICAgc2hlbGwubWtkaXIodGhpcy4kLmVudi5wYXRocy5lbGVjdHJvbkFwcC5yb290KTtcbiAgICAgICAgfVxuXG4gICAgICAgIHJldHVybiBkZWwoW1xuICAgICAgICAgICAgYCR7dGhpcy4kLmVudi5wYXRocy5lbGVjdHJvbkFwcC5yb290fSR7cGF0aC5zZXB9KmAsXG4gICAgICAgICAgICBgISR7dGhpcy4kLmVudi5wYXRocy5lbGVjdHJvbkFwcC5ub2RlTW9kdWxlc31gXG4gICAgICAgIF0sIHsgZm9yY2U6IHRydWUgfSk7XG4gICAgfVxuXG4gICAgLyoqXG4gICAgICogSnVzdCBjb3BpZXMgdGhlIFNrZWxldG9uIEFwcCBpbnRvIHRoZSBlbGVjdHJvbiBhcHAuXG4gICAgICovXG4gICAgY29weVNrZWxldG9uQXBwKCkge1xuICAgICAgICB0aGlzLmxvZy52ZXJib3NlKCdjb3B5aW5nIHNrZWxldG9uIGFwcCcpO1xuICAgICAgICB0cnkge1xuICAgICAgICAgICAgc2hlbGwuY3AoXG4gICAgICAgICAgICAgICAgJy1yZicsXG4gICAgICAgICAgICAgICAgam9pbih0aGlzLiQuZW52LnBhdGhzLm1ldGVvckRlc2t0b3Auc2tlbGV0b24sICcqJyksXG4gICAgICAgICAgICAgICAgdGhpcy4kLmVudi5wYXRocy5lbGVjdHJvbkFwcC5hcHBSb290ICsgcGF0aC5zZXBcbiAgICAgICAgICAgICk7XG4gICAgICAgIH0gY2F0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DLENBQUwsQ0FBT00sR0FBUCxDQUFXWSxLQUFYLENBQWlCQyxXQUFqQixDQUE2QmhCLFdBRGpDLEVBQzhDc0MsSUFBSSxDQUFDQyxTQUFMLENBQWUsS0FBS3ZDLFdBQXBCLEVBQWlDLElBQWpDLEVBQXVDLENBQXZDLENBRDlDO0VBR0g7RUFFRDtBQUNKO0FBQ0E7OztFQUNJbUMsYUFBYSxHQUFHO0lBQ1osSUFBSTtNQUNBLEtBQUtyQyxHQUFMLENBQVNvQixPQUFULENBQWtCLFlBQVcsS0FBS3JCLENBQUwsQ0FBT00sR0FBUCxDQUFXWSxLQUFYLENBQWlCQyxXQUFqQixDQUE2QmEsT0FBUSxFQUFsRTs7TUFDQU8sV0FBQSxDQUFHSSxTQUFILENBQWEsS0FBSzNDLENBQUwsQ0FBT00sR0FBUCxDQUFXWSxLQUFYLENBQWlCQyxXQUFqQixDQUE2QmEsT0FBMUM7SUFDSCxDQUhELENBR0UsT0FBT0MsQ0FBUCxFQUFVO01BQ1IsSUFBSUEsQ0FBQyxDQUFDVyxJQUFGLEtBQVcsUUFBZixFQUF5QjtRQUNyQixLQUFLM0MsR0FBTCxDQUFTaUMsS0FBVCxDQUNLLDZCQUE0QixLQUFLbEMsQ0FBTCxDQUFPTSxHQUFQLENBQVdZLEtBQVgsQ0FBaUJDLFdBQWpCLENBQTZCYSxPQUFRLElBRHRFLEVBQzJFQyxDQUQzRTtRQUdBRSxPQUFPLENBQUNDLElBQVIsQ0FBYSxDQUFiO01BQ0g7SUFDSjtFQUNKOztBQTdHb0MifQ==
\ No newline at end of file
diff --git a/dist/electronBuilder.js b/dist/electronBuilder.js
new file mode 100644
index 00000000..d4438f23
--- /dev/null
+++ b/dist/electronBuilder.js
@@ -0,0 +1,384 @@
+"use strict";
+
+Object.defineProperty(exports, "__esModule", {
+ value: true
+});
+exports.default = void 0;
+
+var _runtime = _interopRequireDefault(require("regenerator-runtime/runtime"));
+
+var _shelljs = _interopRequireDefault(require("shelljs"));
+
+var _path = _interopRequireDefault(require("path"));
+
+var _fs = _interopRequireDefault(require("fs"));
+
+var _rimraf = _interopRequireDefault(require("rimraf"));
+
+var _crossSpawn = _interopRequireDefault(require("cross-spawn"));
+
+var _log = _interopRequireDefault(require("./log"));
+
+var _defaultDependencies = _interopRequireDefault(require("./defaultDependencies"));
+
+function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
+
+// eslint-disable-next-line no-unused-vars
+
+/**
+ * Promisfied rimraf.
+ *
+ * @param {string} dirPath - path to the dir to be deleted
+ * @param {number} delay - delay the task by ms
+ * @returns {Promise}
+ */
+function removeDir(dirPath, delay = 0) {
+ return new Promise((resolve, reject) => {
+ setTimeout(() => {
+ (0, _rimraf.default)(dirPath, {
+ maxBusyTries: 100
+ }, err => {
+ if (err) {
+ reject(err);
+ } else {
+ resolve();
+ }
+ });
+ }, delay);
+ });
+}
+/**
+ * Wrapper for electron-builder.
+ */
+
+
+class InstallerBuilder {
+ /**
+ * @param {MeteorDesktop} $ - context
+ *
+ * @constructor
+ */
+ constructor($) {
+ this.log = new _log.default('electronBuilder');
+ this.$ = $;
+ this.firstPass = true;
+ this.lastRebuild = {};
+ this.currentContext = null;
+ this.installerDir = _path.default.join(this.$.env.options.output, this.$.env.paths.installerDir);
+ this.platforms = [];
+ }
+
+ async init() {
+ this.builder = await this.$.getDependency('electron-builder', _defaultDependencies.default['electron-builder']);
+ const appBuilder = await this.$.getDependency('app-builder-lib', _defaultDependencies.default['electron-builder'], false);
+ this.yarn = require(_path.default.join(appBuilder.path, 'out', 'util', 'yarn'));
+ this.getGypEnv = this.yarn.getGypEnv;
+ this.packageDependencies = require(_path.default.join(appBuilder.path, 'out', 'util', 'packageDependencies'));
+ }
+ /**
+ * Prepares the last rebuild object for electron-builder.
+ *
+ * @param {string} arch
+ * @param {string} platform
+ * @returns {Object}
+ */
+
+
+ prepareLastRebuildObject(arch, platform = process.platform) {
+ const productionDeps = this.packageDependencies.createLazyProductionDeps(this.$.env.paths.electronApp.root);
+ this.lastRebuild = {
+ frameworkInfo: {
+ version: this.$.getElectronVersion(),
+ useCustomDist: true
+ },
+ platform,
+ arch,
+ productionDeps
+ };
+ return this.lastRebuild;
+ }
+ /**
+ * Calls npm rebuild from electron-builder.
+ * @param {string} arch
+ * @param {string} platform
+ * @param {boolean} install
+ * @returns {Promise}
+ */
+
+
+ async installOrRebuild(arch, platform = process.platform, install = false) {
+ this.log.debug(`calling installOrRebuild from electron-builder for arch ${arch}`);
+ this.prepareLastRebuildObject(arch, platform);
+ await this.yarn.installOrRebuild(this.$.desktop.getSettings().builderOptions || {}, this.$.env.paths.electronApp.root, this.lastRebuild, install);
+ }
+ /**
+ * Callback invoked before build is made. Ensures that app.asar have the right rebuilt
+ * node_modules.
+ *
+ * @param {Object} context
+ * @returns {Promise}
+ */
+
+
+ beforeBuild(context) {
+ this.currentContext = Object.assign({}, context);
+ return new Promise((resolve, reject) => {
+ const platformMatches = process.platform === context.platform.nodeName;
+ const rebuild = platformMatches && context.arch !== this.lastRebuild.arch;
+
+ if (!platformMatches) {
+ this.log.warn('skipping dependencies rebuild because platform is different, if you have native ' + 'node modules as your app dependencies you should od the build on the target platform only');
+ }
+
+ if (!rebuild) {
+ this.moveNodeModulesOut().catch(e => reject(e)).then(() => setTimeout(() => resolve(false), 2000)); // Timeout helps on Windows to clear the file locks.
+ } else {
+ // Lets rebuild the node_modules for different arch.
+ this.installOrRebuild(context.arch, context.platform.nodeName).catch(e => reject(e)).then(() => this.$.electronApp.installLocalNodeModules(context.arch)).catch(e => reject(e)).then(() => {
+ this.$.electronApp.scaffold.createAppRoot();
+ this.$.electronApp.scaffold.copySkeletonApp();
+ return this.$.electronApp.packSkeletonToAsar([this.$.env.paths.electronApp.meteorAsar, this.$.env.paths.electronApp.desktopAsar, this.$.env.paths.electronApp.extracted]);
+ }).catch(e => reject(e)).then(() => this.moveNodeModulesOut()).catch(e => reject(e)).then(() => resolve(false));
+ }
+ });
+ }
+ /**
+ * Callback to be invoked after packing. Restores node_modules to the .desktop-build.
+ * @returns {Promise}
+ */
+
+
+ afterPack(context) {
+ this.platforms = this.platforms.filter(platform => platform !== context.electronPlatformName);
+
+ if (this.platforms.length !== 0) {
+ return Promise.resolve();
+ }
+
+ return new Promise((resolve, reject) => {
+ _shelljs.default.config.fatal = true;
+
+ if (this.$.utils.exists(this.$.env.paths.electronApp.extractedNodeModules)) {
+ this.log.debug('injecting extracted modules');
+
+ _shelljs.default.cp('-Rf', this.$.env.paths.electronApp.extractedNodeModules, _path.default.join(this.getPackagedAppPath(context), 'node_modules'));
+ }
+
+ this.log.debug('moving node_modules back'); // Move node_modules back.
+
+ try {
+ _shelljs.default.mv(this.$.env.paths.electronApp.tmpNodeModules, this.$.env.paths.electronApp.nodeModules);
+ } catch (e) {
+ reject(e);
+ return;
+ } finally {
+ _shelljs.default.config.reset();
+ }
+
+ if (this.firstPass) {
+ this.firstPass = false;
+ }
+
+ this.log.debug('node_modules moved back');
+ this.wait().catch(e => reject(e)).then(() => resolve());
+ });
+ }
+ /**
+ * This command kills orphaned MSBuild.exe processes.
+ * Sometime after native node_modules compilation they are still writing some logs,
+ * prevent node_modules from being deleted.
+ */
+
+
+ killMSBuild() {
+ if (this.currentContext.platform.nodeName !== 'win32') {
+ return;
+ }
+
+ try {
+ const out = _crossSpawn.default.sync('wmic', ['process', 'where', 'caption="MSBuild.exe"', 'get', 'processid']).stdout.toString('utf-8').split('\n');
+
+ const regex = new RegExp(/(\d+)/, 'gm'); // No we will check for those with the matching params.
+
+ out.forEach(line => {
+ const match = regex.exec(line) || false;
+
+ if (match) {
+ this.log.debug(`killing MSBuild.exe at pid: ${match[1]}`);
+
+ _crossSpawn.default.sync('taskkill', ['/pid', match[1], '/f', '/t']);
+ }
+
+ regex.lastIndex = 0;
+ });
+ } catch (e) {
+ this.log.debug('kill MSBuild failed');
+ }
+ }
+ /**
+ * Returns the path to packaged app.
+ * @returns {string}
+ */
+
+
+ getPackagedAppPath(context = {}) {
+ if (this.currentContext.platform.nodeName === 'darwin') {
+ return _path.default.join(this.installerDir, 'mac', `${context.packager.appInfo.productFilename}.app`, 'Contents', 'Resources', 'app');
+ }
+
+ const platformDir = `${this.currentContext.platform.nodeName === 'win32' ? 'win' : 'linux'}-${this.currentContext.arch === 'ia32' ? 'ia32-' : ''}unpacked`;
+ return _path.default.join(this.installerDir, platformDir, 'resources', 'app');
+ }
+ /**
+ * On Windows it waits for the app.asar in the packed app to be free (no file locks).
+ * @returns {*}
+ */
+
+
+ wait() {
+ if (this.currentContext.platform.nodeName !== 'win32') {
+ return Promise.resolve();
+ }
+
+ const appAsarPath = _path.default.join(this.getPackagedAppPath(), 'app.asar');
+
+ let retries = 0;
+ const self = this;
+ return new Promise((resolve, reject) => {
+ function check() {
+ _fs.default.open(appAsarPath, 'r+', (err, fd) => {
+ retries += 1;
+
+ if (err) {
+ if (err.code !== 'ENOENT') {
+ self.log.debug(`waiting for app.asar to be readable, ${'code' in err ? `currently reading it returns ${err.code}` : ''}`);
+
+ if (retries < 6) {
+ setTimeout(() => check(), 4000);
+ } else {
+ reject(`file is locked: ${appAsarPath}`);
+ }
+ } else {
+ resolve();
+ }
+ } else {
+ _fs.default.closeSync(fd);
+
+ resolve();
+ }
+ });
+ }
+
+ check();
+ });
+ }
+ /**
+ * Prepares the target object passed to the electron-builder.
+ *
+ * @returns {Map>>}
+ */
+
+
+ prepareTargets() {
+ let arch = this.$.env.options.ia32 ? 'ia32' : 'x64';
+ arch = this.$.env.options.allArchs ? 'all' : arch;
+ const targets = [];
+
+ if (this.$.env.options.win) {
+ targets.push(this.builder.dependency.Platform.WINDOWS);
+ }
+
+ if (this.$.env.options.linux) {
+ targets.push(this.builder.dependency.Platform.LINUX);
+ }
+
+ if (this.$.env.options.mac) {
+ targets.push(this.builder.dependency.Platform.MAC);
+ }
+
+ if (targets.length === 0) {
+ if (this.$.env.os.isWindows) {
+ targets.push(this.builder.dependency.Platform.WINDOWS);
+ } else if (this.$.env.os.isLinux) {
+ targets.push(this.builder.dependency.Platform.LINUX);
+ } else {
+ targets.push(this.builder.dependency.Platform.MAC);
+ }
+ }
+
+ return this.builder.dependency.createTargets(targets, null, arch);
+ }
+
+ async build() {
+ const settings = this.$.desktop.getSettings();
+
+ if (!('builderOptions' in settings)) {
+ this.log.error('no builderOptions in settings.json, aborting');
+ process.exit(1);
+ }
+
+ const builderOptions = Object.assign({}, settings.builderOptions);
+ builderOptions.asar = false;
+ builderOptions.npmRebuild = true;
+ builderOptions.beforeBuild = this.beforeBuild.bind(this);
+ builderOptions.afterPack = this.afterPack.bind(this);
+ builderOptions.electronVersion = this.$.getElectronVersion();
+ builderOptions.directories = {
+ app: this.$.env.paths.electronApp.root,
+ output: _path.default.join(this.$.env.options.output, this.$.env.paths.installerDir)
+ };
+
+ if ('mac' in builderOptions && 'target' in builderOptions.mac) {
+ if (builderOptions.mac.target.includes('mas')) {
+ this.platforms = ['darwin', 'mas'];
+ }
+ }
+
+ try {
+ this.log.debug('calling build from electron-builder');
+ await this.builder.dependency.build(Object.assign({
+ targets: this.prepareTargets(),
+ config: builderOptions
+ }, settings.builderCliOptions));
+
+ if (this.$.utils.exists(this.$.env.paths.electronApp.extractedNodeModules)) {
+ _shelljs.default.rm('-rf', this.$.env.paths.electronApp.extractedNodeModules);
+ }
+ } catch (e) {
+ this.log.error('error while building installer: ', e);
+ }
+ }
+ /**
+ * Moves node_modules out of the app because while the app will be packaged
+ * we do not want it to be there.
+ * @returns {Promise}
+ */
+
+
+ moveNodeModulesOut() {
+ return new Promise((resolve, reject) => {
+ this.log.debug('moving node_modules out, because we have them already in' + ' app.asar');
+ this.killMSBuild();
+ removeDir(this.$.env.paths.electronApp.tmpNodeModules).catch(e => reject(e)).then(() => {
+ _shelljs.default.config.fatal = true;
+ _shelljs.default.config.verbose = true;
+
+ try {
+ _shelljs.default.mv(this.$.env.paths.electronApp.nodeModules, this.$.env.paths.electronApp.tmpNodeModules);
+
+ _shelljs.default.config.reset();
+
+ return this.wait();
+ } catch (e) {
+ _shelljs.default.config.reset();
+
+ return Promise.reject(e);
+ }
+ }).catch(e => reject(e)).then(() => removeDir(this.$.env.paths.electronApp.nodeModules, 1000)).catch(e => reject(e)).then(() => this.wait()).catch(reject).then(resolve);
+ });
+ }
+
+}
+
+exports.default = InstallerBuilder;
+//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJuYW1lcyI6WyJyZW1vdmVEaXIiLCJkaXJQYXRoIiwiZGVsYXkiLCJQcm9taXNlIiwicmVzb2x2ZSIsInJlamVjdCIsInNldFRpbWVvdXQiLCJyaW1yYWYiLCJtYXhCdXN5VHJpZXMiLCJlcnIiLCJJbnN0YWxsZXJCdWlsZGVyIiwiY29uc3RydWN0b3IiLCIkIiwibG9nIiwiTG9nIiwiZmlyc3RQYXNzIiwibGFzdFJlYnVpbGQiLCJjdXJyZW50Q29udGV4dCIsImluc3RhbGxlckRpciIsInBhdGgiLCJqb2luIiwiZW52Iiwib3B0aW9ucyIsIm91dHB1dCIsInBhdGhzIiwicGxhdGZvcm1zIiwiaW5pdCIsImJ1aWxkZXIiLCJnZXREZXBlbmRlbmN5IiwiZGVmYXVsdERlcGVuZGVuY2llcyIsImFwcEJ1aWxkZXIiLCJ5YXJuIiwicmVxdWlyZSIsImdldEd5cEVudiIsInBhY2thZ2VEZXBlbmRlbmNpZXMiLCJwcmVwYXJlTGFzdFJlYnVpbGRPYmplY3QiLCJhcmNoIiwicGxhdGZvcm0iLCJwcm9jZXNzIiwicHJvZHVjdGlvbkRlcHMiLCJjcmVhdGVMYXp5UHJvZHVjdGlvbkRlcHMiLCJlbGVjdHJvbkFwcCIsInJvb3QiLCJmcmFtZXdvcmtJbmZvIiwidmVyc2lvbiIsImdldEVsZWN0cm9uVmVyc2lvbiIsInVzZUN1c3RvbURpc3QiLCJpbnN0YWxsT3JSZWJ1aWxkIiwiaW5zdGFsbCIsImRlYnVnIiwiZGVza3RvcCIsImdldFNldHRpbmdzIiwiYnVpbGRlck9w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3ZlRGlyKGRpclBhdGgsIGRlbGF5ID0gMCkge1xuICAgIHJldHVybiBuZXcgUHJvbWlzZSgocmVzb2x2ZSwgcmVqZWN0KSA9PiB7XG4gICAgICAgIHNldFRpbWVvdXQoKCkgPT4ge1xuICAgICAgICAgICAgcmltcmFmKGRpclBhdGgsIHtcbiAgICAgICAgICAgICAgICBtYXhCdXN5VHJpZXM6IDEwMFxuICAgICAgICAgICAgfSwgKGVycikgPT4ge1xuICAgICAgICAgICAgICAgIGlmIChlcnIpIHtcbiAgICAgICAgICAgICAgICAgICAgcmVqZWN0KGVycik7XG4gICAgICAgICAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgICAgICAgICAgcmVzb2x2ZSgpO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgIH0pO1xuICAgICAgICB9LCBkZWxheSk7XG4gICAgfSk7XG59XG5cbi8qKlxuICogV3JhcHBlciBmb3IgZWxlY3Ryb24tYnVpbGRlci5cbiAqL1xuZXhwb3J0IGRlZmF1bHQgY2xhc3MgSW5zdGFsbGVyQnVpbGRlciB7XG4gICAgLyoqXG4gICAgICogQHBhcmFtIHtNZXRlb3JEZXNrdG9wfSAkIC0gY29udGV4dFxuICAgICAqXG4gICAgICogQGNvbnN0cnVjdG9yXG4gICAgICovXG4gICAgY29uc3RydWN0b3IoJCkge1xuICAgICAgICB0aGlzLmxvZyA9IG5ldyBMb2coJ2VsZWN0cm9uQnVpbGRlcicpO1xuICAgICAgICB0aGlzLiQgPSAkO1xuICAgICAgICB0aGlzLmZpcnN0UGFzcyA9IHRydWU7XG4gICAgICAgIHRoaXMubGFzdFJlYnVpbGQgPSB7fTtcbiAgICAgICAgdGhpcy5jdXJyZW50Q29udGV4dCA9IG51bGw7XG4gICAgICAgIHRoaXMuaW5zdGFsbGVyRGlyID0gcGF0aC5qb2luKHRoaXMuJC5lbnYub3B0aW9ucy5vdXRwdXQsIHRoaXMuJC5lbnYucGF0aHMuaW5zdGFsbGVyRGlyKTt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B5b3VyIGFwcCBkZXBlbmRlbmNpZXMgeW91IHNob3VsZCBvZCB0aGUgYnVpbGQgb24gdGhlIHRhcmdldCBwbGF0Zm9ybSBvbmx5Jyk7XG4gICAgICAgICAgICB9XG5cbiAgICAgICAgICAgIGlmICghcmVidWlsZCkge1xuICAgICAgICAgICAgICAgIHRoaXMubW92ZU5vZGVNb2R1bGVzT3V0KClcbiAgICAgICAgICAgICAgICAgICAgLmNhdGNoKGUgPT4gcmVqZWN0KGUpKVxuICAgICAgICAgICAgICAgICAgICAudGhlbigoKSA9PiBzZXRUaW1lb3V0KCgpID0+IHJlc29sdmUoZmFsc2UpLCAyMDAwKSk7XG4gICAgICAgICAgICAgICAgLy8gVGltZW91dCBoZWxwcyBvbiBXaW5kb3dzIHRvIGNsZWFyIHRoZSBmaWxlIGxvY2tzLlxuICAgICAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgICAgICAvLyBMZXRzIHJlYnVpbGQgdGhlIG5vZGVfbW9kdWxlcyBmb3IgZGlmZmVyZW50IGFyY2guXG4gICAgICAgICAgICAgICAgdGhpcy5pbnN0YWxsT3JSZWJ1aWxkKGNvbnRleHQuYXJjaCwgY29udGV4dC5wbGF0Zm9ybS5ub2RlTmFtZSlcbiAgICAgICAgICAgICAgICAgICAgLmNhdGNoKGUgPT4gcmVqZWN0KGUpKVxuICAgICAgICAgICAgICAgICAgICAudGhlbigoKSA9PiB0aGlzLiQuZWxlY3Ryb25BcHAuaW5zdGFsbExvY2FsTm9kZU1vZHVsZXMoY29udGV4dC5hcmNoKSlcbiAgICAgICAgICAgICAgICAgICAgLmNhdGNoKGUgPT4gcmVqZWN0KGUpKVxuICAgICAgICAgICAgICAgICAgICAudGhlbigoKSA9PiB7XG4gICAgICAgICAgICAgICAgICAgICAgICB0aGlzLiQuZWxlY3Ryb25BcHAuc2NhZmZvbGQuY3JlYXRlQXBwUm9vdCgpO1xuICAgICAgICAgICAgICAgICAgICAgICAgdGhpcy4kLmVsZWN0cm9uQXBwLnNjYWZmb2xkLmNvcHlTa2VsZXRvbkFwcCgpO1xuICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHRoaXMuJC5lbGVjdHJvbkFwcC5wYWNrU2tlbGV0b25Ub0FzYXIoXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgW1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aGlzLiQuZW52LnBhdGhzLmVsZWN0cm9uQXBwLm1ldGVvckFzYXIsXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRoaXMuJC5lbnYucGF0aHMuZWxlY3Ryb25BcHAuZGVza3RvcEFzYXIsXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRoaXMuJC5lbnYucGF0aHMuZWxlY3Ryb25BcHAuZXh0cmFjdGVkXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgXVxuICAgICAgICAgICAgICAgICAgICAgICAgKTtcbiAgICAgICAgICAgICAgICAgICAgfSlcbiAgICAgICAgICAgICAgICAgICAgLmNhdGNoKGUgPT4gcmVqZWN0KGUpKVxuICAgICAgICAgICAgICAgICAgICAudGhlbigoKSA9PiB0aGlzLm1vdmVOb2RlTW9kdWxlc091dCgpKVxuICAgICAgICAgICAgICAgICAgICAuY2F0Y2goZSA9PiByZWplY3QoZSkpXG4gICAgICAgICAgICAgICAgICAgIC50aGVuKCgpID0+IHJlc29sdmUoZmFsc2UpKTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgfSk7XG4gICAgfVxuXG4gICAgLyoqXG4gICAgICogQ2FsbGJhY2sgdG8gYmUgaW52b2tlZCBhZnRlciBwYWNraW5nLiBSZXN0b3JlcyBub2RlX21vZHVsZXMgdG8gdGhlIC5kZXNrdG9wLWJ1aWxkLlxuICAgICAqIEByZXR1cm5zIHtQcm9taXNlfVxuICAgICAqL1xuICAgIGFmdGVyUGFjayhjb250ZXh0KSB7XG4gICAgICAgIHRoaXMucGxhdGZvcm1zID0gdGhpcy5wbGF0Zm9ybXNcbiAgICAgICAgICAgIC5maWx0ZXIocGxhdGZvcm0gPT4gcGxhdGZvcm0gIT09IGNvbnRleHQuZWxlY3Ryb25QbGF0Zm9ybU5hbWUpO1xuICAgICAgICBpZiAodGhpcy5wbGF0Zm9ybXMubGVuZ3RoICE9PSAwKSB7XG4gICAgICAgICAgICByZXR1cm4gUHJvbWlzZS5yZXNvbHZlKCk7XG4gICAgICAgIH1cbiAgICAgICAgcmV0dXJuIG5ldyBQcm9taXNlKChyZXNvbHZlLCByZWplY3QpID0+IHtcbiAgICAgICAgICAgIHNoZWxsLmNvbmZpZy5mYXRhbCA9IHRydWU7XG5cbiAgICAgICAgICAgIGlmICh0aGlzLiQudXRpbHMuZXhpc3RzKHRoaXMuJC5lbnYucGF0aHMuZWxlY3Ryb25BcHAuZXh0cmFjdGVkTm9kZU1vZHVsZXMpKSB7XG4gICAgICAgICAgICAgICAgdGhpcy5sb2cuZGVidWcoJ2luamVjdGluZyBleHRyYWN0ZWQgbW9kdWxlcycpO1xuICAgICAgICAgICAgICAgIHNoZWxsLmNwKFxuICAgICAgICAgICAgICAgICAgICAnLVJmJyxcbiAgICAgICAgICAgICAgICAgICAgdGhpcy4kLmVudi5wYXRocy5lbGVjdHJvbkFwcC5leHRyYWN0ZWROb2RlTW9kdWxlcyxcbiAgICAgICAgICAgICAgICAgICAgcGF0aC5qb2luKHRoaXMuZ2V0UGFja2FnZWRBcHBQYXRoKGNvbnRleHQpLCAnbm9kZV9tb2R1bGVzJylcbiAgICAgICAgICAgICAgICApO1xuICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICB0aGlzLmxvZy5kZWJ1ZygnbW92aW5nIG5vZGVfbW9kdWxlcyBiYWNrJyk7XG4gICAgICAgICAgICAvLyBNb3ZlIG5vZGVfbW9kdWxlcyBiYWNrLlxuXG4gICAgICAgICAgICB0cnkge1xuICAgICAgICAgICAgICAgIHNoZWxsLm12KFxuICAgICAgICAgICAgICAgICAgICB0aGlzLiQuZW52LnBhdGhzLmVsZWN0cm9uQXBwLnRtcE5vZGVNb2R1bGVzLFxuICAgICAgICAgICAgICAgICAgICB0aGlzLiQuZW52LnBhdGhzLmVsZWN0cm9uQXBwLm5vZGVNb2R1bGVzXG4gICAgICAgICAgICAgICAgKTtcbiAgICAgICAgICAgIH0gY2F0Y2ggKGUpIHtcbiAgICAgICAgICAgICAgICByZWplY3QoZSk7XG4gICAgICAgICAgICAgICAgcmV0dXJuO1xuICAgICAgICAgICAgfSBmaW5hbGx5IHtcbiAgICAgICAgICAgICAgICBzaGVsbC5jb25maWcucmVzZXQoKTtcbiAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgaWYgKHRoaXMuZmlyc3RQYXNzKSB7XG4gICAgICAgICAgICAgICAgdGhpcy5maXJzdFBhc3MgPSBmYWxzZTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIHRoaXMubG9nLmRlYnVnKCdub2RlX21vZHVsZXMgbW92ZWQgYmFjaycpO1xuXG4gICAgICAgICAgICB0aGlzLndhaXQoKVxuICAgICAgICAgICAgICAgIC5jYXRjaChlID0+IHJlamVjdChlKSlcbiAgICAgICAgICAgICAgICAudGhlbigoKSA9PiByZXNvbHZlKCkpO1xuICAgICAgICB9KTtcbiAgICB9XG5cbiAgICAvKipcbiAgICAgKiBUaGlzIGNvbW1hbmQga2lsbHMgb3JwaGFuZWQgTVNCdWlsZC5leGUgcHJvY2Vzc2VzLlxuICAgICAqIFNvbWV0aW1lIGFmdGVyIG5hdGl2ZSBub2RlX21vZHVsZXMgY29tcGlsYXRpb24gdGhleSBhcmUgc3RpbGwgd3JpdGluZyBzb21lIGxvZ3MsXG4gICAgICogcHJldmVudCBub2RlX21vZHVsZXMgZnJvbSBiZWluZyBkZWxldGVkLlxuICAgICAqL1xuICAgIGtpbGxNU0J1aWxkKCkge1xuICAgICAgICBpZiAodGhpcy5jdXJyZW50Q29udGV4dC5wbGF0Zm9ybS5ub2RlTmFtZSAhPT0gJ3dpbjMyJykge1xuICAgICAgICAgICAgcmV0dXJuO1xuICAgICAgICB9XG4gICAgICAgIHRyeSB7XG4gICAgICAgICAgICBjb25zdCBvdXQgPSBzcGF3blxuICAgICAgICAgICAgICAgIC5zeW5jKFxuICAgICAgICAgICAgICAgICAgICAnd21pYycsXG4gICAgICAgICAgICAgICAgICAgIFsncHJvY2VzcycsICd3aGVyZScsICdjYXB0aW9uPVwiTVNCdWlsZC5leGVcIicsICdnZXQnLCAncHJvY2Vzc2lkJ11cbiAgICAgICAgICAgICAgICApXG4gICAgICAgICAgICAgICAgLnN0ZG91dC50b1N0cmluZygndXRmLTgnKVxuICAgICAgICAgICAgICAgIC5zcGxpdCgnXFxuJyk7XG5cbiAgICAgICAgICAgIGNvbnN0IHJlZ2V4ID0gbmV3IFJlZ0V4cCgvKFxcZCspLywgJ2dtJyk7XG4gICAgICAgICAgICAvLyBObyB3ZSB3aWxsIGNoZWNrIGZvciB0aG9zZSB3aXRoIHRoZSBtYXRjaGluZyBwYXJhbXMuXG4gICAgICAgICAgICBvdXQuZm9yRWFjaCgobGluZSkgPT4ge1xuICAgICAgICAgICAgICAgIGNvbnN0IG1hdGNoID0gcmVnZXguZXhlYyhsaW5lKSB8fCBmYWxzZTtcbiAgICAgICAgICAgICAgICBpZiAobWF0Y2gpIHtcbiAgICAgICAgICAgICAgICAgICAgdGhpcy5sb2cuZGVidWcoYGtpbGxpbmcgTVNCdWlsZC5leGUgYXQgcGlkOiAke21hdGNoWzFdfWApO1xuICAgICAgICAgICAgICAgICAgICBzcGF3bi5zeW5jKCd0YXNra2lsbCcsIFsnL3BpZCcsIG1hdGNoWzFdLCAnL2YnLCAnL3QnXSk7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIHJlZ2V4Lmxhc3RJbmRleCA9IDA7XG4gICAgICAgICAgICB9KTtcbiAgICAgICAgfSBjYXRjaCAoZSkge1xuICAgICAgICAgICAgdGhpcy5sb2cuZGVidWcoJ2tpbGwgTVNCdWlsZCBmYWlsZWQnKTtcbiAgICAgICAgfVxuICAgIH1cblxuICAgIC8qKlxuICAgICAqIFJldHVybnMgdGhlIHBhdGggdG8gcGFja2FnZWQgYXBwLlxuICAgICAqIEByZXR1cm5zIHtzdHJpbmd9XG4gICAgICovXG4gICAgZ2V0UGFja2FnZWRBcHBQYXRoKGNvbnRleHQgPSB7fSkge1xuICAgICAgICBpZiAodGhpcy5jdXJyZW50Q29udGV4dC5wbGF0Zm9ybS5ub2RlTmFtZSA9PT0gJ2RhcndpbicpIHtcbiAgICAgICAgICAgIHJldHVybiBwYXRoLmpvaW4oXG4gICAgICAgICAgICAgICAgdGhpcy5pbnN0YWxsZXJEaXIsXG4gICAgICAgICAgICAgICAgJ21hYycsXG4gICAgICAgICAgICAgICAgYCR7Y29udGV4dC5wYWNrYWdlci5hcHBJbmZvLnByb2R1Y3RGaWxlbmFtZX0uYXBwYCxcbiAgICAgICAgICAgICAgICAnQ29udGVudHMnLCAnUmVzb3VyY2VzJywgJ2FwcCdcbiAgICAgICAgICAgICk7XG4gICAgICAgIH1cbiAgICAgICAgY29uc3QgcGxhdGZvcm1EaXIgPVxuICAgICAgICAgICAgYCR7dGhpcy5jdXJyZW50Q29udGV4dC5wbGF0Zm9ybS5ub2RlTmFtZSA9PT0gJ3dpbjMyJyA/ICd3aW4nIDogJ2xpbnV4J30tJHt0aGlzLmN1cnJlbnRDb250ZXh0LmFyY2ggPT09ICdpYTMyJyA/ICdpYTMyLScgOiAnJ311bnBhY2tlZGA7XG4gICAgICAgIHJldHVybiBwYXRoLmpvaW4oXG4gICAgICAgICAgICB0aGlzLmluc3RhbGxlckRpcixcbiAgICAgICAgICAgIHBsYXRmb3JtRGlyLFxuICAgICAgICAgICAgJ3Jlc291cmNlcycsICdhcHAnXG4gICAgICAgICk7XG4gICAgfVxuXG4gICAgLyoqXG4gICAgICogT24gV2luZG93cyBpdCB3YWl0cyBmb3IgdGhlIGFwcC5hc2FyIGluIHRoZSBwYWNrZWQgYXBwIHRvIGJlIGZyZWUgKG5vIGZpbGUgbG9ja3MpLlxuICAgICAqIEByZXR1cm5zIHsqfVxuICAgICAqL1xuICAgIHdhaXQoKSB7XG4gICAgICAgIGlmICh0aGlzLmN1cnJlbnRDb250ZXh0LnBsYXRmb3JtLm5vZGVOYW1lICE9PSAnd2luMzInKSB7XG4gICAgICAgICAgICByZXR1cm4gUHJvbWlzZS5yZXNvbHZlKCk7XG4gICAgICAgIH1cbiAgICAgICAgY29uc3QgYXBwQXNhclBhdGggPSBwYXRoLmpvaW4oXG4gICAgICAgICAgICB0aGlzLmdldFBhY2thZ2VkQXBwUGF0aCgpLFxuICAgICAgICAgICAgJ2FwcC5hc2FyJ1xuICAgICAgICApO1xuICAgICAgICBsZXQgcmV0cmllcyA9IDA7XG4gICAgICAgIGNvbnN0IHNlbGYgPSB0aGlzO1xuICAgICAgICByZXR1cm4gbmV3IFByb21pc2UoKHJlc29sdmUsIHJlamVjdCkgPT4ge1xuICAgICAgICAgICAgZnVuY3Rpb24gY2hlY2soKSB7XG4gICAgICAgICAgICAgICAgZnMub3BlbihhcHBBc2FyUGF0aCwgJ3IrJywgKGVyciwgZmQpID0+IHtcbiAgICAgICAgICAgICAgICAgICAgcmV0cmllcyArPSAxO1xuICAgICAgICAgICAgICAgICAgICBpZiAoZXJyKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICBpZiAoZXJyLmNvZGUgIT09ICdFTk9FTlQnKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgc2VsZi5sb2cuZGVidWcoYHdhaXRpbmcgZm9yIGFwcC5hc2FyIHRvIGJlIHJlYWRhYmxlLCAkeydjb2RlJyBpbiBlcnIgPyBgY3VycmVudGx5IHJlYWRpbmcgaXQgcmV0dXJucyAke2Vyci5jb2RlfWAgOiAnJ31gKTtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAocmV0cmllcyA8IDYpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0VGltZW91dCgoKSA9PiBjaGVjaygpLCA0MDAwKTtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZWplY3QoYGZpbGUgaXMgbG9ja2VkOiAke2FwcEFzYXJQYXRofWApO1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAgICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgcmVzb2x2ZSgpO1xuICAgICAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgICAgICAgICAgICAgZnMuY2xvc2VTeW5jKGZkKTtcbiAgICAgICAgICAgICAgICAgICAgICAgIHJlc29sdmUoKTtcbiAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIH0pO1xuICAgICAgICAgICAgfVxuICAgICAgICAgICAgY2hlY2soKTtcbiAgICAgICAgfSk7XG4gICAgfVxuXG4gICAgLyoqXG4gICAgICogUHJlcGFyZXMgdGhlIHRhcmdldCBvYmplY3QgcGFzc2VkIHRvIHRoZSBlbGVjdHJvbi1idWlsZGVyLlxuICAgICAqXG4gICAgICogQHJldHVybnMge01hcDxQbGF0Zm9ybSwgTWFwPEFyY2gsIEFycmF5PHN0cmluZz4+Pn1cbiAgICAgKi9cbiAgICBwcmVwYXJlVGFyZ2V0cygpIHtcbiAgICAgICAgbGV0IGFyY2ggPSB0aGlzLiQuZW52Lm9wdGlvbnMuaWEzMiA/ICdpYTMyJyA6ICd4NjQnO1xuICAgICAgICBhcmNoID0gdGhpcy4kLmVudi5vcHRpb25zLmFsbEFyY2hzID8gJ2FsbCcgOiBhcmNoO1xuXG4gICAgICAgIGNvbnN0IHRhcmdldHMgPSBbXTtcblxuICAgICAgICBpZiAodGhpcy4kLmVudi5vcHRpb25zLndpbikge1xuICAgICAgICAgICAgdGFyZ2V0cy5wdXNoKHRoaXMuYnVpb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vdCB3YW50IGl0IHRvIGJlIHRoZXJlLlxuICAgICAqIEByZXR1cm5zIHtQcm9taXNlPGFueT59XG4gICAgICovXG4gICAgbW92ZU5vZGVNb2R1bGVzT3V0KCkge1xuICAgICAgICByZXR1cm4gbmV3IFByb21pc2UoKHJlc29sdmUsIHJlamVjdCkgPT4ge1xuICAgICAgICAgICAgdGhpcy5sb2cuZGVidWcoJ21vdmluZyBub2RlX21vZHVsZXMgb3V0LCBiZWNhdXNlIHdlIGhhdmUgdGhlbSBhbHJlYWR5IGluJyArXG4gICAgICAgICAgICAgICAgJyBhcHAuYXNhcicpO1xuICAgICAgICAgICAgdGhpcy5raWxsTVNCdWlsZCgpO1xuICAgICAgICAgICAgcmVtb3ZlRGlyKHRoaXMuJC5lbnYucGF0aHMuZWxlY3Ryb25BcHAudG1wTm9kZU1vZHVsZXMpXG4gICAgICAgICAgICAgICAgLmNhdGNoKGUgPT4gcmVqZWN0KGUpKVxuICAgICAgICAgICAgICAgIC50aGVuKCgpID0+IHtcbiAgICAgICAgICAgICAgICAgICAgc2hlbGwuY29uZmlnLmZhdGFsID0gdHJ1ZTtcbiAgICAgICAgICAgICAgICAgICAgc2hlbGwuY29uZmlnLnZlcmJvc2UgPSB0cnVlO1xuICAgICAgICAgICAgICAgICAgICB0cnkge1xuICAgICAgICAgICAgICAgICAgICAgICAgc2hlbGwubXYoXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhpcy4kLmVudi5wYXRocy5lbGVjdHJvbkFwcC5ub2RlTW9kdWxlcyxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aGlzLiQuZW52LnBhdGhzLmVsZWN0cm9uQXBwLnRtcE5vZGVNb2R1bGVzXG4gICAgICAgICAgICAgICAgICAgICAgICApO1xuICAgICAgICAgICAgICAgICAgICAgICAgc2hlbGwuY29uZmlnLnJlc2V0KCk7XG4gICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdGhpcy53YWl0KCk7XG4gICAgICAgICAgICAg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line at end of file
diff --git a/dist/env.js b/dist/env.js
new file mode 100644
index 00000000..8f8fd133
--- /dev/null
+++ b/dist/env.js
@@ -0,0 +1,239 @@
+"use strict";
+
+Object.defineProperty(exports, "__esModule", {
+ value: true
+});
+exports.default = void 0;
+
+var _path = _interopRequireDefault(require("path"));
+
+var _os = _interopRequireDefault(require("os"));
+
+var _assignIn = _interopRequireDefault(require("lodash/assignIn"));
+
+function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
+
+const {
+ join
+} = _path.default;
+/**
+ * @class
+ * @property {packagePaths} paths
+ */
+
+class Env {
+ constructor(input, output, options) {
+ this.options = options;
+
+ if (this.isProductionBuild()) {
+ process.env.NODE_ENV = 'production';
+ }
+
+ this.sys = {
+ platform: process.platform,
+ arch: process.arch
+ }; // Operational System.
+
+ this.os = {
+ isWindows: process.platform === 'win32',
+ isLinux: process.platform === 'linux',
+ isOsx: process.platform === 'darwin'
+ };
+ this.stdio = 'inherit';
+ this.os.name = this.sys.platform === 'darwin' ? 'osx' : this.sys.platform;
+ this.os.home = process.env[this.os.isWindows ? 'USERPROFILE' : 'HOME'];
+ this.os.tmp = _os.default.tmpdir();
+ /** @type {packagePaths} */
+
+ this.paths = {};
+ /** @type {meteorDesktopPaths} */
+
+ this.paths.meteorDesktop = {
+ root: _path.default.resolve(__dirname, '..')
+ };
+ this.paths.meteorDesktop.skeleton = join(this.paths.meteorDesktop.root, 'skeleton');
+ /** @type {meteorAppPaths} */
+
+ this.paths.meteorApp = {
+ root: input
+ };
+ /** @type {desktopPaths} */
+
+ this.paths.desktop = {
+ rootName: '.desktop',
+ root: join(this.paths.meteorApp.root, '.desktop')
+ };
+ (0, _assignIn.default)(this.paths.desktop, {
+ modules: join(this.paths.desktop.root, 'modules'),
+ import: join(this.paths.desktop.root, 'import'),
+ assets: join(this.paths.desktop.root, 'assets'),
+ settings: join(this.paths.desktop.root, 'settings.json'),
+ desktop: join(this.paths.desktop.root, 'desktop.js')
+ });
+ this.paths.desktop.splashScreen = join(this.paths.desktop.assets, 'splashScreen.png');
+ this.paths.desktop.loadingGif = join(this.paths.desktop.assets, 'loading.gif');
+ this.paths.desktop.meteorIco = join(this.paths.desktop.assets, 'meteor.ico');
+ /** @type {electronAppPaths} */
+
+ this.paths.electronApp = {
+ rootName: 'desktop-build'
+ };
+ this.paths.electronApp.root = join(this.paths.meteorApp.root, '.meteor', this.paths.electronApp.rootName);
+ this.paths.electronApp.tmpNodeModules = join(this.paths.meteorApp.root, '.meteor', '.desktop_node_modules');
+ this.paths.cache = join(this.paths.meteorApp.root, '.meteor', 'local', 'desktop-cache');
+ this.paths.electronApp.extractedNodeModules = join(this.paths.meteorApp.root, '.meteor', '.desktop_extracted_node_modules');
+ this.paths.electronApp.extractedNodeModulesBin = join(this.paths.electronApp.extractedNodeModules, '.bin');
+ this.paths.electronApp.appRoot = join(this.paths.electronApp.root, 'app');
+ (0, _assignIn.default)(this.paths.electronApp, {
+ app: join(this.paths.electronApp.appRoot, 'app.js'),
+ cordova: join(this.paths.electronApp.appRoot, 'cordova.js'),
+ index: join(this.paths.electronApp.appRoot, 'index.js'),
+ preload: join(this.paths.electronApp.appRoot, 'preload.js'),
+ modules: join(this.paths.electronApp.appRoot, 'modules'),
+ desktopAsar: join(this.paths.electronApp.root, 'desktop.asar'),
+ extracted: join(this.paths.electronApp.root, 'extracted'),
+ appAsar: join(this.paths.electronApp.root, 'app.asar'),
+ import: join(this.paths.electronApp.root, 'import'),
+ assets: join(this.paths.electronApp.root, 'assets'),
+ packageJson: join(this.paths.electronApp.root, 'package.json'),
+ settings: join(this.paths.electronApp.root, 'settings.json'),
+ desktop: join(this.paths.electronApp.root, 'desktop.js'),
+ desktopTmp: join(this.paths.electronApp.root, '__desktop'),
+ nodeModules: join(this.paths.electronApp.root, 'node_modules'),
+ meteorAsar: join(this.paths.electronApp.root, 'meteor.asar'),
+ meteorApp: join(this.paths.electronApp.root, 'meteor'),
+ meteorAppIndex: join(this.paths.electronApp.root, 'meteor', 'index.html'),
+ meteorAppProgramJson: join(this.paths.electronApp.root, 'meteor', 'program.json'),
+ skeleton: join(this.paths.electronApp.root, 'skeleton')
+ });
+ (0, _assignIn.default)(this.paths.meteorApp, {
+ platforms: join(this.paths.meteorApp.root, '.meteor', 'platforms'),
+ packages: join(this.paths.meteorApp.root, '.meteor', 'packages'),
+ versions: join(this.paths.meteorApp.root, '.meteor', 'versions'),
+ release: join(this.paths.meteorApp.root, '.meteor', 'release'),
+ packageJson: join(this.paths.meteorApp.root, 'package.json'),
+ gitIgnore: join(this.paths.meteorApp.root, '.meteor', '.gitignore'),
+ cordovaBuild: join(this.paths.meteorApp.root, '.meteor', 'local', 'cordova-build', 'www', 'application'),
+ webCordova: join(this.paths.meteorApp.root, '.meteor', 'local', 'build', 'programs', 'web.cordova')
+ });
+ (0, _assignIn.default)(this.paths.meteorApp, {
+ cordovaBuildIndex: join(this.paths.meteorApp.cordovaBuild, 'index.html'),
+ cordovaBuildProgramJson: join(this.paths.meteorApp.cordovaBuild, 'program.json')
+ });
+ (0, _assignIn.default)(this.paths.meteorApp, {
+ webCordovaProgramJson: join(this.paths.meteorApp.webCordova, 'program.json')
+ });
+ /** @type {desktopTmpPaths} */
+
+ this.paths.desktopTmp = {
+ root: join(this.paths.electronApp.root, '__desktop')
+ };
+ (0, _assignIn.default)(this.paths.desktopTmp, {
+ modules: join(this.paths.desktopTmp.root, 'modules'),
+ settings: join(this.paths.desktopTmp.root, 'settings.json')
+ });
+ this.paths.packageDir = '.desktop-package';
+ this.paths.installerDir = '.desktop-installer'; // Scaffold
+
+ this.paths.scaffold = join(__dirname, '..', 'scaffold');
+ }
+ /**
+ * @returns {boolean|*}
+ * @public
+ */
+
+
+ isProductionBuild() {
+ return !!('production' in this.options && this.options.production);
+ }
+
+}
+
+exports.default = Env;
+module.exports = Env;
+/**
+ * @typedef {Object} desktopPaths
+ * @property {string} rootName
+ * @property {string} root
+ * @property {string} modules
+ * @property {string} import
+ * @property {string} assets
+ * @property {string} settings
+ * @property {string} desktop
+ * @property {string} splashScreen
+ * @property {string} loadingGif
+ * @property {string} meteorIco
+ */
+
+/**
+ * @typedef {Object} meteorAppPaths
+ * @property {string} root
+ * @property {string} platforms
+ * @property {string} release
+ * @property {string} packages
+ * @property {string} versions
+ * @property {string} gitIgnore
+ * @property {string} packageJson
+ * @property {string} cordovaBuild
+ * @property {string} cordovaBuildIndex
+ * @property {string} cordovaBuildProgramJson
+ * @property {string} webCordova
+ * @property {string} webCordovaIndex
+ * @property {string} webCordovaProgramJson
+ */
+
+/**
+ * @typedef {Object} electronAppPaths
+ * @property {string} rootName
+ * @property {string} root
+ * @property {Object} appRoot
+ * @property {string} appRoot.cordova
+ * @property {string} appRoot.index
+ * @property {string} appRoot.app
+ * @property {string} appRoot.modules
+ * @property {string} desktopAsar
+ * @property {string} extracted
+ * @property {string} appAsar
+ * @property {string} preload
+ * @property {string} import
+ * @property {string} assets
+ * @property {string} gitIgnore
+ * @property {string} packageJson
+ * @property {string} settings
+ * @property {string} desktop
+ * @property {string} desktopTmp
+ * @property {string} nodeModules
+ * @property {string} meteorAsar
+ * @property {string} meteorApp
+ * @property {string} meteorAppIndex
+ * @property {string} meteorAppProgramJson
+ * @property {string} skeleton
+ * @property {string} tmpNodeModules
+ * @property {string} extractedNodeModules
+ * @property {string} extractedNodeModulesBin
+ */
+
+/**
+ * @typedef {Object} desktopTmpPaths
+ * @property {string} root
+ * @property {string} modules
+ * @property {string} settings
+ */
+
+/**
+ * @typedef {Object} meteorDesktopPaths
+ * @property {string} root
+ * @property {string} skeleton
+ */
+
+/**
+ * @typedef {Object} packagePaths
+ * @property {meteorAppPaths} meteorApp
+ * @property {desktopPaths} desktop
+ * @property {electronAppPaths} electronApp
+ * @property {desktopTmpPaths} desktopTmp
+ * @property {meteorDesktopPaths} meteorDesktop
+ * @property {string} packageDir
+ * @property {string} scaffold
+ */
+//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJuYW1lcy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Y3Ryb25BcHAucm9vdCwgJ2Rlc2t0b3AuanMnKSxcbiAgICAgICAgICAgIGRlc2t0b3BUbXA6IGpvaW4odGhpcy5wYXRocy5lbGVjdHJvbkFwcC5yb290LCAnX19kZXNrdG9wJyksXG4gICAgICAgICAgICBub2RlTW9kdWxlczogam9pbih0aGlzLnBhdGhzLmVsZWN0cm9uQXBwLnJvb3QsICdub2RlX21vZHVsZXMnKSxcbiAgICAgICAgICAgIG1ldGVvckFzYXI6IGpvaW4odGhpcy5wYXRocy5lbGVjdHJvbkFwcC5yb290LCAnbWV0ZW9yLmFzYXInKSxcbiAgICAgICAgICAgIG1ldGVvckFwcDogam9pbih0aGlzLnBhdGhzLmVsZWN0cm9uQXBwLnJvb3QsICdtZXRlb3InKSxcbiAgICAgICAgICAgIG1ldGVvckFwcEluZGV4OiBqb2luKHRoaXMucGF0aHMuZWxlY3Ryb25BcHAucm9vdCwgJ21ldGVvcicsICdpbmRleC5odG1sJyksXG4gICAgICAgICAgICBtZXRlb3JBcHBQcm9ncmFtSnNvbjogam9pbih0aGlzLnBhdGhzLmVsZWN0cm9uQXBwLnJvb3QsICdtZXRlb3InLCAncHJvZ3JhbS5qc29uJyksXG4gICAgICAgICAgICBza2VsZXRvbjogam9pbih0aGlzLnBhdGhzLmVsZWN0cm9uQXBwLnJvb3QsICdza2VsZXRvbicpXG4gICAgICAgIH0pO1xuXG4gICAgICAgIGFzc2lnbkluKHRoaXMucGF0aHMubWV0ZW9yQXBwLCB7XG4gICAgICAgICAgICBwbGF0Zm9ybXM6IGpvaW4odGhpcy5wYXRocy5tZXRlb3JBcHAucm9vdCwgJy5tZXRlb3InLCAncGxhdGZvcm1zJyksXG4gICAgICAgICAgICBwYWNrYWdlczogam9pbih0aGlzLnBhdGhzLm1ldGVvckFwcC5yb290LCAnLm1ldGVvcicsICdwYWNrYWdlcycpLFxuICAgICAgICAgICAgdmVyc2lvbnM6IGpvaW4odGhpcy5wYXRocy5tZXRlb3JBcHAucm9vdCwgJy5tZXRlb3InLCAndmVyc2lvbnMnKSxcbiAgICAgICAgICAgIHJlbGVhc2U6IGpvaW4odGhpcy5wYXRocy5tZXRlb3JBcHAucm9vdCwgJy5tZXRlb3InLCAncmVsZWFzZScpLFxuICAgICAgICAgICAgcGFja2FnZUpzb246IGpvaW4odGhpcy5wYXRocy5tZXRlb3JBcHAucm9vdCwgJ3BhY2thZ2UuanNvbicpLFxuICAgICAgICAgICAgZ2l0SWdub3JlOiBqb2luKHRoaXMucGF0aHMubWV0ZW9yQXBwLnJvb3QsICcubWV0ZW9yJywgJy5naXRpZ25vcmUnKSxcbiAgICAgICAgICAgIGNvcmRvdmFCdWlsZDogam9pbihcbiAgICAgICAgICAgICAgICB0aGlzLnBhdGhzLm1ldGVvckFwcC5yb290LFxuICAgICAgICAgICAgICAgICcubWV0ZW9yJyxcbiAgICAgICAgICAgICAgICAnbG9jYWwnLFxuICAgICAgICAgICAgICAgICdjb3Jkb3ZhLWJ1aWxkJyxcbiAgICAgICAgICAgICAgICAnd3d3JyxcbiAgICAgICAgICAgICAgICAnYXBwbGljYXRpb24nXG4gICAgICAgICAgICApLFxuICAgICAgICAgICAgd2ViQ29yZG92YTogam9pbihcbiAgICAgICAgICAgICAgICB0aGlzLnBhdGhzLm1ldGVvckFwcC5yb290LFxuICAgICAgICAgICAgICAgICcubWV0ZW9yJyxcbiAgICAgICAgICAgICAgICAnbG9jYWwnLFxuICAgICAgICAgICAgICAgICdidWlsZCcsXG4gICAgICAgICAgICAgICAgJ3Byb2dyYW1zJyxcbiAgICAgICAgICAgICAgICAnd2ViLmNvcmRvdmEnXG4gICAgICAgICAgICApXG4gICAgICAgIH0pO1xuXG4gICAgICAgIGFzc2lnbkluKHRoaXMucGF0aHMubWV0ZW9yQXBwLCB7XG4gICAgICAgICAgICBjb3Jkb3ZhQnVpbGRJbmRleDogam9pbihcbiAgICAgICAgICAgICAgICB0aGlzLnBhdGhzLm1ldGVvckFwcC5jb3Jkb3ZhQnVpbGQsICdpbmRleC5odG1sJ1xuICAgICAgICAgICAgKSxcbiAgICAgICAgICAgIGNvcmRvdmFCdWlsZFByb2dyYW1Kc29uOiBqb2luKFxuICAgICAgICAgICAgICAgIHRoaXMucGF0aHMubWV0ZW9yQXBwLmNvcmRvdmFCdWlsZCwgJ3Byb2dyYW0uanNvbidcbiAgICAgICAgICAgIClcbiAgICAgICAgfSk7XG5cbiAgICAgICAgYXNzaWduSW4odGhpcy5wYXRocy5tZXRlb3JBcHAsIHtcbiAgICAgICAgICAgIHdlYkNvcmRvdmFQcm9ncmFtSnNvbjogam9pbihcbiAgICAgICAgICAgICAgICB0aGlzLnBhdGhzLm1ldGVvckFwcC53ZWJDb3Jkb3ZhLCAncHJvZ3JhbS5qc29uJ1xuICAgICAgICAgICAgKVxuICAgICAgICB9KTtcblxuXG4gICAgICAgIC8qKiBAdHlwZSB7ZGVza3RvcFRtcFBhdGhzfSAqL1xuICAgICAgICB0aGlzLnBhdGhzLmRlc2t0b3BUbXAgPSB7XG4gICAgICAgICAgICByb290OiBqb2luKHRoaXMucGF0aHMuZWxlY3Ryb25BcHAucm9vdCwgJ19fZGVza3RvcCcpLFxuICAgICAgICB9O1xuXG4gICAgICAgIGFzc2lnbkluKHRoaXMucGF0aHMuZGVza3RvcFRtcCwge1xuICAgICAgICAgICAgbW9kdWxlczogam9pbih0aGlzLnBhdGhzLmRlc2t0b3BUbXAucm9vdCwgJ21vZHVsZXMnKSxcbiAgICAgICAgICAgIHNldHRpbmdzOiBqb2luKHRoaXMucGF0aHMuZGVza3RvcFRtcC5yb290LCAnc2V0dGluZ3MuanNvbicpXG4gICAgICAgIH0pO1xuXG4gICAgICAgIHRoaXMucGF0aHMucGFja2FnZURpciA9ICcuZGVza3RvcC1wYWNrYWdlJztcbiAgICAgICAgdGhpcy5wYXRocy5pbnN0YWxsZXJEaXIgPSAnLmRlc2t0b3AtaW5zdGFsbGVyJztcblxuICAgICAgICAvLyBTY2FmZm9sZFxuICAgICAgICB0aGlzLnBhdGh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0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTs7QUFFQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7O0FBRUE7QUFDQTtBQUNBO0FBQ0E7QUFDQTs7QUFFQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQSJ9
\ No newline at end of file
diff --git a/dist/index.js b/dist/index.js
new file mode 100644
index 00000000..44c7cecc
--- /dev/null
+++ b/dist/index.js
@@ -0,0 +1,247 @@
+"use strict";
+
+Object.defineProperty(exports, "__esModule", {
+ value: true
+});
+exports.default = _exports;
+
+var _runtime = _interopRequireDefault(require("regenerator-runtime/runtime"));
+
+var _fs = _interopRequireDefault(require("fs"));
+
+var _path = _interopRequireDefault(require("path"));
+
+var _shelljs = _interopRequireDefault(require("shelljs"));
+
+var _env = _interopRequireDefault(require("./env"));
+
+var _electron = _interopRequireDefault(require("./electron"));
+
+var _log = _interopRequireDefault(require("./log"));
+
+var _desktop = _interopRequireDefault(require("./desktop"));
+
+var _electronApp = _interopRequireDefault(require("./electronApp"));
+
+var _meteorApp = _interopRequireDefault(require("./meteorApp"));
+
+var _electronBuilder = _interopRequireDefault(require("./electronBuilder"));
+
+var _packager = _interopRequireDefault(require("./packager"));
+
+var _utils = _interopRequireDefault(require("./utils"));
+
+function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
+
+// eslint-disable-next-line no-unused-vars
+_shelljs.default.config.fatal = true;
+/**
+ * Main entity.
+ * @class
+ * @property {Env} env
+ * @property {Electron} electron
+ * @property {InstallerBuilder} installerBuilder
+ * @property {ElectronApp} electronApp
+ * @property {Desktop} desktop
+ * @property {MeteorApp} meteorApp
+ */
+
+class MeteorDesktop {
+ /**
+ * @param {string} input - Meteor app dir
+ * @param {string} output - output dir for bundle/package/installer
+ * @param {Object} options - options from cli.js
+ * @param {Object} dependencies - dependencies object
+ * @constructor
+ */
+ constructor(input, output, options, dependencies) {
+ const Log = dependencies.log;
+ this.log = new Log('index');
+ this.version = this.getVersion();
+ this.log.info('initializing');
+ this.env = new _env.default(input, output, options);
+ this.electron = new _electron.default(this);
+ this.electronBuilder = new _electronBuilder.default(this);
+ this.electronApp = new _electronApp.default(this);
+ this.desktop = new _desktop.default(this);
+ this.meteorApp = new _meteorApp.default(this);
+ this.utils = _utils.default;
+ }
+ /**
+ * Tries to read the version from our own package.json.
+ *
+ * @returns {string}
+ */
+
+
+ getVersion() {
+ if (this.version) {
+ return this.version;
+ }
+
+ let version = null;
+
+ try {
+ ({
+ version
+ } = JSON.parse(_fs.default.readFileSync(_path.default.join(__dirname, '..', 'package.json'), 'UTF-8')));
+ } catch (e) {
+ this.log.error(`error while trying to read ${_path.default.join(__dirname, 'package.json')}`, e);
+ process.exit(1);
+ }
+
+ if (process.env.PLUGIN_VERSION && (version.includes('rc') || version.includes('beta') || version.includes('alpha'))) {
+ version = process.env.PLUGIN_VERSION;
+ }
+
+ return version;
+ }
+ /**
+ * Tries to read the version from our own package.json.
+ *
+ * @returns {string}
+ */
+
+
+ getElectronVersion() {
+ let version = null;
+
+ try {
+ const {
+ dependencies = {},
+ devDependencies = {}
+ } = JSON.parse(_fs.default.readFileSync(_path.default.join(this.env.paths.meteorApp.root, 'package.json'), 'UTF-8'));
+
+ if (!('electron' in dependencies) && !('electron' in devDependencies)) {
+ this.log.error('electron not found in meteor project dependencies');
+ process.exit(1);
+ }
+
+ version = dependencies.electron || devDependencies.electron;
+
+ if (this.electronApp.depsManager.checks.version.regex.test(version)) {
+ ({
+ version
+ } = JSON.parse(_fs.default.readFileSync(_path.default.join(this.env.paths.meteorApp.root, 'node_modules', 'electron', 'package.json'), 'UTF-8')));
+ }
+ } catch (e) {
+ this.log.error(`error while trying to read ${_path.default.join(this.env.paths.meteorApp.root, 'package.json')}`, e);
+ process.exit(1);
+ }
+
+ return version;
+ }
+
+ async init() {
+ this.desktop.scaffold();
+ this.meteorApp.updateGitIgnore();
+ await this.electronApp.init();
+ }
+
+ async buildInstaller(throwError = false) {
+ this.env.options.installerBuild = true;
+ await this.electronApp.build();
+
+ try {
+ await this.electronBuilder.build();
+ } catch (e) {
+ this.log.error('error occurred while building installer', e);
+
+ if (throwError) {
+ throw new Error(e);
+ }
+ }
+ }
+
+ async run() {
+ await this.electronApp.build(true);
+ }
+
+ async build() {
+ await this.electronApp.build();
+ }
+
+ justRun() {
+ this.electron.run();
+ }
+
+ async runPackager() {
+ this.packager = new _packager.default(this);
+ await this.packager.init();
+ await this.electronApp.build();
+ this.packager.packageApp().catch(e => {
+ this.log.error(`while trying to build a package an error occurred: ${e}`);
+ });
+ }
+
+ async getDependency(name, version, declarationCheck = true) {
+ if (declarationCheck) {
+ try {
+ const {
+ dependencies = {},
+ devDependencies = {}
+ } = JSON.parse(_fs.default.readFileSync(_path.default.join(this.env.paths.meteorApp.root, 'package.json'), 'UTF-8'));
+
+ if (!(name in dependencies) && !(name in devDependencies)) {
+ await this.meteorApp.runNpm(['i', '-D', '-E', '--only=dev', `${name}@${version}`], 'inherit');
+ }
+ } catch (e) {
+ this.log.error(`could no read ${_path.default.join(this.env.paths.meteorApp.root, 'package.json')}`, e);
+ process.exit(1);
+ }
+ }
+
+ const dependencyPath = _path.default.join(this.env.paths.meteorApp.root, 'node_modules', name);
+
+ let dependency = null;
+
+ try {
+ dependency = require(dependencyPath);
+ } catch (e) {
+ if (declarationCheck) {
+ this.log.warn(`could not find ${name}, installing the default version for you: ${name}@${version}`);
+
+ try {
+ await this.meteorApp.runNpm(['i', '-D', '-E', '--only=dev', `${name}@${version}`], 'inherit');
+ } catch (err) {
+ this.log.error(err);
+ process.exit(1);
+ }
+ } else {
+ this.log.warn(`could not find ${name}, exiting`);
+ process.exit(1);
+ }
+ } finally {
+ if (!dependency) {
+ dependency = require(dependencyPath);
+ }
+ }
+
+ const dependencyVersion = require(_path.default.join(dependencyPath, 'package.json')).version;
+
+ if (dependencyVersion !== version) {
+ if (dependencyVersion.split('.')[0] !== version.split('.')[0]) {
+ this.log.warn(`you are using a ${name}@${dependencyVersion} while the recommended version is ` + `${version}, the compatibility version is different, use at your own risk, be sure to report ` + 'that when submitting issues');
+ } else {
+ this.log.warn(`you are using a ${name}@${dependencyVersion} while the recommended version is ` + `${version}, be sure to report that when submitting issues`);
+ }
+ }
+
+ return {
+ dependency,
+ path: dependencyPath
+ };
+ }
+
+}
+
+function _exports(input, output, options, {
+ log = _log.default
+} = {
+ log: _log.default
+}) {
+ return new MeteorDesktop(input, output, options, {
+ log
+ });
+}
+//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJuYW1lcyI6WyJzaGVsbCIsImNvbmZpZyIsImZhdGFsIiwiTWV0ZW9yRGVza3RvcCIsImNvbnN0cnVjdG9yIiwiaW5wdXQiLCJvdXRwdXQiLCJvcHRpb25zIiwiZGVwZW5kZW5jaWVzIiwiTG9nIiwibG9nIiwidmVyc2lvbiIsImdldFZlcnNpb24iLCJpbmZvIiwiZW52IiwiRW52IiwiZWxlY3Ryb24iLCJFbGVjdHJvbiIsImVsZWN0cm9uQnVpbGRlciIsIkVsZWN0cm9uQnVpbGRlciIsImVsZWN0cm9uQXBwIiwiRWxlY3Ryb25BcHAiLCJkZXNrdG9wIiwiRGVza3RvcCIsIm1ldGVvckFwcCIsIk1ldGVvckFwcCIsInV0aWxzIiwiSlNPTiIsInBhcnNlIiwiZnMiLCJyZWFkRmlsZVN5bmMiLCJwYXRoIiwiam9pbiIsIl9fZGlybmFtZSIsImUiLCJlcnJvciIsInByb2Nlc3MiLCJleGl0IiwiUExVR0lOX1ZFUlNJT04iLCJpbmNsdWRlcyIsImdldEVsZWN0cm9uVmVyc2lvbiIsImRldkRlcGVuZGVuY2llcyIsInBhdGhz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J1VURi04JylcbiAgICAgICAgICAgICkpO1xuICAgICAgICB9IGNhdGNoIChlKSB7XG4gICAgICAgICAgICB0aGlzLmxvZy5lcnJvcihgZXJyb3Igd2hpbGUgdHJ5aW5nIHRvIHJlYWQgJHtwYXRoLmpvaW4oX19kaXJuYW1lLCAncGFja2FnZS5qc29uJyl9YCwgZSk7XG4gICAgICAgICAgICBwcm9jZXNzLmV4aXQoMSk7XG4gICAgICAgIH1cbiAgICAgICAgaWYgKHByb2Nlc3MuZW52LlBMVUdJTl9WRVJTSU9OICYmXG4gICAgICAgICAgICAodmVyc2lvbi5pbmNsdWRlcygncmMnKSB8fCB2ZXJzaW9uLmluY2x1ZGVzKCdiZXRhJykgfHwgdmVyc2lvbi5pbmNsdWRlcygnYWxwaGEnKSlcbiAgICAgICAgKSB7XG4gICAgICAgICAgICB2ZXJzaW9uID0gcHJvY2Vzcy5lbnYuUExVR0lOX1ZFUlNJT047XG4gICAgICAgIH1cbiAgICAgICAgcmV0dXJuIHZlcnNpb247XG4gICAgfVxuXG4gICAgLyoqXG4gICAgICogVHJpZXMgdG8gcmVhZCB0aGUgdmVyc2lvbiBmcm9tIG91ciBvd24gcGFja2FnZS5qc29uLlxuICAgICAqXG4gICAgICogQHJldHVybnMge3N0cmluZ31cbiAgICAgKi9cbiAgICBnZXRFbGVjdHJvblZlcnNpb24oKSB7XG4gICAgICAgIGxldCB2ZXJzaW9uID0gbnVsbDtcbiAgICAgICAgdHJ5IHtcbiAgICAgICAgICAgIGNvbnN0IHsgZGVwZW5kZW5jaWVzID0ge30sIGRldkRlcGVuZGVuY2llcyA9IHt9IH0gPSBKU09OLnBhcnNlKFxuICAgICAgICAgICAgICAgIGZzLnJlYWRGaWxlU3luYyhwYXRoLmpvaW4odGhpcy5lbnYucGF0aHMubWV0ZW9yQXBwLnJvb3QsICdwYWNrYWdlLmpzb24nKSwgJ1VURi04JylcbiAgICAgICAgICAgICk7XG4gICAgICAgICAgICBpZiAoISgnZWxlY3Ryb24nIGluIGRlcGVuZGVuY2llcykgJiYgISgnZWxlY3Ryb24nIGluIGRldkRlcGVuZGVuY2llcykpIHtcbiAgICAgICAgICAgICAgICB0aGlzLmxvZy5lcnJvcignZWxlY3Ryb24gbm90IGZvdW5kIGluIG1ldGVvciBwcm9qZWN0IGRlcGVuZGVuY2llcycpO1xuICAgICAgICAgICAgICAgIHByb2Nlc3MuZXhpdCgxKTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIHZlcnNpb24gPSBkZXBlbmRlbmNpZXMuZWxlY3Ryb24gfHwgZGV2RGVwZW5kZW5jaWVzLmVsZWN0cm9uO1xuICAgICAgICAgICAgaWYgKHRoaXMuZWxlY3Ryb25BcHAuZGVwc01hbmFnZXIuY2hlY2tzLnZlcnNpb24ucmVnZXgudGVzdCh2ZXJzaW9uKSkge1xuICAgICAgICAgICAgICAgICh7IHZlcnNpb24gfSA9IEpTT04ucGFyc2UoXG4gICAgICAgICAgICAgICAgICAgIGZzLnJlYWRGaWxlU3luYyhwYXRoLmpvaW4odGhpcy5lbnYucGF0aHMubWV0ZW9yQXBwLnJvb3QsICdub2RlX21vZHVsZXMnLCAnZWxlY3Ryb24nLCAncGFja2FnZS5qc29uJyksICdVVEYtOCcpXG4gICAgICAgICAgICAgICAgKSk7XG4gICAgICAgICAgICB9XG4gICAgICAgIH0gY2F0Y2ggKGUpIHtcbiAgICAgICAgICAgIHRoaXMubG9nLmVycm9yKGBlcnJvciB3aGlsZSB0cnlpbmcgdG8gcmVhZCAke3BhdGguam9pbih0aGlzLmVudi5wYXRocy5tZXRlb3JBcHAucm9vdCwgJ3BhY2thZ2UuanNvbicpfWAsIGUpO1xuICAgICAgICAgICAgcHJvY2Vzcy5leGl0KDEpO1xuICAgICAgICB9XG4gICAgICAgIHJldHVybiB2ZXJzaW9uO1xuICAgIH1cblxuICAgIGFzeW5jIGluaXQoKSB7XG4gICAgICAgIHRoaXMuZGVza3RvcC5zY2FmZm9sZCgpO1xuICAgICAgICB0aGlz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G5cbiAgICAgICAgdGhpcy5wYWNrYWdlci5wYWNrYWdlQXBwKCkuY2F0Y2goKGUpID0+IHtcbiAgICAgICAgICAgIHRoaXMubG9nLmVycm9yKGB3aGlsZSB0cnlpbmcgdG8gYnVpbGQgYSBwYWNrYWdlIGFuIGVycm9yIG9jY3VycmVkOiAke2V9YCk7XG4gICAgICAgIH0pO1xuICAgIH1cblxuICAgIGFzeW5jIGdldERlcGVuZGVuY3kobmFtZSwgdmVyc2lvbiwgZGVjbGFyYXRpb25DaGVjayA9IHRydWUpIHtcbiAgICAgICAgaWYgKGRlY2xhcmF0aW9uQ2hlY2spIHtcbiAgICAgICAgICAgIHRyeSB7XG4gICAgICAgICAgICAgICAgY29uc3QgeyBkZXBlbmRlbmNpZXMgPSB7fSwgZGV2RGVwZW5kZW5jaWVzID0ge30gfSA9IEpTT04ucGFyc2UoXG4gICAgICAgICAgICAgICAgICAgIGZzLnJlYWRGaWxlU3luYyhwYXRoLmpvaW4odGhpcy5lbnYucGF0aHMubWV0ZW9yQXBwLnJvb3QsICdwYWNrYWdlLmpzb24nKSwgJ1VURi04JylcbiAgICAgICAgICAgICAgICApO1xuICAgICAgICAgICAgICAgIGlmICghKG5hbWUgaW4gZGVwZW5kZW5jaWVzKSAmJiAhKG5hbWUgaW4gZGV2RGVwZW5kZW5jaWVzKSkge1xuICAgICAgICAgICAgICAgICAgICBhd2FpdCB0aGlzLm1ldGVvckFwcC5ydW5OcG0oWydpJywgJy1EJywgJy1FJywgJy0tb25seT1kZXYnLCBgJHtuYW1lfUAke3ZlcnNpb259YF0sICdpbmhlcml0Jyk7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfSBjYXRjaCAoZSkge1xuICAgICAgICAgICAgICAgIHRoaXMubG9nLmVycm9yKGBjb3VsZCBubyByZWFkICR7cGF0aC5qb2luKHRoaXMuZW52LnBhdGhzLm1ldGVvckFwcC5yb290LCAncGFja2FnZS5qc29uJyl9YCwgZSk7XG4gICAgICAgICAgICAgICAgcHJvY2Vzcy5leGl0KDEpO1xuICAgICAgICAgICAgfVxuICAgICAgICB9XG5cbiAgICAgICAgY29uc3QgZGVwZW5kZW5jeVBhdGggPSBwYXRoLmpvaW4odGhpcy5lbnYucGF0aHMubWV0ZW9yQXBwLnJvb3QsICdub2RlX21vZHVsZXMnLCBuYW1lKTtcbiAgICAgICAgbGV0IGRlcGVuZGVuY3kgPSBudWxsO1xuICAgICAgICB0cnkge1xuICAgICAgICAgICAgZGVwZW5kZW5jeSA9IHJlcXVpcmUoZGVwZW5kZW5jeVBhdGgpO1xuICAgICAgICB9IGNhdGNoIChlKSB7XG4gICAgICAgICAgICBpZiAoZGVjbGFyYXRpb25DaGVjaykge1xuICAgICAgICAgICAgICAgIHRoaXMubG9nLndhcm4oYGNvdWxkIG5vdCBmaW5kICR7bmFtZX0sIGluc3RhbGxpbmcgdGhlIGRlZmF1bHQgdmVyc2lvbiBmb3IgeW91OiAke25hbWV9QCR7dmVyc2lvbn1gKTtcbiAgICAgICAgICAgICAgICB0cnkge1xuICAgICAgICAgICAgICAgICAgICBhd2FpdCB0aGlzLm1ldGVvckFwcC5ydW5OcG0oWydpJywgJy1EJywgJy1FJywgJy0tb25seT1kZXYnLCBgJHtuYW1lfUAke3ZlcnNpb259YF0sICdpbmhlcml0Jyk7XG4gICAgICAgICAgICAgICAgfSBjYXRjaCAoZXJyKSB7XG4gICAgICAgICAgICAgICAgICAgIHRoaXMubG9nLmVycm9yKGVycik7XG4gICAgICAgICAgICAgICAgICAgIHByb2Nlc3MuZXhpdCgxKTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgICAgIHRoaXMubG9nLndhcm4oYGNvdWxkIG5vdCBmaW5kICR7bmFtZX0sIGV4aXRpbmdgKTtcbiAgICAgICAgICAgICAgICBwcm9jZXNzLmV4aXQoMSk7XG4gICAgICAgICAgICB9XG4gICAgICAgIH0gZmluYWxseSB7XG4gICAgICAgICAgICB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FELENBQVAsQ0FBbUR4RCxPQUE3RTs7SUFFQSxJQUFJNkQsaUJBQWlCLEtBQUs3RCxPQUExQixFQUFtQztNQUMvQixJQUFJNkQsaUJBQWlCLENBQUNDLEtBQWxCLENBQXdCLEdBQXhCLEVBQTZCLENBQTdCLE1BQW9DOUQsT0FBTyxDQUFDOEQsS0FBUixDQUFjLEdBQWQsRUFBbUIsQ0FBbkIsQ0FBeEMsRUFBK0Q7UUFDM0QsS0FBSy9ELEdBQUwsQ0FBUzRELElBQVQsQ0FBZSxtQkFBa0JOLElBQUssSUFBR1EsaUJBQWtCLG9DQUE3QyxHQUNULEdBQUU3RCxPQUFRLG9GQURELEdBRVYsNkJBRko7TUFHSCxDQUpELE1BSU87UUFDSCxLQUFLRCxHQUFMLENBQVM0RCxJQUFULENBQWUsbUJBQWtCTixJQUFLLElBQUdRLGlCQUFrQixvQ0FBN0MsR0FDVCxHQUFFN0QsT0FBUSxpREFEZjtNQUVIO0lBQ0o7O0lBQ0QsT0FBTztNQUFFeUQsVUFBRjtNQUFjckMsSUFBSSxFQUFFb0M7SUFBcEIsQ0FBUDtFQUNIOztBQTFLZTs7QUE2S0wsU0FBU08sUUFBVCxDQUFpQnJFLEtBQWpCLEVBQXdCQyxNQUF4QixFQUFnQ0MsT0FBaEMsRUFBeUM7RUFBRUcsR0FBRyxHQUFHaUU7QUFBUixJQUFtQjtFQUFFakUsR0FBRyxFQUFFaUU7QUFBUCxDQUE1RCxFQUE2RTtFQUN4RixPQUFPLElBQUl4RSxhQUFKLENBQWtCRSxLQUFsQixFQUF5QkMsTUFBekIsRUFBaUNDLE9BQWpDLEVBQTBDO0lBQUVHO0VBQUYsQ0FBMUMsQ0FBUDtBQUNIIn0=
\ No newline at end of file
diff --git a/dist/log.js b/dist/log.js
new file mode 100644
index 00000000..5677ea1e
--- /dev/null
+++ b/dist/log.js
@@ -0,0 +1,75 @@
+"use strict";
+
+Object.defineProperty(exports, "__esModule", {
+ value: true
+});
+exports.default = void 0;
+
+/* eslint-disable no-console */
+
+/*
+ 0.OFF
+ 1.INFO
+ 2.WARN
+ 3.ERROR
+ 4.TRACE
+ 5.DEBUG
+ 6.ALL
+ */
+class Log {
+ constructor(prefix) {
+ this.prefix = prefix;
+ }
+
+ static level() {
+ return process.env.MD_LOG_LEVEL || 'ALL';
+ }
+
+ static slice(args) {
+ return Array.prototype.slice.call(args, 0);
+ }
+
+ log(type, args) {
+ console.log.apply(null, [`${type} ${this.prefix}: `].concat(Log.slice(args)));
+ }
+
+ info(...args) {
+ if (/INFO|ALL/i.test(Log.level())) {
+ this.log('INFO', args);
+ }
+ }
+
+ warn(...args) {
+ if (/WARN|ALL/i.test(Log.level())) {
+ this.log('WARN', args);
+ }
+ }
+
+ error(...args) {
+ if (/ERROR|ALL/i.test(Log.level())) {
+ this.log('ERROR', args);
+ }
+ }
+
+ debug(...args) {
+ if (/DEBUG|ALL/i.test(Log.level())) {
+ this.log('DEBUG', args);
+ }
+ }
+
+ verbose(...args) {
+ if (/VERBOSE|ALL/i.test(Log.level())) {
+ this.log('VERBOSE', args);
+ }
+ }
+
+ trace(...args) {
+ if (/TRACE|ALL/i.test(Log.level())) {
+ this.log('TRACE', args);
+ }
+ }
+
+}
+
+exports.default = Log;
+//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJuYW1lcyI6WyJMb2ciLCJjb25zdHJ1Y3RvciIsInByZWZpeCIsImxldmVsIiwicHJvY2VzcyIsImVudiIsIk1EX0xPR19MRVZFTCIsInNsaWNlIiwiYXJncyIsIkFycmF5IiwicHJvdG90eXBlIiwiY2FsbCIsImxvZyIsInR5cGUiLCJjb25zb2xlIiwiYXBwbHkiLCJjb25jYXQiLCJpbmZvIiwidGVzdCIsIndhcm4iLCJlcnJvciIsImRlYnVnIiwidmVyYm9zZSIsInRyYWNlIl0sInNvdXJjZXMiOlsiLi4vbGliL2xvZy5qcyJdLCJzb3VyY2VzQ29udGVudCI6WyIvKiBlc2xpbnQtZGl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JsQixHQUFHLENBQUNHLEtBQUosRUFBcEIsQ0FBSixFQUFzQztNQUNsQyxLQUFLUyxHQUFMLENBQVMsU0FBVCxFQUFvQkosSUFBcEI7SUFDSDtFQUNKOztFQUVEZSxLQUFLLENBQUMsR0FBR2YsSUFBSixFQUFVO0lBQ1gsSUFBSSxhQUFhVSxJQUFiLENBQWtCbEIsR0FBRyxDQUFDRyxLQUFKLEVBQWxCLENBQUosRUFBb0M7TUFDaEMsS0FBS1MsR0FBTCxDQUFTLE9BQVQsRUFBa0JKLElBQWxCO0lBQ0g7RUFDSjs7QUFuRG9CIn0=
\ No newline at end of file
diff --git a/dist/meteorApp.js b/dist/meteorApp.js
new file mode 100644
index 00000000..e4508bfe
--- /dev/null
+++ b/dist/meteorApp.js
@@ -0,0 +1,923 @@
+"use strict";
+
+Object.defineProperty(exports, "__esModule", {
+ value: true
+});
+exports.default = void 0;
+
+var _runtime = _interopRequireDefault(require("regenerator-runtime/runtime"));
+
+var _fs = _interopRequireDefault(require("fs"));
+
+var _crossSpawn = _interopRequireDefault(require("cross-spawn"));
+
+var _semver = _interopRequireDefault(require("semver"));
+
+var _shelljs = _interopRequireDefault(require("shelljs"));
+
+var _path = _interopRequireDefault(require("path"));
+
+var _singleLineLog = _interopRequireDefault(require("single-line-log"));
+
+var _asar = _interopRequireDefault(require("@electron/asar"));
+
+var _nodeFetch = _interopRequireDefault(require("node-fetch"));
+
+var _isDesktopInjector = _interopRequireDefault(require("../skeleton/modules/autoupdate/isDesktopInjector"));
+
+var _log = _interopRequireDefault(require("./log"));
+
+var _meteorManager = _interopRequireDefault(require("./meteorManager"));
+
+function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
+
+// eslint-disable-next-line no-unused-vars
+const {
+ join
+} = _path.default;
+const sll = _singleLineLog.default.stdout; // TODO: refactor all strategy ifs to one place
+
+/**
+ * Represents the Meteor app.
+ * @property {MeteorDesktop} $
+ * @class
+ */
+
+class MeteorApp {
+ /**
+ * @param {MeteorDesktop} $ - context
+ * @constructor
+ */
+ constructor($) {
+ this.log = new _log.default('meteorApp');
+ this.$ = $;
+ this.meteorManager = new _meteorManager.default($);
+ this.mobilePlatform = null;
+ this.oldManifest = null;
+ this.injector = new _isDesktopInjector.default();
+ this.matcher = new RegExp('__meteor_runtime_config__ = JSON.parse\\(decodeURIComponent\\("([^"]*)"\\)\\)');
+ this.replacer = new RegExp('(__meteor_runtime_config__ = JSON.parse\\(decodeURIComponent\\()"([^"]*)"(\\)\\))');
+ this.meteorVersion = null;
+ this.indexHTMLstrategy = null;
+ this.indexHTMLStrategies = {
+ INDEX_FROM_CORDOVA_BUILD: 1,
+ INDEX_FROM_RUNNING_SERVER: 2
+ };
+ this.deprectatedPackages = ['omega:meteor-desktop-localstorage'];
+ }
+ /**
+ * Remove any deprecated packages from meteor project.
+ * @returns {Promise}
+ */
+
+
+ async removeDeprecatedPackages() {
+ try {
+ if (this.meteorManager.checkPackages(this.deprectatedPackages)) {
+ this.log.info('deprecated meteor plugins found, removing them');
+ await this.meteorManager.deletePackages(this.deprectatedPackages);
+ }
+ } catch (e) {
+ throw new Error(e);
+ }
+ }
+ /**
+ * Ensures that required packages are added to the Meteor app.
+ */
+
+
+ async ensureDesktopHCPPackages() {
+ const desktopHCPPackages = ['communitypackages:meteor-desktop-watcher', 'communitypackages:meteor-desktop-bundler'];
+
+ if (this.$.desktop.getSettings().desktopHCP) {
+ this.log.verbose('desktopHCP is enabled, checking for required packages');
+ const packagesWithVersion = desktopHCPPackages.map(packageName => `${packageName}@${this.$.getVersion()}`);
+
+ try {
+ await this.meteorManager.ensurePackages(desktopHCPPackages, packagesWithVersion, 'desktopHCP');
+ } catch (e) {
+ throw new Error(e);
+ }
+ } else {
+ this.log.verbose('desktopHCP is not enabled, removing required packages');
+
+ try {
+ if (this.meteorManager.checkPackages(desktopHCPPackages)) {
+ await this.meteorManager.deletePackages(desktopHCPPackages);
+ }
+ } catch (e) {
+ throw new Error(e);
+ }
+ }
+ }
+ /**
+ * Adds entry to .meteor/.gitignore if necessary.
+ */
+
+
+ updateGitIgnore() {
+ this.log.verbose('updating .meteor/.gitignore'); // Lets read the .meteor/.gitignore and filter out blank lines.
+
+ const gitIgnore = _fs.default.readFileSync(this.$.env.paths.meteorApp.gitIgnore, 'UTF-8').split('\n').filter(ignoredPath => ignoredPath.trim() !== '');
+
+ if (!~gitIgnore.indexOf(this.$.env.paths.electronApp.rootName)) {
+ this.log.verbose(`adding ${this.$.env.paths.electronApp.rootName} to .meteor/.gitignore`);
+ gitIgnore.push(this.$.env.paths.electronApp.rootName);
+
+ _fs.default.writeFileSync(this.$.env.paths.meteorApp.gitIgnore, gitIgnore.join('\n'), 'UTF-8');
+ }
+ }
+ /**
+ * Reads the Meteor release version used in the app.
+ * @returns {string}
+ */
+
+
+ getMeteorRelease() {
+ let release = _fs.default.readFileSync(this.$.env.paths.meteorApp.release, 'UTF-8').replace(/\r/gm, '').split('\n')[0];
+
+ [, release] = release.split('@'); // We do not care if it is beta.
+
+ if (~release.indexOf('-')) {
+ [release] = release.split('-');
+ }
+
+ return release;
+ }
+ /**
+ * Cast Meteor release to semver version.
+ * @returns {string}
+ */
+
+
+ castMeteorReleaseToSemver() {
+ return `${this.getMeteorRelease()}.0.0`.match(/(^\d+\.\d+\.\d+)/gmi)[0];
+ }
+ /**
+ * Validate meteor version against a versionRange.
+ * @param {string} versionRange - semver version range
+ */
+
+
+ checkMeteorVersion(versionRange) {
+ const release = this.castMeteorReleaseToSemver();
+
+ if (!_semver.default.satisfies(release, versionRange)) {
+ if (this.$.env.options.skipMobileBuild) {
+ this.log.error(`wrong meteor version (${release}) in project - only ` + `${versionRange} is supported`);
+ } else {
+ this.log.error(`wrong meteor version (${release}) in project - only ` + `${versionRange} is supported for automatic meteor builds (you can always ` + 'try with `--skip-mobile-build` if you are using meteor >= 1.2.1');
+ }
+
+ process.exit(1);
+ }
+ }
+ /**
+ * Decides which strategy to use while trying to get client build out of Meteor project.
+ * @returns {number}
+ */
+
+
+ chooseStrategy() {
+ if (this.$.env.options.forceCordovaBuild) {
+ return this.indexHTMLStrategies.INDEX_FROM_CORDOVA_BUILD;
+ }
+
+ const release = this.castMeteorReleaseToSemver();
+
+ if (_semver.default.satisfies(release, '> 1.3.4')) {
+ return this.indexHTMLStrategies.INDEX_FROM_RUNNING_SERVER;
+ }
+
+ if (_semver.default.satisfies(release, '1.3.4')) {
+ const explodedVersion = this.getMeteorRelease().split('.');
+
+ if (explodedVersion.length >= 4) {
+ if (explodedVersion[3] > 1) {
+ return this.indexHTMLStrategies.INDEX_FROM_RUNNING_SERVER;
+ }
+
+ return this.indexHTMLStrategies.INDEX_FROM_CORDOVA_BUILD;
+ }
+ }
+
+ return this.indexHTMLStrategies.INDEX_FROM_CORDOVA_BUILD;
+ }
+ /**
+ * Checks required preconditions.
+ * - Meteor version
+ * - is mobile platform added
+ */
+
+
+ async checkPreconditions() {
+ if (this.$.env.options.skipMobileBuild) {
+ this.checkMeteorVersion('>= 1.2.1');
+ } else {
+ this.checkMeteorVersion('>= 1.3.3');
+ this.indexHTMLstrategy = this.chooseStrategy();
+
+ if (this.indexHTMLstrategy === this.indexHTMLStrategies.INDEX_FROM_CORDOVA_BUILD) {
+ this.log.debug('meteor version is < 1.3.4.2 so the index.html from cordova-build will' + ' be used');
+ } else {
+ this.log.debug('meteor version is >= 1.3.4.2 so the index.html will be downloaded ' + 'from __cordova/index.html');
+ }
+ }
+
+ if (!this.$.env.options.skipMobileBuild) {
+ const platforms = _fs.default.readFileSync(this.$.env.paths.meteorApp.platforms, 'UTF-8');
+
+ if (!~platforms.indexOf('android') && !~platforms.indexOf('ios')) {
+ if (!this.$.env.options.android) {
+ this.mobilePlatform = 'ios';
+ } else {
+ this.mobilePlatform = 'android';
+ }
+
+ this.log.warn(`no mobile target detected - will add '${this.mobilePlatform}' ` + 'just to get a mobile build');
+
+ try {
+ await this.addMobilePlatform(this.mobilePlatform);
+ } catch (e) {
+ this.log.error('failed to add a mobile platform - please try to do it manually');
+ process.exit(1);
+ }
+ }
+ }
+ }
+ /**
+ * Tries to add a mobile platform to meteor project.
+ * @param {string} platform - platform to add
+ * @returns {Promise}
+ */
+
+
+ addMobilePlatform(platform) {
+ return new Promise((resolve, reject) => {
+ this.log.verbose(`adding mobile platform: ${platform}`);
+ (0, _crossSpawn.default)('meteor', ['add-platform', platform], {
+ cwd: this.$.env.paths.meteorApp.root,
+ stdio: this.$.env.stdio
+ }).on('exit', () => {
+ const platforms = _fs.default.readFileSync(this.$.env.paths.meteorApp.platforms, 'UTF-8');
+
+ if (!~platforms.indexOf('android') && !~platforms.indexOf('ios')) {
+ reject();
+ } else {
+ resolve();
+ }
+ });
+ });
+ }
+ /**
+ * Tries to remove a mobile platform from meteor project.
+ * @param {string} platform - platform to remove
+ * @returns {Promise}
+ */
+
+
+ removeMobilePlatform(platform) {
+ if (this.$.env.options.skipRemoveMobilePlatform) {
+ return Promise.resolve();
+ }
+
+ return new Promise((resolve, reject) => {
+ this.log.verbose(`removing mobile platform: ${platform}`);
+ (0, _crossSpawn.default)('meteor', ['remove-platform', platform], {
+ cwd: this.$.env.paths.meteorApp.root,
+ stdio: this.$.env.stdio,
+ env: Object.assign({
+ METEOR_PRETTY_OUTPUT: 0
+ }, process.env)
+ }).on('exit', () => {
+ const platforms = _fs.default.readFileSync(this.$.env.paths.meteorApp.platforms, 'UTF-8');
+
+ if (~platforms.indexOf(platform)) {
+ reject();
+ } else {
+ resolve();
+ }
+ });
+ });
+ }
+ /**
+ * Just checks for index.html and program.json existence.
+ * @returns {boolean}
+ */
+
+
+ isCordovaBuildReady() {
+ if (this.indexHTMLstrategy === this.indexHTMLStrategies.INDEX_FROM_CORDOVA_BUILD) {
+ return this.$.utils.exists(this.$.env.paths.meteorApp.cordovaBuildIndex) && this.$.utils.exists(this.$.env.paths.meteorApp.cordovaBuildProgramJson) && (!this.oldManifest || this.oldManifest && this.oldManifest !== _fs.default.readFileSync(this.$.env.paths.meteorApp.cordovaBuildProgramJson, 'UTF-8'));
+ }
+
+ return this.$.utils.exists(this.$.env.paths.meteorApp.webCordovaProgramJson) && (!this.oldManifest || this.oldManifest && this.oldManifest !== _fs.default.readFileSync(this.$.env.paths.meteorApp.webCordovaProgramJson, 'UTF-8'));
+ }
+ /**
+ * Fetches index.html from running project.
+ * @returns {Promise.<*>}
+ */
+
+
+ async acquireIndex() {
+ const port = this.$.env.options.port ? this.$.env.options.port : 3080;
+ this.log.info('acquiring index.html');
+ const res = await (0, _nodeFetch.default)(`http://127.0.0.1:${port}/__cordova/index.html`);
+ const text = await res.text(); // Simple test if we really download index.html for web.cordova.
+
+ if (~text.indexOf('src="/cordova.js"')) {
+ return text;
+ }
+
+ return false;
+ }
+ /**
+ * Fetches mainfest.json from running project.
+ * @returns {Promise.}
+ */
+
+
+ async acquireManifest() {
+ const port = this.$.env.options.port ? this.$.env.options.port : 3080;
+ this.log.info('acquiring manifest.json');
+ const res = await (0, _nodeFetch.default)(`http://127.0.0.1:${port}/__cordova/manifest.json?meteor_dont_serve_index=true`);
+ const text = await res.text();
+ return JSON.parse(text);
+ }
+ /**
+ * Tries to get a mobile build from meteor app.
+ * In case of failure leaves a meteor.log.
+ * A lot of stuff is happening here - but the main aim is to get a mobile build from
+ * .meteor/local/cordova-build/www/application and exit as soon as possible.
+ *
+ * @returns {Promise}
+ */
+
+
+ buildMobileTarget() {
+ const programJson = this.indexHTMLstrategy === this.indexHTMLStrategies.INDEX_FROM_CORDOVA_BUILD ? this.$.env.paths.meteorApp.cordovaBuildProgramJson : this.$.env.paths.meteorApp.webCordovaProgramJson;
+
+ if (this.$.utils.exists(programJson)) {
+ this.oldManifest = _fs.default.readFileSync(programJson, 'UTF-8');
+ }
+
+ return new Promise((resolve, reject) => {
+ const self = this;
+ let log = '';
+ let desiredExit = false;
+ let buildTimeout = null;
+ let errorTimeout = null;
+ let messageTimeout = null;
+ let killTimeout = null;
+ let cordovaCheckInterval = null;
+ let portProblem = false;
+
+ function windowsKill(pid) {
+ self.log.debug(`killing pid: ${pid}`);
+
+ _crossSpawn.default.sync('taskkill', ['/pid', pid, '/f', '/t']); // We will look for other process which might have been created outside the
+ // process tree.
+ // Lets list all node.exe processes.
+
+
+ const out = _crossSpawn.default.sync('wmic', ['process', 'where', 'caption="node.exe"', 'get', 'commandline,processid']).stdout.toString('utf-8').split('\n');
+
+ const args = self.prepareArguments(); // Lets mount regex.
+
+ const regexV1 = new RegExp(`${args.join('\\s+')}\\s+(\\d+)`, 'gm');
+ const regexV2 = new RegExp(`"${args.join('"\\s+"')}"\\s+(\\d+)`, 'gm'); // No we will check for those with the matching params.
+
+ out.forEach(line => {
+ const match = regexV1.exec(line) || regexV2.exec(line) || false;
+
+ if (match) {
+ self.log.debug(`killing pid: ${match[1]}`);
+
+ _crossSpawn.default.sync('taskkill', ['/pid', match[1], '/f', '/t']);
+ }
+
+ regexV1.lastIndex = 0;
+ regexV2.lastIndex = 0;
+ });
+ }
+
+ function writeLog() {
+ _fs.default.writeFileSync('meteor.log', log, 'UTF-8');
+ }
+
+ function clearTimeoutsAndIntervals() {
+ clearInterval(cordovaCheckInterval);
+ clearTimeout(buildTimeout);
+ clearTimeout(errorTimeout);
+ clearTimeout(messageTimeout);
+ clearTimeout(killTimeout);
+ }
+
+ const args = this.prepareArguments();
+ this.log.info(`running "meteor ${args.join(' ')}"... this might take a while`);
+ const env = {
+ METEOR_PRETTY_OUTPUT: 0,
+ METEOR_NO_RELEASE_CHECK: 1
+ };
+
+ if (this.$.env.options.prodDebug) {
+ env.METEOR_DESKOP_PROD_DEBUG = true;
+ } // Lets spawn meteor.
+
+
+ const child = (0, _crossSpawn.default)('meteor', args, {
+ env: Object.assign(env, process.env),
+ cwd: this.$.env.paths.meteorApp.root
+ }, {
+ shell: true
+ }); // Kills the currently running meteor command.
+
+ function kill() {
+ sll('');
+ child.kill('SIGKILL');
+
+ if (self.$.env.os.isWindows) {
+ windowsKill(child.pid);
+ }
+ }
+
+ function exit() {
+ killTimeout = setTimeout(() => {
+ clearTimeoutsAndIntervals();
+ desiredExit = true;
+ kill();
+ resolve();
+ }, 500);
+ }
+
+ function copyBuild() {
+ self.copyBuild().then(() => {
+ exit();
+ }).catch(() => {
+ clearTimeoutsAndIntervals();
+ kill();
+ writeLog();
+ reject('copy');
+ });
+ }
+
+ cordovaCheckInterval = setInterval(() => {
+ // Check if we already have cordova-build ready.
+ if (this.isCordovaBuildReady()) {
+ // If so, then exit immediately.
+ if (this.indexHTMLstrategy === this.indexHTMLStrategies.INDEX_FROM_CORDOVA_BUILD) {
+ copyBuild();
+ }
+ }
+ }, 1000);
+ child.stderr.on('data', chunk => {
+ const line = chunk.toString('UTF-8');
+ log += `${line}\n`;
+
+ if (errorTimeout) {
+ clearTimeout(errorTimeout);
+ } // Do not exit if this is the warning for using --production.
+ // Output exceeds -> https://github.com/meteor/meteor/issues/8592
+
+
+ if (!~line.indexOf('--production') && !~line.indexOf('Output exceeds ') && !~line.indexOf('Node#moveTo') && !~line.indexOf('Browserslist') && Array.isArray(self.$.env.options.ignoreStderr) && self.$.env.options.ignoreStderr.every(str => !~line.indexOf(str))) {
+ self.log.warn('STDERR:', line); // We will exit 1s after last error in stderr.
+
+ errorTimeout = setTimeout(() => {
+ clearTimeoutsAndIntervals();
+ kill();
+ writeLog();
+ reject('error');
+ }, 1000);
+ }
+ });
+ child.stdout.on('data', chunk => {
+ const line = chunk.toString('UTF-8');
+
+ if (!desiredExit && line.trim().replace(/[\n\r\t\v\f]+/gm, '') !== '') {
+ const linesToDisplay = line.trim().split('\n\r'); // Only display last line from the chunk.
+
+ const sanitizedLine = linesToDisplay.pop().replace(/[\n\r\t\v\f]+/gm, '');
+ sll(sanitizedLine);
+ }
+
+ log += `${line}\n`;
+
+ if (~line.indexOf('after_platform_add')) {
+ sll('');
+ this.log.info('done... 10%');
+ }
+
+ if (~line.indexOf('Local package version')) {
+ if (messageTimeout) {
+ clearTimeout(messageTimeout);
+ }
+
+ messageTimeout = setTimeout(() => {
+ sll('');
+ this.log.info('building in progress...');
+ }, 1500);
+ }
+
+ if (~line.indexOf('Preparing Cordova project')) {
+ sll('');
+ this.log.info('done... 60%');
+ }
+
+ if (~line.indexOf('Can\'t listen on port')) {
+ portProblem = true;
+ }
+
+ if (~line.indexOf('Your application has errors')) {
+ if (errorTimeout) {
+ clearTimeout(errorTimeout);
+ }
+
+ errorTimeout = setTimeout(() => {
+ clearTimeoutsAndIntervals();
+ kill();
+ writeLog();
+ reject('errorInApp');
+ }, 1000);
+ }
+
+ if (~line.indexOf('App running at')) {
+ copyBuild();
+ }
+ }); // When Meteor exits
+
+ child.on('exit', () => {
+ sll('');
+ clearTimeoutsAndIntervals();
+
+ if (!desiredExit) {
+ writeLog();
+
+ if (portProblem) {
+ reject('port');
+ } else {
+ reject('exit');
+ }
+ }
+ });
+ buildTimeout = setTimeout(() => {
+ kill();
+ writeLog();
+ reject('timeout');
+ }, this.$.env.options.buildTimeout ? this.$.env.options.buildTimeout * 1000 : 600000);
+ });
+ }
+ /**
+ * Replaces the DDP url that was used originally when Meteor was building the client.
+ * @param {string} indexHtml - path to index.html from the client
+ */
+
+
+ updateDdpUrl(indexHtml) {
+ let content;
+ let runtimeConfig;
+
+ try {
+ content = _fs.default.readFileSync(indexHtml, 'UTF-8');
+ } catch (e) {
+ this.log.error(`error loading index.html file: ${e.message}`);
+ process.exit(1);
+ }
+
+ if (!this.matcher.test(content)) {
+ this.log.error('could not find runtime config in index file');
+ process.exit(1);
+ }
+
+ try {
+ const matches = content.match(this.matcher);
+ runtimeConfig = JSON.parse(decodeURIComponent(matches[1]));
+ } catch (e) {
+ this.log.error('could not find runtime config in index file');
+ process.exit(1);
+ }
+
+ if (this.$.env.options.ddpUrl.substr(-1, 1) !== '/') {
+ this.$.env.options.ddpUrl += '/';
+ }
+
+ runtimeConfig.ROOT_URL = this.$.env.options.ddpUrl;
+ runtimeConfig.DDP_DEFAULT_CONNECTION_URL = this.$.env.options.ddpUrl;
+ content = content.replace(this.replacer, `$1"${encodeURIComponent(JSON.stringify(runtimeConfig))}"$3`);
+
+ try {
+ _fs.default.writeFileSync(indexHtml, content);
+ } catch (e) {
+ this.log.error(`error writing index.html file: ${e.message}`);
+ process.exit(1);
+ }
+
+ this.log.info('successfully updated ddp string in the runtime config of a mobile build' + ` to ${this.$.env.options.ddpUrl}`);
+ }
+ /**
+ * Prepares the arguments passed to `meteor` command.
+ * @returns {string[]}
+ */
+
+
+ prepareArguments() {
+ const args = ['run', '--verbose', `--mobile-server=${this.$.env.options.ddpUrl}`];
+
+ if (this.$.env.isProductionBuild()) {
+ args.push('--production');
+ }
+
+ args.push('-p');
+
+ if (this.$.env.options.port) {
+ args.push(this.$.env.options.port);
+ } else {
+ args.push('3080');
+ }
+
+ if (this.$.env.options.meteorSettings) {
+ args.push('--settings', this.$.env.options.meteorSettings);
+ }
+
+ return args;
+ }
+ /**
+ * Validates the mobile build and copies it into electron app.
+ */
+
+
+ async copyBuild() {
+ this.log.debug('clearing build dir');
+
+ try {
+ await this.$.utils.rmWithRetries('-rf', this.$.env.paths.electronApp.meteorApp);
+ } catch (e) {
+ throw new Error(e);
+ }
+
+ let prefix = 'cordovaBuild';
+ let copyPathPostfix = '';
+
+ if (this.indexHTMLstrategy === this.indexHTMLStrategies.INDEX_FROM_RUNNING_SERVER) {
+ prefix = 'webCordova';
+ copyPathPostfix = `${_path.default.sep}*`;
+ let indexHtml;
+
+ try {
+ _fs.default.mkdirSync(this.$.env.paths.electronApp.meteorApp);
+
+ indexHtml = await this.acquireIndex();
+
+ _fs.default.writeFileSync(this.$.env.paths.electronApp.meteorAppIndex, indexHtml);
+
+ this.log.info('successfully downloaded index.html from running meteor app');
+ } catch (e) {
+ this.log.error('error while trying to download index.html for web.cordova, ' + 'be sure that you are running a mobile target or with' + ' --mobile-server: ', e);
+ throw e;
+ }
+ }
+
+ const cordovaBuild = this.$.env.paths.meteorApp[prefix];
+ const {
+ cordovaBuildIndex
+ } = this.$.env.paths.meteorApp;
+ const cordovaBuildProgramJson = this.$.env.paths.meteorApp[`${prefix}ProgramJson`];
+
+ if (!this.$.utils.exists(cordovaBuild)) {
+ this.log.error(`no mobile build found at ${cordovaBuild}`);
+ this.log.error('are you sure you did run meteor with --mobile-server?');
+ throw new Error('required file not present');
+ }
+
+ if (!this.$.utils.exists(cordovaBuildProgramJson)) {
+ this.log.error('no program.json found in mobile build found at ' + `${cordovaBuild}`);
+ this.log.error('are you sure you did run meteor with --mobile-server?');
+ throw new Error('required file not present');
+ }
+
+ if (this.indexHTMLstrategy !== this.indexHTMLStrategies.INDEX_FROM_RUNNING_SERVER) {
+ if (!this.$.utils.exists(cordovaBuildIndex)) {
+ this.log.error('no index.html found in cordova build found at ' + `${cordovaBuild}`);
+ this.log.error('are you sure you did run meteor with --mobile-server?');
+ throw new Error('required file not present');
+ }
+ }
+
+ this.log.verbose('copying mobile build');
+
+ _shelljs.default.cp('-R', `${cordovaBuild}${copyPathPostfix}`, this.$.env.paths.electronApp.meteorApp); // Because of various permission problems here we try to clear te path by clearing
+ // all possible restrictions.
+
+
+ _shelljs.default.chmod('-R', '777', this.$.env.paths.electronApp.meteorApp);
+
+ if (this.$.env.os.isWindows) {
+ _shelljs.default.exec(`attrib -r ${this.$.env.paths.electronApp.meteorApp}${_path.default.sep}*.* /s`);
+ }
+
+ if (this.indexHTMLstrategy === this.indexHTMLStrategies.INDEX_FROM_RUNNING_SERVER) {
+ let programJson;
+
+ try {
+ programJson = await this.acquireManifest();
+
+ _fs.default.writeFileSync(this.$.env.paths.electronApp.meteorAppProgramJson, JSON.stringify(programJson, null, 4));
+
+ this.log.info('successfully downloaded manifest.json from running meteor app');
+ } catch (e) {
+ this.log.error('error while trying to download manifest.json for web.cordova,' + ' be sure that you are running a mobile target or with' + ' --mobile-server: ', e);
+ throw e;
+ }
+ }
+
+ this.log.info('mobile build copied to electron app');
+ this.log.debug('copy cordova.js to meteor build');
+
+ _shelljs.default.cp(join(__dirname, '..', 'skeleton', 'cordova.js'), this.$.env.paths.electronApp.meteorApp);
+ }
+ /**
+ * Injects Meteor.isDesktop
+ */
+
+
+ injectIsDesktop() {
+ this.log.info('injecting isDesktop');
+ let manifestJsonPath = this.$.env.paths.meteorApp.cordovaBuildProgramJson;
+
+ if (this.indexHTMLstrategy === this.indexHTMLStrategies.INDEX_FROM_RUNNING_SERVER) {
+ manifestJsonPath = this.$.env.paths.meteorApp.webCordovaProgramJson;
+ }
+
+ try {
+ const {
+ manifest
+ } = JSON.parse(_fs.default.readFileSync(manifestJsonPath, 'UTF-8'));
+ let injected = false;
+ let injectedStartupDidComplete = false;
+ let result = null; // We will search in every .js file in the manifest.
+ // We could probably detect whether this is a dev or production build and only search in
+ // the correct files, but for now this should be fine.
+
+ manifest.forEach(file => {
+ let fileContents; // Hacky way of setting isDesktop.
+
+ if (file.type === 'js') {
+ fileContents = _fs.default.readFileSync(join(this.$.env.paths.electronApp.meteorApp, file.path), 'UTF-8');
+ result = this.injector.processFileContents(fileContents);
+ ({
+ fileContents
+ } = result);
+ injectedStartupDidComplete = result.injectedStartupDidComplete ? true : injectedStartupDidComplete;
+ injected = result.injected ? true : injected;
+
+ _fs.default.writeFileSync(join(this.$.env.paths.electronApp.meteorApp, file.path), fileContents);
+ }
+ });
+
+ if (!injected) {
+ this.log.error('error injecting isDesktop global var.');
+ process.exit(1);
+ }
+
+ if (!injectedStartupDidComplete) {
+ this.log.error('error injecting isDesktop for startupDidComplete');
+ process.exit(1);
+ }
+ } catch (e) {
+ this.log.error('error occurred while injecting isDesktop: ', e);
+ process.exit(1);
+ }
+
+ this.log.info('injected successfully');
+ }
+ /**
+ * Builds, modifies and copies the meteor app to electron app.
+ */
+
+
+ async build() {
+ this.log.info('checking for any mobile platform');
+
+ try {
+ await this.checkPreconditions();
+ } catch (e) {
+ this.log.error('error occurred during checking preconditions: ', e);
+ process.exit(1);
+ }
+
+ this.log.info('building meteor app');
+
+ if (!this.$.env.options.skipMobileBuild) {
+ try {
+ await this.buildMobileTarget();
+ } catch (reason) {
+ switch (reason) {
+ case 'timeout':
+ this.log.error('timeout while building, log has been written to meteor.log');
+ break;
+
+ case 'error':
+ this.log.error('build was terminated by meteor-desktop as some errors were reported to stderr, you ' + 'should see it above, also check meteor.log for more info, to ignore it use the ' + '--ignore-stderr ""');
+ break;
+
+ case 'errorInApp':
+ this.log.error('your meteor app has errors - look into meteor.log for more' + ' info');
+ break;
+
+ case 'port':
+ this.log.error('your port 3080 is currently used (you probably have this or other ' + 'meteor project running?), use `-t` or `--meteor-port` to use ' + 'different port while building');
+ break;
+
+ case 'exit':
+ this.log.error('meteor cmd exited unexpectedly, log has been written to meteor.log');
+ break;
+
+ case 'copy':
+ this.log.error('error encountered when copying the build');
+ break;
+
+ default:
+ this.log.error('error occurred during building mobile target', reason);
+ }
+
+ if (this.mobilePlatform) {
+ await this.removeMobilePlatform(this.mobilePlatform);
+ }
+
+ process.exit(1);
+ }
+ } else {
+ this.indexHTMLstrategy = this.chooseStrategy();
+
+ try {
+ await this.copyBuild();
+ } catch (e) {
+ process.exit(1);
+ }
+ }
+
+ this.injectIsDesktop();
+ this.changeDdpUrl();
+
+ try {
+ await this.packToAsar();
+ } catch (e) {
+ this.log.error('error while packing meteor app to asar');
+ process.exit(1);
+ }
+
+ this.log.info('meteor build finished');
+
+ if (this.mobilePlatform) {
+ await this.removeMobilePlatform(this.mobilePlatform);
+ }
+ }
+
+ changeDdpUrl() {
+ if (this.$.env.options.ddpUrl !== null) {
+ try {
+ this.updateDdpUrl(this.$.env.paths.electronApp.meteorAppIndex);
+ } catch (e) {
+ this.log.error(`error while trying to change the ddp url: ${e.message}`);
+ }
+ }
+ }
+
+ packToAsar() {
+ this.log.info('packing meteor app to asar archive');
+ return new Promise((resolve, reject) => _asar.default.createPackage(this.$.env.paths.electronApp.meteorApp, _path.default.join(this.$.env.paths.electronApp.root, 'meteor.asar')).then(() => {
+ // On Windows some files might still be blocked. Giving a tick for them to be
+ // ready for deletion.
+ setImmediate(() => {
+ this.log.verbose('clearing meteor app after packing');
+ this.$.utils.rmWithRetries('-rf', this.$.env.paths.electronApp.meteorApp).then(() => {
+ resolve();
+ }).catch(e => {
+ reject(e);
+ });
+ });
+ }));
+ }
+ /**
+ * Wrapper for spawning npm.
+ * @param {Array} commands - commands for spawn
+ * @param {string} stdio
+ * @param {string} cwd
+ * @return {Promise}
+ */
+
+
+ runNpm(commands, stdio = 'ignore', cwd = this.$.env.paths.meteorApp.root) {
+ return new Promise((resolve, reject) => {
+ this.log.verbose(`executing meteor npm ${commands.join(' ')}`);
+ (0, _crossSpawn.default)('meteor', ['npm', ...commands], {
+ cwd,
+ stdio
+ }).on('exit', code => code === 0 ? resolve() : reject(new Error(`npm exit code was ${code}`)));
+ });
+ }
+
+}
+
+exports.default = MeteorApp;
+//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJuYW1lcyI6WyJqb2luIiwicGF0aCIsInNsbCIsInNpbmdsZUxpbmVMb2ciLCJzdGRvdXQiLCJNZXRlb3JBcHAiLCJjb25zdHJ1Y3RvciIsIiQiLCJsb2ciLCJMb2ciLCJtZXRlb3JNYW5hZ2VyIiwiTWV0ZW9yTWFuYWdlciIsIm1vYmlsZVBsYXRmb3JtIiwib2xkTWFuaWZlc3QiLCJpbmplY3RvciIsIklzRGVza3RvcEluamVjdG9yIiwibWF0Y2hlciIsIlJlZ0V4cCIsInJlcGxhY2VyIiwibWV0ZW9yVmVyc2lvbiIsImluZGV4SFRNTHN0cmF0ZWd5IiwiaW5kZXhIVE1MU3RyYXRlZ2llcyIsIklOREVYX0ZST01fQ09SRE9WQV9CVUlMRCIsIklOREVYX0ZST01fUlVOTklOR19TRVJWRVIiLCJkZXByZWN0YXRlZFBhY2thZ2VzIiwicmVtb3ZlRGVwcmVjYXRlZFBhY2thZ2VzIiwiY2hlY2tQYWNrYWdlcyIsImluZm8iLCJkZWxldGVQYWNrYWdlcyIsImUiLCJFcnJvciIsImVuc3VyZURlc2t0b3BIQ1BQYWNrYWdlcyIsImRlc2t0b3BIQ1BQYWN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25zLnNraXBNb2JpbGVCdWlsZCkge1xuICAgICAgICAgICAgY29uc3QgcGxhdGZvcm1zID0gZnMucmVhZEZpbGVTeW5jKHRoaXMuJC5lbnYucGF0aHMubWV0ZW9yQXBwLnBsYXRmb3JtcywgJ1VURi04Jyk7XG4gICAgICAgICAgICBpZiAoIX5wbGF0Zm9ybXMuaW5kZXhPZignYW5kcm9pZCcpICYmICF+cGxhdGZvcm1zLmluZGV4T2YoJ2lvcycpKSB7XG4gICAgICAgICAgICAgICAgaWYgKCF0aGlzLiQuZW52Lm9wdGlvbnMuYW5kcm9pZCkge1xuICAgICAgICAgICAgICAgICAgICB0aGlzLm1vYmlsZVBsYXRmb3JtID0gJ2lvcyc7XG4gICAgICAgICAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgICAgICAgICAgdGhpcy5tb2JpbGVQbGF0Zm9ybSA9ICdhbmRyb2lkJztcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgdGhpcy5sb2cud2Fybihgbm8gbW9iaWxlIHRhcmdldCBkZXRlY3RlZCAtIHdpbGwgYWRkICcke3RoaXMubW9iaWxlUGxhdGZvcm19JyBgICtcbiAgICAgICAgICAgICAgICAgICAgJ2p1c3QgdG8gZ2V0IGEgbW9iaWxlIGJ1aWxkJyk7XG4gICAgICAgICAgICAgICAgdHJ5IHtcbiAgICAgICAgICAgICAgICAgICAgYXdhaXQgdGhpcy5hZGRNb2JpbGVQbGF0Zm9ybSh0aGlzLm1vYmlsZVBsYXRmb3JtKTtcbiAgICAgICAgICAgICAgICB9IGNhdGNoIChlKSB7XG4gICAgICAgICAgICAgICAgICAgIHRoaXMubG9nLmVycm9yKCdmYWlsZWQgdG8gYWRkIGEgbW9iaWxlIHBsYXRmb3JtIC0gcGxlYXNlIHRyeSB0byBkbyBpdCBtYW51YWxseScpO1xuICAgICAgICAgICAgICAgICAgICBwcm9jZXNzLmV4aXQoMSk7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfVxuICAgICAgICB9XG4gICAgfVxuXG4gICAgLyoqXG4gICAgICogVHJpZXMgdG8gYWRkIGEgbW9iaWxlIHBsYXRmb3JtIHRvIG1ldGVvciBwcm9qZWN0LlxuICAgICAqIEBwYXJhbSB7c3RyaW5nfSBwbGF0Zm9ybSAtIHBsYXRmb3JtIHRvIGFkZFxuICAgICAqIEByZXR1cm5zIHtQcm9taXNlfVxuICAgICAqL1xuICAgIGFkZE1vYmlsZVBsYXRmb3JtKHBsYXRmb3JtKSB7XG4gICAgICAgIHJldHVybiBuZXcgUHJvbWlzZSgocmVzb2x2ZSwgcmVqZWN0KSA9PiB7XG4gICAgICAgICAgICB0aGlzLmxvZy52ZXJib3NlKGBhZGRpbmcgbW9iaWxlIHBsYXRmb3JtOiAke3BsYXRmb3JtfWApO1xuICAgICAgICAgICAgc3Bhd24oJ21ldGVvcicsIFsnYWRkLXBsYXRmb3JtJywgcGxhdGZvcm1dLCB7XG4gICAgICAgICAgICAgICAgY3dkOiB0aGlzLiQuZW52LnBhdGhzLm1ldGVvckFwcC5yb290LFxuICAgICAgICAgICAgICAgIHN0ZGlvOiB0aGlzLiQuZW52LnN0ZGlvXG4gICAgICAgICAgICB9KS5vbignZXhpdCcsICgpID0+IHtcbiAgICAgICAgICAgICAgICBjb25zdCBwbGF0Zm9ybXMgPSBmcy5yZWFkRmlsZVN5bmModGhpcy4kLmVudi5wYXRocy5tZXRlb3JBcHAucGxhdGZvcm1zLCAnVVRGLTgnKTtcbiAgICAgICAgICAgICAgICBpZiAoIX5wbGF0Zm9ybXMuaW5kZXhPZignYW5kcm9pZCcpICYmICF+cGxhdGZvcm1zLmluZGV4T2YoJ2lvcycpKSB7XG4gICAgICAgICAgICAgICAgICAgIHJlamVjdCgpO1xuICAgICAgICAgICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICAgICAgICAgIHJlc29sdmUoKTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9KTtcbiAgICAgICAgfSk7XG4gIC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m9ybXMuaW5kZXhPZihwbGF0Zm9ybSkpIHtcbiAgICAgICAgICAgICAgICAgICAgcmVqZWN0KCk7XG4gICAgICAgICAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgICAgICAgICAgcmVzb2x2ZSgpO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgIH0pO1xuICAgICAgICB9KTtcbiAgICB9XG5cbiAgICAvKipcbiAgICAgKiBKdXN0IGNoZWNrcyBmb3IgaW5kZXguaHRtbCBhbmQgcHJvZ3JhbS5qc29uIGV4aXN0ZW5jZS5cbiAgICAgKiBAcmV0dXJucyB7Ym9vbGVhbn1cbiAgICAgKi9cbiAgICBpc0NvcmRvdmFCdWlsZFJlYWR5KCkge1xuICAgICAgICBpZiAodGhpcy5pbmRleEhUTUxzdHJhdGVneSA9PT0gdGhpcy5pbmRleEhUTUxTdHJhdGVnaWVzLklOREVYX0ZST01fQ09SRE9WQV9CVUlMRCkge1xuICAgICAgICAgICAgcmV0dXJuIHRoaXMuJC51dGlscy5leGlzdHModGhpcy4kLmVudi5wYXRocy5tZXRlb3JBcHAuY29yZG92YUJ1aWxkSW5kZXgpICYmXG4gICAgICAgICAgICAgICAgdGhpcy4kLnV0aWxzLmV4aXN0cyh0aGlzLiQuZW52LnBhdGhzLm1ldGVvckFwcC5jb3Jkb3ZhQnVpbGRQcm9ncmFtSnNvbikgJiZcbiAgICAgICAgICAgICAgICAoXG4gICAgICAgICAgICAgICAgICAgICF0aGlzLm9sZE1hbmlmZXN0IHx8XG4gICAgICAgICAgICAgICAgICAgICh0aGlzLm9sZE1hbmlmZXN0ICYmXG4gICAgICAgICAgICAgICAgICAgICAgICB0aGlzLm9sZE1hbmlmZXN0ICE9PSBmcy5yZWFkRmlsZVN5bmMoXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhpcy4kLmVudi5wYXRocy5tZXRlb3JBcHAuY29yZG92YUJ1aWxkUHJvZ3JhbUpzb24sICdVVEYtOCdcbiAgICAgICAgICAgICAgICAgICAgICAgIClcbiAgICAgICAgICAgICAgICAgICAgKVxuICAgICAgICAgICAgICAgICk7XG4gICAgICAgIH1cbiAgICAgICAgcmV0dXJuIHRoaXMuJC51dGlscy5leGlzdHModGhpcy4kLmVudi5wYXRocy5tZXRlb3JBcHAud2ViQ29yZG92YVByb2dyYW1Kc29uKSAmJlxuICAgICAgICAgICAgKFxuICAgICAgICAgICAgICAgICF0aGlzLm9sZE1hbmlmZXN0IHx8XG4gICAgICAgICAgICAgICAgKHRoaXMub2xkTWFuaWZlc3QgJiZcbiAgICAgICAgICAgICAgICAgICAgdGhpcy5vbGRNYW5pZmVzdCAhPT0gZnMucmVhZEZpbGVTeW5jKFxuICAgICAgICAgICAgICAgICAgICAgICAgdGhpcy4kLmVudi5wYXRocy5tZXRlb3JBcHAud2ViQ29yZG92YVByb2dyYW1Kc29uLCAnVVRGLTgnXG4gICAgICAgICAgICAgICAgICAgIClcbiAgICAgICAgICAgICAgICApXG4gICAgICAgICAgICApO1xuICAgIH1cblxuICAgIC8qKlxuICAgICAqIEZldGNoZXMgaW5kZXguaHRtbCBmcm9tIHJ1bm5pbmcgcHJvamVjdC5cbiAgICAgKiBAcmV0dXJucyB7UHJvbWlzZS48Kj59XG4gICAgICovXG4gICAgYXN5bmMgYWNxdWlyZUluZGV4KCkge1xuICAgICAgICBjb25zdCBwb3J0ID0gKHRoaXMuJC5lbnYub3B0aW9ucy5wb3J0KSA/IHRoaXMuJC5lbnYub3B0aW9ucy5wb3J0IDogMzA4MDtcbiAgICAgICAgdGhpcy5sb2cuaW5mbygnYWNxdWlyaW5nIGluZGV4Lmh0bWwnKTtcbiAgICAgICAgY29uc3QgcmVzID0gYXdhaXQgZmV0Y2goYGh0dHA6Ly8xMjcuMC4wLjE6JHtwb3J0fS9fX2NvcmRvdmEvaW5kZXguaHRtbGApO1xuICAgICAgICBjb25zdCB0ZXh0ID0gYXdhaXQgcmVzLnRleHQoKTtcbiAgICAgICAgLy8gU2ltcGxlIHR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aW1lb3V0ID0gbnVsbDtcbiAgICAgICAgICAgIGxldCBraWxsVGltZW91dCA9IG51bGw7XG4gICAgICAgICAgICBsZXQgY29yZG92YUNoZWNrSW50ZXJ2YWwgPSBudWxsO1xuICAgICAgICAgICAgbGV0IHBvcnRQcm9ibGVtID0gZmFsc2U7XG5cbiAgICAgICAgICAgIGZ1bmN0aW9uIHdpbmRvd3NLaWxsKHBpZCkge1xuICAgICAgICAgICAgICAgIHNlbGYubG9nLmRlYnVnKGBraWxsaW5nIHBpZDogJHtwaWR9YCk7XG4gICAgICAgICAgICAgICAgc3Bhd24uc3luYygndGFza2tpbGwnLCBbJy9waWQnLCBwaWQsICcvZicsICcvdCddKTtcblxuICAgICAgICAgICAgICAgIC8vIFdlIHdpbGwgbG9vayBmb3Igb3RoZXIgcHJvY2VzcyB3aGljaCBtaWdodCBoYXZlIGJlZW4gY3JlYXRlZCBvdXRzaWRlIHRoZVxuICAgICAgICAgICAgICAgIC8vIHByb2Nlc3MgdHJlZS5cbiAgICAgICAgICAgICAgICAvLyBMZXRzIGxpc3QgYWxsIG5vZGUuZXhlIHByb2Nlc3Nlcy5cblxuICAgICAgICAgICAgICAgIGNvbnN0IG91dCA9IHNwYXduXG4gICAgICAgICAgICAgICAgICAgIC5zeW5jKFxuICAgICAgICAgICAgICAgICAgICAgICAgJ3dtaWMnLFxuICAgICAgICAgICAgICAgICAgICAgICAgWydwcm9jZXNzJywgJ3doZXJlJywgJ2NhcHRpb249XCJub2RlLmV4ZVwiJywgJ2dldCcsICdjb21tYW5kbGluZSxwcm9jZXNzaWQnXVxuICAgICAgICAgICAgICAgICAgICApXG4gICAgICAgICAgICAgICAgICAgIC5zdGRvdXQudG9TdHJpbmcoJ3V0Zi04JylcbiAgICAgICAgICAgICAgICAgICAgLnNwbGl0KCdcXG4nKTtcbiAgICAgICAgICAgICAgICBjb25zdCBhcmdzID0gc2VsZi5wcmVwYXJlQXJndW1lbnRzKCk7XG4gICAgICAgICAgICAgICAgLy8gTGV0cyBtb3VudCByZWdleC5cbiAgICAgICAgICAgICAgICBjb25zdCByZWdleFYxID0gbmV3IFJlZ0V4cChgJHthcmdzLmpvaW4oJ1xcXFxzKycpfVxcXFxzKyhcXFxcZCspYCwgJ2dtJyk7XG4gICAgICAgICAgICAgICAgY29uc3QgcmVnZXhWMiA9IG5ldyBSZWdFeHAoYFwiJHthcmdzLmpvaW4oJ1wiXFxcXHMrXCInKX1cIlxcXFxzKyhcXFxcZCspYCwgJ2dtJyk7XG4gICAgICAgICAgICAgICAgLy8gTm8gd2Ugd2lsbCBjaGVjayBmb3IgdGhvc2Ugd2l0aCB0aGUgbWF0Y2hpbmcgcGFyYW1zLlxuICAgICAgICAgICAgICAgIG91dC5mb3JFYWNoKChsaW5lKSA9PiB7XG4gICAgICAgICAgICAgICAgICAgIGNvbnN0IG1hdGNoID0gcmVnZXhWMS5leGVjKGxpbmUpIHx8IHJlZ2V4VjIuZXhlYyhsaW5lKSB8fCBmYWxzZTtcbiAgICAgICAgICAgICAgICAgICAgaWYgKG1hdGNoKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICBzZWxmLmxvZy5kZWJ1Zyhga2lsbGluZyBwaWQ6ICR7bWF0Y2hbMV19YCk7XG4gICAgICAgICAgICAgICAgICAgICAgICBzcGF3bi5zeW5jKCd0YXNra2lsbCcsIFsnL3BpZCcsIG1hdGNoWzFdLCAnL2YnLCAnL3QnXSk7XG4gICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAgICAgcmVnZXhWMS5sYXN0SW5kZXggPSAwO1xuICAgICAgICAgICAgICAgICAgICByZWdleFYyLmxhc3RJbmRleCA9IDA7XG4gICAgICAgICAgICAgICAgfSk7XG4gICAgICAgICAgICB9XG5cbiAgICAgICAgICAgIGZ1bmN0aW9uIHdyaXRlTG9nKCkge1xuICAgICAgICAgICAgICAgIGZzLndyaXRlRmlsZVN5bmMoJ21ldGVvci5sb2cnLCBsb2csICdVVEYtOCcpO1xuICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICBmdW5jdGlvbiBjbGVhclRpbWVvdXRzQW5kSW50ZXJ2YWxzKCkge1xuICAgICAgICAgICAgICAgIGNsZWFySW50ZXJ2YWwoY29yZG92YUNoZWNrSW50ZXJ2YWwpO1xuICAgICAgICAgICAgICAgIGNsZWFyVGltZW91dChidWlsZFRpbWVvdXQpO1xuICAgICAgICAgICAgICAgIGNsZWFyVGltZW91dChlcnJvclRpbWVvdXQpO1xuICAgICAgICAgICAgICAgIGNsZWFyVGltZW91dChtZXNzYWdlVGltZW91dCk7XG4gICAgICAgICAgICAgICAgY2xlYXJUaW1lb3V0KGtpbGxUaW1lb3V0KTtcbiAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgY29uc3QgYXJncyA9IHRoaXMucHJlcGFyZUFyZ3VtZW50cygpO1xuXG4gICAgICAgICAgICB0aGlzLmxvZy5pbmZvKGBydW5uaW5nIFwibWV0ZW9yICR7YXJncy5qb2luKCcgJyl9XCIuLi4gdGhpcyBtaWdodCB0YWtlIGEgd2hpbGVgKTtcblxuICAgICAgICAgICAgY29uc3QgZW52ID0geyBNRVRFT1JfUFJFVFRZX09VVFBVVDogMCwgTUVURU9SX05PX1JFTEVBU0VfQ0hFQ0s6IDEgfTtcbiAgICAgICAgICAgIGlmICh0aGlzLiQuZW52Lm9wdGlvbnMucHJvZERlYnVnKSB7XG4gICAgICAgICAgICAgICAgZW52Lk1FVEVPUl9ERVNLT1BfUFJPRF9ERUJVRyA9IHRydWU7XG4gICAgICAgICAgICB9XG5cbiAgICAgICAgICAgIC8vIExldHMgc3Bhd24gbWV0ZW9yLlxuICAgICAgICAgICAgY29uc3QgY2hpbGQgPSBzcGF3bihcbiAgICAgICAgICAgICAgICAnbWV0ZW9yJyxcbiAgICAgICAgICAgICAgICBhcmdzLFxuICAgICAgICAgICAgICAgIHtcbiAgICAgICAgICAgICAgICAgICAgZW52OiBPYmplY3QuYXNzaWduKGVudiwgcHJvY2Vzcy5lbnYpLFxuICAgICAgICAgICAgICAgICAgICBjd2Q6IHRoaXMuJC5lbnYucGF0aHMubWV0ZW9yQXBwLnJvb3RcbiAgICAgICAgICAgICAgICB9LFxuICAgICAgICAgICAgICAgIHsgc2hlbGw6IHRydWUgfVxuICAgICAgICAgICAgKTtcblxuICAgICAgICAgICAgLy8gS2lsbHMgdGhlIGN1cnJlbnRseSBydW5uaW5nIG1ldGVvciBjb21tYW5kLlxuICAgICAgICAgICAgZnVuY3Rpb24ga2lsbCgpIHtcbiAgICAgICAgICAgICAgICBzbGwoJycpO1xuICAgICAgICAgICAgICAgIGNoaWxkLmtpbGwoJ1NJR0tJTEwnKTtcbiAgICAgICAgICAgICAgICBpZiAoc2VsZi4kLmVudi5vcy5pc1dpbmRvd3MpIHtcbiAgICAgICAgICAgICAgICAgICAgd2luZG93c0tpbGwoY2hpbGQucGlkKTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9XG5cbiAgICAgICAgICAgIGZ1bmN0aW9uIGV4aXQoKSB7XG4gICAgICAgICAgICAgICAga2lsbFRpbWVvdXQgPSBzZXRUaW1lb3V0KCgpID0+IHtcbiAgICAgICAgICAgICAgICAgICAgY2xlYXJUaW1lb3V0c0FuZEludGVydmFscygpO1xuICAgICAgICAgICAgICAgICAgICBkZXNpcmVkRXhpdCA9IHRydWU7XG4gICAgICAgICAgICAgICAgICAgIGtpbGwoKTtcbiAgICAgICAgICAgICAgICAgICAgcmVzb2x2ZSgpO1xuICAgICAgICAgICAgICAgIH0sIDUwMCk7XG4gICAgICAgICAgICB9XG5cbiAgICAgICAgICAgIGZ1bmN0aW9uIGNvcHlCdWlsZCgpIHtcbiAgICAgICAgICAgICAgICBzZWxmLmNvcHlCdWlsZCgpLnRoZW4oKCkgPT4ge1xuICAgICAgICAgICAgICAgICAgICBleGl0KCk7XG4gICAgICAgICAgICAgICAgfSkuY2F0Y2goKCkgPT4ge1xuICAgICAgICAgICAgICAgICAgICBjbGVhclRpbWVvdXRzQW5kSW50ZXJ2YWxzKCk7XG4gICAgICAgICAgICAgICAgICAgIGtpbGwoKTtcbiAgICAgICAgICAgICAgICAgICAgd3JpdGVMb2coKTtcbiAgICAgICAgICAgICAgICAgICAgcmVqZWN0KCdjb3B5Jyk7XG4gICAgICAgICAgICAgICAgfSk7XG4gICAgICAgICAgICB9XG5cbiAgICAgICAgICAgIGNvcmRvdmFDaGVja0ludGVydmFsID0gc2V0SW50ZXJ2YWwoKCkgPT4ge1xuICAgICAgICAgICAgICAgIC8vIENoZWNrIGlmIHdlIGFscmVhZHkgaGF2ZSBjb3Jkb3ZhLWJ1aWxkIHJlYWR5LlxuICAgICAgICAgICAgICAgIGlmICh0aGlzLmlzQ29yZG92YUJ1aWxkUmVhZHkoKSkge1xuICAgICAgICAgICAgICAgICAgICAvLyBJZiBzbywgdGhlbiBleGl0IGltbWVkaWF0ZWx5LlxuICAgICAgICAgICAgICAgICAgICBpZiAodGhpcy5pbmRleEhUTUxzdHJhdGVneSA9PT1cbiAgICAgICAgICAgICAgICAgICAgICAgIHRoaXMuaW5kZXhIVE1MU3RyYXRlZ2llcy5JTkRFWF9GUk9NX0NPUkRPVkFfQlVJTEQpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgIGNvcHlCdWlsZCgpO1xuICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfSwgMTAwMCk7XG5cbiAgICAgICAgICAgIGNoaWxkLnN0ZGVyci5vbignZGF0YScsIChjaHVuaykgPT4ge1xuICAgICAgICAgICAgICAgIGNvbnN0IGxpbmUgPSBjaHVuay50b1N0cmluZygnVVRGLTgnKTtcbiAgICAgICAgICAgICAgICBsb2cgKz0gYCR7bGluZX1cXG5gO1xuICAgICAgICAgICAgICAgIGlmIChlcnJvclRpbWVvdXQpIHtcbiAgICAgICAgICAgICAgICAgICAgY2xlYXJUaW1lb3V0KGVycm9yVGltZW91dCk7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIC8vIERvIG5vdCBleGl0IGlmIHRoaXMgaXMgdGhlIHdhcm5pbmcgZm9yIHVzaW5nIC0tcHJvZHVjdGlvbi5cbiAgICAgICAgICAgICAgICAvLyBPdXRwdXQgZXhjZWVkcyAtPiBodHRwczovL2dpdGh1Yi5jb20vbWV0ZW9yL21ldGVvci9pc3N1ZXMvODU5MlxuICAgICAgICAgICAgICAgIGlmIChcbiAgICAgICAgICAgICAgICAgICAgIX5saW5lLmluZGV4T2YoJy0tcHJvZHVjdGlvbicpICYmXG4gICAgICAgICAgICAgICAgICAgICF+bGluZS5pbmRleE9mKCdPdXRwdXQgZXhjZWVkcyAnKSAmJlxuICAgICAgICAgICAgICAgICAgICAhfmxpbmUuaW5kZXhPZignTm9kZSNtb3ZlVG8nKSAmJlxuICAgICAgICAgICAgICAgICAgICAhfmxpbmUuaW5kZXhPZignQnJvd3NlcnNsaXN0JykgJiZcbiAgICAgICAgICAgICAgICAgICAgKFxuICAgICAgICAgICAgICAgICAgICAgICAgQXJyYXkuaXNBcnJheShzZWxmLiQuZW52Lm9wdGlvbnMuaWdub3JlU3RkZXJyKSAmJlxuICAgICAgICAgICAgICAgICAgICAgICAgc2VsZi4kLmVudi5vcHRpb25zLmlnbm9yZVN0ZGVyci5ldmVyeShzdHIgPT4gIX5saW5lLmluZGV4T2Yoc3RyKSlcbiAgICAgICAgICAgICAgICAgICAgKVxuICAgICAgICAgICAgICAgICkge1xuICAgICAgICAgICAgICAgICAgICBzZWxmLmxvZy53YXJuKCdTVERFUlI6JywgbGluZSk7XG4gICAgICAgICAgICAgICAgICAgIC8vIFdlIHdpbGwgZXhpdCAxcyBhZnRlciBsYXN0IGVycm9yIGluIHN0ZGVyci5cbiAgICAgICAgICAgICAgICAgICAgZXJyb3JUaW1lb3V0ID0gc2V0VGltZW91dCgoKSA9PiB7XG4gICAgICAgICAgICAgICAgICAgICAgICBjbGVhclRpbWVvdXRzQW5kSW50ZXJ2YWxzKCk7XG4gICAgICAgICAgICAgICAgICAgICAgICBraWxsKCk7XG4gICAgICAgICAgICAgICAgICAgICAgICB3cml0ZUxvZygpO1xuICAgICAgICAgICAgICAgICAgICAgICAgcmVqZWN0KCdlcnJvcicpO1xuICAgICAgICAgICAgICAgICAgICB9LCAxMDAwKTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9KTtcblxuICAgICAgICAgICAgY2hpbGQuc3Rkb3V0Lm9uKCdkYXRhJywgKGNodW5rKSA9PiB7XG4gICAgICAgICAgICAgICAgY29uc3QgbGluZSA9IGNodW5rLnRvU3RyaW5nKCdVVEYtOCcpO1xuICAgICAgICAgICAgICAgIGlmICghZGVzaXJlZEV4aXQgJiYgbGluZS50cmltKCkucmVwbGFjZSgvW1xcblxcclxcdFxcdlxcZl0rL2dtLCAnJykgIT09ICcnKSB7XG4gICAgICAgICAgICAgICAgICAgIGNvbnN0IGxpbmVzVG9EaXNwbGF5ID0gbGluZS50cmltKClcbiAgICAgICAgICAgICAgICAgICAgICAgIC5zcGxpdCgnXFxuXFxyJyk7XG4gICAgICAgICAgICAgICAgICAgIC8vIE9ubHkgZGlzcGxheSBsYXN0IGxpbmUgZnJvbSB0aGUgY2h1bmsuXG4gICAgICAgICAgICAgICAgICAgIGNvbnN0IHNhbml0aXplZExpbmUgPSBsaW5lc1RvRGlzcGxheS5wb3AoKS5yZXBsYWNlKC9bXFxuXFxyXFx0XFx2XFxmXSsvZ20sICcnKTtcbiAgICAgICAgICAgICAgICAgICAgc2xsKHNhbml0aXplZExpbmUpO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICBsb2cgKz0gYCR7bGluZX1cXG5gO1xuICAgICAgICAgICAgICAgIGlmICh+bGluZS5pbmRleE9mKCdhZnRlcl9wbGF0Zm9ybV9hZGQnKSkge1xuICAgICAgICAgICAgICAgICAgICBzbGwoJycpO1xuICAgICAgICAgICAgICAgICAgICB0aGlzLmxvZy5pbmZvKCdkb25lLi4uIDEwJScpO1xuICAgICAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgICAgIGlmICh+bGluZS5pbmRleE9mKCdMb2NhbCBwYWNrYWdlIHZlcnNpb24nKSkge1xuICAgICAgICAgICAgICAgICAgICBpZiAobWVzc2FnZVRpbWVvdXQpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgIGNsZWFyVGltZW91dChtZXNzYWdlVGltZW91dCk7XG4gICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAgICAgbWVzc2FnZVRpbWVvdXQgPSBzZXRUaW1lb3V0KCgpID0+IHtcbiAgICAgICAgICAgICAgICAgICAgICAgIHNsbCgnJyk7XG4gICAgICAgICAgICAgICAgICAgICAgICB0aGlzLmxvZy5pbmZvKCdidWlsZGluZyBpbiBwcm9ncmVzcy4uLicpO1xuICAgICAgICAgICAgICAgICAgICB9LCAxNTAwKTtcbiAgICAgICAgICAgICAgICB9XG5cbiAgICAgICAgICAgICAgICBpZiAofmxpbmUuaW5kZXhPZignUHJlcGFyaW5nIENvcmRvdmEgcHJvamVjdCcpKSB7XG4gICAgICAgICAgICAgICAgICAgIHNsbCgnJyk7XG4gICAgICAgICAgICAgICAgICAgIHRoaXMubG9nLmluZm8oJ2RvbmUuLi4gNjAlJyk7XG4gICAgICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICAgICAgaWYgKH5saW5lLmluZGV4T2YoJ0NhblxcJ3QgbGlzdGVuIG9uIHBvcnQnKSkge1xuICAgICAgICAgICAgICAgICAgICBwb3J0UHJvYmxlbSA9IHRydWU7XG4gICAgICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICAgICAgaWYgKH5saW5lLmluZGV4T2YoJ1lvdXIgYXBwbGljYXRpb24gaGFzIGVycm9ycycpKSB7XG4gICAgICAgICAgICAgICAgICAgIGlmIChlcnJvclRpbWVvdXQpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgIGNsZWFyVGltZW91dChlcnJvclRpbWVvdXQpO1xuICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgICAgIGVycm9yVGltZW91dCA9IHNldFRpbWVvdXQoKCkgPT4ge1xuICAgICAgICAgICAgICAgICAgICAgICAgY2xlYXJUaW1lb3V0c0FuZEludGVydmFscygpO1xuICAgICAgICAgICAgICAgICAgICAgICAga2lsbCgpO1xuICAgICAgICAgICAgICAgICAgICAgICAgd3JpdGVMb2coKTtcbiAgICAgICAgICAgICAgICAgICAgICAgIHJlamVjdCgnZXJyb3JJbkFwcCcpO1xuICAgICAgICAgICAgICAgICAgICB9LCAxMDAwKTtcbiAgICAgICAgICAgICAgICB9XG5cbiAgICAgICAgICAgICAgICBpZiAofmxpbmUuaW5kZXhPZignQXBwIHJ1bm5pbmcgYXQnKSkge1xuICAgICAgICAgICAgICAgICAgICBjb3B5QnVpbGQoKTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9KTtcblxuICAgICAgICAgICAgLy8gV2hlbiBNZXRlb3IgZXhpdHNcbiAgICAgICAgICAgIGNoaWxkLm9uKCdleGl0JywgKCkgPT4ge1xuICAgICAgICAgICAgICAgIHNsbCgnJyk7XG4gICAgICAgICAgICAgICAgY2xlYXJUaW1lb3V0c0FuZEludGVydmFscygpO1xuICAgICAgICAgICAgICAgIGlmICghZGVzaXJlZEV4aXQpIHtcbiAgICAgICAgICAgICAgICAgICAgd3JpdGVMb2coKTtcbiAgICAgICAgICAgICAgICAgICAgaWYgKHBvcnRQcm9ibGVtKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICByZWplY3QoJ3BvcnQnKTtcbiAgICAgICAgICAgICAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgICAgICAgICAgICAgIHJlamVjdCgnZXhpdCcpO1xuICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfSk7XG5cbiAgICAgICAgICAgIGJ1aWxkVGltZW91dCA9IHNldFRpbWVvdXQoKCkgPT4ge1xuICAgICAgICAgICAgICAgIGtpbGwoKTtcbiAgICA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ICAgICAgIGNvbnN0IG1hdGNoZXMgPSBjb250ZW50Lm1hdGNoKHRoaXMubWF0Y2hlcik7XG4gICAgICAgICAgICBydW50aW1lQ29uZmlnID0gSlNPTi5wYXJzZShkZWNvZGVVUklDb21wb25lbnQobWF0Y2hlc1sxXSkpO1xuICAgICAgICB9IGNhdGNoIChlKSB7XG4gICAgICAgICAgICB0aGlzLmxvZy5lcnJvcignY291bGQgbm90IGZpbmQgcnVudGltZSBjb25maWcgaW4gaW5kZXggZmlsZScpO1xuICAgICAgICAgICAgcHJvY2Vzcy5leGl0KDEpO1xuICAgICAgICB9XG5cbiAgICAgICAgaWYgKHRoaXMuJC5lbnYub3B0aW9ucy5kZHBVcmwuc3Vic3RyKC0xLCAxKSAhPT0gJy8nKSB7XG4gICAgICAgICAgICB0aGlzLiQuZW52Lm9wdGlvbnMuZGRwVXJsICs9ICcvJztcbiAgICAgICAgfVxuXG4gICAgICAgIHJ1bnRpbWVDb25maWcuUk9PVF9VUkwgPSB0aGlzLiQuZW52Lm9wdGlvbnMuZGRwVXJsO1xuICAgICAgICBydW50aW1lQ29uZmlnLkREUF9ERUZBVUxUX0NPTk5FQ1RJT05fVVJMID0gdGhpcy4kLmVudi5vcHRpb25zLmRkcFVybDtcblxuICAgICAgICBjb250ZW50ID0gY29udGVudC5yZXBsYWNlKFxuICAgICAgICAgICAgdGhpcy5yZXBsYWNlciwgYCQxXCIke2VuY29kZVVSSUNvbXBvbmVudChKU09OLnN0cmluZ2lmeShydW50aW1lQ29uZmlnKSl9XCIkM2BcbiAgICAgICAgKTtcblxuICAgICAgICB0cnkge1xuICAgICAgICAgICAgZnMud3JpdGVGaWxlU3luYyhpbmRleEh0bWwsIGNvbnRlbnQpO1xuICAgICAgICB9IGNhdGNoIChlKSB7XG4gICAgICAgICAgICB0aGlzLmxvZy5lcnJvcihgZXJyb3Igd3JpdGluZyBpbmRleC5odG1sIGZpbGU6ICR7ZS5tZXNzYWdlfWApO1xuICAgICAgICAgICAgcHJvY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IGluXG4gICAgICAgICAgICAvLyB0aGUgY29ycmVjdCBmaWxlcywgYnV0IGZvciBub3cgdGhpcyBzaG91bGQgYmUgZmluZS5cbiAgICAgICAgICAgIG1hbmlmZXN0LmZvckVhY2goKGZpbGUpID0+IHtcbiAgICAgICAgICAgICAgICBsZXQgZmlsZUNvbnRlbnRzO1xuICAgICAgICAgICAgICAgIC8vIEhhY2t5IHdheSBvZiBzZXR0aW5nIGlzRGVza3RvcC5cbiAgICAgICAgICAgICAgICBpZiAoZmlsZS50eXBlID09PSAnanMnKSB7XG4gICAgICAgICAgICAgICAgICAgIGZpbGVDb250ZW50cyA9IGZzLnJlYWRGaWxlU3luYyhcbiAgICAgICAgICAgICAgICAgICAgICAgIGpvaW4odGhpcy4kLmVudi5wYXRocy5lbGVjdHJvbkFwcC5tZXRlb3JBcHAsIGZpbGUucGF0aCksXG4gICAgICAgICAgICAgICAgICAgICAgICAnVVRGLTgnXG4gICAgICAgICAgICAgICAgICAgICk7XG4gICAgICAgICAgICAgICAgICAgIHJlc3VsdCA9IHRoaXMuaW5qZWN0b3IucHJvY2Vzc0ZpbGVDb250ZW50cyhmaWxlQ29udGVudHMpO1xuXG4gICAgICAgICAgICAgICAgICAgICh7IGZpbGVDb250ZW50cyB9ID0gcmVzdWx0KTtcbiAgICAgICAgICAgICAgICAgICAgaW5qZWN0ZWRTdGFydHVwRGlkQ29tcGxldGUgPVxuICAgICAgICAgICAgICAgICAgICAgICAgcmVzdWx0LmluamVjdGVkU3RhcnR1cERpZENvbXBsZXRlID8gdHJ1ZSA6IGluamVjdGVkU3RhcnR1cERpZENvbXBsZXRlO1xuICAgICAgICAgICAgICAgICAgICBpbmplY3RlZCA9IHJlc3VsdC5pbmplY3RlZCA/IHRydWUgOiBpbmplY3RlZDtcblxuICAgICAgICAgICAgICAgICAgICBmcy53cml0ZUZpbGVTeW5jKFxuICAgICAgICAgICAgICAgICAgICAgICAgam9pbih0aGlzLiQuZW52LnBhdGhzLmVsZWN0cm9uQ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hlY2tQcmVjb25kaXRpb25zKCk7XG4gICAgICAgIH0gY2F0Y2ggKGUpIHtcbiAgICAgICAgICAgIHRoaXMubG9nLmVycm9yKCdlcnJvciBvY2N1cnJlZCBkdXJpbmcgY2hlY2tpbmcgcHJlY29uZGl0aW9uczogJywgZSk7XG4gICAgICAgICAgICBwcm9jZXNzLmV4aXQoMSk7XG4gICAgICAgIH1cblxuICAgICAgICB0aGlzLmxvZy5pbmZvKCdidWlsZGluZyBtZXRlb3IgYXBwJyk7XG5cbiAgICAgICAgaWYgKCF0aGlzLiQuZW52Lm9wdGlvbnMuc2tpcE1vYmlsZUJ1aWxkKSB7XG4gICAgICAgICAgICB0cnkge1xuICAgICAgICAgICAgICAgIGF3YWl0IHRoaXMuYnVpbGRNb2JpbGVUYXJnZXQoKTtcbiAgICAgICAgICAgIH0gY2F0Y2ggKHJlYXNvbikge1xuICAgICAgICAgICAgICAgIHN3aXRjaCAocmVhc29uKSB7XG4gICAgICAgICAgICAgICAgICAgIGNhc2UgJ3RpbWVvdXQnOlxuICAgICAgICAgICAgICAgICAgICAgICAgdGhpcy5sb2cuZXJyb3IoXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgJ3RpbWVvdXQgd2hpbGUgYnVpbGRpbmcsIGxvZyBoYXMgYmVlbiB3cml0dGVuIHRvIG1ldGVvci5sb2cnXG4gICAgICAgICAgICAgICAgICAgICAgICApO1xuICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgICAgIGNhc2UgJ2Vycm9yJzpcbiAgICAgICAgICAgICAgICAgICAgICAgIHRoaXMubG9nLmVycm9yKFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICdidWlsZCB3YXMgdGVybWluYXRlZCBieSBtZXRlb3ItZGVza3RvcCBhcyBzb21lIGVycm9ycyB3ZXJlIHJlcG9ydGVkIHRvIHN0ZGVyciwgeW91ICcgK1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgICdzaG91bGQgc2VlIGl0IGFib3ZlLCBhbHNvIGNoZWNrIG1ldGVvci5sb2cgZm9yIG1vcmUgaW5mbywgdG8gaWdub3JlIGl0IHVzZSB0aGUgJyArXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgJy0taWdub3JlLXN0ZGVyciBcIjxzdHJpbmc+XCInXG4gICAgICAgICAgICAgICAgICAgICAgICApO1xuICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgICAgIGNhc2UgJ2Vycm9ySW5BcHAnOlxuICAgICAgICAgICAgICAgICAgICAgICAgdGhpcy5sb2cuZXJyb3IoXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgJ3lvdXIgbWV0ZW9yIGFwcCBoYXMgZXJyb3JzIC0gbG9vayBpbnRvIG1ldGVvci5sb2cgZm9yIG1vcmUnICtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAnIGluZm8nXG4gICAgICAgICAgICAgICAgICAgICAgICApO1xuICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgICAgIGNhc2UgJ3BvcnQnOlxuICAgICAgICAgICAgICAgICAgICAgICAgdGhpcy5sb2cuZXJyb3IoXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgJ3lvdXIgcG9ydCAzMDgwIGlzIGN1cnJlbnRseSB1c2VkICh5b3UgcHJvYmFibHkgaGF2ZSB0aGlzIG9yIG90aGVyICcgK1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgICdtZXRlb3IgcHJvamVjdCBydW5uaW5nPyksIHVzZSBgLXRgIG9yIGAtLW1ldGVvci1wb3J0YCB0byB1c2UgJyArXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgJ2RpZmZlcmVudCBwb3J0IHdoaWxlIGJ1aWxkaW5nJ1xuICAgICAgICAgICAgICAgICAgICAgICAgKTtcbiAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgICAgICBjYXNlICdleGl0JzpcbiAgICAgICAgICAgICAgICAgICAgICAgIHRoaXMubG9nLmVycm9yKFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICdtZXRlb3IgY21kIGV4aXRlZCB1bmV4cGVjdGVkbHksIGxvZyBoYXMgYmVlbiB3cml0dGVuIHRvIG1ldGVvci5sb2cnXG4gICAgICAgICAgICAgICAgICAgICAgICApO1xuICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgICAgIGNhc2UgJ2NvcHknOlxuICAgICAgICAgICAgICAgICAgICAgICAgdGhpcy5sb2cuZXJyb3IoXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgJ2Vycm9yIGVuY291bnRlcmVkIHdoZW4gY29weWluZyB0aGUgYnVpbGQnXG4gICAgICAgICAgICAgICAgICAgICAgICApO1xuICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgICAgIGRlZmF1bHQ6XG4gICAgICAgICAgICAgICAgICAgICAgICB0aGlzLmxvZy5lcnJvcignZXJyb3Igb2NjdXJyZWQgZHVyaW5nIGJ1aWxkaW5nIG1vYmlsZSB0YXJnZXQnLCByZWFzb24pO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICBpZiAodGhpcy5tb2JpbGVQbGF0Zm9ybSkge1xuICAgICAgICAgICAgICAgICAgICBhd2FpdCB0aGlzLnJlbW92ZU1vYmlsZVBsYXRmb3JtKHRoaXMubW9iaWxlUGxhdGZvcm0pO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICBwcm9jZXNzLmV4aXQoMSk7XG4gICAgICAgICAgICB9XG4gICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICB0aGlzLmluZGV4SFRNTHN0cmF0ZWd5ID0gdGhpcy5jaG9vc2VTdHJhdGVneSgpO1xuICAgICAgICAgICAgdHJ5IHtcbiAgICAgICAgICAgICAgICBhd2FpdCB0aGlzLmNvcHlCdWlsZC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gICAgfVxuICAgIH1cblxuICAgIHBhY2tUb0FzYXIoKSB7XG4gICAgICAgIHRoaXMubG9nLmluZm8oJ3BhY2tpbmcgbWV0ZW9yIGFwcCB0byBhc2FyIGFyY2hpdmUnKTtcbiAgICAgICAgcmV0dXJuIG5ldyBQcm9taXNlKChyZXNvbHZlLCByZWplY3QpID0+XG4gICAgICAgICAgICBhc2FyLmNyZWF0ZVBhY2thZ2UoXG4gICAgICAgICAgICAgICAgdGhpcy4kLmVudi5wYXRocy5lbGVjdHJvbkFwcC5tZXRlb3JBcHAsXG4gICAgICAgICAgICAgICAgcGF0aC5qb2luKHRoaXMuJC5lbnYucGF0aHMuZWxlY3Ryb25BcHAucm9vdCwgJ21ldGVvci5hc2FyJylcbiAgICAgICAgICAgIClcbiAgICAgICAgICAgICAgICAudGhlbigoKSA9PiB7XG4gICAgICAgICAgICAgICAgICAgIC8vIE9uIFdpbmRvd3Mgc29tZSBmaWxlcyBtaWdodCBzdGlsbCBiZSBibG9ja2VkLiBHaXZpbmcgYSB0aWNrIGZvciB0aGVtIHRvIGJlXG4gICAgICAgICAgICAgICAgICAgIC8vIHJlYWR5IGZvciBkZWxldGlvbi5cbiAgICAgICAgICAgICAgICAgICAgc2V0SW1tZWRpYXRlKCgpID0+IHtcbiAgICAgICAgICAgICAgICAgICAgICAgIHRoaXMubG9nLnZlcmJvc2UoJ2NsZWFyaW5nIG1ldGVvciBhcHAgYWZ0ZXIgcGFja2luZycpO1xuICAgICAgICAgICAgICAgICAgICAgICAgdGhpcy4kLnV0aWxzXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgLnJtV2l0aFJldHJpZXMoJy1yZicsIHRoaXMuJC5lbnYucGF0aHMuZWxlY3Ryb25BcHAubWV0ZW9yQXBwKVxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIC50aGVuKCgpID0+IHtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmVzb2x2ZSgpO1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgLmNhdGNoKChlKSA9PiB7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJlamVjdChlKTtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KTtcbiAgICAgICAgICAgICAgICAgICAgfSk7XG4gICAgICAgICAgICAgICAgfSkpO1xuICAgIH1cblxuICAgIC8qKlxuICAgICAqIFdyYXBwZXIgZm9yIHNwYXduaW5nIG5wbS5cbiAgICAgKiBAcGFyYW0ge0FycmF5fSAgY29tbWFuZHMgLSBjb21tYW5kcyBmb3Igc3Bhd25cbiAgICAgKiBAcGFyYW0ge3N0cmluZ30gc3RkaW9cbiAgICAgKiBAcGFyYW0ge3N0cmluZ30gY3dkXG4gICAgICogQHJldHVybiB7UHJvbWlzZX1cbiAgICAgKi9cbiAgICBydW5OcG0oY29tbWFuZHMsIHN0ZGlvID0gJ2lnbm9yZScsIGN3ZCA9IHRoaXMuJC5lbnYucGF0aHMubWV0ZW9yQXBwLnJvb3QpIHtcbiAgICAgICAgcmV0dXJuIG5ldyBQcm9taXNlKChyZXNvbHZlLCByZWplY3QpID0+IHtcbiAgICAgICAgICAgIHRoaXMubG9nLnZlcmJvc2UoYGV4ZWN1dGluZyBtZXRlb3IgbnBtICR7Y29tbWFuZHMuam9pbignICcpfWApO1xuXG4gICAgICAgICAgICBzcGF3bignbWV0ZW9yJywgWyducG0nLCAuLi5jb21tYW5kc10sIHtcbiAgICAgICAgICAgICAgICBjd2QsXG4gICAgICAgICAgICAgICAgc3RkaW9cbiAgICAgICAgICAgIH0pLm9uKCdleGl0JywgY29kZSA9PiAoXG4gICAgICAgICAgICAgICAgKGNvZGUgPT09IDApID8gcmVzb2x2ZSgpIDogcmVqZWN0KG5ldyBFcnJvcihgbnBtIGV4aXQgY29kZSB3YXMgJHtjb2RlfWApKVxuICAgICAgICAgICAgKSk7XG4gICAgICAgIH0pO1xuICAgIH1cbn1cbiJdLCJtYXBw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KLENBQVksQ0FBQ0MsT0FBRCxFQUFVQyxNQUFWLEtBQXFCO01BQ3BDLEtBQUs3RSxHQUFMLENBQVM0QixPQUFULENBQWtCLHdCQUF1QnlLLFFBQVEsQ0FBQzdNLElBQVQsQ0FBYyxHQUFkLENBQW1CLEVBQTVEO01BRUEsSUFBQXNGLG1CQUFBLEVBQU0sUUFBTixFQUFnQixDQUFDLEtBQUQsRUFBUSxHQUFHdUgsUUFBWCxDQUFoQixFQUFzQztRQUNsQ3RILEdBRGtDO1FBRWxDRTtNQUZrQyxDQUF0QyxFQUdHQyxFQUhILENBR00sTUFITixFQUdjb0gsSUFBSSxJQUNiQSxJQUFJLEtBQUssQ0FBVixHQUFlMUgsT0FBTyxFQUF0QixHQUEyQkMsTUFBTSxDQUFDLElBQUl2RCxLQUFKLENBQVcscUJBQW9CZ0wsSUFBSyxFQUFwQyxDQUFELENBSnJDO0lBTUgsQ0FUTSxDQUFQO0VBVUg7O0FBMTRCMEIifQ==
\ No newline at end of file
diff --git a/dist/meteorManager.js b/dist/meteorManager.js
new file mode 100644
index 00000000..098723b3
--- /dev/null
+++ b/dist/meteorManager.js
@@ -0,0 +1,147 @@
+"use strict";
+
+Object.defineProperty(exports, "__esModule", {
+ value: true
+});
+exports.default = void 0;
+
+var _runtime = _interopRequireDefault(require("regenerator-runtime/runtime"));
+
+var _fs = _interopRequireDefault(require("fs"));
+
+var _crossSpawn = _interopRequireDefault(require("cross-spawn"));
+
+var _log = _interopRequireDefault(require("./log"));
+
+function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
+
+// eslint-disable-next-line no-unused-vars
+
+/**
+ * Utility class designed for managing Meteor packages.
+ *
+ * @property {MeteorDesktop} $
+ * @class
+ */
+class MeteorManager {
+ /**
+ * @param {MeteorDesktop} $ - context
+ * @constructor
+ */
+ constructor($) {
+ this.log = new _log.default('meteorManager');
+ this.$ = $;
+ }
+ /**
+ * Looks for specified packages in .meteor/packages. In other words checks if the project has
+ * specified packages added.
+ * @param {Array} packages
+ * @returns {boolean}
+ */
+
+
+ checkPackages(packages) {
+ const usedPackages = _fs.default.readFileSync(this.$.env.paths.meteorApp.packages, 'UTF-8').replace(/\r/gm, '').split('\n').filter(line => !line.trim().startsWith('#'));
+
+ return !packages.some(packageToFind => !usedPackages.some(meteorPackage => ~meteorPackage.indexOf(packageToFind)));
+ }
+ /**
+ * Looks for specified packages in .meteor/packages. In other words checks if the project has
+ * specified packages added.
+ * @param {Array} packages
+ * @returns {boolean}
+ */
+
+
+ checkPackagesVersion(packages) {
+ const usedPackages = _fs.default.readFileSync(this.$.env.paths.meteorApp.versions, 'UTF-8').replace(/\r/gm, '').split('\n');
+
+ return !packages.some(packageToFind => !usedPackages.some(meteorPackage => meteorPackage === packageToFind));
+ }
+ /**
+ * Ensures certain packages are added to meteor project and in correct version.
+ * @param {Array} packages
+ * @param {Array} packagesWithVersion
+ * @param {string} who - name of the entity that requests presence of thos packages (can be the
+ * integration itself or a plugin)
+ * @returns {Promise.}
+ */
+
+
+ async ensurePackages(packages, packagesWithVersion, who) {
+ if (!this.checkPackages(packages)) {
+ this.log.warn(`${who} requires some packages that are not added to project, will try to add them now`);
+
+ try {
+ await this.addPackages(packages, packagesWithVersion);
+ } catch (e) {
+ throw new Error(e);
+ }
+ }
+
+ if (!this.checkPackagesVersion(packagesWithVersion)) {
+ this.log.warn(`${who} required packages version is different, fixing it`);
+
+ try {
+ await this.addPackages(packages, packagesWithVersion);
+ } catch (e) {
+ throw new Error(e);
+ }
+ }
+ }
+ /**
+ * Removes packages from the meteor app.
+ * @param {Array} packages - array with names of the packages to remove
+ */
+
+
+ deletePackages(packages) {
+ this.log.warn('removing packages from meteor project', ...packages);
+ return new Promise((resolve, reject) => {
+ (0, _crossSpawn.default)('meteor', ['remove'].concat(packages), {
+ cwd: this.$.env.paths.meteorApp.root,
+ stdio: ['pipe', 'pipe', process.stderr],
+ env: Object.assign({
+ METEOR_PRETTY_OUTPUT: 0,
+ METEOR_NO_RELEASE_CHECK: 1
+ }, process.env)
+ }).on('exit', code => {
+ if (code !== 0 || this.checkPackages(packages)) {
+ reject('removing packages failed');
+ } else {
+ resolve();
+ }
+ });
+ });
+ }
+ /**
+ * Adds packages to the meteor app.
+ * @param {Array} packages - array with names of the packages to add
+ * @param {Array} packagesWithVersion - array with names and versions of the packages to add
+ */
+
+
+ addPackages(packages, packagesWithVersion) {
+ this.log.info('adding packages to meteor project', ...packagesWithVersion);
+ return new Promise((resolve, reject) => {
+ (0, _crossSpawn.default)('meteor', ['add'].concat(packagesWithVersion.map(packageName => packageName.replace('@', '@='))), {
+ cwd: this.$.env.paths.meteorApp.root,
+ stdio: ['pipe', 'pipe', process.stderr],
+ env: Object.assign({
+ METEOR_PRETTY_OUTPUT: 0,
+ METEOR_NO_RELEASE_CHECK: 1
+ }, process.env)
+ }).on('exit', code => {
+ if (code !== 0 || !this.checkPackages(packages)) {
+ reject('adding packages failed');
+ } else {
+ resolve();
+ }
+ });
+ });
+ }
+
+}
+
+exports.default = MeteorManager;
+//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJuYW1lcyI6WyJNZXRlb3JNYW5hZ2VyIiwiY29uc3RydWN0b3IiLCIkIiwibG9nIiwiTG9nIiwiY2hlY2tQYWNrYWdlcyIsInBhY2thZ2VzIiwidXNlZFBhY2thZ2VzIiwiZnMiLCJyZWFkRmlsZVN5bmMiLCJlbnYiLCJwYXRocyIsIm1ldGVvckFwcCIsInJlcGxhY2UiLCJzcGxpdCIsImZpbHRlciIsImxpbmUiLCJ0cmltIiwic3RhcnRzV2l0aCIsInNvbWUiLCJwYWNrYWdlVG9GaW5kIiwibWV0ZW9yUGFja2FnZSIsImluZGV4T2YiLCJjaGVja1BhY2thZ2VzVmVyc2lvbiIsInZlcnNpb25zIiwiZW5zdXJlUGFja2FnZXMiLCJwYWNrYWdlc1dpdGhWZXJzaW9uIiwid2hvIiwid2FybiIsImFkZFBhY2thZ2VzIiwiZSIsIkV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MubG9nLndhcm4oJ3JlbW92aW5nIHBhY2thZ2VzIGZyb20gbWV0ZW9yIHByb2plY3QnLCAuLi5wYWNrYWdlcyk7XG4gICAgICAgIHJldHVybiBuZXcgUHJvbWlzZSgocmVzb2x2ZSwgcmVqZWN0KSA9PiB7XG4gICAgICAgICAgICBzcGF3bihcbiAgICAgICAgICAgICAgICAnbWV0ZW9yJyxcbiAgICAgICAgICAgICAgICBbJ3JlbW92ZSddLmNvbmNhdChwYWNrYWdlcyksIHtcbiAgICAgICAgICAgICAgICAgICAgY3dkOiB0aGlzLiQuZW52LnBhdGhzLm1ldGVvckFwcC5yb290LFxuICAgICAgICAgICAgICAgICAgICBzdGRpbzogWydwaXBlJywgJ3BpcGUnLCBwcm9jZXNzLnN0ZGVycl0sXG4gICAgICAgICAgICAgICAgICAgIGVudjogT2JqZWN0LmFzc2lnbihcbiAgICAgICAgICAgICAgICAgICAgICAgIHsgTUVURU9SX1BSRVRUWV9PVVRQVVQ6IDAsIE1FVEVPUl9OT19SRUxFQVNFX0NIRUNLOiAxIH0sIHByb2Nlc3MuZW52XG4gICAgICAgICAgICAgICAgICAgIClcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICApLm9uKCdleGl0JywgKGNvZGUpID0+IHtcbiAgICAgICAgICAgICAgICBpZiAoY29kZSAhPT0gMCB8fCB0aGlzLmNoZWNrUGFja2FnZXMocGFja2FnZXMpKSB7XG4gICAgICAgICAgICAgICAgICAgIHJlamVjdCgncmVtb3ZpbmcgcGFja2FnZXMgZmFpbGVkJyk7XG4gICAgICAgICAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgICAgICAgICAgcmVzb2x2ZSgpO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgIH0pO1xuICAgICAgICB9KTtcbiAgICB9XG5cbiAgICAvKipcbiAgICAgKiBBZGRzIHBhY2thZ2VzIHRvIHRoZSBtZXRlb3IgYXBwLlxuICAgICAqIEBwYXJhbSB7QXJyYXl9IHBhY2thZ2VzICAgICAgICAgICAgLSBhcnJheSB3aXRoIG5hbWVzIG9mIHRoZSBwYWNrYWdlcyB0byBhZGRcbiAgICAgKiBAcGFyYW0ge0FycmF5fSBwYWNrYWdlc1dpdGhWZXJzaW9uIC0gYXJyYXkgd2l0aCBuYW1lcyBhbmQgdmVyc2lvbnMgb2YgdGhlIHBhY2thZ2VzIHRvIGFkZFxuICAgICAqL1xuICAgIGFkZFBhY2thZ2VzKHBhY2thZ2VzLCBwYWNrYWdlc1dpdGhWZXJzaW9uKSB7XG4gICAgICAgIHRoaXMubG9nLmluZm8oJ2FkZGluZyBwYWNrYWdlcyB0byBtZXRlb3IgcHJvamVjdCcsIC4uLnBhY2thZ2VzV2l0aFZlcnNpb24pO1xuICAgICAgICByZXR1cm4gbmV3IFByb21pc2UoKHJlc29sdmUsIHJlamVjdCkgPT4ge1xuICAgICAgICAgICAgc3Bhd24oXG4gICAgICAgICAgICAgICAgJ21ldGVvcicsXG4gICAgICAgICAgICAgICAgWydhZGQnXS5jb25jYXQoXG4gICAgICAgICAgICAgICAgICAgIHBhY2thZ2VzV2l0aFZlcnNpb24ubWFwKHBhY2thZ2VOYW1lID0+IHBhY2thZ2VOYW1lLnJlcGxhY2UoJ0AnLCAnQD0nKSlcbiAgICAgICAgICAgICAgICApLFxuICAgICAgICAgICAgICAgIHtcbiAgICAgICAgICAgICAgICAgICAgY3dkOiB0aGlzLiQuZW52LnBhdGhzLm1ldGVvckFwcC5yb290LFxuICAgICAgICAgICAgICAgICAgICBzdGRpbzogWydwaXBlJywgJ3BpcGUnLCBwcm9jZXNzLnN0ZGVycl0sXG4gICAgICAgICAgICAgICAgICAgIGVudjogT2JqZWN0LmFzc2lnbihcbiAgICAgICAgICAgICAgICAgICAgICAgIHsgTUVURU9SX1BSRVRUWV9PVVRQVVQ6IDAsIE1FVEVPUl9OT19SRUxFQVNFX0NIRUNLOiAxIH0sIHByb2Nlc3MuZW52XG4gICAgICAgICAgICAgICAgICAgIClcbiAg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FBR0loQyxHQUFHLEVBQUVpQyxNQUFNLENBQUNDLE1BQVAsQ0FDRDtVQUFFQyxvQkFBb0IsRUFBRSxDQUF4QjtVQUEyQkMsdUJBQXVCLEVBQUU7UUFBcEQsQ0FEQyxFQUN3REwsT0FBTyxDQUFDL0IsR0FEaEU7TUFIVCxDQUxKLEVBWUVxQyxFQVpGLENBWUssTUFaTCxFQVljQyxJQUFELElBQVU7UUFDbkIsSUFBSUEsSUFBSSxLQUFLLENBQVQsSUFBYyxDQUFDLEtBQUszQyxhQUFMLENBQW1CQyxRQUFuQixDQUFuQixFQUFpRDtVQUM3QzZCLE1BQU0sQ0FBQyx3QkFBRCxDQUFOO1FBQ0gsQ0FGRCxNQUVPO1VBQ0hELE9BQU87UUFDVjtNQUNKLENBbEJEO0lBbUJILENBcEJNLENBQVA7RUFxQkg7O0FBNUg4QiJ9
\ No newline at end of file
diff --git a/dist/packager.js b/dist/packager.js
new file mode 100644
index 00000000..5dc2f01f
--- /dev/null
+++ b/dist/packager.js
@@ -0,0 +1,142 @@
+"use strict";
+
+Object.defineProperty(exports, "__esModule", {
+ value: true
+});
+exports.default = void 0;
+
+var _runtime = _interopRequireDefault(require("regenerator-runtime/runtime"));
+
+var _assignIn = _interopRequireDefault(require("lodash/assignIn"));
+
+var _path = _interopRequireDefault(require("path"));
+
+var _fs = _interopRequireDefault(require("fs"));
+
+var _shelljs = _interopRequireDefault(require("shelljs"));
+
+var _log = _interopRequireDefault(require("./log"));
+
+var _defaultDependencies = _interopRequireDefault(require("./defaultDependencies"));
+
+function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
+
+// eslint-disable-next-line no-unused-vars
+const {
+ join
+} = _path.default;
+/**
+ * Wrapper around electron-packager.
+ * @class
+ */
+
+class ElectronPackager {
+ constructor($) {
+ this.log = new _log.default('electron-packager');
+ this.$ = $;
+ }
+
+ async init() {
+ this.packager = (await this.$.getDependency('electron-packager', _defaultDependencies.default['electron-packager'])).dependency;
+ }
+ /**
+ * Runs the packager with provided arguments.
+ *
+ * @param {Object} args
+ * @returns {Promise}
+ */
+
+
+ runPackager(args) {
+ return new Promise((resolve, reject) => {
+ this.packager(args, err => {
+ if (err) {
+ reject(err);
+ } else {
+ this.log.info(`wrote packaged app to ${this.$.env.paths.packageDir}`);
+ resolve();
+ }
+ });
+ });
+ }
+
+ async packageApp() {
+ const {
+ version
+ } = JSON.parse(_fs.default.readFileSync(join(this.$.env.paths.meteorApp.root, 'node_modules', 'electron', 'package.json'), 'UTF-8'));
+ const settings = this.$.desktop.getSettings();
+ const {
+ name
+ } = settings;
+
+ if (!name) {
+ this.log.error('`name` field in settings.json not set');
+ process.exit(1);
+ }
+
+ const arch = this.$.env.options.ia32 ? 'ia32' : 'x64';
+ this.log.info(`packaging '${name}' for platform '${this.$.env.sys.platform}-${arch}'` + ` using electron v${version}`);
+
+ try {
+ await this.$.utils.rmWithRetries('-rf', _path.default.join(this.$.env.options.output, this.$.env.paths.packageDir));
+ } catch (e) {
+ throw new Error(e);
+ }
+
+ const args = {
+ name,
+ arch,
+ prune: false,
+ electronVersion: version,
+ platform: this.$.env.sys.platform,
+ dir: this.$.env.paths.electronApp.root,
+ out: _path.default.join(this.$.env.options.output, this.$.env.paths.packageDir)
+ };
+
+ if ('packagerOptions' in settings) {
+ const {
+ packagerOptions
+ } = settings;
+ ['windows', 'linux', 'osx'].forEach(system => {
+ if (this.$.env.os[`is${system[0].toUpperCase()}${system.substring(1)}`] && `_${system}` in packagerOptions) {
+ (0, _assignIn.default)(packagerOptions, packagerOptions[`_${system}`]);
+ }
+ });
+ Object.keys(packagerOptions).forEach(field => {
+ if (packagerOptions[field] === '@version') {
+ packagerOptions[field] = settings.version;
+ }
+ });
+ (0, _assignIn.default)(args, packagerOptions);
+ } // Move node_modules away. We do not want to delete it, just temporarily remove it from
+ // our way.
+
+
+ _fs.default.renameSync(this.$.env.paths.electronApp.nodeModules, this.$.env.paths.electronApp.tmpNodeModules);
+
+ let extracted = false;
+
+ if (this.$.utils.exists(this.$.env.paths.electronApp.extractedNodeModules)) {
+ _fs.default.renameSync(this.$.env.paths.electronApp.extractedNodeModules, this.$.env.paths.electronApp.nodeModules);
+
+ extracted = true;
+ }
+
+ try {
+ await this.runPackager(args);
+ } finally {
+ if (extracted) {
+ _shelljs.default.rm('-rf', this.$.env.paths.electronApp.extractedNodeModules);
+
+ _shelljs.default.rm('-rf', this.$.env.paths.electronApp.nodeModules);
+ } // Move node_modules back.
+
+
+ _fs.default.renameSync(this.$.env.paths.electronApp.tmpNodeModules, this.$.env.paths.electronApp.nodeModules);
+ }
+ }
+
+}
+
+exports.default = ElectronPackager;
+//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJuYW1lcyI6WyJqb2luIiwicGF0aCIsIkVsZWN0cm9uUGFja2FnZXIiLCJjb25zdHJ1Y3RvciIsIiQiLCJsb2ciLCJMb2ciLCJpbml0IiwicGFja2FnZXIiLCJnZXREZXBlbmRlbmN5IiwiZGVmYXVsdERlcGVuZGVuY2llcyIsImRlcGVuZGVuY3kiLCJydW5QYWNrYWdlciIsImFyZ3MiLCJQcm9taXNlIiwicmVzb2x2ZSIsInJlamVjdCIsImVyciIsImluZm8iLCJlbnYiLCJwYXRocyIsInBhY2thZ2VEaXIiLCJwYWNrYWdlQXBwIiwidmVyc2lvbiIsIkpTT04iLCJwYXJzZSIsImZzIiwicmVhZEZpbGVTeW5jIiwibWV0ZW9yQXBwIiwicm9vdCIsInNldHRpbmdzIiwiZGVza3RvcCIsImdldFNldHRpbmdzIiwibmFtZSIsImVycm9yIiwicHJvY2VzcyIsImV4aXQiLCJhcmNoIiwib3B0aW9ucyIsImlhMzIiLCJzeXMiLCJwbGF0Zm9ybSIsInV0aWxzIiwicm1XaXRoUmV0cmllcyIsIm91dHB1dCIsImUiLCJFcnJvciIsInBydW5lIiwiZWxlY3Ryb25WZXJzaW9uIiwiZGlyIiwiZWxlY3Ryb25BcHAiLCJvdXQiLCJwYWNr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tcbiAgICAgICAgdGhpcy5wYWNrYWdlciA9IChhd2FpdCB0aGlzLiQuZ2V0RGVwZW5kZW5jeSgnZWxlY3Ryb24tcGFja2FnZXInLCBkZWZhdWx0RGVwZW5kZW5jaWVzWydlbGVjdHJvbi1wYWNrYWdlciddKSkuZGVwZW5kZW5jeTtcbiAgICB9XG5cbiAgICAvKipcbiAgICAgKiBSdW5zIHRoZSBwYWNrYWdlciB3aXRoIHByb3ZpZGVkIGFyZ3VtZW50cy5cbiAgICAgKlxuICAgICAqIEBwYXJhbSB7T2JqZWN0fSBhcmdzXG4gICAgICogQHJldHVybnMge1Byb21pc2V9XG4gICAgICovXG4gICAgcnVuUGFja2FnZXIoYXJncykge1xuICAgICAgICByZXR1cm4gbmV3IFByb21pc2UoKHJlc29sdmUsIHJlamVjdCkgPT4ge1xuICAgICAgICAgICAgdGhpcy5wYWNrYWdlcihhcmdzLCAoZXJyKSA9PiB7XG4gICAgICAgICAgICAgICAgaWYgKGVycikge1xuICAgICAgICAgICAgICAgICAgICByZWplY3QoZXJyKTtcbiAgICAgICAgICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgICAgICAgICB0aGlzLmxvZy5pbmZvKGB3cm90ZSBwYWNrYWdlZCBhcHAgdG8gJHt0aGlzLiQuZW52LnBhdGhzLnBhY2thZ2VEaXJ9YCk7XG4gICAgICAgICAgICAgICAgICAgIHJlc29sdmUoKTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9KTtcbiAgICAgICAgfSk7XG4gICAgfVxuXG4gICAgYXN5bmMgcGFja2FnZUFwcCgpIHtcbiAgICAgICAgY29uc3QgeyB2ZXJzaW9uIH0gPSBKU09OLnBhcnNlKGZzLnJlYWRGaWxlU3luYyhcbiAgICAgICAgICAgIGpvaW4oXG4gICAgICAgICAgICAgICAgdGhpcy4kLmVudi5wYXRocy5tZXRlb3JBcHAucm9vdCxcbiAgICAgICAgICAgICAgICAnbm9kZV9tb2R1bGVzJyxcbiAgICAgICAgICAgICAgICAnZWxlY3Ryb24nLFxuICAgICAgICAgICAgICAgICdwYWNrYWdlLmpzb24nXG4gICAgICAgICAgICApLCAnVVRGLTgnXG4gICAgICAgICkpO1xuXG4gICAgICAgIGNvbnN0IHNldHRpbmdzID0gdGhpcy4kLmRlc2t0b3AuZ2V0U2V0dGluZ3MoKTtcbiAgICAgICAgY29uc3QgeyBuYW1lIH0gPSBzZXR0aW5ncztcbiAgICAgICAgaWYgKCFuYW1lKSB7XG4gICAgICAgICAgICB0aGlzLmxvZy5lcnJvcignYG5hbWVgIGZpZWxkIGluIHNldHRpbmdzLmpzb24gbm90IHNldCcpO1xuICAgICAgICAgICAgcHJvY2Vzcy5leGl0KDEpO1xuICAgICAgICB9XG5cbiAgICAgICAgY29uc3QgYXJjaCA9IHRoaXMuJC5lbnYub3B0aW9ucy5pYTMyID8gJ2lhMzInIDogJ3g2NCc7XG5cbiAgICAgICAgdGhpcy5sb2cuaW5mbyhcbiAgICAgICAgICAgIGBwYWNrYWdpbmcgJyR7bmFtZX0nIGZvciBwbGF0Zm9ybSAnJHt0aGlzLiQuZW52LnN5cy5wbGF0Zm9ybX0tJHthcmNofSdgICtcbiAgICAgICAgICAgIGAgdXNpbmcgZWxlY3Ryb24gdiR7dmVyc2lvbn1gXG4gICAgICAgICk7XG5cbiAgICAgICAgdHJ5IHtcbiAgICAgICAgICAgIGF3YWl0IHRoaXMuJC51dGlscy5ybVdpdGhSZXRyaWVzKFxuICAgICAgICAgICAgICAgICctcmYnLCBwYXRoLmpvaW4odGhpcy4kLmVudi5vcHRpb25zLm91dHB1dCwgdGhpcy4kLmVudi5wYXRocy5wYWNrYWdlRGlyKVxuICAgICAgICAgICAgKTtcbiAgICAgICAgfSBjYXRjaCAoZSkge1xuICAgICAgICAgICAgdGhyb3cgbmV3IEVycm9yKGUpO1xuICAgICAgICB9XG5cbiAgICAgICAgY29uc3QgYXJncyA9IHtcbiAgICAgICAgICAgIG5hbWUsXG4gICAgICAgICAgICBhcmNoLFxuICAgICAgICAgICAgcHJ1bmU6IGZhbHNlLFxuICAgICAgICAgICAgZWxlY3Ryb25WZXJzaW9uOiB2ZXJzaW9uLFxuICAgICAgICAgICAgcGxhdGZvcm06IHRoaXMuJC5lbnYuc3lzLnBsYXRmb3JtLFxuICAgICAgICAgICAgZGlyOiB0aGlzLiQuZW52LnBhdGhzLmVsZWN0cm9uQXBwLnJvb3QsXG4gICAgICAgICAgICBvdXQ6IHBhdGguam9pbih0aGlzLiQuZW52Lm9wdGlvbnMub3V0cHV0LCB0aGlzLiQuZW52LnBhdGhzLnBhY2thZ2VEaXIpXG4gICAgICAgIH07XG5cbiAgICAgICAgaWYgKCdwYWNrYWdlck9wdGlvbnMnIGluIHNldHRpbmdzKSB7XG4gICAgICAgICAgICBjb25zdCB7IHBhY2thZ2VyT3B0aW9ucyB9ID0gc2V0dGluZ3M7XG5cbiAgICAgICAgICAgIFsnd2luZG93cycsICdsaW51eCcsICdvc3gnXS5mb3JFYWNoKChzeXN0ZW0pID0+IHtcbiAgICAgICAgICAgICAgICBpZiAoXG4gICAgICAgICAgICAgICAgICAgIHRoaXMuJC5lbnYub3NbYGlzJHtzeXN0ZW1bMF0udG9VcHBlckNhc2UoKX0ke3N5c3RlbS5zdWJzdHJpbmcoMSl9YF0gJiZcbiAgICAgICAgICAgICAgICAgICAgKGBfJHtzeXN0ZW19YCkgaW4gcGFja2FnZXJPcHRpb25zXG4gICAgICAgICAgICAgICAgKSB7XG4gICAgICAgICAgICAgICAgICAgIGFzc2lnbkluKHBhY2thZ2VyT3B0aW9ucywgcGFja2FnZXJPcHRpb25zW2BfJHtzeXN0ZW19YF0pO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgIH0pO1xuXG4gICAgICAgICAgICBPYmplY3Qua2V5cyhwYWNrYWdlck9wdGlvbnMpLmZvckVhY2goKGZpZWxkKSA9PiB7XG4gICAgICAgICAgICAgICAgaWYgKHBhY2thZ2VyT3B0aW9uc1tmaWVsZF0gPT09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7TUFDQXJDLFdBQUEsQ0FBR29DLFVBQUgsQ0FDSSxLQUFLMUQsQ0FBTCxDQUFPZSxHQUFQLENBQVdDLEtBQVgsQ0FBaUI4QixXQUFqQixDQUE2QmMsY0FEakMsRUFFSSxLQUFLNUQsQ0FBTCxDQUFPZSxHQUFQLENBQVdDLEtBQVgsQ0FBaUI4QixXQUFqQixDQUE2QmEsV0FGakM7SUFJSDtFQUNKOztBQTFIaUMifQ==
\ No newline at end of file
diff --git a/dist/scripts/addToScripts.js b/dist/scripts/addToScripts.js
new file mode 100644
index 00000000..aa8d2507
--- /dev/null
+++ b/dist/scripts/addToScripts.js
@@ -0,0 +1,24 @@
+"use strict";
+
+var _path = _interopRequireDefault(require("path"));
+
+var _addScript = _interopRequireDefault(require("./utils/addScript"));
+
+function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
+
+/* eslint-disable no-console */
+
+/**
+ * This script adds a 'desktop' entry to 'scripts' in package.json. If the entry already exists
+ * it leaves it untouched.
+ */
+function fail() {
+ console.error('[meteor-desktop] failed to add meteor-desktop to your package.json scripts, ' + 'please add it manually as \'desktop\': \'meteor-desktop\'');
+ process.exit(0);
+}
+
+const packageJsonPath = _path.default.resolve(_path.default.join(__dirname, '..', '..', '..', '..', 'package.json'));
+
+(0, _addScript.default)('desktop', 'meteor-desktop', packageJsonPath, fail);
+console.log('[meteor-desktop] successfully added a \'desktop\' entry to your package.json' + ' scripts section.');
+//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJuYW1lcyI6WyJmYWlsIiwiY29uc29sZSIsImVycm9yIiwicHJvY2VzcyIsImV4aXQiLCJwYWNrYWdlSnNvblBhdGgiLCJwYXRoIiwicmVzb2x2ZSIsImpvaW4iLCJfX2Rpcm5hbWUiLCJhZGRTY3JpcHQiLCJsb2ciXSwic291cmNlcyI6WyIuLi8uLi9saWIvc2NyaXB0cy9hZGRUb1NjcmlwdHMuanMiXSwic291cmNlc0Nvbn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UFIQTs7QUFJQTtBQUNBO0FBQ0E7QUFDQTtBQUNBLFNBQVNBLElBQVQsR0FBZ0I7RUFDWkMsT0FBTyxDQUFDQyxLQUFSLENBQWMsaUZBQ1YsMkRBREo7RUFFQUMsT0FBTyxDQUFDQyxJQUFSLENBQWEsQ0FBYjtBQUNIOztBQUVELE1BQU1DLGVBQWUsR0FBR0MsYUFBQSxDQUFLQyxPQUFMLENBQ3BCRCxhQUFBLENBQUtFLElBQUwsQ0FBVUMsU0FBVixFQUFxQixJQUFyQixFQUEyQixJQUEzQixFQUFpQyxJQUFqQyxFQUF1QyxJQUF2QyxFQUE2QyxjQUE3QyxDQURvQixDQUF4Qjs7QUFJQSxJQUFBQyxrQkFBQSxFQUFVLFNBQVYsRUFBcUIsZ0JBQXJCLEVBQXVDTCxlQUF2QyxFQUF3REwsSUFBeEQ7QUFFQUMsT0FBTyxDQUFDVSxHQUFSLENBQVksaUZBQ1IsbUJBREoifQ==
\ No newline at end of file
diff --git a/dist/scripts/propagateVersion.js b/dist/scripts/propagateVersion.js
new file mode 100644
index 00000000..eb548ed1
--- /dev/null
+++ b/dist/scripts/propagateVersion.js
@@ -0,0 +1,21 @@
+"use strict";
+
+// This propagates the version from package.json to Meteor plugins.
+const {
+ version
+} = require('../../package.json');
+
+const fs = require('fs');
+
+const paths = ['./plugins/bundler/package.js', './plugins/watcher/package.js'];
+paths.forEach(path => {
+ let packageJs = fs.readFileSync(path, 'UTF-8');
+ packageJs = packageJs.replace(/(version: ')([^']+)'/, `$1${version}'`);
+
+ if (~path.indexOf('watcher')) {
+ packageJs = packageJs.replace(/(communitypackages:meteor-desktop-bundler@)([^']+)'/, `$1${version}'`);
+ }
+
+ fs.writeFileSync(path, packageJs);
+});
+//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJuYW1lcyI6WyJ2ZXJzaW9uIiwicmVxdWlyZSIsImZzIiwicGF0aHMiLCJmb3JFYWNoIiwicGF0aCIsInBhY2thZ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E9BQU8sQ0FBQyxJQUFELENBQWxCOztBQUVBLE1BQU1FLEtBQUssR0FBRyxDQUFDLDhCQUFELEVBQWlDLDhCQUFqQyxDQUFkO0FBQ0FBLEtBQUssQ0FBQ0MsT0FBTixDQUFlQyxJQUFELElBQVU7RUFDcEIsSUFBSUMsU0FBUyxHQUFHSixFQUFFLENBQUNLLFlBQUgsQ0FBZ0JGLElBQWhCLEVBQXNCLE9BQXRCLENBQWhCO0VBQ0FDLFNBQVMsR0FBR0EsU0FBUyxDQUFDRSxPQUFWLENBQWtCLHNCQUFsQixFQUEyQyxLQUFJUixPQUFRLEdBQXZELENBQVo7O0VBQ0EsSUFBSSxDQUFDSyxJQUFJLENBQUNJLE9BQUwsQ0FBYSxTQUFiLENBQUwsRUFBOEI7SUFDMUJILFNBQVMsR0FBR0EsU0FBUyxDQUFDRSxPQUFWLENBQWtCLHFEQUFsQixFQUEwRSxLQUFJUixPQUFRLEdBQXRGLENBQVo7RUFDSDs7RUFDREUsRUFBRSxDQUFDUSxhQUFILENBQWlCTCxJQUFqQixFQUF1QkMsU0FBdkI7QUFDSCxDQVBEIn0=
\ No newline at end of file
diff --git a/dist/scripts/utils/addScript.js b/dist/scripts/utils/addScript.js
new file mode 100644
index 00000000..3e6b47e5
--- /dev/null
+++ b/dist/scripts/utils/addScript.js
@@ -0,0 +1,50 @@
+"use strict";
+
+Object.defineProperty(exports, "__esModule", {
+ value: true
+});
+exports.default = addScript;
+
+var _fs = _interopRequireDefault(require("fs"));
+
+function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
+
+function readJsonFile(jsonFilePath) {
+ try {
+ return JSON.parse(_fs.default.readFileSync(jsonFilePath, 'UTF-8'));
+ } catch (e) {
+ return false;
+ }
+}
+
+function writeJsonFile(jsonFilePath, jsonContents) {
+ try {
+ _fs.default.writeFileSync(jsonFilePath, JSON.stringify(jsonContents, null, 2));
+ } catch (e) {
+ return false;
+ }
+
+ return true;
+}
+
+function addScript(name, script, packageJsonPath, fail) {
+ const packageJson = readJsonFile(packageJsonPath);
+
+ if (!(packageJson && packageJson.name)) {
+ fail();
+ return;
+ }
+
+ if (!('scripts' in packageJson)) {
+ packageJson.scripts = {};
+ }
+
+ if (!(name in packageJson.scripts)) {
+ packageJson.scripts[name] = script;
+ }
+
+ if (!writeJsonFile(packageJsonPath, packageJson)) {
+ fail();
+ }
+}
+//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJuYW1lcyI6WyJyZWFkSnNvbkZpbGUiLCJqc29uRmlsZVBhdGgiLCJKU09OIiwicGFyc2UiLCJmcyIsInJlYWRGaWxlU3luYyIsImUiLCJ3cml0ZUpzb25GaWxlIiwianNvbkNvbnRlbnRzIiwid3JpdGVGaWxlU3luYyIsInN0cmluZ2lmeSIsImFkZFNjcmlwdCIsIm5hbWUiLCJzY3JpcHQiLCJwYWNrYWdlSnNvblBhdGgiLCJmYWlsIiwicGFja2FnZUpzb24iLCJzY3JpcHRzIl0sInNvdXJjZXMiOlsiLi4vLi4vLi4vbGliL3NjcmlwdHMvdXRpbHMvYWRkU2NyaXB0LmpzIl0sInNvdXJjZXNDb250ZW50IjpbImltcG9ydCBmcyBmcm9tICdmcyc7XG5cbmZ1bmN0aW9uIHJlYWRKc29uRmlsZShqc29uRmlsZVBhdGgpIHtcbiAgICB0cnkge1xuICAgICAgICByZXR1cm4gSlNPTi5wYXJzZShmcy5yZWFkRmlsZVN5bmMoanNvbkZpbGVQYXRoLCAnVVRGLTgnKSk7XG4gICAgfSBjYXRjaCAoZSkge1xuICAgICAgICByZXR1cm4gZmFsc2U7XG4gICAgfVxufVxuXG5mdW5jdGlvbiB3cml0ZUpzb25GaWxlKGpzb25GaWxlUGF0aCwganNvbkNvbnRlbnRzKSB7XG4gICAgdHJ5IHtcbiAgICAgICAgZnMud3JpdGVGaWxlU3luYyhqc29uRmlsZVBhdGgsIEpTT04uc3RyaW5naWZ5KGpzb25Db250ZW50cywgbnVsbCwgMikp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sWUFBckMsRUFBbUQ7RUFDL0MsSUFBSTtJQUNBSixXQUFBLENBQUdLLGFBQUgsQ0FBaUJSLFlBQWpCLEVBQStCQyxJQUFJLENBQUNRLFNBQUwsQ0FBZUYsWUFBZixFQUE2QixJQUE3QixFQUFtQyxDQUFuQyxDQUEvQjtFQUNILENBRkQsQ0FFRSxPQUFPRixDQUFQLEVBQVU7SUFDUixPQUFPLEtBQVA7RUFDSDs7RUFDRCxPQUFPLElBQVA7QUFDSDs7QUFFYyxTQUFTSyxTQUFULENBQW1CQyxJQUFuQixFQUF5QkMsTUFBekIsRUFBaUNDLGVBQWpDLEVBQWtEQyxJQUFsRCxFQUF3RDtFQUNuRSxNQUFNQyxXQUFXLEdBQUdoQixZQUFZLENBQUNjLGVBQUQsQ0FBaEM7O0VBQ0EsSUFBSSxFQUFFRSxXQUFXLElBQUlBLFdBQVcsQ0FBQ0osSUFBN0IsQ0FBSixFQUF3QztJQUNwQ0csSUFBSTtJQUNKO0VBQ0g7O0VBRUQsSUFBSSxFQUFFLGFBQWFDLFdBQWYsQ0FBSixFQUFpQztJQUM3QkEsV0FBVyxDQUFDQyxPQUFaLEdBQXNCLEVBQXRCO0VBQ0g7O0VBRUQsSUFBSSxFQUFFTCxJQUFJLElBQUlJLFdBQVcsQ0FBQ0MsT0FBdEIsQ0FBSixFQUFvQztJQUNoQ0QsV0FBVyxDQUFDQyxPQUFaLENBQW9CTCxJQUFwQixJQUE0QkMsTUFBNUI7RUFDSDs7RUFFRCxJQUFJLENBQUNOLGFBQWEsQ0FBQ08sZUFBRCxFQUFrQkUsV0FBbEIsQ0FBbEIsRUFBa0Q7SUFDOUNELElBQUk7RUFDUDtBQUNKIn0=
\ No newline at end of file
diff --git a/dist/skeletonDependencies.js b/dist/skeletonDependencies.js
new file mode 100644
index 00000000..31e6e13d
--- /dev/null
+++ b/dist/skeletonDependencies.js
@@ -0,0 +1,24 @@
+"use strict";
+
+Object.defineProperty(exports, "__esModule", {
+ value: true
+});
+exports.default = void 0;
+var _default = {
+ connect: '3.6.6',
+ 'server-destroy': '1.0.1',
+ winston: '2.3.0',
+ 'find-port': '2.0.1',
+ rimraf: '2.6.2',
+ shelljs: '0.7.5',
+ lodash: '4.17.15',
+ request: '2.88.0',
+ queue: '4.0.1',
+ reify: '0.17.3',
+ send: '0.16.2',
+ mime: '2.0.3',
+ 'fs-extra': '3.0.1',
+ 'fs-plus': '2.9.3'
+};
+exports.default = _default;
+//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJuYW1lcyI6WyJjb25uZWN0Iiwid2luc3RvbiIsInJpbXJhZiIsInNoZWxsanMiLCJsb2Rhc2giLCJyZXF1ZXN0IiwicXVldWUiLCJyZWlmeSIsInNlbmQiLCJtaW1lIl0sInNvdXJjZXMiOlsiLi4vbGliL3NrZWxldG9uRGVwZW5kZW5jaWVzLmpzIl0sInNvdXJjZXNDb250ZW50IjpbImV4cG9ydCBkZWZhdWx0IHtcbiAgICBjb25uZWN0OiAnMy42LjYnLFxuICAgICdzZXJ2ZXItZGVzdHJveSc6ICcxLjAuMScsXG4gICAgd2luc3RvbjogJzIuMy4wJyxcbiAgICAnZmluZC1wb3J0JzogJzIuMC4xJyxcbiAgICByaW1yYWY6ICcyLjYuMicsXG4gICAgc2hlbGxqczogJzAuNy41JyxcbiAgICBsb2Rhc2g6ICc0LjE3LjE1JyxcbiAgICByZXF1ZXN0OiAnMi44OC4wJyxcbiAgICBxdWV1ZTogJzQuMC4xJyxcbiAgICByZWlmeTogJzAuMTcuMycsXG4gICAgc2VuZDogJzAuMTYuMicsXG4gICAgbWltZTogJzIuMC4zJyxcbiAgICAnZnMtZXh0cmEnOiAnMy4wLjEnLFxuICAgICdmcy1wbHVzJzogJzIuOS4zJ1xufTtcbiJdLCJtYXBwaW5ncyI6Ijs7Ozs7O2VBQWU7RUFDWEEsT0FBTyxFQUFFLE9BREU7RUFFWCxrQkFBa0IsT0FGUDtFQUdYQyxPQUFPLEVBQUUsT0FIRTtFQUlYLGFBQWEsT0FKRjtFQUtYQyxNQUFNLEVBQUUsT0FMRztFQU1YQyxPQUFPLEVBQUUsT0FORTtFQU9YQyxNQUFNLEVBQUUsU0FQRztFQVFYQyxPQUFPLEVBQUUsUUFSRTtFQVNYQyxLQUFLLEVBQUUsT0FUSTtFQVVYQyxLQUFLLEVBQUUsUUFWSTtFQVdYQyxJQUFJLEVBQUUsUUFYSztFQVlYQyxJQUFJLEVBQUUsT0FaSztFQWFYLFlBQVksT0FiRDtFQWNYLFdBQVc7QUFkQSxDIn0=
\ No newline at end of file
diff --git a/dist/utils.js b/dist/utils.js
new file mode 100644
index 00000000..f931f672
--- /dev/null
+++ b/dist/utils.js
@@ -0,0 +1,328 @@
+"use strict";
+
+Object.defineProperty(exports, "__esModule", {
+ value: true
+});
+exports.computeHashForHashesSet = computeHashForHashesSet;
+exports.default = void 0;
+exports.exists = exists;
+exports.getFileList = getFileList;
+exports.readAndGetFileHash = readAndGetFileHash;
+exports.readAndHashFiles = readAndHashFiles;
+exports.readDir = readDir;
+exports.readFilesAndComputeHash = readFilesAndComputeHash;
+exports.rmWithRetries = rmWithRetries;
+exports.symlinkExists = symlinkExists;
+
+var _path = _interopRequireDefault(require("path"));
+
+var _fs = _interopRequireDefault(require("fs"));
+
+var _crypto = _interopRequireDefault(require("crypto"));
+
+var _shelljs = _interopRequireDefault(require("shelljs"));
+
+function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
+
+/* eslint-disable consistent-return */
+
+/**
+ * Exists
+ * @param {string} pathToCheck
+ * @returns {boolean}
+ */
+function exists(pathToCheck) {
+ try {
+ _fs.default.accessSync(pathToCheck);
+
+ return true;
+ } catch (e) {
+ return false;
+ }
+}
+/**
+ * Simple wrapper for shelljs.rm with additional retries in case of failure.
+ * It is useful when something is concurrently reading the dir you want to remove.
+ */
+
+
+function rmWithRetries(...args) {
+ let retries = 0;
+ return new Promise((resolve, reject) => {
+ function rm(...rmArgs) {
+ try {
+ _shelljs.default.config.fatal = true;
+
+ _shelljs.default.rm(...rmArgs);
+
+ _shelljs.default.config.reset();
+
+ resolve();
+ } catch (e) {
+ retries += 1;
+
+ if (retries < 5) {
+ setTimeout(() => {
+ rm(...rmArgs);
+ }, 100);
+ } else {
+ _shelljs.default.config.reset();
+
+ reject(e);
+ }
+ }
+ }
+
+ rm(...args);
+ });
+}
+
+function readDir(dir, callback) {
+ if (!callback) {
+ return new Promise((resolve, reject) => {
+ readDir(dir, (err, data, stats) => {
+ if (err) {
+ reject(err);
+ } else {
+ resolve({
+ data,
+ stats
+ });
+ }
+ });
+ });
+ }
+
+ let list = [];
+ let allStats = {};
+
+ _fs.default.readdir(dir, (err, files) => {
+ if (err) {
+ return callback(err);
+ }
+
+ let pending = files.length;
+
+ if (!pending) {
+ return callback(null, list, allStats);
+ }
+
+ files.forEach(file => {
+ const filePath = _path.default.join(dir, file);
+
+ _fs.default.stat(filePath, (_err, stats) => {
+ if (_err) {
+ return callback(_err);
+ }
+
+ if (stats.isDirectory()) {
+ readDir(filePath, (__err, res, _allStats) => {
+ if (__err) {
+ return callback(__err);
+ }
+
+ list = list.concat(res);
+ allStats = Object.assign(allStats, _allStats);
+ pending -= 1;
+
+ if (!pending) {
+ return callback(null, list, allStats);
+ }
+ });
+ } else {
+ list.push(filePath);
+ allStats[filePath] = {
+ size: stats.size,
+ dates: [stats.birthtime.getTime(), stats.ctime.getTime(), stats.mtime.getTime()]
+ };
+ pending -= 1;
+
+ if (!pending) {
+ return callback(null, list, allStats);
+ }
+ }
+ });
+ });
+ });
+}
+/**
+ * Returns a file list from a directory.
+ * @param {string} dir - dir path
+ * @param {boolean} sort - whether to apply sort
+ * @returns {Promise}
+ */
+
+
+function getFileList(dir, sort = false) {
+ return new Promise((resolve, reject) => {
+ readDir(dir, (error, files) => {
+ if (error) {
+ reject(error);
+ return;
+ } // eslint-disable-next-line no-param-reassign
+
+
+ let resultantFilesList;
+
+ if (sort) {
+ const stripLength = dir.substr(0, 2) === './' ? dir.length - 1 : dir.length + 1;
+ let pathsUnified = files.map(pth => pth.substr(stripLength).replace(/[\\/]/gm, '-'));
+ const temporaryIndex = {};
+ files.forEach((file, i) => {
+ temporaryIndex[pathsUnified[i]] = file;
+ });
+ pathsUnified = pathsUnified.sort();
+ const filesSorted = [];
+ pathsUnified.forEach(key => {
+ filesSorted.push(temporaryIndex[key]);
+ });
+ resultantFilesList = filesSorted;
+ } else {
+ resultantFilesList = files;
+ }
+
+ resolve(resultantFilesList);
+ });
+ });
+}
+/**
+ * Returns file's hash.
+ * @param {string} file - file path
+ * @param {boolean} returnFileContents - include file contents in the resultant object
+ * @returns {Promise