Commit e42a2169 authored by rockyl's avatar rockyl

修复组件依赖关系

增加文件夹遍历执行
parent 16ac989e
......@@ -5,11 +5,40 @@
const {execute: executeDeclareGenerator} = require('scilla-declare-generator/bin/cli-wrapper');
const {execute: executeTsCompiler} = require('scilla-ts-compiler/bin/cli-wrapper');
const fs = require('fs-extra');
const path = require('path');
const glob = require('glob');
exports.execute = async function (program) {
let code;
code = await executeDeclareGenerator(program);
if(code > 0){
return code;
const inputFile = program.input;
if(await fs.exists(inputFile)){
const stat = await fs.stat(inputFile);
if(stat.isDirectory()){
const indexFiles = glob.sync(path.join(inputFile, '**/index.ts'));
let code, params = {
projectPath: program.projectPath,
};
for(let file of indexFiles){
params.input = file;
code = await executeDeclareGenerator(params);
if(code > 0){
return code;
}
code = await executeTsCompiler(params);
if(code > 0){
return code;
}
}
}else{
let code;
code = await executeDeclareGenerator(program);
if(code > 0){
return code;
}
return await executeTsCompiler(program);
}
}
return await executeTsCompiler(program);
return 10
};
......@@ -5,6 +5,8 @@
"bin": "bin/cli.js",
"license": "MIT",
"dependencies": {
"fs-extra": "^7.0.1",
"glob": "^7.1.3",
"scilla-declare-generator": "git+http://gitlab2.dui88.com/laoqifeng/scilla-declare-generator.git",
"scilla-ts-compiler": "git+http://gitlab2.dui88.com/laoqifeng/scilla-ts-compiler.git"
}
......
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment