-
Notifications
You must be signed in to change notification settings - Fork 743
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feat: make lab icon same api as default icon * fix: treeUtil export
- Loading branch information
Showing
113 changed files
with
3,283 additions
and
181 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
{ | ||
"useWorkspaces": true, | ||
"npmClient": "yarn", | ||
"version": "2.48.0-beta.0" | ||
"version": "2.48.1-alpha.1" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,32 @@ | ||
# semi-icons-lab | ||
|
||
Beautiful, colorful icons(experimental). JSX code generated by Semi icon. | ||
|
||
```bash | ||
## 📣 Introduce | ||
|
||
Beautiful, colorful icons(experimental) design by Semi Team | ||
|
||
 | ||
|
||
|
||
## 🚀 Getting Start | ||
|
||
### install deps | ||
|
||
```shell | ||
npm install @douyinfe/semi-icons-lab | ||
``` | ||
|
||
 | ||
### as a react component | ||
|
||
```tsx | ||
import { IconAnchor } from '@douyinfe/semi-icons-lab'; | ||
|
||
ReactDOM.render(<IconAnchor />, root); | ||
``` | ||
|
||
|
||
|
||
## How to contribute icon to this package | ||
- Add the svg file under the path ```src/svgs/```, naming references to other files. | ||
- Run command ```lerna run build:icon --scope @douyinfe/semi-icons```, the corresponding tsx file will be generated under the path ```src/icons```. | ||
- Add the category and name of the new icon to the ```src/svgs/meta.json``` file. | ||
- Finally, run command ```yarn docsite``` and go to the icon page to confirm whether the icon is successfully added. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
module.exports = ({ isESM }) => { | ||
return { | ||
presets: [ | ||
'@babel/preset-react', | ||
[ | ||
'@babel/preset-env', | ||
{ | ||
modules: isESM ? false : 'commonjs', | ||
targets: { | ||
browsers: [ | ||
"> 0.5%", | ||
"last 2 versions", | ||
"Firefox ESR", | ||
"not dead", | ||
"not IE 11" | ||
] | ||
} | ||
}, | ||
], | ||
], | ||
plugins: [] | ||
}; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
const path = require('path'); | ||
const { Buffer } = require('buffer'); | ||
const through2 = require('through2'); | ||
const gulp = require('gulp'); | ||
const merge2 = require('merge2'); | ||
const gulpBabel = require('gulp-babel'); | ||
const gulpTS = require('gulp-typescript'); | ||
const sass = require('gulp-sass')(require('sass')); | ||
const replace = require('gulp-replace'); | ||
const del = require('del'); | ||
const tsConfig = require('./tsconfig.json'); | ||
const getBabelConfig = require('./getBabelConfig'); | ||
|
||
gulp.task('cleanLib', function cleanLib() { | ||
return del(['lib/**/*']); | ||
}); | ||
|
||
function compileTSX(isESM) { | ||
const targetDir = isESM ? 'lib/es' : 'lib/cjs'; | ||
const tsStream = gulp.src(['src/**/*.tsx', 'src/**/*.ts']) | ||
.pipe(gulpTS({ | ||
...tsConfig.compilerOptions, | ||
rootDir: path.join(__dirname, '..') | ||
})); | ||
const jsStream = tsStream.js | ||
.pipe(gulpBabel(getBabelConfig({ isESM }))) | ||
.pipe(replace(/(require\(['"])([^'"]+)(\.scss)(['"]\))/g, '$1$2.css$4')) | ||
.pipe(replace(/(import\s+)['"]([^'"]+)(\.scss)['"]/, '$1\'$2.css\'')) | ||
.pipe(gulp.dest(targetDir)); | ||
const dtsStream = tsStream.dts | ||
.pipe(replace(/(require\(['"])([^'"]+)(\.scss)(['"]\))/g, '$1$2.css$4')) | ||
.pipe(replace(/(import\s+)['"]([^'"]+)(\.scss)['"]/, '$1\'$2.css\'')) | ||
.pipe(gulp.dest(targetDir)); | ||
return merge2([jsStream, dtsStream]); | ||
} | ||
|
||
gulp.task('compileTSXForESM', function compileTSXForESM() { | ||
return compileTSX(true); | ||
}); | ||
|
||
gulp.task('compileTSXForCJS', function compileTSXForCJS() { | ||
return compileTSX(false); | ||
}); | ||
|
||
gulp.task('compileScss', function compileScss() { | ||
return gulp.src(['src/**/*.scss']) | ||
.pipe(through2.obj( | ||
function (chunk, enc, cb) { | ||
const rootPath = path.join(__dirname, '../../'); | ||
const scssVarStr = `@import "${rootPath}/packages/semi-theme-default/scss/index.scss";\n`; | ||
const scssBuffer = Buffer.from(scssVarStr); | ||
const buffers = [scssBuffer]; | ||
chunk.contents = Buffer.concat([...buffers, chunk.contents]); | ||
cb(null, chunk); | ||
} | ||
)) | ||
.pipe(sass().on('error', sass.logError)) | ||
.pipe(gulp.dest('lib/cjs')) | ||
.pipe(gulp.dest('lib/es')); | ||
}); | ||
|
||
gulp.task('moveScss', function moveScss() { | ||
return gulp.src(['src/**/*.scss']) | ||
.pipe(gulp.dest('lib/cjs')) | ||
.pipe(gulp.dest('lib/es')); | ||
}); | ||
|
||
gulp.task('compileLib', gulp.series(['cleanLib', 'compileScss', 'moveScss', gulp.parallel('compileTSXForESM', 'compileTSXForCJS')])); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.