@finsemble/finsemble-core 8.2.0-beta.1 → 8.2.0
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.
- package/cli-api.js +16 -0
- package/dist/cli/cli-api/tools.cjs +119 -66
- package/dist/cli/cli-api/tools.cjs.map +1 -1
- package/dist/cli/cli-api/tools.d.cts +7 -6
- package/dist/cli/cli-api/tools.d.cts.map +1 -1
- package/dist/cli/cli.cjs +3 -3
- package/dist/cli/cli.cjs.map +1 -1
- package/dist/cli/tsconfig.cli.tsbuildinfo +1 -1
- package/dist/platform/configs/core/config.json +2 -2
- package/dist/platform/services/Interop/InteropServiceUI.js +1 -1
- package/dist/platform/services/config/configService.js +1 -1
- package/dist/platform/services/config/configService.js.map +1 -1
- package/dist/platform/services/router/routerService.js +1 -1
- package/dist/platform/services/window/windowService.js +1 -1
- package/package.json +3 -3
package/cli-api.js
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This is the entry point for Finsemble's CLI API. This file re-exports functions from the dist/cli/tools
|
|
3
|
+
* directory which is built in CommonJS format (most of @finsemble/finsemble-core is built in ESM which is
|
|
4
|
+
* problematic for Node.js).
|
|
5
|
+
*
|
|
6
|
+
* Usage:
|
|
7
|
+
* const { ruleCSS, launchFEA} = require("@finsemble/finsemble-core/cli-api");
|
|
8
|
+
*
|
|
9
|
+
* import { ruleCSS, launchFEA } from "@finsemble/finsemble-core/cli-api";
|
|
10
|
+
*/
|
|
11
|
+
const webpack = require("./dist/cli/cli-api/webpack.js");
|
|
12
|
+
const tools = require("./dist/cli/cli-api/tools.cjs");
|
|
13
|
+
module.exports = {
|
|
14
|
+
...webpack,
|
|
15
|
+
...tools,
|
|
16
|
+
};
|
|
@@ -65,7 +65,8 @@ const getLaunchConfigFromLegacy = (environment) => {
|
|
|
65
65
|
var _a, _b;
|
|
66
66
|
const rawConfig = fs_extra_1.default.readJSONSync("./public/configs/other/server-environment-startup.json", { throws: false });
|
|
67
67
|
const config = rawConfig === null || rawConfig === void 0 ? void 0 : rawConfig[environment];
|
|
68
|
-
return config
|
|
68
|
+
return config
|
|
69
|
+
? 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;
|
|
69
70
|
};
|
|
70
71
|
/**
|
|
71
72
|
* Returns the installer config from project.json, applying environmental overrides if they exist using json-merge-patch.
|
|
@@ -87,7 +88,7 @@ const getLaunchConfigFromProject = (environment) => {
|
|
|
87
88
|
* Returns a launch config for the requested environment. See getLaunchConfig(). The only difference is that this version
|
|
88
89
|
* returns null if no config is found.
|
|
89
90
|
*/
|
|
90
|
-
const getLaunchConfigNoDefaults = ({ environment = "development" }) => {
|
|
91
|
+
const getLaunchConfigNoDefaults = ({ environment = "development", }) => {
|
|
91
92
|
var _a;
|
|
92
93
|
const legacyConfigExists = fs_extra_1.default.existsSync("./public/configs/other/server-environment-startup.json");
|
|
93
94
|
return legacyConfigExists ? getLaunchConfigFromLegacy(environment) : (_a = getLaunchConfigFromProject(environment)) !== null && _a !== void 0 ? _a : null;
|
|
@@ -145,7 +146,37 @@ const getInstallerConfigFromProject = (environment) => {
|
|
|
145
146
|
*/
|
|
146
147
|
const getInstallerConfig = (environment) => {
|
|
147
148
|
const legacyInstallerJSONExists = fs_extra_1.default.existsSync("./public/configs/other/installer.json");
|
|
148
|
-
return legacyInstallerJSONExists
|
|
149
|
+
return legacyInstallerJSONExists
|
|
150
|
+
? getInstallerConfigFromLegacy(environment)
|
|
151
|
+
: getInstallerConfigFromProject(environment);
|
|
152
|
+
};
|
|
153
|
+
/**
|
|
154
|
+
* Given an args array checks whether a given argument entry exists and removes it
|
|
155
|
+
* from the array.
|
|
156
|
+
*
|
|
157
|
+
* e.g. checks for the existence of --manifest OR --manifest=
|
|
158
|
+
*
|
|
159
|
+
* @param args The arg array to check
|
|
160
|
+
*/
|
|
161
|
+
const maybeRemoveFromArgs = (args, field) => {
|
|
162
|
+
// Arguments can be passed in the format "--arg=value" OR "--arg value", therefore we
|
|
163
|
+
// need to check which format we received and remove the relevant arg portion.
|
|
164
|
+
let indexToRemove = null;
|
|
165
|
+
let equalDelimiter = false;
|
|
166
|
+
args.forEach((element, index) => {
|
|
167
|
+
if (element && element.startsWith(`--${field}=`)) {
|
|
168
|
+
// when argument was passed in as --fooArg=bar
|
|
169
|
+
indexToRemove = index;
|
|
170
|
+
equalDelimiter = true;
|
|
171
|
+
}
|
|
172
|
+
else if (element === `--${field}`) {
|
|
173
|
+
// when argument was passed in as --fooArg bar
|
|
174
|
+
indexToRemove = index;
|
|
175
|
+
}
|
|
176
|
+
});
|
|
177
|
+
if (indexToRemove !== null) {
|
|
178
|
+
args.splice(indexToRemove, equalDelimiter ? 1 : 2);
|
|
179
|
+
}
|
|
149
180
|
};
|
|
150
181
|
/**
|
|
151
182
|
* :::note
|
|
@@ -200,6 +231,10 @@ const launchFEA = async ({ environment = "development", args = [], } = {}) => {
|
|
|
200
231
|
handler(exitCode);
|
|
201
232
|
});
|
|
202
233
|
};
|
|
234
|
+
// If we pass a manifest as an argument this will be in the parsedArgs and extracted into the manifest
|
|
235
|
+
// variable. We need to remove the existing entry from the remaining args before we concat on the config
|
|
236
|
+
// object below.
|
|
237
|
+
maybeRemoveFromArgs(args, "manifest");
|
|
203
238
|
const config = {
|
|
204
239
|
manifest,
|
|
205
240
|
onElectronClose,
|
|
@@ -468,7 +503,7 @@ const getScrubbedConfig = (originalConfig, environment) => {
|
|
|
468
503
|
* @param __namedParameters.configPath - Optional path to a config file to be used for installer configuration (overrides default of project.json).
|
|
469
504
|
* @returns Resolves to null when the installer has been created, or to an error string if there is an error.
|
|
470
505
|
*/
|
|
471
|
-
const makeInstaller = async ({ environment = "development", configPath, output = true } = {}) => {
|
|
506
|
+
const makeInstaller = async ({ environment = "development", configPath, output = true, } = {}) => {
|
|
472
507
|
// Get either the installer config that was passed in, or from standard locations (such as project.json), or use a default
|
|
473
508
|
const rawConfig = configPath ? require(path_1.default.resolve(configPath)) : getInstallerConfig(environment);
|
|
474
509
|
if (!rawConfig) {
|
|
@@ -654,7 +689,7 @@ const overrideCoreConfig = (config, projectFolder) => {
|
|
|
654
689
|
const setWindowTitleBarConfig = (template, projectFolder) => {
|
|
655
690
|
const url = `$applicationRoot/${template}/`;
|
|
656
691
|
const json = {
|
|
657
|
-
windowTitleBarUrl: url
|
|
692
|
+
windowTitleBarUrl: url,
|
|
658
693
|
};
|
|
659
694
|
return overrideCoreConfig(json, projectFolder);
|
|
660
695
|
};
|
|
@@ -670,8 +705,8 @@ const setAuthenticationConfig = (componentConfig, template, projectFolder) => {
|
|
|
670
705
|
const json = Object.assign(Object.assign({}, componentConfig), { authentication: {
|
|
671
706
|
startup: {
|
|
672
707
|
adapter: "PASSWORD",
|
|
673
|
-
component: `Authentication
|
|
674
|
-
}
|
|
708
|
+
component: `Authentication`,
|
|
709
|
+
},
|
|
675
710
|
} });
|
|
676
711
|
return overrideCoreConfig(json, projectFolder);
|
|
677
712
|
};
|
|
@@ -689,13 +724,13 @@ const setStorageAdapterConfig = (template, projectFolder) => {
|
|
|
689
724
|
servicesConfig: {
|
|
690
725
|
storage: {
|
|
691
726
|
topicToDataStoreAdapters: {
|
|
692
|
-
"finsemble.workspace": "StorageAdapter"
|
|
727
|
+
"finsemble.workspace": "StorageAdapter",
|
|
693
728
|
},
|
|
694
729
|
dataStoreAdapters: {
|
|
695
|
-
StorageAdapter: url
|
|
696
|
-
}
|
|
697
|
-
}
|
|
698
|
-
}
|
|
730
|
+
StorageAdapter: url,
|
|
731
|
+
},
|
|
732
|
+
},
|
|
733
|
+
},
|
|
699
734
|
};
|
|
700
735
|
return overrideCoreConfig(json, projectFolder);
|
|
701
736
|
};
|
|
@@ -730,8 +765,8 @@ const maybeAddConfigForTemplate = (template, projectFolder) => {
|
|
|
730
765
|
// The component entry to merge into the existing config.json file.
|
|
731
766
|
const json = {
|
|
732
767
|
components: {
|
|
733
|
-
[template]: Object.assign(Object.assign({}, defaultConfig), { window: Object.assign(Object.assign({}, defaultConfig.window), { url }) })
|
|
734
|
-
}
|
|
768
|
+
[template]: Object.assign(Object.assign({}, defaultConfig), { window: Object.assign(Object.assign({}, defaultConfig.window), { url }) }),
|
|
769
|
+
},
|
|
735
770
|
};
|
|
736
771
|
if (template === "Authentication")
|
|
737
772
|
return setAuthenticationConfig(json, template, projectFolder);
|
|
@@ -759,7 +794,7 @@ const getComputedProjectFolder = (projectFolder, output) => {
|
|
|
759
794
|
* @param __namedParameters.output - Set to false to suppress console.log output
|
|
760
795
|
* @returns Resolves to an error string if an error occurs, otherwise to null
|
|
761
796
|
*/
|
|
762
|
-
const createApp = async ({ name, projectFolder, output = true }) => {
|
|
797
|
+
const createApp = async ({ name, projectFolder, output = true, }) => {
|
|
763
798
|
if (!name) {
|
|
764
799
|
const error = `createApp(): name must be provided as a parameter`;
|
|
765
800
|
if (output)
|
|
@@ -796,7 +831,7 @@ exports.createApp = createApp;
|
|
|
796
831
|
* @param __namedParameters.output - set to false to suppress console.log output.
|
|
797
832
|
* @returns - resolves to an error string if an error occurs, otherwise to null.
|
|
798
833
|
*/
|
|
799
|
-
const createPreload = async ({ name, projectFolder, output = true }) => {
|
|
834
|
+
const createPreload = async ({ name, projectFolder, output = true, }) => {
|
|
800
835
|
if (!name) {
|
|
801
836
|
const error = `createPreload(): name must be provided as a parameter`;
|
|
802
837
|
if (output)
|
|
@@ -844,7 +879,7 @@ const maybeConvertTemplateToPascalCase = (template) => {
|
|
|
844
879
|
* @param param.output - set to false to suppress console.log output.
|
|
845
880
|
* @returns - resolves to an error string if an error occurs, otherwise to null.
|
|
846
881
|
*/
|
|
847
|
-
const installTemplate = async ({ template, projectFolder, output }) => {
|
|
882
|
+
const installTemplate = async ({ template, projectFolder, output, }) => {
|
|
848
883
|
const pascalCaseTemplate = maybeConvertTemplateToPascalCase(template);
|
|
849
884
|
const error = copyTemplate(pascalCaseTemplate, projectFolder);
|
|
850
885
|
if (error) {
|
|
@@ -887,7 +922,7 @@ const installTemplate = async ({ template, projectFolder, output }) => {
|
|
|
887
922
|
* @param __namedParameters.output - Set to false to suppress console.log output
|
|
888
923
|
* @returns Resolves to an error string if an error occurs, otherwise to null
|
|
889
924
|
*/
|
|
890
|
-
const installTemplates = async ({ whichTemplates, projectFolder, output = true }) => new Promise(async (resolve) => {
|
|
925
|
+
const installTemplates = async ({ whichTemplates, projectFolder, output = true, }) => new Promise(async (resolve) => {
|
|
891
926
|
if (!whichTemplates.length) {
|
|
892
927
|
if (output) {
|
|
893
928
|
console.log("Installs templates for customizing Finsemble's UI components or Storage Adapter. Set arguments to the names of the templates you wish to install.");
|
|
@@ -909,7 +944,7 @@ const installTemplates = async ({ whichTemplates, projectFolder, output = true }
|
|
|
909
944
|
return;
|
|
910
945
|
}
|
|
911
946
|
const results = await Promise.allSettled(whichTemplates.map((template) => installTemplate({ template, projectFolder: computedProjectFolder, output })));
|
|
912
|
-
const errors = results.flatMap((result) => result.status === "rejected" ? [result.reason] : []);
|
|
947
|
+
const errors = results.flatMap((result) => (result.status === "rejected" ? [result.reason] : []));
|
|
913
948
|
resolve(errors.length ? errors.join("; ") : null);
|
|
914
949
|
});
|
|
915
950
|
exports.installTemplates = installTemplates;
|
|
@@ -1041,7 +1076,7 @@ const maybeSetAliases = (webpackConfig) => {
|
|
|
1041
1076
|
* @param __namedParameters.mode - Webpack mode is set to "development" by default. Optionally set this to "production" for production builds.
|
|
1042
1077
|
* @param __namedParameters.webpackConfig - Optionally provide a starting webpack config. Any field in this config will not be modified. CopyWebpackPlugins will not be generated for any entries in this object.
|
|
1043
1078
|
*/
|
|
1044
|
-
const getWebpackConfig = ({ args, entries, entriesFile, outputPath, autoGenerateHtml, copyWebpackPlugin, watch, mode, webpackConfig } = {}) => {
|
|
1079
|
+
const getWebpackConfig = ({ args, entries, entriesFile, outputPath, autoGenerateHtml, copyWebpackPlugin, watch, mode, webpackConfig, } = {}) => {
|
|
1045
1080
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r;
|
|
1046
1081
|
const finsembleCoreNodeModulesLocation = path_1.default.join(__dirname, "../../../node_modules");
|
|
1047
1082
|
const defaultWebpackEntriesLocation = path_1.default.join(process.cwd(), "webpack", "entries.json");
|
|
@@ -1059,7 +1094,7 @@ const getWebpackConfig = ({ args, entries, entriesFile, outputPath, autoGenerate
|
|
|
1059
1094
|
*/
|
|
1060
1095
|
const defaultResolveLoader = {
|
|
1061
1096
|
modules: ["node_modules", finsembleCoreNodeModulesLocation],
|
|
1062
|
-
extensions: [".tsx", ".ts", ".js", ".jsx"]
|
|
1097
|
+
extensions: [".tsx", ".ts", ".js", ".jsx"],
|
|
1063
1098
|
};
|
|
1064
1099
|
const parsedArgs = (0, minimist_1.default)(args !== null && args !== void 0 ? args : []);
|
|
1065
1100
|
const computedWatch = (_b = (_a = watch !== null && watch !== void 0 ? watch : stringToBoolean(parsedArgs["watch"])) !== null && _a !== void 0 ? _a : webpackConfig === null || webpackConfig === void 0 ? void 0 : webpackConfig.watch) !== null && _b !== void 0 ? _b : true;
|
|
@@ -1098,7 +1133,7 @@ const getWebpackConfig = ({ args, entries, entriesFile, outputPath, autoGenerate
|
|
|
1098
1133
|
* This can cause annoying warning outputs so we set it to only print errors.
|
|
1099
1134
|
*/
|
|
1100
1135
|
computedConfig.infrastructureLogging = (_r = computedConfig.infrastructureLogging) !== null && _r !== void 0 ? _r : {
|
|
1101
|
-
level: "error"
|
|
1136
|
+
level: "error",
|
|
1102
1137
|
};
|
|
1103
1138
|
maybeSetAliases(computedConfig);
|
|
1104
1139
|
return computedConfig;
|
|
@@ -1109,7 +1144,7 @@ exports.getWebpackConfig = getWebpackConfig;
|
|
|
1109
1144
|
*/
|
|
1110
1145
|
const showWebpackConfig = ({ args } = {}) => {
|
|
1111
1146
|
const webpackConfig = (0, exports.getWebpackConfig)({ args });
|
|
1112
|
-
console.log(
|
|
1147
|
+
console.log('//Note, this webpack config does not display plugins because they are JavaScript object. `import { getWebpackConfig } from "@finsemble/finsemble-core/cli-api"` to get a full Webpack config.');
|
|
1113
1148
|
console.log(JSON.stringify(webpackConfig, null, "\t"));
|
|
1114
1149
|
};
|
|
1115
1150
|
exports.showWebpackConfig = showWebpackConfig;
|
|
@@ -1124,7 +1159,7 @@ exports.showWebpackConfig = showWebpackConfig;
|
|
|
1124
1159
|
* @returns - Resolves to an error if one occurs, otherwise resolves to null. If run in watch mode then the process will continue in the
|
|
1125
1160
|
* background. If run with the --start option, the webpack watch process terminates when Finsemble is closed.
|
|
1126
1161
|
*/
|
|
1127
|
-
const build = ({ args, webpackConfig, start: startFinsemble, prepare } = {}) => new Promise(async (resolve) => {
|
|
1162
|
+
const build = ({ args, environment, webpackConfig, start: startFinsemble, prepare, } = {}) => new Promise(async (resolve) => {
|
|
1128
1163
|
var _a, _b;
|
|
1129
1164
|
const parsedArgs = (0, minimist_1.default)(args !== null && args !== void 0 ? args : []);
|
|
1130
1165
|
const prepareCLA = (_a = prepare !== null && prepare !== void 0 ? prepare : stringToBoolean(parsedArgs["prepare"])) !== null && _a !== void 0 ? _a : true;
|
|
@@ -1143,7 +1178,7 @@ const build = ({ args, webpackConfig, start: startFinsemble, prepare } = {}) =>
|
|
|
1143
1178
|
(0, exports.preparePlatform)();
|
|
1144
1179
|
}
|
|
1145
1180
|
if (startCLA) {
|
|
1146
|
-
const tuple = await (0, exports.start)({ args });
|
|
1181
|
+
const tuple = await (0, exports.start)({ args, environment });
|
|
1147
1182
|
tuple.onClose((exitCode) => {
|
|
1148
1183
|
console.log(`Finsemble closed with exit code ${exitCode}. Stopping webpack...`);
|
|
1149
1184
|
compiler === null || compiler === void 0 ? void 0 : compiler.watching.close(() => {
|
|
@@ -1166,9 +1201,9 @@ exports.build = build;
|
|
|
1166
1201
|
const getKeyPress = async () => {
|
|
1167
1202
|
readline_1.default.emitKeypressEvents(process.stdin);
|
|
1168
1203
|
process.stdin.setRawMode(true);
|
|
1169
|
-
return new Promise((resolve) => process.stdin.once(
|
|
1204
|
+
return new Promise((resolve) => process.stdin.once("keypress", (character, key) => {
|
|
1170
1205
|
if (key.sequence === "\x03" && key.ctrl) {
|
|
1171
|
-
console.log(
|
|
1206
|
+
console.log("^C");
|
|
1172
1207
|
process.exit(1);
|
|
1173
1208
|
}
|
|
1174
1209
|
process.stdin.setRawMode(false);
|
|
@@ -1198,7 +1233,7 @@ const scrubImportConfig = (importConfig) => {
|
|
|
1198
1233
|
"$configRoot/application/workspaces.json",
|
|
1199
1234
|
"$configRoot/application/services.json",
|
|
1200
1235
|
"$configRoot/application/securityPolicies.json",
|
|
1201
|
-
"$configRoot/application/dashbarConfig.json"
|
|
1236
|
+
"$configRoot/application/dashbarConfig.json",
|
|
1202
1237
|
];
|
|
1203
1238
|
if (!importConfig)
|
|
1204
1239
|
return [];
|
|
@@ -1220,19 +1255,28 @@ const migrateAppAssets = async () => {
|
|
|
1220
1255
|
return asset;
|
|
1221
1256
|
});
|
|
1222
1257
|
fs_extra_1.default.writeJSONSync(manifestPath, manifest, {
|
|
1223
|
-
spaces: "\t"
|
|
1258
|
+
spaces: "\t",
|
|
1224
1259
|
});
|
|
1225
1260
|
};
|
|
1226
1261
|
const consolidateConfig = async () => {
|
|
1227
|
-
const files = [
|
|
1262
|
+
const files = [
|
|
1263
|
+
"components.json",
|
|
1264
|
+
"dashbarConfig.json",
|
|
1265
|
+
"securityPolicies.json",
|
|
1266
|
+
"services.json",
|
|
1267
|
+
"UIComponents.json",
|
|
1268
|
+
"workspaces.json",
|
|
1269
|
+
];
|
|
1228
1270
|
const paths = files.map((file) => path_1.default.resolve("public/configs/application", file));
|
|
1229
1271
|
const jsons = paths.map((filePath) => fs_extra_1.default.readJSONSync(filePath, {
|
|
1230
|
-
throws: false
|
|
1272
|
+
throws: false,
|
|
1231
1273
|
}));
|
|
1232
|
-
const scrubbed = jsons.map((json) => json
|
|
1233
|
-
|
|
1234
|
-
|
|
1235
|
-
|
|
1274
|
+
const scrubbed = jsons.map((json) => json
|
|
1275
|
+
? jsonMergePatch.apply(json, {
|
|
1276
|
+
comment: null,
|
|
1277
|
+
$schema: null,
|
|
1278
|
+
})
|
|
1279
|
+
: {});
|
|
1236
1280
|
const configPath = path_1.default.resolve("public/configs/application/config.json");
|
|
1237
1281
|
let config = fs_extra_1.default.readJSONSync(configPath);
|
|
1238
1282
|
scrubbed.forEach((json) => {
|
|
@@ -1242,12 +1286,12 @@ const consolidateConfig = async () => {
|
|
|
1242
1286
|
servicesConfig: {
|
|
1243
1287
|
launcher: {
|
|
1244
1288
|
unknownComponent: "NonConfiguredComponent",
|
|
1245
|
-
}
|
|
1289
|
+
},
|
|
1246
1290
|
},
|
|
1247
1291
|
importConfig: scrubImportConfig(config.importConfig),
|
|
1248
1292
|
});
|
|
1249
1293
|
fs_extra_1.default.writeJSONSync(configPath, config, {
|
|
1250
|
-
spaces: "\t"
|
|
1294
|
+
spaces: "\t",
|
|
1251
1295
|
});
|
|
1252
1296
|
console.log("Migrated config.json");
|
|
1253
1297
|
paths.forEach((filePath) => {
|
|
@@ -1257,7 +1301,7 @@ const consolidateConfig = async () => {
|
|
|
1257
1301
|
}
|
|
1258
1302
|
});
|
|
1259
1303
|
const smartDesktopJSON = path_1.default.resolve("public/configs/application/smartDesktop.json");
|
|
1260
|
-
if (fs_extra_1.default.existsSync(
|
|
1304
|
+
if (fs_extra_1.default.existsSync(smartDesktopJSON))
|
|
1261
1305
|
fs_extra_1.default.removeSync(smartDesktopJSON);
|
|
1262
1306
|
console.log(`Deleted file ${smartDesktopJSON}`);
|
|
1263
1307
|
};
|
|
@@ -1270,16 +1314,19 @@ const migrateStorageAdapters = async () => {
|
|
|
1270
1314
|
storage: {
|
|
1271
1315
|
dataStoreAdapters: {
|
|
1272
1316
|
LocalStorageAdapter: "$moduleRoot/adapters/localStorageAdapter.js",
|
|
1273
|
-
IndexedDBAdapter: "$moduleRoot/adapters/indexedDBAdapter.js"
|
|
1274
|
-
}
|
|
1275
|
-
}
|
|
1276
|
-
}
|
|
1317
|
+
IndexedDBAdapter: "$moduleRoot/adapters/indexedDBAdapter.js",
|
|
1318
|
+
},
|
|
1319
|
+
},
|
|
1320
|
+
},
|
|
1277
1321
|
});
|
|
1278
1322
|
fs_extra_1.default.writeJSONSync(configPath, config, {
|
|
1279
|
-
spaces: "\t"
|
|
1323
|
+
spaces: "\t",
|
|
1280
1324
|
});
|
|
1281
1325
|
console.log("Changed serviceConfig.storage.dataStoreAdapters entries in config.json");
|
|
1282
|
-
const filePaths = [
|
|
1326
|
+
const filePaths = [
|
|
1327
|
+
path_1.default.resolve("src/adapters/indexedDBAdapter.ts"),
|
|
1328
|
+
path_1.default.resolve("src/adapters/localStorageAdapter.ts"),
|
|
1329
|
+
];
|
|
1283
1330
|
filePaths.forEach((filePath) => {
|
|
1284
1331
|
if (fs_extra_1.default.existsSync(filePath)) {
|
|
1285
1332
|
fs_extra_1.default.removeSync(filePath);
|
|
@@ -1320,7 +1367,7 @@ const cleanWebpackFolder = async () => {
|
|
|
1320
1367
|
"./src/components/notificationsCenter/NotificationsCenter.tsx",
|
|
1321
1368
|
"./src/components/notificationsToasts/NotificationsToasts.tsx",
|
|
1322
1369
|
"./src/components/windowTitleBar/WindowTitleBar.tsx",
|
|
1323
|
-
"./src/components/FDC3Resolver/FDC3Resolver.tsx"
|
|
1370
|
+
"./src/components/FDC3Resolver/FDC3Resolver.tsx",
|
|
1324
1371
|
];
|
|
1325
1372
|
const componentsEntriesPath = path_1.default.resolve("webpack/webpack.components.entries.json");
|
|
1326
1373
|
const adapterEntriesPath = path_1.default.resolve("webpack/webpack.adapters.entries.json");
|
|
@@ -1336,7 +1383,10 @@ const cleanWebpackFolder = async () => {
|
|
|
1336
1383
|
}
|
|
1337
1384
|
});
|
|
1338
1385
|
const serviceEntries = await getServiceEntries();
|
|
1339
|
-
const allEntries = Object.values(json)
|
|
1386
|
+
const allEntries = Object.values(json)
|
|
1387
|
+
.map((value) => value.entry)
|
|
1388
|
+
.concat(serviceEntries)
|
|
1389
|
+
.concat(defaultEntries);
|
|
1340
1390
|
fs_extra_1.default.emptyDirSync("webpack");
|
|
1341
1391
|
fs_extra_1.default.writeJSONSync(path_1.default.resolve("webpack/entries.json"), allEntries, { spaces: "\t" });
|
|
1342
1392
|
console.log("Migrated webpack folder");
|
|
@@ -1354,12 +1404,12 @@ const migrateInstaller = async () => {
|
|
|
1354
1404
|
companyName: "Cosaic",
|
|
1355
1405
|
background: "./public/assets/img/installer-image-mac.png",
|
|
1356
1406
|
loadingGif: "./public/assets/img/installer-image-windows.gif",
|
|
1357
|
-
macIcon: "./public/assets/img/installer_icon.icns"
|
|
1407
|
+
macIcon: "./public/assets/img/installer_icon.icns",
|
|
1358
1408
|
};
|
|
1359
1409
|
const envJSON = (_b = fs_extra_1.default.readJSONSync(path_1.default.resolve("public/configs/other/server-environment-startup.json"), { throws: false })) !== null && _b !== void 0 ? _b : {};
|
|
1360
1410
|
let config = {
|
|
1361
1411
|
$schema: "./node_modules/@finsemble/finsemble-core/configs/schemas/fileBasedSchemas/project.schema.json",
|
|
1362
|
-
environments: {}
|
|
1412
|
+
environments: {},
|
|
1363
1413
|
};
|
|
1364
1414
|
const removeComments = (obj) => {
|
|
1365
1415
|
Object.entries(obj).forEach(([keyInner]) => {
|
|
@@ -1373,10 +1423,11 @@ const migrateInstaller = async () => {
|
|
|
1373
1423
|
removeComments(value);
|
|
1374
1424
|
config.environments[key] = {
|
|
1375
1425
|
launch: value,
|
|
1376
|
-
installer: {}
|
|
1426
|
+
installer: {},
|
|
1377
1427
|
};
|
|
1378
1428
|
config.environments[key].launch.port = (_a = config.environments[key].launch.port) !== null && _a !== void 0 ? _a : value.serverPort;
|
|
1379
|
-
config.environments[key].installer.manifestUrl =
|
|
1429
|
+
config.environments[key].installer.manifestUrl =
|
|
1430
|
+
(_b = config.environments[key].installer.manifestUrl) !== null && _b !== void 0 ? _b : value.serverConfig;
|
|
1380
1431
|
delete config.environments[key].launch.serverPort;
|
|
1381
1432
|
delete config.environments[key].launch.serverConfig;
|
|
1382
1433
|
});
|
|
@@ -1391,7 +1442,7 @@ const migrateInstaller = async () => {
|
|
|
1391
1442
|
config.installer = installerJSON;
|
|
1392
1443
|
}
|
|
1393
1444
|
fs_extra_1.default.writeJsonSync(path_1.default.resolve("project.json"), config, {
|
|
1394
|
-
spaces: "\t"
|
|
1445
|
+
spaces: "\t",
|
|
1395
1446
|
});
|
|
1396
1447
|
fs_extra_1.default.removeSync("public/configs/other");
|
|
1397
1448
|
console.log("Migrated installer and launch config.");
|
|
@@ -1426,20 +1477,20 @@ const migratePackageJSON = async () => {
|
|
|
1426
1477
|
prod: "finsemble build --mode=production --watch=false --prepare=true",
|
|
1427
1478
|
server: "finsemble server",
|
|
1428
1479
|
start: "finsemble start",
|
|
1429
|
-
template: "finsemble template"
|
|
1480
|
+
template: "finsemble template",
|
|
1430
1481
|
}, dependencies: {
|
|
1431
|
-
"@finsemble/finsemble-core": json.dependencies["@finsemble/finsemble-core"]
|
|
1482
|
+
"@finsemble/finsemble-core": json.dependencies["@finsemble/finsemble-core"],
|
|
1432
1483
|
} });
|
|
1433
1484
|
// react 17 resolution https://stackoverflow.com/questions/71791347/npm-package-cannot-be-used-as-a-jsx-component-type-errors
|
|
1434
1485
|
const cleanedJSON = jsonMergePatch.apply(revisedJSON, {
|
|
1435
1486
|
devDependencies: null,
|
|
1436
1487
|
optionalDependencies: null,
|
|
1437
1488
|
resolutions: {
|
|
1438
|
-
"@types/react": "17.0.2"
|
|
1439
|
-
}
|
|
1489
|
+
"@types/react": "17.0.2",
|
|
1490
|
+
},
|
|
1440
1491
|
});
|
|
1441
1492
|
fs_extra_1.default.writeJSONSync(packageJSONPath, cleanedJSON, {
|
|
1442
|
-
spaces: "\t"
|
|
1493
|
+
spaces: "\t",
|
|
1443
1494
|
});
|
|
1444
1495
|
console.log("Migrated package.json");
|
|
1445
1496
|
};
|
|
@@ -1499,7 +1550,9 @@ const migrateWindowTitleBar = () => {
|
|
|
1499
1550
|
// Get rid of old setUpDOMContainer reference
|
|
1500
1551
|
const replacementContents = fileContents.toString().replace("setUpDOMContainer();", "");
|
|
1501
1552
|
// Remove the setUpDOMContainer function
|
|
1502
|
-
const replacementContents1 = replacementContents
|
|
1553
|
+
const replacementContents1 = replacementContents
|
|
1554
|
+
.toString()
|
|
1555
|
+
.replace(new RegExp(`const setUpDOMContainer(.+?)};`, "s"), "");
|
|
1503
1556
|
// Use src code from above to replace the old ReactDOM entry
|
|
1504
1557
|
const replacementContents2 = replacementContents1.replace(new RegExp(`ReactDOM\.render(.+?)\\);`, "s"), src);
|
|
1505
1558
|
const replacementContents3 = `import {getOrCreateWindowTitleBarContainer} from "@finsemble/finsemble-core";\n${replacementContents2}`;
|
|
@@ -1511,14 +1564,14 @@ const migrateSrcCode = async () => {
|
|
|
1511
1564
|
const htmlFiles = await (0, fast_glob_1.default)(["src/**/*.html"]);
|
|
1512
1565
|
const reactFiles = await (0, fast_glob_1.default)(["src/**/*.(tsx|jsx)"]);
|
|
1513
1566
|
htmlFiles.forEach((fileName) => {
|
|
1514
|
-
const vendorBundle = new RegExp("
|
|
1567
|
+
const vendorBundle = new RegExp("<script.*vendor.bundle.js.*script>");
|
|
1515
1568
|
let fileContents = fs_extra_1.default.readFileSync(fileName);
|
|
1516
1569
|
const newFileContents = fileContents.toString().replace(vendorBundle, "");
|
|
1517
1570
|
fs_extra_1.default.writeFileSync(fileName, newFileContents);
|
|
1518
1571
|
});
|
|
1519
1572
|
console.log("Removed <script>...vendor.bundle.js</script> from all html files");
|
|
1520
1573
|
reactFiles.forEach((fileName) => {
|
|
1521
|
-
const themeCSS = new RegExp("import.+theme
|
|
1574
|
+
const themeCSS = new RegExp("import.+theme.css.+");
|
|
1522
1575
|
const finsembleCSS = new RegExp(`import "@finsemble/finsemble-ui/.*/finsemble.css".+`, "g");
|
|
1523
1576
|
const finsembleUI = new RegExp(`"@finsemble/finsemble-ui/.*"`, "g");
|
|
1524
1577
|
let fileContents = fs_extra_1.default.readFileSync(fileName);
|
|
@@ -1577,13 +1630,13 @@ CLEAN WEBPACK FOLDER
|
|
|
1577
1630
|
`))
|
|
1578
1631
|
await cleanWebpackFolder();
|
|
1579
1632
|
/* Disabled in favor of asking customers to manually migrate their built in adapters.
|
|
1580
|
-
|
|
1581
|
-
|
|
1582
|
-
|
|
1583
|
-
|
|
1584
|
-
|
|
1585
|
-
|
|
1586
|
-
|
|
1633
|
+
if(await executeStep(`
|
|
1634
|
+
MIGRATE BUILT-IN STORAGE ADAPTERS
|
|
1635
|
+
Finsemble's built-in storage adapters (indexedDBAdapter.ts and localStorageAdapter.ts) will be removed from your project.
|
|
1636
|
+
These are now automatically available in finsemble-core. The "dataStoreAdapters" config entry will be changed to point to
|
|
1637
|
+
their new locations in $moduleRoot.
|
|
1638
|
+
`)) await migrateStorageAdapters()
|
|
1639
|
+
*/
|
|
1587
1640
|
if (await executeStep(`
|
|
1588
1641
|
MIGRATE INSTALLER AND ENV CONFIG
|
|
1589
1642
|
/public/configs/other has been deprecated. Your entries from installer.json and server-environment-startup.json
|