@cyklang/cli 0.14.16 → 0.14.18
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/build/RunCommand.js +1 -15
- package/build/TestCommand.js +1 -16
- package/build/index.js +1 -1
- package/package.json +2 -2
- package/src/RunCommand.ts +2 -20
- package/src/TestCommand.ts +3 -21
- package/src/index.ts +1 -1
- package/test/t34.output +16 -0
- package/test/t34.xml +36 -0
package/build/RunCommand.js
CHANGED
|
@@ -85,21 +85,7 @@ async function runFile(filename) {
|
|
|
85
85
|
const login = await dbRemote.signin(process.env.USER_NAME, undefined, process.env.USER_PASSWORD);
|
|
86
86
|
const dbManager = new core_1.DBManager(structure.scope, dbRemote);
|
|
87
87
|
await dbManager.initialize();
|
|
88
|
-
|
|
89
|
-
if (user_lang && user_lang.trim() !== '') {
|
|
90
|
-
const langfilename = filename + "__" + user_lang + ".xml";
|
|
91
|
-
if (fs.existsSync(langfilename)) {
|
|
92
|
-
const langXml = fs.readFileSync(langfilename);
|
|
93
|
-
const tag = (0, core_1.parseXML)(xmlfilename, langXml.toString());
|
|
94
|
-
const modLang = new core_1.ModuleInstruction(tag, dbManager);
|
|
95
|
-
await modLang.parse(structure.scope);
|
|
96
|
-
await modLang.execute(structure.scope);
|
|
97
|
-
const langMap = modLang.objectData?.variables.getData(user_lang);
|
|
98
|
-
if (langMap !== null && langMap !== undefined) {
|
|
99
|
-
await structure.scope.setLang(user_lang, langMap);
|
|
100
|
-
}
|
|
101
|
-
}
|
|
102
|
-
}
|
|
88
|
+
await (0, core_1.loadLanguageModule)(structure.scope, dbManager, '', [login.content.user_lang, process.env.LANG]);
|
|
103
89
|
let script = new core_1.Script(structure.scope, xmlfilename, xml.toString(), dbManager);
|
|
104
90
|
await script.parseInstructions();
|
|
105
91
|
await script.execute();
|
package/build/TestCommand.js
CHANGED
|
@@ -86,23 +86,8 @@ async function testfile(filename) {
|
|
|
86
86
|
const dbManager = new core_1.DBManager(structure.scope, dbRemote);
|
|
87
87
|
await dbManager.initialize();
|
|
88
88
|
structure.scope.addInstructionType(new console_1.PrintInstructionType(logfilename));
|
|
89
|
+
await (0, core_1.loadLanguageModule)(structure.scope, dbManager, '', [login.content.user_lang, process.env.LANG]);
|
|
89
90
|
let script = new core_1.Script(structure.scope, xmlfilename, xml.toString(), dbManager);
|
|
90
|
-
const user_lang = login.content.user_lang;
|
|
91
|
-
if (user_lang && user_lang.trim() !== '') {
|
|
92
|
-
const langfilename = filename + "__" + user_lang + ".xml";
|
|
93
|
-
if (fs.existsSync(langfilename)) {
|
|
94
|
-
const langXml = fs.readFileSync(langfilename);
|
|
95
|
-
const tag = (0, core_1.parseXML)(xmlfilename, langXml.toString());
|
|
96
|
-
const modLang = new core_1.ModuleInstruction(tag, dbManager);
|
|
97
|
-
await modLang.parse(structure.scope);
|
|
98
|
-
await modLang.execute(structure.scope);
|
|
99
|
-
const langMap = modLang.objectData?.variables.getData(user_lang);
|
|
100
|
-
if (langMap !== null && langMap !== undefined) {
|
|
101
|
-
await structure.scope.setLang(user_lang, langMap);
|
|
102
|
-
outfilename = filename + "__" + user_lang + ".output";
|
|
103
|
-
}
|
|
104
|
-
}
|
|
105
|
-
}
|
|
106
91
|
await script.parseInstructions();
|
|
107
92
|
await script.execute();
|
|
108
93
|
// console.log(JSON.stringify(script.block.toString()))
|
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.14.
|
|
185
|
+
.version('0.14.18');
|
|
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.14.
|
|
3
|
+
"version": "0.14.18",
|
|
4
4
|
"description": "cyklang CLI",
|
|
5
5
|
"main": "build/index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
"author": "",
|
|
20
20
|
"license": "ISC",
|
|
21
21
|
"dependencies": {
|
|
22
|
-
"@cyklang/core": "^0.
|
|
22
|
+
"@cyklang/core": "^0.18.0",
|
|
23
23
|
"commander": "^9.4.0",
|
|
24
24
|
"dotenv": "^16.0.1",
|
|
25
25
|
"form-data": "^4.0.0",
|
package/src/RunCommand.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Structure, Script, XmlError, DBRemote, DBManager, ModuleInstruction, parseXML, MapData } from "@cyklang/core"
|
|
1
|
+
import { Structure, Script, XmlError, DBRemote, DBManager, ModuleInstruction, parseXML, MapData, loadLanguageModule } from "@cyklang/core"
|
|
2
2
|
import * as fs from "fs"
|
|
3
3
|
import { errorconsole, PrintInstructionType } from "./console"
|
|
4
4
|
import loglevel from 'loglevel'
|
|
@@ -61,25 +61,7 @@ export async function runFile(filename: string): Promise<void> {
|
|
|
61
61
|
const dbManager = new DBManager(structure.scope, dbRemote)
|
|
62
62
|
await dbManager.initialize()
|
|
63
63
|
|
|
64
|
-
|
|
65
|
-
if (user_lang && user_lang.trim() !== '') {
|
|
66
|
-
|
|
67
|
-
const langfilename = filename + "__" + user_lang + ".xml"
|
|
68
|
-
|
|
69
|
-
if (fs.existsSync(langfilename)) {
|
|
70
|
-
const langXml = fs.readFileSync(langfilename)
|
|
71
|
-
const tag = parseXML(xmlfilename, langXml.toString())
|
|
72
|
-
const modLang = new ModuleInstruction(tag, dbManager)
|
|
73
|
-
await modLang.parse(structure.scope)
|
|
74
|
-
await modLang.execute(structure.scope)
|
|
75
|
-
|
|
76
|
-
const langMap = modLang.objectData?.variables.getData(user_lang)
|
|
77
|
-
|
|
78
|
-
if (langMap !== null && langMap !== undefined) {
|
|
79
|
-
await structure.scope.setLang(user_lang, langMap as MapData)
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
}
|
|
64
|
+
await loadLanguageModule(structure.scope, dbManager, '', [login.content.user_lang, process.env.LANG])
|
|
83
65
|
|
|
84
66
|
let script = new Script(structure.scope, xmlfilename, xml.toString(), dbManager)
|
|
85
67
|
await script.parseInstructions()
|
package/src/TestCommand.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Structure, Script, XmlError, DBRemote, DBManager, MapData, ModuleInstruction, parseXML } from "@cyklang/core"
|
|
1
|
+
import { Structure, Script, XmlError, DBRemote, DBManager, MapData, ModuleInstruction, parseXML, loadLanguageModule } from "@cyklang/core"
|
|
2
2
|
import * as fs from "fs"
|
|
3
3
|
import { errorconsole, PrintInstructionType } from "./console"
|
|
4
4
|
import loglevel from 'loglevel'
|
|
@@ -64,28 +64,10 @@ async function testfile(filename: string): Promise<boolean> {
|
|
|
64
64
|
const dbManager = new DBManager(structure.scope, dbRemote)
|
|
65
65
|
await dbManager.initialize()
|
|
66
66
|
structure.scope.addInstructionType(new PrintInstructionType(logfilename))
|
|
67
|
-
let script = new Script(structure.scope, xmlfilename, xml.toString(), dbManager)
|
|
68
|
-
const user_lang = login.content.user_lang
|
|
69
|
-
if (user_lang && user_lang.trim() !== '') {
|
|
70
|
-
|
|
71
|
-
const langfilename = filename + "__" + user_lang + ".xml"
|
|
72
|
-
|
|
73
|
-
if (fs.existsSync(langfilename)) {
|
|
74
|
-
const langXml = fs.readFileSync(langfilename)
|
|
75
|
-
const tag = parseXML(xmlfilename, langXml.toString())
|
|
76
|
-
const modLang = new ModuleInstruction(tag, dbManager)
|
|
77
|
-
await modLang.parse(structure.scope)
|
|
78
|
-
await modLang.execute(structure.scope)
|
|
79
|
-
|
|
80
|
-
const langMap = modLang.objectData?.variables.getData(user_lang)
|
|
81
67
|
|
|
82
|
-
|
|
83
|
-
await structure.scope.setLang(user_lang, langMap as MapData)
|
|
68
|
+
await loadLanguageModule(structure.scope, dbManager, '', [login.content.user_lang, process.env.LANG])
|
|
84
69
|
|
|
85
|
-
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
}
|
|
70
|
+
let script = new Script(structure.scope, xmlfilename, xml.toString(), dbManager)
|
|
89
71
|
|
|
90
72
|
await script.parseInstructions()
|
|
91
73
|
await script.execute()
|
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.14.
|
|
179
|
+
.version('0.14.18')
|
|
180
180
|
program.addCommand(new StartCommand('start'))
|
|
181
181
|
program.addCommand(new StopCommand('stop'))
|
|
182
182
|
program.addCommand(new InstallCommand('install'))
|
package/test/t34.output
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
<Exercice> <Journal> Contenu du Journal </Journal> <Journal> Contenu du Journal </Journal> </Exercice>
|
|
2
|
+
encodexml() : Frais postaux et de Télécom.
|
|
3
|
+
dialog.__dirty__ = false
|
|
4
|
+
dialog.d1 = 10
|
|
5
|
+
dialog.grid.g1 = 20
|
|
6
|
+
dialog=<boolean name="__dirty__">false</boolean>
|
|
7
|
+
<number name="d1">10</number>
|
|
8
|
+
<object name="grid">
|
|
9
|
+
<number name="g1">20</number>
|
|
10
|
+
<function name="f1" returns="result:number">
|
|
11
|
+
</function>
|
|
12
|
+
<boolean name="boole">false</boolean>
|
|
13
|
+
</object>
|
|
14
|
+
dialog.grid.f1() = 50
|
|
15
|
+
dialog.grid.boole = false
|
|
16
|
+
dialog2.__dirty__ = false
|
package/test/t34.xml
CHANGED
|
@@ -71,4 +71,40 @@
|
|
|
71
71
|
|
|
72
72
|
<print>"encodexml() : " + encodexml("Frais postaux et de Télécom.")</print>
|
|
73
73
|
|
|
74
|
+
<boolean name="bool">true</boolean>
|
|
75
|
+
|
|
76
|
+
<type name="TDialog">
|
|
77
|
+
<method name="__init__">
|
|
78
|
+
<block>
|
|
79
|
+
<call object="this" method="push">
|
|
80
|
+
<boolean name="__dirty__">false</boolean>
|
|
81
|
+
</call>
|
|
82
|
+
</block>
|
|
83
|
+
</method>
|
|
84
|
+
</type>
|
|
85
|
+
|
|
86
|
+
<object name="dialog" type="TDialog">
|
|
87
|
+
<number name="d1">10</number>
|
|
88
|
+
<object name="grid">
|
|
89
|
+
<number name="g1"> 2 * d1</number>
|
|
90
|
+
<function name="f1" returns="result: number">
|
|
91
|
+
<block>
|
|
92
|
+
<set name="result">2 * grid.g1 + dialog.d1</set>
|
|
93
|
+
<print>"dialog=" + string(dialog)</print>
|
|
94
|
+
</block>
|
|
95
|
+
</function>
|
|
96
|
+
<boolean name="boole"> false </boolean>
|
|
97
|
+
</object>
|
|
98
|
+
</object>
|
|
99
|
+
|
|
100
|
+
<print>"dialog.__dirty__ = " + dialog.__dirty__</print>
|
|
101
|
+
<print>"dialog.d1 = " + dialog.d1</print>
|
|
102
|
+
<print>"dialog.grid.g1 = " + dialog.grid.g1</print>
|
|
103
|
+
<print>"dialog.grid.f1() = " + dialog.grid.f1()</print>
|
|
104
|
+
<print>"dialog.grid.boole = " + dialog.grid.boole</print>
|
|
105
|
+
|
|
106
|
+
<object name="dialog2" type="TDialog"></object>
|
|
107
|
+
<print>"dialog2.__dirty__ = " + dialog2.__dirty__</print>
|
|
108
|
+
|
|
109
|
+
|
|
74
110
|
</module>
|