Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

edp import 导入非edp项目的edp依赖 #352

Open
teazean opened this issue Jun 12, 2016 · 2 comments
Open

edp import 导入非edp项目的edp依赖 #352

teazean opened this issue Jun 12, 2016 · 2 comments

Comments

@teazean
Copy link

teazean commented Jun 12, 2016

好吧,如题。非edp项目,但需要导入edp的依赖。
现状:项目目录执行edp import无法导入。
看了代码:失败在了判断是否是edp项目的地方。

希望加个支持:非edp项目,执行edp import自动导入package.json/edp/dependencies里面的依赖

@teazean
Copy link
Author

teazean commented Jun 12, 2016

=。=我在本地修改了edp-packge/lib/pkg.js的代码,可以支持了。
原代码: //64行
if (projectInfo) {
// edp-project/lib/metadata里面处理可package.json和.edpproj/metadata的兼容性问题
data = project.metadata.get(projectInfo);
}

修改后:
if (projectInfo) {
// edp-project/lib/metadata里面处理可package.json和.edpproj/metadata的兼容性问题
data = project.metadata.get(projectInfo);
} else {
var pkgFile = path.resolve(importDir, 'package.json' );
if ( fs.existsSync( pkgFile ) ) {
var pkgConfig = JSON.parse( fs.readFileSync( pkgFile, 'UTF-8' ) );
if (pkgConfig.edp) {
data = pkgConfig.edp;
}
}
}

没问题的话,能加入edp import本身最好。

ps:能不能取消[y/n]的判断,我想写脚本来实现导入的。

@otakustay
Copy link
Member

我感觉得先等 ecomfe/edp-package#20 这个搞定……

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants