Skip to content

Commit 0291f4a

Browse files
authored
@channel.io/bezier-icons npm package (#1366)
* feat(bezier-icons): npm init * chore(bezier-react): enhance package.json * chore(bezier-figma-plugin): enhance package.json * feat(bezier-icons): add svg assets and scripts * feat(bezier-icons): set up package, apply path changes * chore(deps): re-install * build(bezier-icons): enhance icon generation setting * feat(bezier-icons): generate icons * feat(bezier-icons): remove a11y label util * chore(deps): add @types/react * feat(bezier-icons): add svgo package and configure optimization setting * feat(bezier-icons): make createBezierIcon fn to have no side effects * feat(bezier-react): configure svgr option and refactor & format icon templates * feat(bezier-icons): generate react icons * build(bezier-icons): init rollup config * build(bezier-icons): experiment with build settings * chore: experiment with build settings * build(bezier-icons): experiment with build settings * build(bezier-icons): add Utility Modules * feat(bezier-icons): remove generated icons * chore(bezier-react): remove unused js file fix lint config * feat(bezier-icons): export icons obj * feat(bezier-icons): generate type declaration * build(bezier-react): config npm package * feat(bezier-icons): add IconName and icons obj type declaration * build(bezier-icons): clean up dependencies and scripts * build(bezier-icons): refactor rollup config * feat(bezier-icons): enhance icon source type * build(bezier-icons): add jest and test scripts * build(bezier-icons): npm package settings * fix(bezier-icons): add missing utils export * chore(github): add codeowner * docs(bezier-icons): add README.md * docs: update README.md * chore(changeset): add changeset * build(bezier-icons): change initial version * docs(bezier-icons): update readme * feat(bezier-icons): update icons * chore(bezier-icons): add dev script * chore: fix release script and make dev script to run storybook * docs: update readme.md
1 parent d6f35d4 commit 0291f4a

File tree

517 files changed

+4594
-34
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

517 files changed

+4594
-34
lines changed

.changeset/clever-dragons-grin.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@channel.io/bezier-icons": minor
3+
---
4+
5+
First release

.github/CODEOWNERS

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@
66

77
/packages/bezier-figma-plugin/ @sungik-choi
88

9+
# Owner of bezier-icons
10+
11+
/packages/bezier-icons/ @sungik-choi
12+
913
# Owner of bezier-react
1014

1115
/packages/bezier-react/src/components/AutoFocus/ @sungik-choi

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
| Name | Description |
1010
|---|---|
1111
| [bezier-react](packages/bezier-react) | React components library that implements Bezier Design System. |
12+
| [bezier-icons](packages/bezier-icons) | Icon library that implements the Bezier Design System. |
1213
| [bezier-figma-plugin](packages/bezier-figma-plugin) | Figma plugin that helps build Bezier Design System and increase productivity. |
1314

1415
## Commands
@@ -34,21 +35,20 @@ yarn build --filter=<workspace>
3435
### Run Storybook
3536

3637
```bash
37-
yarn storybook
38+
yarn dev
3839
```
3940

4041
### Other Commands
4142

4243
| Command | Description |
4344
|---|---|
44-
| `yarn dev` | Runs Storybook and Builds Figma plugin in watch mode |
4545
| `yarn test` | Tests all workspaces |
4646
| `yarn lint` | Lints all workspaces |
47-
| `yarn typecheck` | Compiles `bezier-react` |
47+
| `yarn typecheck` | Type checks all workspaces |
4848
| `yarn clean` | Remove generated files |
4949
| `yarn update-snapshot` | Update test snapshots of `bezier-react` |
5050

51-
## Contribute
51+
## Contributing
5252

5353
See [contribution guide](CONTRIBUTING.md).
5454

package.json

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,13 @@
77
],
88
"scripts": {
99
"build": "turbo run build",
10-
"dev": "turbo run dev --no-cache --parallel",
10+
"dev": "turbo run dev --filter=@channel.io/bezier-react",
1111
"lint": "turbo run lint",
1212
"typecheck": "turbo run typecheck",
1313
"test": "turbo run test",
1414
"test:ci": "turbo run test:ci",
1515
"clean": "turbo run clean && rm -rf node_modules .turbo",
16-
"release": "turbo run build --filter=@channel.io/bezier-react && changeset publish",
17-
"storybook": "yarn workspace @channel.io/bezier-react storybook",
16+
"release": "turbo run build --filter='@channel.io/*' && changeset publish",
1817
"update-snapshot": "yarn workspace @channel.io/bezier-react update-snapshot",
1918
"pre-commit": "run-s verify lint-staged typecheck test",
2019
"verify": "ts-node -P ./supports/tsconfig/script.json ./scripts/check-yarn-version.ts",

packages/bezier-figma-plugin/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ Open the Figma desktop app
1818
Plugins > Development > Import plugin from manifest
1919
```
2020

21-
## Contribute
21+
## Contributing
2222

2323
See [contribution guide](../../CONTRIBUTING.md).
2424

packages/bezier-figma-plugin/package.json

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,12 @@
22
"name": "bezier-figma-plugin",
33
"version": "0.2.1",
44
"private": true,
5-
"description": "Figma plugin that helps build Bezier Design System and increase productivity.",
5+
"description": "Figma plugin that helps build the Bezier design system and increase productivity.",
6+
"repository": {
7+
"type": "git",
8+
"url": "https://github.com/channel-io/bezier-react",
9+
"directory": "packages/bezier-figma-plugin"
10+
},
611
"scripts": {
712
"build": "webpack --mode=production",
813
"dev": "webpack --mode=development --watch",

packages/bezier-icons/.eslintignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
node_modules
2+
dist

packages/bezier-icons/.eslintrc.js

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
module.exports = {
2+
root: true,
3+
extends: ['bezier'],
4+
parserOptions: {
5+
tsconfigRootDir: __dirname,
6+
project: './tsconfig.eslint.json',
7+
},
8+
rules: {
9+
'sort-imports': [
10+
'error',
11+
{
12+
ignoreDeclarationSort: true,
13+
},
14+
],
15+
'import/order': [
16+
'error',
17+
{
18+
'newlines-between': 'always',
19+
alphabetize: { order: 'asc' },
20+
groups: ['builtin', 'external', 'internal', 'parent', 'sibling', 'index'],
21+
pathGroupsExcludedImportTypes: ['react'],
22+
pathGroups: [
23+
{
24+
pattern: 'react',
25+
group: 'external',
26+
position: 'before',
27+
},
28+
],
29+
},
30+
],
31+
'react/react-in-jsx-scope': 'off',
32+
'react/jsx-props-no-spreading': 'off',
33+
'@typescript-eslint/naming-convention': 'off',
34+
},
35+
}
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"**/*.(js|ts)?(x)": "yarn lint"
3+
}

packages/bezier-icons/README.md

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
# Bezier Icons
2+
3+
Bezier Icons is a icon library that implements the Bezier Design System.
4+
5+
## Installation
6+
7+
1. (Recommend) Install `@channel.io/bezier-react` if you haven’t already.
8+
2. Install `@channel.io/bezier-icons` as a dependency.
9+
10+
### npm
11+
12+
```bash
13+
npm i @channel.io/bezier-icons
14+
```
15+
16+
### yarn
17+
18+
```bash
19+
yarn add @channel.io/bezier-icons
20+
```
21+
22+
## Usage
23+
24+
All icons are available as individual React components. We recommend using them with the `Icon` component from our `@channel.io/bezier-react` library.
25+
26+
```tsx
27+
import { Icon } from '@channel.io/bezier-react'
28+
import { AllIcon } from '@channel.io/bezier-icons'
29+
30+
function Component() {
31+
return (
32+
<div>
33+
<Icon source={AllIcon} />
34+
</div>
35+
);
36+
}
37+
```
38+
39+
You can also use them individually.
40+
41+
```tsx
42+
import { AllIcon } from '@channel.io/bezier-icons'
43+
44+
function Component() {
45+
return (
46+
<div>
47+
<AllIcon />
48+
</div>
49+
);
50+
}
51+
```
52+
53+
If you need to validate the icon source component, use the utility function `isBezierIcon`.
54+
55+
```tsx
56+
import { isBezierIcon, AllIcon } from '@channel.io/bezier-icons'
57+
58+
console.log(isBezierIcon(AllIcon)) // true
59+
console.log(isBezierIcon(<svg />)) // false
60+
```
61+
62+
## Contributing
63+
64+
See [contribution guide](../../CONTRIBUTING.md).
65+
66+
## Maintainers
67+
68+
This package is mainly contributed by Channel Corp. Although feel free to contribution, or raise concerns!

packages/bezier-icons/babel.config.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
module.exports = {
2+
presets: [
3+
'@babel/preset-env',
4+
/**
5+
* Will use the native built-in instead of trying to polyfill behavior for any plugins that require one.
6+
* Remove the helper function for Object.assign.
7+
* @see https://babeljs.io/docs/babel-preset-react#usebuiltins
8+
*/
9+
['@babel/preset-react', { useBuiltIns: true }],
10+
['@babel/preset-typescript', { isTSX: true, allExtensions: true }],
11+
],
12+
}

packages/bezier-icons/icons/all.svg

Lines changed: 3 additions & 0 deletions
Loading

packages/bezier-icons/icons/android.svg

Lines changed: 3 additions & 0 deletions
Loading

packages/bezier-icons/icons/api.svg

Lines changed: 3 additions & 0 deletions
Loading

packages/bezier-icons/icons/app-check.svg

Lines changed: 3 additions & 0 deletions
Loading

packages/bezier-icons/icons/app-plus.svg

Lines changed: 3 additions & 0 deletions
Loading

packages/bezier-icons/icons/app-push.svg

Lines changed: 3 additions & 0 deletions
Loading

packages/bezier-icons/icons/apple.svg

Lines changed: 3 additions & 0 deletions
Loading

packages/bezier-icons/icons/apps-add.svg

Lines changed: 3 additions & 0 deletions
Loading

packages/bezier-icons/icons/apps-filled.svg

Lines changed: 3 additions & 0 deletions
Loading

0 commit comments

Comments
 (0)