Skip to content

Commit

Permalink
refactor: Pretty generate logs
Browse files Browse the repository at this point in the history
  • Loading branch information
fwh1990 committed Aug 27, 2019
1 parent b8e8b00 commit 78d6cf2
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 7 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ cd ios && pod install
```json
{
"symbol_url": "复制官网提供的JS链接",
"safe_dir": "./src/iconfont",
"safe_dir": "./src/components/iconfont",
"trim_icon_prefix": "icon-",
"default_font_size": 18,
"use_typescript": false
Expand Down
8 changes: 3 additions & 5 deletions src/libs/generateComponent.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,6 @@ export const generateComponent = (data: XmlData) => {
: iconId;
const componentName = upperFirst(camelCase(iconId));

console.log(`Generating icon "${colors.green(iconId)}"...`);

names.push(iconIdAfterTrim);

for (const domName of Object.keys(item)) {
Expand Down Expand Up @@ -73,9 +71,9 @@ export const generateComponent = (data: XmlData) => {

fs.writeFileSync(path.join(saveDir, componentName + '.jsx'), singleFile);
}
});

console.log(`Generating all icons in one...`);
console.log(`${colors.green('√')} Generated icon "${colors.yellow(iconId)}"`);
});

let iconFile: string;

Expand All @@ -98,7 +96,7 @@ export const generateComponent = (data: XmlData) => {
fs.writeFileSync(path.join(saveDir, 'Icon.jsx'), iconFile);
}

console.log(colors.green('\nDone!\n'));
console.log(`\n${colors.green('√')} You will find all icons in dir: ${colors.green(config.safe_dir)}\n`);
};

const generateCase = (data: XmlData['svg']['symbol'][number], baseIdent: number) => {
Expand Down
2 changes: 1 addition & 1 deletion src/libs/iconfont.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"symbol_url": "请参考README.md,复制官网提供的JS链接",
"safe_dir": "./src/iconfont",
"safe_dir": "./src/components/iconfont",
"trim_icon_prefix": "icon-",
"default_font_size": 18,
"use_typescript": false
Expand Down

0 comments on commit 78d6cf2

Please sign in to comment.