Skip to content

Commit

Permalink
Merge pull request #769 from thundersdata-frontend/svgicon-issue
Browse files Browse the repository at this point in the history
fix: 修复 svgicon 工具包运行失败的问题
  • Loading branch information
chj-damon authored Nov 21, 2023
2 parents e2d96c7 + 81a24e2 commit 4486a67
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 3 deletions.
5 changes: 5 additions & 0 deletions .changeset/three-pants-burn.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@td-design/svgicon-cli': minor
---

修复执行命令报错的问题
6 changes: 5 additions & 1 deletion packages/svgicon-cli/gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,8 @@ function copyTemplate() {
return gulp.src('./src/templates/**/*').pipe(gulp.dest('lib/templates'));
}

exports.default = gulp.series(clean, buildCJS, copyTemplate);
function copyJson() {
return gulp.src('./svgicon.json').pipe(gulp.dest('lib/libs'));
}

exports.default = gulp.series(clean, buildCJS, copyTemplate, copyJson);
4 changes: 2 additions & 2 deletions packages/svgicon-cli/src/libs/parseLocalSvg.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as fs from 'fs';
import glob from 'glob';
import { globSync } from 'glob';
import path from 'path';

import { Config } from '../libs/getConfig';
Expand All @@ -18,7 +18,7 @@ const parseLocalSvg = ({ icon_svg }: Config) => {

const localDir = path.resolve(icon_svg);

const localSvg = glob.sync(path.join(localDir, '**/*.svg'));
const localSvg = globSync(path.join(localDir, '**/*.svg'));

return localSvg.reduce<ILocalSvg[]>((previousValue, currentValue) => {
let svgStr = fs.readFileSync(currentValue, 'utf-8');
Expand Down

0 comments on commit 4486a67

Please sign in to comment.