@oslo-flanders/core 1.0.14 → 1.0.15

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.
@@ -13,6 +13,7 @@ export type YargsParams = {
13
13
  $0: string;
14
14
  };
15
15
  export declare abstract class AppRunner<T extends IService, K extends IConfiguration> {
16
+ protected createYargsInstance(argv: string[]): any;
16
17
  runCliSync(process: NodeJS.Process): void;
17
18
  abstract runCli(argv: CliArgv): Promise<void>;
18
19
  startApp(params: YargsParams, container: Container): Promise<void>;
@@ -1,10 +1,21 @@
1
1
  "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
2
5
  Object.defineProperty(exports, "__esModule", { value: true });
3
6
  exports.AppRunner = void 0;
4
7
  const process_1 = require("process");
5
8
  const LogUtil_1 = require("../logging/LogUtil");
6
9
  const ServiceIdentifier_1 = require("../ServiceIdentifier");
10
+ const yargs_1 = __importDefault(require("yargs"));
7
11
  class AppRunner {
12
+ createYargsInstance(argv) {
13
+ return (0, yargs_1.default)(argv)
14
+ .parserConfiguration({
15
+ 'duplicate-arguments-array': false,
16
+ })
17
+ .usage('node ./bin/runner.js [args]');
18
+ }
8
19
  runCliSync(process) {
9
20
  this.runCli(process.argv).catch((error) => {
10
21
  process_1.stderr.write(error.message);
@@ -16,11 +27,15 @@ class AppRunner {
16
27
  const configuration = container.get(ServiceIdentifier_1.ServiceIdentifier.Configuration);
17
28
  await configuration.createFromCli(params);
18
29
  (0, LogUtil_1.setLoggerFactory)(params);
19
- container.bind(ServiceIdentifier_1.ServiceIdentifier.Logger).toDynamicValue(() => (0, LogUtil_1.createLogger)()).inSingletonScope();
30
+ container
31
+ .bind(ServiceIdentifier_1.ServiceIdentifier.Logger)
32
+ .toDynamicValue(() => (0, LogUtil_1.createLogger)())
33
+ .inSingletonScope();
20
34
  const service = container.get(ServiceIdentifier_1.ServiceIdentifier.Service);
21
- service.init()
35
+ service
36
+ .init()
22
37
  .then(() => service.run())
23
- .catch(error => console.error(error));
38
+ .catch((error) => console.error(error));
24
39
  }
25
40
  }
26
41
  exports.AppRunner = AppRunner;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@oslo-flanders/core",
3
- "version": "1.0.14",
3
+ "version": "1.0.15",
4
4
  "description": "Core interfaces and utilities",
5
5
  "author": "Digitaal Vlaanderen <https://data.vlaanderen.be/id/organisatie/OVO002949>",
6
6
  "homepage": "https://github.com/informatievlaanderen/OSLO-UML-Transformer/tree/main/packages/oslo-core#readme",