dbmodel 5.3.4 → 5.4.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.
Files changed (2) hide show
  1. package/bin/dbmodel.js +30 -1
  2. package/package.json +11 -11
package/bin/dbmodel.js CHANGED
@@ -26,6 +26,8 @@ async function runAndExit(promise) {
26
26
  }
27
27
  }
28
28
 
29
+ program.version(dbgateApi.currentVersion.version);
30
+
29
31
  program
30
32
  .option('-s, --server <server>', 'server host')
31
33
  .option('-u, --user <user>', 'user name')
@@ -36,7 +38,8 @@ program
36
38
  '--load-data-condition <condition>',
37
39
  'regex, which table data will be loaded and stored in model (in load command)'
38
40
  )
39
- .requiredOption('-e, --engine <engine>', 'engine name, eg. mysql@dbgate-plugin-mysql');
41
+ .option('-e, --engine <engine>', 'engine name, eg. mysql@dbgate-plugin-mysql')
42
+ .option('--commonjs', 'Creates CommonJS module');
40
43
 
41
44
  program
42
45
  .command('deploy <modelFolder>')
@@ -115,4 +118,30 @@ program
115
118
  );
116
119
  });
117
120
 
121
+ program
122
+ .command('json-to-model <jsonFile> <modelFolder>')
123
+ .description('Converts JSON file to model')
124
+ .action((jsonFile, modelFolder) => {
125
+ runAndExit(
126
+ dbgateApi.jsonToDbModel({
127
+ modelFile: jsonFile,
128
+ outputDir: modelFolder,
129
+ })
130
+ );
131
+ });
132
+
133
+ program
134
+ .command('model-to-json <modelFolder> <jsonFile>')
135
+ .description('Converts model to JSON file')
136
+ .action((modelFolder, jsonFile) => {
137
+ const { commonjs } = program.opts();
138
+ runAndExit(
139
+ dbgateApi.dbModelToJson({
140
+ modelFolder,
141
+ outputFile: jsonFile,
142
+ commonjs,
143
+ })
144
+ );
145
+ });
146
+
118
147
  program.parse(process.argv);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dbmodel",
3
- "version": "5.3.4",
3
+ "version": "5.4.0",
4
4
  "homepage": "https://dbgate.org/",
5
5
  "repository": {
6
6
  "type": "git",
@@ -30,16 +30,16 @@
30
30
  ],
31
31
  "dependencies": {
32
32
  "commander": "^10.0.0",
33
- "dbgate-api": "^5.3.4",
34
- "dbgate-plugin-csv": "^5.3.4",
35
- "dbgate-plugin-excel": "^5.3.4",
36
- "dbgate-plugin-mongo": "^5.3.4",
37
- "dbgate-plugin-mssql": "^5.3.4",
38
- "dbgate-plugin-mysql": "^5.3.4",
39
- "dbgate-plugin-postgres": "^5.3.4",
40
- "dbgate-plugin-xml": "^5.3.4",
41
- "dbgate-plugin-oracle": "^5.3.4",
42
- "dbgate-web": "^5.3.4",
33
+ "dbgate-api": "^5.4.0",
34
+ "dbgate-plugin-csv": "^5.4.0",
35
+ "dbgate-plugin-excel": "^5.4.0",
36
+ "dbgate-plugin-mongo": "^5.4.0",
37
+ "dbgate-plugin-mssql": "^5.4.0",
38
+ "dbgate-plugin-mysql": "^5.4.0",
39
+ "dbgate-plugin-postgres": "^5.4.0",
40
+ "dbgate-plugin-xml": "^5.4.0",
41
+ "dbgate-plugin-oracle": "^5.4.0",
42
+ "dbgate-web": "^5.4.0",
43
43
  "dotenv": "^16.0.0",
44
44
  "pinomin": "^1.0.4"
45
45
  }