Skip to content

Commit baf1cf3

Browse files
committed
chore(deps): update dependency tsbb to v4 #18
jaywcjlove/tsbb#439
1 parent ce45255 commit baf1cf3

File tree

4 files changed

+141
-75
lines changed

4 files changed

+141
-75
lines changed

.github/workflows/ci.yml

Lines changed: 71 additions & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -7,79 +7,83 @@ jobs:
77
build-deploy:
88
runs-on: ubuntu-18.04
99
steps:
10-
- uses: actions/checkout@v2
11-
with:
12-
submodules: true
13-
- uses: actions/setup-node@v2
14-
with:
15-
node-version: 14
10+
- uses: actions/checkout@v3
11+
with:
12+
submodules: true
13+
- uses: actions/setup-node@v3
14+
with:
15+
node-version: 16
16+
registry-url: 'https://registry.npmjs.org'
1617

17-
- run: npm install
18-
- run: npm run font
19-
- run: npm run build
20-
- run: npm run copy
21-
- run: rm -rf fonts/react
22-
- run: cp lib/*js ./
23-
- run: mkdir icon
24-
- run: cp icons/icons/*svg ./icon
25-
- run: rm -rf index.js
26-
- run: ls -al
18+
- run: npm install
19+
- run: npm run font
20+
- run: npm run copy:svg
21+
- run: npm run copy
22+
- run: npm run build
23+
- run: rm -rf fonts/react
24+
- run: cp lib/*.js ./
25+
- run: cp lib/*.d.ts ./
26+
- run: mkdir icon
27+
- run: cp icons/icons/*svg ./icon
28+
- run: rm -rf index.js
29+
- run: ls -al
2730

28-
- name: Generate Contributors Images
29-
uses: jaywcjlove/github-action-contributors@main
30-
with:
31-
filter-author: (renovate\[bot\]|renovate-bot|dependabot\[bot\])
32-
output: fonts/CONTRIBUTORS.svg
33-
avatarSize: 42
31+
- name: Generate Contributors Images
32+
uses: jaywcjlove/github-action-contributors@main
33+
with:
34+
filter-author: (renovate\[bot\]|renovate-bot|dependabot\[bot\])
35+
output: fonts/CONTRIBUTORS.svg
36+
avatarSize: 42
3437

35-
- name: Create Tag
36-
id: create_tag
37-
uses: jaywcjlove/create-tag-action@v1.3.6
38-
with:
39-
package-path: ./package.json
38+
- name: Create Tag
39+
id: create_tag
40+
uses: jaywcjlove/create-tag-action@main
41+
with:
42+
package-path: ./package.json
4043

41-
- name: get tag version
42-
id: tag_version
43-
uses: jaywcjlove/changelog-generator@v1.5.0
44+
- name: get tag version
45+
id: tag_version
46+
uses: jaywcjlove/changelog-generator@main
4447

45-
- name: Deploy
46-
uses: peaceiris/actions-gh-pages@v3
47-
with:
48-
commit_message: ${{steps.tag_version.outputs.tag}} ${{ github.event.head_commit.message }}
49-
github_token: ${{ secrets.GITHUB_TOKEN }}
50-
publish_dir: ./fonts
48+
- name: Deploy
49+
uses: peaceiris/actions-gh-pages@v3
50+
with:
51+
commit_message: ${{steps.tag_version.outputs.tag}} ${{ github.event.head_commit.message }}
52+
github_token: ${{ secrets.GITHUB_TOKEN }}
53+
publish_dir: ./fonts
5154

52-
- name: Generate Changelog
53-
id: changelog
54-
uses: jaywcjlove/changelog-generator@v1.5.0
55-
with:
56-
head-ref: ${{steps.create_tag.outputs.version}}
57-
filter-author: (jaywcjlove|小弟调调™|dependabot\[bot\]|Renovate Bot)
58-
filter: '[R|r]elease[d]\s+[v|V]\d(\.\d+){0,2}'
55+
- name: Generate Changelog
56+
id: changelog
57+
uses: jaywcjlove/changelog-generator@main
58+
with:
59+
head-ref: ${{steps.create_tag.outputs.version}}
60+
filter-author: (jaywcjlove|小弟调调™|dependabot\[bot\]|Renovate Bot)
61+
filter: '[R|r]elease[d]\s+[v|V]\d(\.\d+){0,2}'
5962

60-
- name: Create Release
61-
uses: ncipollo/release-action@v1
62-
if: steps.create_tag.outputs.successful
63-
with:
64-
token: ${{ secrets.GITHUB_TOKEN }}
65-
name: ${{ steps.create_tag.outputs.version }}
66-
tag: ${{ steps.create_tag.outputs.version }}
67-
body: |
68-
[![](https://img.shields.io/badge/Open%20in-unpkg-blue)](https://uiwjs.github.io/npm-unpkg/#/pkg/@uiw/bootstrap-icons@${{steps.create_tag.outputs.versionNumber}}/file/README.md) [![npm bundle size](https://img.shields.io/bundlephobia/minzip/@uiw/bootstrap-icons)](https://bundlephobia.com/result?p=@uiw/bootstrap-icons@${{steps.create_tag.outputs.versionNumber}})
69-
70-
Documentation ${{ steps.changelog.outputs.tag }}: https://raw.githack.com/uiwjs/bootstrap-icons/${{ steps.changelog.outputs.gh-pages-short-hash }}/index.html
71-
Comparing Changes: ${{ steps.changelog.outputs.compareurl }}
72-
73-
```bash
74-
npm i @uiw/bootstrap-icons@${{steps.create_tag.outputs.versionNumber}}
75-
```
76-
77-
${{ steps.changelog.outputs.changelog }}
63+
- name: Create Release
64+
uses: ncipollo/release-action@v1
65+
if: steps.create_tag.outputs.successful
66+
with:
67+
token: ${{ secrets.GITHUB_TOKEN }}
68+
name: ${{ steps.create_tag.outputs.version }}
69+
tag: ${{ steps.create_tag.outputs.version }}
70+
body: |
71+
[![](https://img.shields.io/badge/Open%20in-unpkg-blue)](https://uiwjs.github.io/npm-unpkg/#/pkg/@uiw/bootstrap-icons@${{steps.create_tag.outputs.versionNumber}}/file/README.md) [![npm bundle size](https://img.shields.io/bundlephobia/minzip/@uiw/bootstrap-icons)](https://bundlephobia.com/result?p=@uiw/bootstrap-icons@${{steps.create_tag.outputs.versionNumber}})
72+
73+
Documentation ${{ steps.changelog.outputs.tag }}: https://raw.githack.com/uiwjs/bootstrap-icons/${{ steps.changelog.outputs.gh-pages-short-hash }}/index.html
74+
Comparing Changes: ${{ steps.changelog.outputs.compareurl }}
75+
76+
```bash
77+
npm i @uiw/bootstrap-icons@${{steps.create_tag.outputs.versionNumber}}
78+
```
79+
80+
${{ steps.changelog.outputs.changelog }}
81+
82+
- run: rm -rf fonts/*.html
83+
- run: npm publish --access public
84+
name: 📦 @uiw/bootstrap-icons publish to NPM
85+
continue-on-error: true
86+
env:
87+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
7888

79-
- run: rm -rf fonts/*.html
80-
- name: 📦 @uiw/icons publish to NPM
81-
uses: JS-DevTools/npm-publish@v1
82-
with:
83-
token: ${{ secrets.NPM_TOKEN }}
84-
package: ./package.json
8589

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
build
2+
react
3+
svg
24
fonts
35
coverage
46
cjs

README.md

Lines changed: 50 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -100,18 +100,66 @@ Support for `.less` and `.css` styles references.
100100
<i class="btfont-javascript"></i>
101101
```
102102

103-
### React
103+
### Used in React
104104

105105
Icons are used as components. `v1.3.0+` support.
106106

107107
```jsx
108108
import { Activity, Wifi } from '@uiw/bootstrap-icons';
109-
import { Activity } from '@uiw/icons/Activity';
109+
import { Activity } from '@uiw/bootstrap-icons/Activity';
110110

111111
<Activity style={{ fill: 'red' }} />
112112
<Wifi height="36" />
113113
```
114114

115+
To use SVG images as React components directly, webpack loader support is required.
116+
117+
Install dependencies:
118+
119+
```bash
120+
yarn add @svgr/webpack file-loader
121+
```
122+
123+
Configure webpack loader:
124+
125+
```js
126+
// webpack.config.js
127+
{
128+
test: /\.svg$/,
129+
use: [
130+
{
131+
loader: require.resolve('@svgr/webpack'),
132+
options: {
133+
prettier: false,
134+
svgo: false,
135+
svgoConfig: {
136+
plugins: [{ removeViewBox: false }],
137+
},
138+
titleProp: true,
139+
ref: true,
140+
},
141+
},
142+
{
143+
loader: require.resolve('file-loader'),
144+
options: {
145+
name: 'static/media/[name].[hash].[ext]',
146+
},
147+
},
148+
],
149+
issuer: {
150+
and: [/\.(ts|tsx|js|jsx|md|mdx)$/],
151+
},
152+
},
153+
```
154+
155+
You can then import the SVG as a React component like this:
156+
157+
```javascript
158+
import { ReactComponent as ComLogo } from '@uiw/bootstrap-icons/svg/wifi.svg';
159+
160+
<ComLogo />
161+
```
162+
115163
**Custom Icon Component**
116164

117165
Create an `Icon` component.

package.json

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,16 +7,28 @@
77
"types": "./esm/index.d.ts",
88
"scripts": {
99
"font": "svgtofont --sources icons/icons --output fonts",
10-
"copy": "copyfiles -f fonts/react/*.d.ts lib --verbose && copyfiles -f fonts/react/*.d.ts esm --verbose",
11-
"build": "tsbb build --entry fonts/react/index.js",
12-
"start": "npm run font && npm run build && npm run copy"
10+
"copy:svg": "cpy icons/icons/*.svg svg --flat",
11+
"copy": "cpy fonts/react/*.js fonts/react/*.d.ts react --flat",
12+
"build": "tsbb build react/*.{js,d.ts} --useBabel",
13+
"start": "npm run font && npm run copy:svg && npm run copy && npm run build"
1314
},
1415
"license": "MIT",
1516
"author": "Kenny <[email protected]>",
1617
"repository": {
1718
"type": "git",
1819
"url": "https://github.com/uiwjs/bootstrap-icons.git"
1920
},
21+
"files": [
22+
"lib",
23+
"esm",
24+
"svg",
25+
"*.js",
26+
"*.d.ts",
27+
"icon",
28+
"!icon/react",
29+
"!icon/*.html",
30+
"fonts"
31+
],
2032
"keywords": [
2133
"bootstrap",
2234
"bootstrap-icons",
@@ -41,8 +53,8 @@
4153
"base64"
4254
],
4355
"devDependencies": {
44-
"copyfiles": "~2.4.1",
45-
"svgtofont": "~3.17.6",
46-
"tsbb": "~3.7.2"
56+
"cpy-cli": "^4.2.0",
57+
"svgtofont": "~3.23.0",
58+
"tsbb": "^4.0.2"
4759
}
4860
}

0 commit comments

Comments
 (0)