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

coco/support for installing fonts #831

Merged
merged 3 commits into from Mar 27, 2020

Conversation

coco-super
Copy link
Collaborator

fix #822

@coco-super coco-super force-pushed the coco/support-for-installing-fonts branch from 292b98c to db2142a Compare March 27, 2020 06:58
Comment on lines +57 to +66
async function isNotEmptyDir(path) {
const lstat = await fs.lstat(path);
if (lstat.isDirectory()) {
const dirs = await fs.readdir(path);
if (!_.isEmpty(dirs)) {
return true;
}
}
return false;
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

return !await isEmptyDir(path)

const absCodeUri = path.resolve(baseDir, codeUri);
const fontsDir = path.join(absCodeUri, 'fonts');

if (!await fs.pathExists(fontsDir) || !await isNotEmptyDir(fontsDir)) { return {}; }
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

!await isNotEmptyDir(fontsDir) 不就等于 await isEmptyDir(fontsDir)?后者已经有这个方法了吧

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

添加了注释 仅当路径为目录且目录下有文件是返回 ture

@@ -37,6 +37,8 @@ program
.description('install dependencies which are described in fun.yml file.')
.action(async (packageNames, program) => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这里不要写 .action 的方式了,commander 5.0 应该是有改动,可以把这个逻辑放到 if (!program.args.length) { 的 else 条件里

@@ -37,6 +37,8 @@ program
.description('install dependencies which are described in fun.yml file.')
.action(async (packageNames, program) => {

if (_.isEmpty(packageNames)) { return; }
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这个就不需要了

src/lib/fc.js Outdated
@@ -171,14 +172,19 @@ const CUSTOM_RUNTIME_JAVA_MAPPING = {
'pathSuffix': '*'
};

const FONTS__MAPPING = {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

多了一个下划线吧

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

src/lib/fc.js Outdated
@@ -983,6 +992,39 @@ function generateNasAndVpcConfig(mountTarget, securityGroupId, serviceName) {
};
}

function writeFileToLine(filePath, content, lineNum) {
let data = fs.readFileSync(filePath, 'utf8').split(/\r\n|\n|\r/gm);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

\r?\n

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

@tanhe123 tanhe123 merged commit 4336c92 into alibaba:master Mar 27, 2020
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

Successfully merging this pull request may close these issues.

支持安装字体
2 participants