@cyklang/cli 0.11.1 → 0.11.3

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.
@@ -35,6 +35,7 @@ const path_1 = __importDefault(require("path"));
35
35
  const commander_1 = require("commander");
36
36
  const Cmd_1 = require("./Cmd");
37
37
  const DBClient_1 = require("./DBClient");
38
+ const RunCommand_1 = require("./RunCommand");
38
39
  const logger = loglevel_1.default.getLogger("ModuleCommand.ts");
39
40
  logger.setLevel("debug");
40
41
  class ModuleCommand extends commander_1.Command {
@@ -135,7 +136,26 @@ class ModuleU extends Cmd_1.Cmd {
135
136
  else {
136
137
  for (let ind = 0; ind < files.length; ind++) {
137
138
  const file = files[ind];
138
- await uploadModule(file, this.dbManager);
139
+ try {
140
+ await uploadModule(file, this.dbManager);
141
+ }
142
+ catch (err) {
143
+ logger.error('Error uploading module ' + file, err);
144
+ throw err;
145
+ }
146
+ }
147
+ // run *_init.xml files
148
+ for (let ind = 0; ind < files.length; ind++) {
149
+ const file = files[ind];
150
+ if (file.endsWith('_init.xml')) {
151
+ try {
152
+ await (0, RunCommand_1.runFile)(file);
153
+ logger.info('Run module: ', file);
154
+ }
155
+ catch (err) {
156
+ logger.error('Error running module ' + file, err);
157
+ }
158
+ }
139
159
  }
140
160
  }
141
161
  }
@@ -3,3 +3,9 @@ export declare class RunCommand extends Cmd {
3
3
  constructor(name: string);
4
4
  runFiles(files: string[], options: any): Promise<void>;
5
5
  }
6
+ /**
7
+ *
8
+ * @param filename
9
+ * @returns
10
+ */
11
+ export declare function runFile(filename: string): Promise<void>;
@@ -26,7 +26,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
26
26
  return (mod && mod.__esModule) ? mod : { "default": mod };
27
27
  };
28
28
  Object.defineProperty(exports, "__esModule", { value: true });
29
- exports.RunCommand = void 0;
29
+ exports.runFile = exports.RunCommand = void 0;
30
30
  const core_1 = require("@cyklang/core");
31
31
  const fs = __importStar(require("fs"));
32
32
  const console_1 = require("./console");
@@ -60,6 +60,11 @@ class RunCommand extends Cmd_1.Cmd {
60
60
  }
61
61
  }
62
62
  exports.RunCommand = RunCommand;
63
+ /**
64
+ *
65
+ * @param filename
66
+ * @returns
67
+ */
63
68
  async function runFile(filename) {
64
69
  let result;
65
70
  if (filename.indexOf(".") !== -1) {
@@ -107,3 +112,4 @@ async function runFile(filename) {
107
112
  console.log(err);
108
113
  }
109
114
  }
115
+ exports.runFile = runFile;
package/build/index.js CHANGED
@@ -182,7 +182,7 @@ class StopCommand extends commander_1.Command {
182
182
  */
183
183
  const program = new commander_1.Command();
184
184
  program.name('cyk').description('cyklang CLI')
185
- .version('0.9.1');
185
+ .version('0.11.3');
186
186
  program.addCommand(new StartCommand('start'));
187
187
  program.addCommand(new StopCommand('stop'));
188
188
  program.addCommand(new InstallCommand_1.InstallCommand('install'));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cyklang/cli",
3
- "version": "0.11.1",
3
+ "version": "0.11.3",
4
4
  "description": "cyklang CLI",
5
5
  "main": "build/index.js",
6
6
  "scripts": {
@@ -17,7 +17,7 @@
17
17
  "author": "",
18
18
  "license": "ISC",
19
19
  "dependencies": {
20
- "@cyklang/core": "^0.8.0",
20
+ "@cyklang/core": "^0.8.3",
21
21
  "commander": "^9.4.0",
22
22
  "dotenv": "^16.0.1",
23
23
  "form-data": "^4.0.0",
@@ -6,6 +6,7 @@ import path from "path"
6
6
  import { Command } from 'commander'
7
7
  import { Cmd } from "./Cmd"
8
8
  import { DBClient } from "./DBClient"
9
+ import { runFile } from "./RunCommand"
9
10
  const logger = loglevel.getLogger("ModuleCommand.ts")
10
11
  logger.setLevel("debug")
11
12
 
@@ -115,7 +116,26 @@ class ModuleU extends Cmd {
115
116
  else {
116
117
  for (let ind = 0; ind < files.length; ind++) {
117
118
  const file = files[ind]
118
- await uploadModule(file, this.dbManager)
119
+ try {
120
+ await uploadModule(file, this.dbManager)
121
+ }
122
+ catch (err) {
123
+ logger.error('Error uploading module ' + file, err)
124
+ throw err
125
+ }
126
+ }
127
+ // run *_init.xml files
128
+ for (let ind = 0; ind < files.length; ind++) {
129
+ const file = files[ind]
130
+ if (file.endsWith('_init.xml')) {
131
+ try {
132
+ await runFile(file)
133
+ logger.info('Run module: ', file)
134
+ }
135
+ catch (err) {
136
+ logger.error('Error running module ' + file, err)
137
+ }
138
+ }
119
139
  }
120
140
  }
121
141
  }
package/src/RunCommand.ts CHANGED
@@ -32,8 +32,12 @@ export class RunCommand extends Cmd {
32
32
  }
33
33
  }
34
34
 
35
-
36
- async function runFile(filename: string): Promise<void> {
35
+ /**
36
+ *
37
+ * @param filename
38
+ * @returns
39
+ */
40
+ export async function runFile(filename: string): Promise<void> {
37
41
  let result: boolean
38
42
 
39
43
  if (filename.indexOf(".") !== -1) {
package/src/index.ts CHANGED
@@ -176,7 +176,7 @@ class StopCommand extends Command {
176
176
  */
177
177
  const program = new Command()
178
178
  program.name('cyk').description('cyklang CLI')
179
- .version('0.9.1')
179
+ .version('0.11.3')
180
180
  program.addCommand(new StartCommand('start'))
181
181
  program.addCommand(new StopCommand('stop'))
182
182
  program.addCommand(new InstallCommand('install'))
package/test/db/t30.xml CHANGED
@@ -6,7 +6,7 @@
6
6
 
7
7
  <db.table name="cook_recipe">
8
8
  <number name="rcp_id" dbtype="int" generated="by default" label="ID recette" primary=""/>
9
- <string name="rcp_name" label="Recette"/>
9
+ <string name="rcp_name" dbtype="varchar(255)" label="Recette"/>
10
10
  <string name="rcp_genre" label="Genre"/>
11
11
  <foreignkey parent="cook_genre">
12
12
  <string name="genre_name">"rcp_genre"</string>