@scifeon/sdk 0.86.0 → 0.89.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.
@@ -238,18 +238,15 @@ class AppGenerator {
238
238
  }
239
239
  addElnStepSectionDecorators() {
240
240
  const builderRegex = /@scifeonElnStepSection\s*\(\s*(\{[^]*?\})\s*\)/i;
241
- const nameRegex = /name\s*:\s*('.*'|".*")/i;
242
241
  const idRegex = /id\s*:\s*('.*'|".*")/i;
243
242
  for (const file of this.tsFiles) {
244
243
  if (!this.fileIncludesDecorator(file.content, "@scifeonElnStepSection"))
245
244
  continue;
246
245
  const match = builderRegex.exec(file.content);
247
- const nameMatch = nameRegex.exec(match[1]);
248
246
  const idMatch = idRegex.exec(match[1]);
249
247
  const section = {
250
248
  id: idMatch[1].slice(1, -1),
251
249
  src: file.src,
252
- name: nameMatch[1].slice(1, -1),
253
250
  type: plugin_types_1.PLUGIN_TYPE.ELN_STEP_SECTION,
254
251
  };
255
252
  this.contributionsJson.plugins.push(section);
@@ -1,3 +1,4 @@
1
1
  export declare class BuildCommand {
2
- execute(): Promise<void>;
2
+ execute(options: any): Promise<void>;
3
+ private downloadTypes;
3
4
  }
@@ -16,12 +16,26 @@ const download_utils_1 = require("../../../download-utils");
16
16
  const config_1 = require("../../config");
17
17
  const webpack_runner_1 = require("../../webpack-runner");
18
18
  class BuildCommand {
19
- execute() {
19
+ execute(options) {
20
20
  return __awaiter(this, void 0, void 0, function* () {
21
21
  if (!fs.existsSync(config_1.config.wwwDir)) {
22
- yield download_utils_1.DownloadUtils.downloadZip("https://scifeon.azureedge.net/sdk/packages-types.zip", path.resolve("runtime", "scifeon", "generated"), "Downloading Scifeon Types");
22
+ let branch = "";
23
+ if (options === null || options === void 0 ? void 0 : options.branch) {
24
+ branch = `-${options.branch}`;
25
+ }
26
+ try {
27
+ yield this.downloadTypes(branch);
28
+ }
29
+ catch (_a) {
30
+ yield this.downloadTypes();
31
+ }
23
32
  }
24
- webpack_runner_1.webpackRunner("build");
33
+ (0, webpack_runner_1.webpackRunner)("build");
34
+ });
35
+ }
36
+ downloadTypes(branch) {
37
+ return __awaiter(this, void 0, void 0, function* () {
38
+ yield download_utils_1.DownloadUtils.downloadZip(`https://scifeon.azureedge.net/sdk/packages-types${branch}.zip`, path.resolve("runtime", "scifeon", "generated"), `Downloading Scifeon Types ${branch}`);
25
39
  });
26
40
  }
27
41
  }
@@ -106,7 +106,7 @@ class NewCommand {
106
106
  fs.writeFileSync(path.resolve(packageJson.name, "contributions.json"), JSON.stringify(contributionsJson, null, 2));
107
107
  logger_1.LOGGER.msg("Installing node_modules...");
108
108
  const npmCmd = process.platform === "win32" ? "npm.cmd" : "npm";
109
- const proc = child_process_1.spawn(npmCmd, ["install --silent --prefer-offline --no-audit"], { cwd: path.resolve(packageJson.name) });
109
+ const proc = (0, child_process_1.spawn)(npmCmd, ["install --silent --prefer-offline --no-audit"], { cwd: path.resolve(packageJson.name) });
110
110
  proc.stderr.on("data", (data) => console.log(data.toString()));
111
111
  proc.stdout.on("data", (data) => console.log(data.toString()));
112
112
  proc.once("exit", () => logger_1.LOGGER.msg("App created in folder [" + packageJson.name + "]. Run 'scifeon-cli debug' in this directory to start development of your app."));
@@ -4,7 +4,7 @@ exports.PackageCommand = void 0;
4
4
  const webpack_runner_1 = require("../../webpack-runner");
5
5
  class PackageCommand {
6
6
  execute() {
7
- webpack_runner_1.webpackRunner("package");
7
+ (0, webpack_runner_1.webpackRunner)("package");
8
8
  }
9
9
  }
10
10
  exports.PackageCommand = PackageCommand;
@@ -5,7 +5,7 @@ const unit_test_runner_1 = require("../../../unit-test-runner");
5
5
  const config_1 = require("../../config");
6
6
  class TestCommand {
7
7
  execute(options) {
8
- unit_test_runner_1.unitTestRunner(options, config_1.config);
8
+ (0, unit_test_runner_1.unitTestRunner)(options, config_1.config);
9
9
  }
10
10
  }
11
11
  exports.TestCommand = TestCommand;
@@ -22,7 +22,7 @@ class WatchCommand {
22
22
  if (!fs.existsSync("./runtime")) {
23
23
  yield new download_1.DownloadCommand().execute();
24
24
  }
25
- const webpackConfig = webpack_app_config_1.webpackAppConfig({ watch: true }, config_1.config);
25
+ const webpackConfig = (0, webpack_app_config_1.webpackAppConfig)({ watch: true }, config_1.config);
26
26
  webpackConfig.output.publicPath = "http://localhost:9090" + webpackConfig.output.publicPath;
27
27
  webpackConfig.entry.app.unshift(require.resolve("webpack-dev-server/client") + "?http://localhost:9090", require.resolve("webpack/hot/dev-server"));
28
28
  const compiler = webpack(webpackConfig);
package/dist/cli/index.js CHANGED
@@ -7,7 +7,7 @@ var __createBinding = (this && this.__createBinding) || (Object.create ? (functi
7
7
  o[k2] = m[k];
8
8
  }));
9
9
  var __exportStar = (this && this.__exportStar) || function(m, exports) {
10
- for (var p in m) if (p !== "default" && !exports.hasOwnProperty(p)) __createBinding(exports, m, p);
10
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
11
11
  };
12
12
  var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
13
13
  function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
@@ -59,9 +59,10 @@ class ScifeonCLI {
59
59
  setup() {
60
60
  this.program
61
61
  .command("build")
62
+ .option("--branch [branch]", "Platform branch to use for SDK types")
62
63
  .allowUnknownOption()
63
64
  .description("Build the App into the folder /build.\n")
64
- .action(() => __awaiter(this, void 0, void 0, function* () { return yield new build_1.BuildCommand().execute(); }));
65
+ .action((options) => __awaiter(this, void 0, void 0, function* () { return yield new build_1.BuildCommand().execute(options); }));
65
66
  this.program
66
67
  .command("clean")
67
68
  .description("Remove the /build-folder.\n")
@@ -8,7 +8,7 @@ const config_1 = require("./config");
8
8
  function webpackRunner(mode) {
9
9
  const env = {};
10
10
  env[mode] = true;
11
- const compiler = webpack(webpack_app_config_1.webpackAppConfig(env, config_1.config));
11
+ const compiler = webpack((0, webpack_app_config_1.webpackAppConfig)(env, config_1.config));
12
12
  compiler.run(function (err, stats) {
13
13
  logger_1.LOGGER.info("Webpack output: ");
14
14
  const config = logger_1.LOGGER.verbose ? "verbose" : {
@@ -1,3 +1,3 @@
1
1
  export declare class DownloadUtils {
2
- static downloadZip(url: string, targetPath: string, progressBarMsg: string): Promise<unknown>;
2
+ static downloadZip(url: string, targetPath: string, progressBarMsg: string): Promise<void>;
3
3
  }
@@ -31,5 +31,7 @@ export declare enum PLUGIN_TYPE {
31
31
  ELN_STEP_SECTION = "eln.step.section",
32
32
  ELN_EXPERIMENT_COMPLETE = "eln.experiment.complete",
33
33
  ELN_EXPERIMENT_LOCK = "eln.experiment.lock",
34
- PRE_PROCESS_SAVE_ENTITY = "pre_process_save_entity"
34
+ ELN_STEP_FORM_MODE = "eln.step.form.mode",
35
+ PRE_PROCESS_SAVE_ENTITY = "pre_process_save_entity",
36
+ ADMINISTRATION_SETTINGS_ELN = "administration.settings.eln"
35
37
  }
@@ -35,5 +35,7 @@ var PLUGIN_TYPE;
35
35
  PLUGIN_TYPE["ELN_STEP_SECTION"] = "eln.step.section";
36
36
  PLUGIN_TYPE["ELN_EXPERIMENT_COMPLETE"] = "eln.experiment.complete";
37
37
  PLUGIN_TYPE["ELN_EXPERIMENT_LOCK"] = "eln.experiment.lock";
38
+ PLUGIN_TYPE["ELN_STEP_FORM_MODE"] = "eln.step.form.mode";
38
39
  PLUGIN_TYPE["PRE_PROCESS_SAVE_ENTITY"] = "pre_process_save_entity";
40
+ PLUGIN_TYPE["ADMINISTRATION_SETTINGS_ELN"] = "administration.settings.eln";
39
41
  })(PLUGIN_TYPE = exports.PLUGIN_TYPE || (exports.PLUGIN_TYPE = {}));
@@ -27,7 +27,7 @@ function unitTestRunner(options, config, appType = "sdk") {
27
27
  }
28
28
  file_utils_1.FileUtils.createDirRecurSync(path.resolve(config.tempDir));
29
29
  fs.writeFileSync(path.resolve(config.tempDir, "unit-tests.js"), unitTestsJs.join("\n"));
30
- const webpackConfig = webpack_app_config_1.webpackAppConfig({ test: true }, config, appType);
30
+ const webpackConfig = (0, webpack_app_config_1.webpackAppConfig)({ test: true }, config, appType);
31
31
  webpackConfig.target = "node";
32
32
  const compiler = webpack(webpackConfig);
33
33
  compiler.run(function (err, stats) {
@@ -20,7 +20,7 @@ const requireURL = (url) => __awaiter(void 0, void 0, void 0, function* () {
20
20
  script = requireCache[url];
21
21
  }
22
22
  else {
23
- const response = yield node_fetch_1.default(url);
23
+ const response = yield (0, node_fetch_1.default)(url);
24
24
  script = yield response.text();
25
25
  requireCache[url] = script;
26
26
  }
@@ -15,26 +15,6 @@ const logger_1 = require("./logger");
15
15
  const webpack_utils_1 = require("./webpack-utils");
16
16
  const OptimizeCSSAssetsPlugin = require("optimize-css-assets-webpack-plugin");
17
17
  const TerserJSPlugin = require("terser-webpack-plugin");
18
- const ModuleDependencyWarning = require("webpack/lib/ModuleDependencyWarning");
19
- class IgnoreNotFoundExportPlugin {
20
- apply(compiler) {
21
- const messageRegExp = /export '.*'( \(reexported as '.*'\))? was not found in/;
22
- function doneHook(stats) {
23
- stats.compilation.warnings = stats.compilation.warnings.filter(function (warn) {
24
- if (warn instanceof ModuleDependencyWarning && messageRegExp.test(warn.message)) {
25
- return false;
26
- }
27
- return true;
28
- });
29
- }
30
- if (compiler.hooks) {
31
- compiler.hooks.done.tap("IgnoreNotFoundExportPlugin", doneHook);
32
- }
33
- else {
34
- compiler.plugin("done", doneHook);
35
- }
36
- }
37
- }
38
18
  function webpackAppConfig(env, config, appType = "sdk") {
39
19
  env = env || { debug: true };
40
20
  const DEBUG = env.debug;
@@ -62,12 +42,13 @@ function webpackAppConfig(env, config, appType = "sdk") {
62
42
  let output = {};
63
43
  if (!TEST) {
64
44
  const aureliaPlugins = [];
65
- plugins = plugins.concat([...aureliaPlugins,
45
+ plugins = plugins.concat([
46
+ ...aureliaPlugins,
66
47
  new MiniCssExtractPlugin({
67
48
  filename: "[name].[contenthash].css",
68
49
  chunkFilename: "[id].[contenthash].css",
69
50
  }),
70
- new IgnoreNotFoundExportPlugin(),
51
+ new webpack_utils_1.IgnoreNotFoundExportPlugin(),
71
52
  ]);
72
53
  if (PACKAGE) {
73
54
  plugins.push(webpack_utils_1.WebpackUtils.parseLogForAzureDevOps());
@@ -3,3 +3,6 @@ export declare class WebpackUtils {
3
3
  static getPublicPath(fallback: string, prefix: string, postfix?: string): string;
4
4
  static transformTsConfig(file: string): string;
5
5
  }
6
+ export declare class IgnoreNotFoundExportPlugin {
7
+ apply(compiler: any): void;
8
+ }
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.WebpackUtils = void 0;
3
+ exports.IgnoreNotFoundExportPlugin = exports.WebpackUtils = void 0;
4
4
  const FriendlyErrorsPlugin = require("friendly-errors-webpack-plugin");
5
5
  const fs = require("fs");
6
6
  const file_utils_1 = require("./file-utils");
@@ -59,3 +59,26 @@ function getFileDirectory(filePath) {
59
59
  return filePath.substring(0, filePath.lastIndexOf("/"));
60
60
  }
61
61
  }
62
+ class IgnoreNotFoundExportPlugin {
63
+ apply(compiler) {
64
+ const doneHook = (stats) => {
65
+ stats.compilation.warnings = stats.compilation.warnings.filter(warn => {
66
+ const ignoreWarn1 = /export '.*'( \(reexported as '.*'\))? was not found in/;
67
+ const ignoreWarn2 = /export 'default'( \(imported as '.*'\))? was not found in/;
68
+ const ignoreWarn3 = /export '.*'( \(imported as '.*'\))? was not found in/;
69
+ if (warn.constructor.name === "ModuleDependencyWarning"
70
+ && (ignoreWarn1.test(warn.message) || ignoreWarn2.test(warn.message) || ignoreWarn3.test(warn.message))) {
71
+ return false;
72
+ }
73
+ return true;
74
+ });
75
+ };
76
+ if (compiler.hooks) {
77
+ compiler.hooks.done.tap("IgnoreNotFoundExportPlugin", doneHook);
78
+ }
79
+ else {
80
+ compiler.plugin("done", doneHook);
81
+ }
82
+ }
83
+ }
84
+ exports.IgnoreNotFoundExportPlugin = IgnoreNotFoundExportPlugin;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@scifeon/sdk",
3
- "version": "0.86.0",
3
+ "version": "0.89.0",
4
4
  "description": "A tool for developing Apps for Scifeon.",
5
5
  "author": {
6
6
  "name": "Scifeon",
@@ -55,11 +55,11 @@
55
55
  "semver": "7.3.2",
56
56
  "style-loader": "1.2.1",
57
57
  "terser-webpack-plugin": "2.3.6",
58
- "ts-loader": "7.0.2",
58
+ "ts-loader": "8.3.0",
59
59
  "ts-node": "8.9.1",
60
60
  "tsconfig-paths-webpack-plugin": "3.2.0",
61
- "tslib": "1.11.1",
62
- "typescript": "3.9.5",
61
+ "tslib": "2.3.1",
62
+ "typescript": "4.4.2",
63
63
  "url-loader": "4.1.0",
64
64
  "webpack": "4.43.0",
65
65
  "webpack-cli": "3.3.11",