@finsemble/finsemble-core 8.0.0-alpha-3 → 8.0.0-beta.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (33) hide show
  1. package/configs/schemas/fileBasedSchemas/project.schema.json +199 -0
  2. package/configs/schemas/finsemble.schema.json +2 -2
  3. package/dist/cli/cli-api/tools.cjs +171 -96
  4. package/dist/cli/cli-api/tools.cjs.map +1 -1
  5. package/dist/cli/cli-api/tools.d.cts +13 -12
  6. package/dist/cli/cli-api/tools.d.cts.map +1 -1
  7. package/dist/cli/cli-api/webpack.d.ts.map +1 -1
  8. package/dist/cli/cli-api/webpack.js +2 -0
  9. package/dist/cli/cli-api/webpack.js.map +1 -1
  10. package/dist/cli/cli.cjs +7 -3
  11. package/dist/cli/cli.cjs.map +1 -1
  12. package/dist/cli/tsconfig.cli.tsbuildinfo +1 -1
  13. package/dist/configs/schemas/fileBasedSchemas/project.schema.json +199 -0
  14. package/dist/configs/schemas/finsemble.schema.json +2 -2
  15. package/dist/lib/index.d.ts +1 -0
  16. package/dist/lib/index.d.ts.map +1 -1
  17. package/dist/lib/index.js +1 -0
  18. package/dist/lib/index.js.map +1 -1
  19. package/dist/lib/tsconfig.lib.tsbuildinfo +1 -1
  20. package/dist/lib/tsconfig.noglobals.tsbuildinfo +1 -1
  21. package/dist/platform/configs/core/config.json +2 -2
  22. package/dist/platform/configs/schemas/fileBasedSchemas/project.schema.json +199 -0
  23. package/dist/platform/configs/schemas/finsemble.schema.json +2 -2
  24. package/dist/platform/services/Interop/InteropServiceUI.js +1 -1
  25. package/dist/platform/services/router/routerService.js +1 -1
  26. package/dist/platform/services/storage/storageService.js.map +1 -1
  27. package/dist/platform/services/window/windowService.js +1 -1
  28. package/dist/platform/smartDesktopDesigner/smartDesktopDesigner.js +1 -1
  29. package/dist/platform/smartDesktopDesigner/smartDesktopDesigner.js.map +1 -1
  30. package/dist/platform/tsconfig-seed.json +3 -5
  31. package/dist/templates/Blank/index.ts +6 -5
  32. package/package.json +4 -3
  33. package/types/index.d.ts +1 -0
@@ -0,0 +1,199 @@
1
+ {
2
+ "$schema": "http://json-schema.org/draft-07/schema#",
3
+ "description": "JSON format for product.json file. This file contains non-runtime configuration for a [seed] project.",
4
+ "type": "object",
5
+ "properties": {
6
+ "installer": {
7
+ "$ref": "#/definitions/installer"
8
+ },
9
+ "launch": {
10
+ "$ref": "#/definitions/launch"
11
+ },
12
+ "environments": {
13
+ "description": "Environmental configuration. These use installer and launch as a based, applying overrides using JSON merge patch. https://www.rfc-editor.org/rfc/rfc7386",
14
+ "type": "object",
15
+ "additionalProperties": {
16
+ "$ref": "#/definitions/environment"
17
+ }
18
+ },
19
+ "deployInfo": {
20
+ "description": "Deployment info that is added by the Smart Desktop Designer (SDD)",
21
+ "type": "object",
22
+ "properties": {
23
+ "uuid": {
24
+ "description": "A unique identifier assigned to this project when it is deployed to Cosaic Cloud",
25
+ "type": "string"
26
+ },
27
+ "installerURL": {
28
+ "description": "The URL that contains the installer for this project. This URL is created by Cosaic Cloud",
29
+ "type": "string"
30
+ },
31
+ "manifestURL": {
32
+ "description": "The production manifest location that was created when the project was deployed to Cosaic Cloud",
33
+ "type": "string"
34
+ }
35
+ }
36
+ },
37
+ "name": {
38
+ "description": "Name of the project. This should match back to an entry in the Smart Desktop Designer (SDD)",
39
+ "type": "string"
40
+ }
41
+ },
42
+ "additionalProperties": true,
43
+ "definitions": {
44
+ "environment": {
45
+ "description": "An environment configuration. installer and launch are both optional. Any specified fields will override the global values using JSON merge patch rules.",
46
+ "type": "object",
47
+ "properties": {
48
+ "installer": {
49
+ "$ref": "#/definitions/installer"
50
+ },
51
+ "launch": {
52
+ "$ref": "#/definitions/launch"
53
+ }
54
+ }
55
+ },
56
+ "installer": {
57
+ "description": "Configuration for generating smart desktop installers",
58
+ "type": "object",
59
+ "additionalProperties": false,
60
+ "properties": {
61
+ "manifestUrl": {
62
+ "description": "The URL of the hosted production Finsemble manifest for this installer configuration.",
63
+ "type": "string"
64
+ },
65
+ "updateUrl": {
66
+ "description": "URL for artifacts generated by npm run makeInstaller in order to enable auto updated of the FEA runtime. The contents of the folder are compared to the user's current installation, and downloaded if they represent a newer version. Default is http://localhost:3375/pkg",
67
+ "type": ["string", "null"]
68
+ },
69
+ "chromiumFlags": {
70
+ "description": "Chromium flags to be set when starting Finsemble.",
71
+ "type": "object",
72
+ "additionalProperties": true
73
+ },
74
+ "icon": {
75
+ "description": "Path to an icon to be used for your executable. This is relative to the root of the seed project.",
76
+ "type": "string"
77
+ },
78
+ "version": {
79
+ "description": "The version number of this release.",
80
+ "type": "string"
81
+ },
82
+ "outputDirectory": {
83
+ "description": "Path where you would like the executable to be placed. This is relative to the root of the seed project.",
84
+ "type": "string"
85
+ },
86
+ "name": {
87
+ "description": "Name of your application. Will be used for the exe, windows metadata, and the name of the installation folder. Only alphanumeric characters, spaces, dashes(-), periods(.), and underscores(_) are allowed",
88
+ "type": "string"
89
+ },
90
+ "authors": {
91
+ "description": "Your company name.",
92
+ "type": "string"
93
+ },
94
+ "description": {
95
+ "description": "Description of your application.",
96
+ "type": "string"
97
+ },
98
+ "companyName": {
99
+ "description": "Name of your company. Will be used for the folder name in the start menu. Defaults to authors if omitted.",
100
+ "type": "string"
101
+ },
102
+ "certificateFile": {
103
+ "description": "The path to an Authenticode Code Signing Certificate for code-signing the application wioth signtool.exe.",
104
+ "type": ["string", "null"]
105
+ },
106
+ "certificatePassword": {
107
+ "description": "The password to decrypt the certificate given in certificateFile.",
108
+ "type": ["string", "null"]
109
+ },
110
+ "signWithParams": {
111
+ "description": "Params to pass to signtool.exe. Specifying a time server is recommended (e.g. '/tr http://timestamp.digicert.com'",
112
+ "type": ["string", "null"]
113
+ },
114
+ "background": {
115
+ "description": "Path to the image used as the background for a Mac installer. Must be a png file.",
116
+ "type": "string"
117
+ },
118
+ "loadingGif": {
119
+ "description": "Path to the image used as the splash for a Windows installer. Must be a gif file.",
120
+ "type": "string"
121
+ },
122
+ "macIcon": {
123
+ "description": "Path to the icon to be used on Mac.",
124
+ "type": "string"
125
+ },
126
+ "osxSign": {
127
+ "description": "MacOS ONLY - An object with the required info for MacOS App codesign. If not specified your .app won't be notarized. See https://electron.github.io/electron-packager/main/interfaces/electronpackager.options.html#osxsign.",
128
+ "type": "string"
129
+ },
130
+ "osxNotarize": {
131
+ "description": "MacOS ONLY - An object with the required info for MacOS App to be notarized. If not specified your .app won't be notarized. See https://electron.github.io/electron-packager/main/interfaces/electronpackager.options.html#osxnotarize.",
132
+ "type": "string"
133
+ },
134
+ "download": {
135
+ "description": "Overrides for where to download the Electron binary when creating an installer.",
136
+ "type": "object",
137
+ "properties": {
138
+ "mirror": {
139
+ "description": "Location of site from where to download the Electron binary. Finsemble's mirror is https://assets.finsemble.com/electron/",
140
+ "type": "string"
141
+ }
142
+ }
143
+ },
144
+ "electronPackagerOptions": {
145
+ "description": "Config overrides to pass to electron-packager. See https://electron.github.io/electron-packager/main/interfaces/electronpackager.options.html.",
146
+ "type": "object",
147
+ "additionalProperties": true
148
+ },
149
+ "electronWinstallerOptions": {
150
+ "description": "Windows Only - Config overrides to pass to electron-winstaller createWindowsInstaller(). See https://github.com/electron/windows-installer",
151
+ "type": "object",
152
+ "additionalProperties": true
153
+ },
154
+ "electronInstallerDmgOptions": {
155
+ "description": "MacOS Only - Config overrides to pass to electron-installer-dmg createDMG(). See https://github.com/electron-userland/electron-installer-dmg#createdmgopts-callback",
156
+ "type": "object",
157
+ "additionalProperties": true
158
+ }
159
+ }
160
+ },
161
+ "launch": {
162
+ "type": "object",
163
+ "description": "Configuration for launching Finsemble in developer mode (e.g. using `yarn dev`)",
164
+ "properties": {
165
+ "port": {
166
+ "description": "The HTTP port to launch the Finsemble devserver. This must match the port that is set in the manifest url.",
167
+ "type": "number",
168
+ "default": 3375
169
+ },
170
+ "manifestUrl": {
171
+ "description": "The URL where the Finsemble manifest is located. The port must match the port field.",
172
+ "type": "string",
173
+ "default": "http://localhost:3375/configs/application/manifest-local.json"
174
+ },
175
+ "breakpointOnStart": {
176
+ "description": "When set to true, the finsemble-electron-adapter (FEA) will pause in the node debugger on startup",
177
+ "type": "boolean",
178
+ "default": false
179
+ },
180
+ "updateUrl": {
181
+ "description": "(DEPRECATED) Set this field in the installer config.",
182
+ "type": ["string", "null"]
183
+ },
184
+ "chromiumFlags": {
185
+ "description": "Chromium flags to be set when starting Finsemble. Defaults to `remote-debugging-port: 9222` so that windows can be debugged through chrome://inspect.",
186
+ "type": "object",
187
+ "properties": {}
188
+ },
189
+ "args": {
190
+ "description": "Optional command line arguments to be passed to Finsemble - example: ['--arg1=value1', '--arg2=value2']",
191
+ "type": "array",
192
+ "items": {
193
+ "type": "string"
194
+ }
195
+ }
196
+ }
197
+ }
198
+ }
199
+ }
@@ -896,7 +896,7 @@
896
896
  "properties": {
897
897
  "name": {
898
898
  "type": "string",
899
- "description": "Defaults to the name of the application as specified in installer.json. This is used for certain dialogs and in the central logger. The name must be alphanumeric characters and spaces. Don't use any other characters",
899
+ "description": "Defaults to the name of the application as specified in project.json. This is used for certain dialogs and in the central logger. The name must be alphanumeric characters and spaces. Don't use any other characters",
900
900
  "pattern": "^[A-Za-z0-9\\s]*$"
901
901
  },
902
902
  "url": {
@@ -904,7 +904,7 @@
904
904
  },
905
905
  "uuid": {
906
906
  "type": "string",
907
- "description": "Uniquely differentiates environmental instances of the same application (see server-environment-startup.json) to avoid storage conflicts. The uuid must be alphanumeric characters. Do not use spaces. The uuid is available for use in storage keys, such as those generated by the IndexedDBStorageAdapter.",
907
+ "description": "Uniquely differentiates environmental instances of the same application (see project.json) to avoid storage conflicts. The uuid must be alphanumeric characters. Do not use spaces. The uuid is available for use in storage keys, such as those generated by the IndexedDBStorageAdapter.",
908
908
  "pattern": "^[A-Za-z0-9\\s\\-]*$",
909
909
  "default": "Finsemble"
910
910
  },
@@ -6,11 +6,34 @@
6
6
  *
7
7
  * These tools are made available as a command line interface via cli.ts at the root level.
8
8
  */
9
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ var desc = Object.getOwnPropertyDescriptor(m, k);
12
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
13
+ desc = { enumerable: true, get: function() { return m[k]; } };
14
+ }
15
+ Object.defineProperty(o, k2, desc);
16
+ }) : (function(o, m, k, k2) {
17
+ if (k2 === undefined) k2 = k;
18
+ o[k2] = m[k];
19
+ }));
20
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
21
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
22
+ }) : function(o, v) {
23
+ o["default"] = v;
24
+ });
25
+ var __importStar = (this && this.__importStar) || function (mod) {
26
+ if (mod && mod.__esModule) return mod;
27
+ var result = {};
28
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
29
+ __setModuleDefault(result, mod);
30
+ return result;
31
+ };
9
32
  var __importDefault = (this && this.__importDefault) || function (mod) {
10
33
  return (mod && mod.__esModule) ? mod : { "default": mod };
11
34
  };
12
35
  Object.defineProperty(exports, "__esModule", { value: true });
13
- exports.build = exports.getWebpackConfig = exports.runWebpack = exports.installTemplates = exports.create = exports.clean = exports.makeInstaller = exports.start = exports.preparePlatform = exports.startFEAServer = exports.launchFEA = exports.getStartupConfigs = exports.argExists = void 0;
36
+ exports.build = exports.getWebpackConfig = exports.runWebpack = exports.installTemplates = exports.create = exports.clean = exports.makeInstaller = exports.start = exports.preparePlatform = exports.startFEAServer = exports.launchFEA = exports.getLaunchConfig = exports.argExists = void 0;
14
37
  const webpack_1 = require("./webpack");
15
38
  const path_1 = __importDefault(require("path"));
16
39
  const fs_extra_1 = __importDefault(require("fs-extra"));
@@ -18,12 +41,10 @@ const minimist_1 = __importDefault(require("minimist"));
18
41
  const webpack_2 = require("webpack");
19
42
  const deepmerge_1 = __importDefault(require("deepmerge"));
20
43
  const resolve_cwd_1 = __importDefault(require("resolve-cwd"));
21
- const FEA = require("@finsemble/finsemble-electron-adapter/exports");
22
- const { e2oLauncher, Server: FEAServer, packager } = FEA;
23
- const defaultStartupConfig = {
24
- port: 3375,
25
- manifest: "http://localhost:3375/configs/application/manifest-local.json",
26
- };
44
+ const jsonMergePatch = __importStar(require("json-merge-patch"));
45
+ const makeInstaller_1 = require("@finsemble/finsemble-electron-adapter/dist/makeInstaller");
46
+ const exports_1 = __importDefault(require("@finsemble/finsemble-electron-adapter/dist/exports"));
47
+ const { e2oLauncher, Server: FEAServer } = exports_1.default;
27
48
  /**
28
49
  * Returns true if the argument was passed either as "myarg" or "--myarg"
29
50
  * @ignore
@@ -31,32 +52,106 @@ const defaultStartupConfig = {
31
52
  const argExists = (arg, args) => args["_"].includes(arg) || args[arg];
32
53
  exports.argExists = argExists;
33
54
  /**
34
- * Retrieves the config from server-environment-startup.json
35
- *
36
- * @returns Resolves to an error string if an error occurs, otherwise to null
55
+ * Returns the config from legacy server-environment-startup.json file.
37
56
  *
38
- * :::note
57
+ * * :::note
39
58
  * If deprecated fields `serverConfig` and `serverPort` are found in the config then they are converted to `manifest` and `port`.
40
59
  * :::
41
60
  */
42
- const getStartupConfigs = () => {
61
+ const getLaunchConfigFromLegacy = (environment) => {
43
62
  var _a, _b;
44
- try {
45
- const originalConfig = require("./public/configs/other/server-environment-startup");
46
- return Object.assign(Object.assign({}, originalConfig), { manifest: (_a = originalConfig.manifest) !== null && _a !== void 0 ? _a : originalConfig.serverConfig, port: (_b = originalConfig.port) !== null && _b !== void 0 ? _b : originalConfig.port });
47
- }
48
- catch (e) {
63
+ const rawConfig = fs_extra_1.default.readJSONSync("./public/configs/other/server-environment-startup.json", { throws: false });
64
+ const config = rawConfig === null || rawConfig === void 0 ? void 0 : rawConfig[environment];
65
+ return config ? Object.assign(Object.assign({}, config), { manifestUrl: (_a = config.manifestUrl) !== null && _a !== void 0 ? _a : config.serverConfig, port: (_b = config.port) !== null && _b !== void 0 ? _b : config.serverPort }) : null;
66
+ };
67
+ /**
68
+ * Returns the installer config from project.json, applying environmental overrides if they exist using json-merge-patch.
69
+ */
70
+ const getLaunchConfigFromProject = (environment) => {
71
+ var _a, _b;
72
+ const rawConfig = fs_extra_1.default.readJSONSync("./project.json", { throws: false });
73
+ const launchConfig = rawConfig === null || rawConfig === void 0 ? void 0 : rawConfig.launch;
74
+ const overrides = (_b = (_a = rawConfig === null || rawConfig === void 0 ? void 0 : rawConfig.environments) === null || _a === void 0 ? void 0 : _a[environment]) === null || _b === void 0 ? void 0 : _b.launch;
75
+ if (!launchConfig && !overrides)
49
76
  return null;
50
- }
77
+ if (!launchConfig && overrides)
78
+ return overrides;
79
+ if (launchConfig && !overrides)
80
+ return launchConfig;
81
+ return jsonMergePatch.apply(launchConfig, overrides);
82
+ };
83
+ /**
84
+ * Returns a launch config for the requested environment. See getLaunchConfig(). The only difference is that this version
85
+ * returns null if no config is found.
86
+ */
87
+ const getLaunchConfigNoDefaults = ({ environment = "development" }) => {
88
+ var _a;
89
+ const legacyConfigExists = fs_extra_1.default.existsSync("./public/configs/other/server-environment-startup.json");
90
+ return legacyConfigExists ? getLaunchConfigFromLegacy(environment) : (_a = getLaunchConfigFromProject(environment)) !== null && _a !== void 0 ? _a : null;
91
+ };
92
+ /**
93
+ * Returns a launch config for the requested environment. This looks in the legacy server-environment-startup.json file before it
94
+ * looks in the standard project.json file, applying environment overrides using json-merge-patch. If no config is found then a
95
+ * default config is returned.
96
+ *
97
+ * @returns Resolves the launcher config or null if it doesn't exist and useDefaults was set to false
98
+ */
99
+ const getLaunchConfig = ({ environment = "development" }) => {
100
+ var _a, _b, _c;
101
+ const defaultLaunchConfig = {
102
+ port: 3375,
103
+ manifestUrl: "http://localhost:3375/configs/application/manifest-local.json",
104
+ // Renderer windows will appear in chrome://inspect if this flag is set
105
+ // (as an alternative to using localhost:9090)
106
+ chromiumFlags: {
107
+ "remote-debugging-port": 9222
108
+ }
109
+ };
110
+ const config = getLaunchConfigNoDefaults({ environment });
111
+ return Object.assign(Object.assign({}, config), { port: (_a = config === null || config === void 0 ? void 0 : config.port) !== null && _a !== void 0 ? _a : defaultLaunchConfig.port, manifest: (_b = config === null || config === void 0 ? void 0 : config.manifest) !== null && _b !== void 0 ? _b : defaultLaunchConfig.manifestUrl, chromiumFlags: (_c = config === null || config === void 0 ? void 0 : config.chromiumFlags) !== null && _c !== void 0 ? _c : defaultLaunchConfig.chromiumFlags });
112
+ };
113
+ exports.getLaunchConfig = getLaunchConfig;
114
+ /**
115
+ * Returns the config from legacy installer.json file. This will detect whether the file has a single
116
+ * installer configuration or multiple configurations by environment.
117
+ */
118
+ const getInstallerConfigFromLegacy = (environment) => {
119
+ var _a;
120
+ const rawConfig = fs_extra_1.default.readJSONSync("./public/configs/other/installer.json", { throws: false });
121
+ // If the "name" field exists then installer.json has just a single config entry. Otherwise, it has multiple entries per environment
122
+ return (rawConfig === null || rawConfig === void 0 ? void 0 : rawConfig.name) ? rawConfig : (_a = rawConfig[environment]) !== null && _a !== void 0 ? _a : null;
123
+ };
124
+ /**
125
+ * Returns the installer config from project.json, applying environmental overrides if they exist using json-merge-patch.
126
+ */
127
+ const getInstallerConfigFromProject = (environment) => {
128
+ var _a, _b;
129
+ const rawConfig = fs_extra_1.default.readJSONSync("./project.json", { throws: false });
130
+ const installerConfig = rawConfig === null || rawConfig === void 0 ? void 0 : rawConfig.installer;
131
+ const overrides = (_b = (_a = rawConfig === null || rawConfig === void 0 ? void 0 : rawConfig.environments) === null || _a === void 0 ? void 0 : _a[environment]) === null || _b === void 0 ? void 0 : _b.installer;
132
+ if (!installerConfig && !overrides)
133
+ return null;
134
+ if (!installerConfig && overrides)
135
+ return overrides;
136
+ if (installerConfig && !overrides)
137
+ return installerConfig;
138
+ return jsonMergePatch.apply(installerConfig, overrides);
139
+ };
140
+ /**
141
+ * Returns the installer configuration which can be used in makeInstaller. This function deals with both the legacy
142
+ * installer.json file and the current project.json file. Legacy, if it exists, will take precedence over current config.
143
+ */
144
+ const getInstallerConfig = (environment) => {
145
+ const legacyInstallerJSONExists = fs_extra_1.default.existsSync("./public/configs/other/installer.json");
146
+ return legacyInstallerJSONExists ? getInstallerConfigFromLegacy(environment) : getInstallerConfigFromProject(environment);
51
147
  };
52
- exports.getStartupConfigs = getStartupConfigs;
53
148
  /**
54
149
  * :::note
55
150
  * Use [start()](#start) to launch the dev server and Finsemble with a single command.
56
151
  * :::
57
152
  *
58
153
  * Launches Finsemble (the Finsemble Electron Adapter (FEA)) using e2oLauncher (in the @finsemble/finsemble-electron-adapter module).
59
- * If an entry exists in server-environment-startup.json for either the requested or default
154
+ * If an entry exists in project.json for either the requested or default
60
155
  * environment then the parameters from that entry are used to determine the server port and manifest
61
156
  * location, otherwise the port will default to 3375 and the manifest location will be `public/configs/application/manifest-local.json`.
62
157
  *
@@ -81,13 +176,12 @@ exports.getStartupConfigs = getStartupConfigs;
81
176
  */
82
177
  const launchFEA = async ({ environment = "development", args = [], }) => {
83
178
  var _a, _b, _c;
84
- const startupConfigs = (0, exports.getStartupConfigs)();
179
+ const launchConfig = (0, exports.getLaunchConfig)({ environment });
85
180
  const parsedArgs = (0, minimist_1.default)(args !== null && args !== void 0 ? args : []);
86
- const cfg = (_a = startupConfigs === null || startupConfigs === void 0 ? void 0 : startupConfigs[environment]) !== null && _a !== void 0 ? _a : defaultStartupConfig;
87
- const installerConfig = require(path_1.default.resolve("./public/configs/other/installer.json"));
88
- const name = (_b = installerConfig === null || installerConfig === void 0 ? void 0 : installerConfig.name) !== null && _b !== void 0 ? _b : "Finsemble";
181
+ const installerConfig = getInstallerConfig(environment);
182
+ const name = (_a = installerConfig === null || installerConfig === void 0 ? void 0 : installerConfig.name) !== null && _a !== void 0 ? _a : "Finsemble";
89
183
  const isSDD = args.includes("--smartDesktopDevMode");
90
- const configuredManifest = (_c = parsedArgs["manifest"]) !== null && _c !== void 0 ? _c : cfg.manifest;
184
+ const configuredManifest = (_c = (_b = parsedArgs["manifest"]) !== null && _b !== void 0 ? _b : parsedArgs["manifestUrl"]) !== null && _c !== void 0 ? _c : launchConfig.manifestUrl;
91
185
  const manifest = isSDD ? undefined : configuredManifest;
92
186
  return new Promise((resolve) => {
93
187
  /**
@@ -103,9 +197,9 @@ const launchFEA = async ({ environment = "development", args = [], }) => {
103
197
  const config = {
104
198
  manifest,
105
199
  onElectronClose,
106
- chromiumFlags: JSON.stringify(cfg.chromiumFlags),
107
- breakpointOnStart: cfg.breakpointOnStart,
108
- args: ["--name", name].concat(cfg["args"]).concat(args),
200
+ chromiumFlags: JSON.stringify(launchConfig.chromiumFlags),
201
+ breakpointOnStart: launchConfig.breakpointOnStart,
202
+ args: ["--name", name].concat(launchConfig["args"]).concat(args),
109
203
  };
110
204
  // Start FEA. Resolve when e2oLauncher has successfully launched Electron.
111
205
  e2oLauncher(config, () => {
@@ -134,11 +228,11 @@ exports.launchFEA = launchFEA;
134
228
  * @returns Resolves to a tuple that contains an instance of the Express server and corresponding Node.js http.server.
135
229
  */
136
230
  const startFEAServer = async ({ environment = "development", consoleOutput = true, args = [], }) => {
137
- var _a, _b, _c;
231
+ var _a;
138
232
  const parsedArgs = (0, minimist_1.default)(args !== null && args !== void 0 ? args : []);
139
233
  const root = path_1.default.join("./public");
140
- const startupConfig = (0, exports.getStartupConfigs)();
141
- const port = parseInt((_c = (_a = parsedArgs["port"]) !== null && _a !== void 0 ? _a : (_b = startupConfig === null || startupConfig === void 0 ? void 0 : startupConfig[environment]) === null || _b === void 0 ? void 0 : _b.port) !== null && _c !== void 0 ? _c : "3375");
234
+ const launchConfig = (0, exports.getLaunchConfig)({ environment });
235
+ const port = parseInt((_a = parsedArgs["port"]) !== null && _a !== void 0 ? _a : launchConfig.port);
142
236
  if (consoleOutput)
143
237
  console.log(`Serving files from directory ${root} on port ${port}`);
144
238
  const serverTuple = await FEAServer.start({ root, port });
@@ -225,17 +319,6 @@ const start = async ({ environment = "development", consoleOutput = true, args =
225
319
  });
226
320
  };
227
321
  exports.start = start;
228
- const resolveRelativePaths = (obj, properties, rootPath) => {
229
- properties.forEach((prop) => {
230
- if (obj[prop]) {
231
- obj[prop] = path_1.default.resolve(rootPath, obj[prop]);
232
- }
233
- else {
234
- console.warn(`Path for property '${prop}' was not resolved as it did not exist in the installer configuration.\nInstaller configuration: ${JSON.stringify(obj, null, 2)}`);
235
- }
236
- });
237
- return obj;
238
- };
239
322
  /**
240
323
  * Adds osxSign information to the installer config. This is used to optionally sign MacOS builds. This will only
241
324
  * run if an osxSign entry exists. It must at least contain an `identity` field.
@@ -290,67 +373,59 @@ const maybeAddOSXNotarizationConfigs = (installerConfig) => {
290
373
  appleIdPassword: (_e = (_d = process.env.osxNotarizationApplePassword) !== null && _d !== void 0 ? _d : process.env.appleIdPassword) !== null && _e !== void 0 ? _e : osxNotarize === null || osxNotarize === void 0 ? void 0 : osxNotarize.appleIdPassword,
291
374
  } });
292
375
  };
376
+ /**
377
+ * Scrubs a raw installer config by applying environment variables as necessary, adding default
378
+ * version from package.json and setting icon entries to absolute paths.
379
+ *
380
+ * Note that most of the environment variables are legacy and not documented.
381
+ */
382
+ const getScrubbedConfig = (originalConfig, environment) => {
383
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
384
+ // Get the version # from package.json (as a fallback)
385
+ const seedPackageJson = fs_extra_1.default.readJSONSync("./package.json", { throws: false });
386
+ // Legacy: manifest, updateUrl and chromiumFlags used to be specified in the launch config. Now they are in installer config.
387
+ const launchConfig = getLaunchConfigNoDefaults({ environment });
388
+ return Object.assign(Object.assign({}, originalConfig), { manifestUrl: (_b = (_a = process.env.manifesturl) !== null && _a !== void 0 ? _a : originalConfig.manifestUrl) !== null && _b !== void 0 ? _b : launchConfig === null || launchConfig === void 0 ? void 0 : launchConfig.manifestUrl, updateUrl: (_c = originalConfig.updateUrl) !== null && _c !== void 0 ? _c : launchConfig === null || launchConfig === void 0 ? void 0 : launchConfig.updateUrl, chromiumFlags: originalConfig.chromiumFlags, name: (_d = process.env.installername) !== null && _d !== void 0 ? _d : originalConfig.name, version: (_f = (_e = process.env.installerversion) !== null && _e !== void 0 ? _e : originalConfig.version) !== null && _f !== void 0 ? _f : seedPackageJson === null || seedPackageJson === void 0 ? void 0 : seedPackageJson.version, authors: (_g = process.env.installerauthors) !== null && _g !== void 0 ? _g : originalConfig.authors, description: (_h = process.env.installerdescription) !== null && _h !== void 0 ? _h : originalConfig.description, certificatePassword: (_k = (_j = process.env["INSTALLER_CERTIFICATE_PASSPHRASE"]) === null || _j === void 0 ? void 0 : _j.trim()) !== null && _k !== void 0 ? _k : originalConfig.certificatePassword, icon: originalConfig.icon ? path_1.default.resolve("./", originalConfig.icon) : null, macIcon: originalConfig.macIcon ? path_1.default.resolve("./", originalConfig.macIcon) : null, background: originalConfig.background ? path_1.default.resolve("./", originalConfig.background) : null });
389
+ };
293
390
  /**
294
391
  * Makes an installer from the seed project. See [Deploying your smart desktop](/docs/managing-and-administrating/deployingYourSmartDesktop).
295
392
  *
296
393
  * @param __namedParameters.environment - Specify which environment to use. Defaults to "development".
297
- * @param __namedParameters.configPath - Optional path to a config file to be used in lieu of installer.json.
298
- * @returns Resolves when the installer has been created
299
- */
300
- const makeInstaller = async ({ environment = "development", configPath, }) => {
301
- var _a, _b, _c, _d, _e, _f, _g, _h, _j;
302
- let seedPackageJson = null;
303
- // Most of the process.env references are legacy and probably not used.
304
- // If we're not in the correct directory then this require may fail. It's only used to get the version # so not a big deal
305
- // since that can be obtained from the installer config.
306
- try {
307
- seedPackageJson = require(path_1.default.resolve("./package.json"));
308
- }
309
- catch (e) { }
310
- let installerConfig = require(path_1.default.resolve(configPath !== null && configPath !== void 0 ? configPath : "./public/configs/other/installer.json"));
311
- //check if we have an installer config matching the environment name, if not assume we just have a single config for all environments
312
- if (installerConfig[environment]) {
313
- installerConfig = installerConfig[environment];
314
- }
315
- installerConfig.name = (_a = process.env.installername) !== null && _a !== void 0 ? _a : installerConfig.name;
316
- installerConfig.version = (_c = (_b = process.env.installerversion) !== null && _b !== void 0 ? _b : installerConfig.version) !== null && _c !== void 0 ? _c : seedPackageJson === null || seedPackageJson === void 0 ? void 0 : seedPackageJson.version;
317
- installerConfig.authors = (_d = process.env.installerauthors) !== null && _d !== void 0 ? _d : installerConfig.authors;
318
- installerConfig.description = (_e = process.env.installerdescription) !== null && _e !== void 0 ? _e : installerConfig.description;
319
- installerConfig.certificatePassword =
320
- (_f = installerConfig.certificatePassword) !== null && _f !== void 0 ? _f : (_g = process.env["INSTALLER_CERTIFICATE_PASSPHRASE"]) === null || _g === void 0 ? void 0 : _g.trim();
394
+ * @param __namedParameters.configPath - Optional path to a config file to be used for installer configuration (overrides default of project.json).
395
+ * @returns Resolves to null when the installer has been created, or to an error string if there is an error.
396
+ */
397
+ const makeInstaller = async ({ environment = "development", configPath, output = true }) => {
398
+ // Get either the installer config that was passed in, or from standard locations (such as project.json), or use a default
399
+ const rawConfig = configPath ? require(path_1.default.resolve(configPath)) : getInstallerConfig(environment);
400
+ if (!rawConfig) {
401
+ const error = `No installer config section found. Please add an "installer" section to your project.json file.`;
402
+ if (output)
403
+ console.log(error);
404
+ return error;
405
+ }
406
+ const installerConfig = getScrubbedConfig(maybeAddOSXNotarizationConfigs(maybeAddOSXSignConfigs(rawConfig)), environment);
321
407
  if (installerConfig.certificateFile && !installerConfig.certificatePassword) {
322
- // Throw error if a certificate file was provided and a password can't be found
323
- throw new Error(`A certificate file was provided but a password cannot be found. Please provide one in the config or as an environment variable: INSTALLER_CERTIFICATE_PASSPHRASE`);
324
- }
325
- // need absolute paths for certain installer configs
326
- installerConfig = resolveRelativePaths(installerConfig, ["icon", "macIcon", "background"], "./");
327
- installerConfig = maybeAddOSXSignConfigs(installerConfig);
328
- installerConfig = maybeAddOSXNotarizationConfigs(installerConfig);
329
- const startupConfigs = (0, exports.getStartupConfigs)();
330
- const cfg = (_h = startupConfigs === null || startupConfigs === void 0 ? void 0 : startupConfigs[environment]) !== null && _h !== void 0 ? _h : defaultStartupConfig;
331
- const manifestUrl = (_j = process.env.manifesturl) !== null && _j !== void 0 ? _j : cfg.manifest;
332
- console.log("The manifest location is: ", manifestUrl);
333
- const { updateUrl, chromiumFlags } = cfg;
334
- // Installer won't work without a proper manifest. Throw a helpful error.
335
- if (!manifestUrl) {
336
- throw new Error(`Installer misconfigured. No 'manifest' in configs/other/server-environment-startup.json under ${environment}. This is required to launch Finsemble.`);
337
- }
338
- // If an installer is pointing to localhost, it's likely an error. Let the dev know with a helpful error.
339
- if (manifestUrl.includes("localhost")) {
340
- console.log(`>>>> WARNING: Installer is pointing to a manifest hosted at ${manifestUrl}. Was this accidental?
341
- environment (e.g. NODE_ENV) == ${environment}`);
408
+ const error = `A certificate file was provided but a password cannot be found. Please provide one in the config or as an environment variable: INSTALLER_CERTIFICATE_PASSPHRASE`;
409
+ if (output)
410
+ console.log(error);
411
+ return error;
412
+ }
413
+ if (!installerConfig.manifestUrl) {
414
+ const error = `Installer misconfigured. No 'manifest' found in project.json's "installer" section. This field must be set to the hosted location of your production manifest file.`;
415
+ if (output)
416
+ console.log(error);
417
+ return error;
418
+ }
419
+ // If an installer is pointing to localhost, it's likely a misconfiguration.
420
+ if (output && installerConfig.manifestUrl.includes("localhost")) {
421
+ console.log(`WARNING: Installer is pointing to a manifest hosted at "${installerConfig.manifestUrl}". Installers should point to production hosted manifest locations.`);
342
422
  }
343
423
  // UpdateURL isn't required, but we let them know in case they're expecting it to work.
344
- if (!updateUrl) {
345
- console.log(`[Info] Did not find 'updateUrl' in configs/other/server-environment-startup.json under ${environment}. The application will still work, but it will not update itself with new versions of the finsemble-electron-adapter.`);
346
- }
347
- const FEA_PATH = path_1.default.resolve("./node_modules/@finsemble/finsemble-electron-adapter");
348
- packager.setFeaPath(FEA_PATH);
349
- await packager.setApplicationFolderName(installerConfig.name);
350
- await packager.setManifestURL(manifestUrl);
351
- await packager.setUpdateURL(updateUrl !== null && updateUrl !== void 0 ? updateUrl : null);
352
- await packager.setChromiumFlags(chromiumFlags || {});
353
- await packager.createFullInstaller(installerConfig);
424
+ if (output && !installerConfig.updateUrl) {
425
+ console.log(`Did not find 'updateUrl' in project.json's "installer" section. The application will not be configured for auto-update.`);
426
+ }
427
+ await (0, makeInstaller_1.makeInstaller)(installerConfig);
428
+ return null;
354
429
  };
355
430
  exports.makeInstaller = makeInstaller;
356
431
  /**