owl-cli 6.211.0 → 6.213.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.
package/bin/owl.js
CHANGED
|
@@ -4,7 +4,7 @@ const {lstatSync, readdirSync} = require('fs')
|
|
|
4
4
|
const fs = require('fs')
|
|
5
5
|
const {join, resolve,dirname,basename} = require('path')
|
|
6
6
|
const {getFormSpecs, flattenFormSpecs} = require('./dsl')
|
|
7
|
-
const {genTableSql} = require('./table_mysql.js');
|
|
7
|
+
const {genTableSql} = require('./table_mysql.js');
|
|
8
8
|
const template = require('art-template')
|
|
9
9
|
const path = require('path');
|
|
10
10
|
|
|
@@ -294,56 +294,72 @@ function processInputDir(dir, outdir, templatePath, buildType, project) {
|
|
|
294
294
|
})
|
|
295
295
|
}
|
|
296
296
|
|
|
297
|
+
function main(){
|
|
298
|
+
var pjson = require(join(__dirname, "../package.json"));
|
|
299
|
+
var version = (pjson.version);
|
|
300
|
+
console.log("owl version:" + version );
|
|
297
301
|
|
|
298
|
-
var
|
|
299
|
-
|
|
300
|
-
|
|
302
|
+
var configFile = resolve(cwd,"owlconfig.json");
|
|
303
|
+
// if (process.argv.length > 2) {
|
|
304
|
+
// configFile = resolve(cwd, process.argv[2]);
|
|
305
|
+
// }
|
|
301
306
|
|
|
302
|
-
var configFile = resolve(cwd,"owlconfig.json");
|
|
303
|
-
if (process.argv.length > 2) {
|
|
304
|
-
configFile = resolve(cwd, process.argv[2]);
|
|
305
|
-
}
|
|
306
307
|
|
|
308
|
+
var content = fs.readFileSync(configFile, {encoding: 'utf-8'})
|
|
309
|
+
var owlconfig = JSON.parse(content)
|
|
310
|
+
var inPath = owlconfig.models;
|
|
311
|
+
var outPath = owlconfig.generatedApps
|
|
312
|
+
var templatePath = owlconfig.templates
|
|
313
|
+
var buildType = owlconfig.buildType;
|
|
314
|
+
var project = owlconfig.project;
|
|
315
|
+
buildProperties = resolve(cwd,owlconfig.buildProperties);
|
|
316
|
+
libpath = resolve(cwd,owlconfig.libpath);
|
|
317
|
+
templatePath = resolve(cwd, templatePath);
|
|
318
|
+
var fulloutPath = resolve(cwd,outPath);
|
|
307
319
|
|
|
308
|
-
|
|
309
|
-
var owlconfig = JSON.parse(content)
|
|
310
|
-
var inPath = owlconfig.models;
|
|
311
|
-
var outPath = owlconfig.generatedApps
|
|
312
|
-
var templatePath = owlconfig.templates
|
|
313
|
-
var buildType = owlconfig.buildType;
|
|
314
|
-
var project = owlconfig.project;
|
|
315
|
-
buildProperties = resolve(cwd,owlconfig.buildProperties);
|
|
316
|
-
libpath = resolve(cwd,owlconfig.libpath);
|
|
317
|
-
templatePath = resolve(cwd, templatePath);
|
|
318
|
-
var fulloutPath = resolve(cwd,outPath);
|
|
320
|
+
console.log("after read config");
|
|
319
321
|
|
|
320
|
-
|
|
322
|
+
console.log("inPath=",inPath);
|
|
323
|
+
console.log("outPath=",outPath);
|
|
324
|
+
console.log("templatePath=",templatePath);
|
|
325
|
+
console.log("buildType=",buildType);
|
|
326
|
+
console.log("project=",project);
|
|
327
|
+
console.log("fulloutPath",fulloutPath);
|
|
321
328
|
|
|
329
|
+
mkdir(fulloutPath);
|
|
322
330
|
|
|
323
331
|
|
|
324
|
-
var inputPattern = null;
|
|
325
|
-
if(process.argv.length>2){
|
|
326
|
-
inputPattern = process.argv[2];
|
|
327
|
-
console.log("compiling" + inputPattern);
|
|
328
|
-
}
|
|
329
332
|
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
333
|
+
var inputPattern = null;
|
|
334
|
+
if(process.argv.length>2){
|
|
335
|
+
inputPattern = process.argv[2];
|
|
336
|
+
console.log("compiling" + inputPattern);
|
|
337
|
+
}
|
|
338
|
+
|
|
339
|
+
if(inputPattern){
|
|
340
|
+
if(isDirectory(resolve(cwd,inPath,inputPattern))){
|
|
341
|
+
let inDir = resolve(cwd,inPath,inputPattern);
|
|
342
|
+
let outDir = resolve(fulloutPath,inputPattern);
|
|
343
|
+
processInputDir(inDir, outDir, templatePath, buildType,project);
|
|
344
|
+
return;
|
|
345
|
+
}
|
|
346
|
+
else if (inputPattern.indexOf('.json') > 0) {
|
|
347
|
+
let inDir = dirname(resolve(cwd,inPath,inputPattern));
|
|
348
|
+
let name =basename(resolve(cwd,inPath,inputPattern));
|
|
349
|
+
let outDir = dirname(resolve(fulloutPath,inputPattern));
|
|
350
|
+
console.log("inDir",inDir,"name",name,"outDir",outDir);
|
|
351
|
+
mkdir(outDir);
|
|
352
|
+
processOwlFile(inDir, name, outDir, templatePath, buildType, inDir, project)
|
|
353
|
+
console.log("processed " + name);
|
|
354
|
+
return;
|
|
355
|
+
}
|
|
356
|
+
}
|
|
357
|
+
else{
|
|
358
|
+
processInputDir(inPath, fulloutPath, templatePath, buildType,project);
|
|
359
|
+
}
|
|
348
360
|
}
|
|
349
361
|
|
|
362
|
+
main();
|
|
363
|
+
|
|
364
|
+
|
|
365
|
+
|