@selfeesas/shared-components 0.3.10 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +233 -1
- package/package.json +21 -2
package/README.md
CHANGED
|
@@ -1 +1,233 @@
|
|
|
1
|
-
#
|
|
1
|
+
# 🧩 @selfeesas/shared-components
|
|
2
|
+
|
|
3
|
+
A component library for sharing UI components across Selfeesas company projects. Built on Vue 3 and Quasar, optimized for Vite.
|
|
4
|
+
|
|
5
|
+
[](https://www.npmjs.com/package/@selfeesas/shared-components)
|
|
6
|
+
[](https://selfeesas.github.io/SharedUI)
|
|
7
|
+
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
## 🚀 Features
|
|
11
|
+
|
|
12
|
+
- 🔁 Reusable components for multiple projects
|
|
13
|
+
- ⚡ Built on Vue 3 + Quasar + Vite
|
|
14
|
+
- 📚 Storybook for visual documentation
|
|
15
|
+
- 🎯 TypeScript support
|
|
16
|
+
- ✅ Installable via npm
|
|
17
|
+
- 🔧 Automated CI/CD, including Semantic Release, SonarCloud, and Storybook GH Pages
|
|
18
|
+
|
|
19
|
+
---
|
|
20
|
+
|
|
21
|
+
## 📦 Installation
|
|
22
|
+
|
|
23
|
+
```bash
|
|
24
|
+
npm install @selfeesas/shared-components
|
|
25
|
+
# or
|
|
26
|
+
yarn add @selfeesas/shared-components
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
> Ensure that `vue`, `vue-router`, and `quasar` are already installed in your project.
|
|
30
|
+
|
|
31
|
+
---
|
|
32
|
+
|
|
33
|
+
## ⚙️ Requirements
|
|
34
|
+
|
|
35
|
+
| Package | Version |
|
|
36
|
+
| ---------- | --------- |
|
|
37
|
+
| Vue | `^3.5.16` |
|
|
38
|
+
| Vue Router | `^4.5.1` |
|
|
39
|
+
| Quasar | `^2.18.1` |
|
|
40
|
+
|
|
41
|
+
---
|
|
42
|
+
|
|
43
|
+
## 🔧 Usage
|
|
44
|
+
|
|
45
|
+
```ts
|
|
46
|
+
import { SharedButton } from "@selfeesas/shared-components";
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
Now you can use the components in your Vue templates:
|
|
50
|
+
|
|
51
|
+
```vue
|
|
52
|
+
<template>
|
|
53
|
+
<SharedButton label="Click me" />
|
|
54
|
+
</template>
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
---
|
|
58
|
+
|
|
59
|
+
## 🧱 Available Components
|
|
60
|
+
|
|
61
|
+
> Examples are available in Storybook:
|
|
62
|
+
> 🔗 [https://selfeesas.github.io/SharedUI](https://selfeesas.github.io/SharedUI)
|
|
63
|
+
|
|
64
|
+
- `NavButton`
|
|
65
|
+
- `CustomTable`
|
|
66
|
+
- `SelectSearch`
|
|
67
|
+
- `DatePicker`
|
|
68
|
+
- and more...
|
|
69
|
+
|
|
70
|
+
---
|
|
71
|
+
|
|
72
|
+
## 📖 Storybook
|
|
73
|
+
|
|
74
|
+
📘 [Open Storybook](https://selfeesas.github.io/SharedUI)
|
|
75
|
+
|
|
76
|
+
Run locally:
|
|
77
|
+
|
|
78
|
+
```bash
|
|
79
|
+
npm run storybook
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
Build:
|
|
83
|
+
|
|
84
|
+
```bash
|
|
85
|
+
npm run build-storybook
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
---
|
|
89
|
+
|
|
90
|
+
## 🚨 Linting and Formatting
|
|
91
|
+
|
|
92
|
+
```bash
|
|
93
|
+
npm run lint # Run ESLint checks
|
|
94
|
+
npm run lint:fix # Fix ESLint errors
|
|
95
|
+
npm run format # Run Prettier + ESLint fix
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
---
|
|
99
|
+
|
|
100
|
+
## 🔁 CI/CD and Automation
|
|
101
|
+
|
|
102
|
+
- **GitHub Actions**: Linting, building, and deploying Storybook
|
|
103
|
+
- **Semantic Release**: Automated version releases
|
|
104
|
+
- **SonarCloud**: Static code analysis
|
|
105
|
+
|
|
106
|
+
---
|
|
107
|
+
|
|
108
|
+
## 🧑💻 Developer Guide
|
|
109
|
+
|
|
110
|
+
### CI/CD Pipeline Overview
|
|
111
|
+
|
|
112
|
+
The CI/CD pipeline is defined in `.github/workflows/main.yml` and automates linting, building, testing, versioning, and deployment. It uses GitHub Actions and is triggered on:
|
|
113
|
+
|
|
114
|
+
- **Pushes** to the `main` branch
|
|
115
|
+
- **Pull requests** targeting the `main` branch
|
|
116
|
+
- **Releases** created in the repository
|
|
117
|
+
|
|
118
|
+
#### Pipeline Jobs
|
|
119
|
+
|
|
120
|
+
1. **Lint and Build**:
|
|
121
|
+
- Checks out the code and sets up Node.js (v20).
|
|
122
|
+
- Installs dependencies with `npm ci`.
|
|
123
|
+
- Runs ESLint with `npm run lint -- --max-warnings=0` to enforce code quality.
|
|
124
|
+
- Builds the package with `npm run build`.
|
|
125
|
+
|
|
126
|
+
2. **Semantic Release** (runs only on `main` branch):
|
|
127
|
+
- Uses `cycjimmy/semantic-release-action` to automate versioning and releases.
|
|
128
|
+
- Analyzes commit messages following the **Conventional Commits** format:
|
|
129
|
+
- `fix`: Patches (e.g., `1.0.1`)
|
|
130
|
+
- `feat`: Minor updates (e.g., `1.1.0`)
|
|
131
|
+
- `BREAKING CHANGE`: Major updates (e.g., `2.0.0`)
|
|
132
|
+
- Automatically updates the version in `package.json`.
|
|
133
|
+
- Generates or updates the `CHANGELOG.md` based on commit messages.
|
|
134
|
+
- Publishes the package to npm using the `NPM_TOKEN`.
|
|
135
|
+
- Creates a GitHub release with the new version.
|
|
136
|
+
|
|
137
|
+
3. **Deploy Storybook** (runs only on `main` branch):
|
|
138
|
+
- Builds Storybook with `npx storybook build`.
|
|
139
|
+
- Deploys the static Storybook site to GitHub Pages using `peaceiris/actions-gh-pages`.
|
|
140
|
+
|
|
141
|
+
4. **SonarCloud**:
|
|
142
|
+
- Runs static code analysis with SonarCloud to detect bugs, vulnerabilities, and code smells.
|
|
143
|
+
- Requires `SONAR_TOKEN` for authentication.
|
|
144
|
+
|
|
145
|
+
#### How to Work with the Pipeline
|
|
146
|
+
|
|
147
|
+
- **Commit Messages**: Use Conventional Commits to ensure Semantic Release works correctly. See the [Conventional Commits](#conventional-commits) section below for details.
|
|
148
|
+
- **Local Testing**: Before pushing, run `npm run lint`, `npm run build`, and `npm run storybook` locally to catch issues early.
|
|
149
|
+
- **Changelog**: The `CHANGELOG.md` is auto-generated by Semantic Release. Do not edit it manually.
|
|
150
|
+
- **Storybook Deployment**: Updates to Storybook are automatically deployed to [https://selfeesas.github.io/SharedUI](https://selfeesas.github.io/SharedUI) on `main` branch pushes.
|
|
151
|
+
|
|
152
|
+
#### Troubleshooting
|
|
153
|
+
|
|
154
|
+
- **Pipeline Fails on Lint**: Run `npm run lint:fix` locally and commit fixes.
|
|
155
|
+
- **Semantic Release Skips Versioning**: Ensure commit messages follow Conventional Commits. Check the pipeline logs for details.
|
|
156
|
+
- **Storybook Deployment Fails**: Verify the `storybook-static` directory is generated correctly with `npm run build-storybook`.
|
|
157
|
+
- **SonarCloud Issues**: Check SonarCloud logs for specific issues and ensure `SONAR_TOKEN` is valid.
|
|
158
|
+
|
|
159
|
+
### Conventional Commits
|
|
160
|
+
|
|
161
|
+
To ensure proper versioning and changelog generation, all commits must follow the [Conventional Commits specification](https://www.conventionalcommits.org/en/v1.0.0/). This standardizes commit messages to make them machine-readable for Semantic Release.
|
|
162
|
+
|
|
163
|
+
#### Commit Message Structure
|
|
164
|
+
|
|
165
|
+
A commit message consists of a **type**, optional **scope**, optional **!** for breaking changes, and a **description**. The format is:
|
|
166
|
+
|
|
167
|
+
```
|
|
168
|
+
<type>(<scope>): <description>
|
|
169
|
+
[optional body]
|
|
170
|
+
[optional footer(s)]
|
|
171
|
+
```
|
|
172
|
+
|
|
173
|
+
- **type**: Indicates the nature of the change (e.g., `fix`, `feat`, `docs`, `style`, `refactor`, `test`, `chore`).
|
|
174
|
+
- **scope**: Specifies the part of the codebase affected (e.g., `SharedButton`, `SharedModal`).
|
|
175
|
+
- **!**: Denotes a breaking change (triggers a major version bump).
|
|
176
|
+
- **description**: A concise summary of the change.
|
|
177
|
+
- **body**: Additional context (optional).
|
|
178
|
+
- **footer**: Metadata like `BREAKING CHANGE:` or issue references (optional).
|
|
179
|
+
|
|
180
|
+
#### Examples
|
|
181
|
+
|
|
182
|
+
- **Fix (Patch Release)**:
|
|
183
|
+
```
|
|
184
|
+
fix(SharedButton): resolve alignment issue in dark mode
|
|
185
|
+
```
|
|
186
|
+
- Triggers a patch release (e.g., `1.0.0` → `1.0.1`).
|
|
187
|
+
|
|
188
|
+
- **Feature (Minor Release)**:
|
|
189
|
+
```
|
|
190
|
+
feat(SharedDropdown): add support for multi-select
|
|
191
|
+
```
|
|
192
|
+
- Triggers a minor release (e.g., `1.0.0` → `1.1.0`).
|
|
193
|
+
|
|
194
|
+
- **Breaking Change (Major Release)**:
|
|
195
|
+
```
|
|
196
|
+
feat(SharedModal): add new props for customization
|
|
197
|
+
BREAKING CHANGE: removed deprecated `size` prop
|
|
198
|
+
```
|
|
199
|
+
- Triggers a major release (e.g., `1.0.0` → `2.0.0`).
|
|
200
|
+
|
|
201
|
+
- **Documentation Update**:
|
|
202
|
+
```
|
|
203
|
+
docs(readme): update installation instructions
|
|
204
|
+
```
|
|
205
|
+
- Does not trigger a release but updates the changelog.
|
|
206
|
+
|
|
207
|
+
- **Scoped Chore**:
|
|
208
|
+
```
|
|
209
|
+
chore(deps): update Quasar to 2.18.1
|
|
210
|
+
```
|
|
211
|
+
- Does not trigger a release but is included in the changelog.
|
|
212
|
+
|
|
213
|
+
#### Best Practices
|
|
214
|
+
|
|
215
|
+
- Keep descriptions concise and meaningful.
|
|
216
|
+
- Use the `!` or `BREAKING CHANGE:` footer for any change that requires users to update their code.
|
|
217
|
+
- Include a scope when possible to clarify the affected component or module.
|
|
218
|
+
- Avoid generic messages like `fix: bug`—be specific about the change.
|
|
219
|
+
- Run `git commit -m "type(scope): description"` or use a tool like [Commitizen](https://github.com/commitizen/cz-cli) for guided commit messages.
|
|
220
|
+
|
|
221
|
+
For full details, refer to the [Conventional Commits specification](https://www.conventionalcommits.org/en/v1.0.0/).
|
|
222
|
+
|
|
223
|
+
---
|
|
224
|
+
|
|
225
|
+
## 📄 License
|
|
226
|
+
|
|
227
|
+
MIT © Selfeesas
|
|
228
|
+
|
|
229
|
+
---
|
|
230
|
+
|
|
231
|
+
## 🧬 Repository
|
|
232
|
+
|
|
233
|
+
[https://github.com/selfeesas/SharedUI](https://github.com/selfeesas/SharedUI)
|
package/package.json
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
"registry": "https://registry.npmjs.org/"
|
|
5
5
|
},
|
|
6
6
|
"name": "@selfeesas/shared-components",
|
|
7
|
-
"version": "0.
|
|
7
|
+
"version": "0.4.0",
|
|
8
8
|
"release": {
|
|
9
9
|
"branches": [
|
|
10
10
|
"main"
|
|
@@ -22,6 +22,9 @@
|
|
|
22
22
|
"type": "git",
|
|
23
23
|
"url": "git+https://github.com/selfeesas/SharedUI.git"
|
|
24
24
|
},
|
|
25
|
+
"vitest": {
|
|
26
|
+
"environment": "jsdom"
|
|
27
|
+
},
|
|
25
28
|
"scripts": {
|
|
26
29
|
"prebuild": "rimraf dist",
|
|
27
30
|
"build": "vue-tsc --noEmit && vite build",
|
|
@@ -29,7 +32,11 @@
|
|
|
29
32
|
"build-storybook": "storybook build",
|
|
30
33
|
"lint": "eslint . --ext .ts,.vue",
|
|
31
34
|
"lint:fix": "eslint . --ext .ts,.vue --fix",
|
|
32
|
-
"format": "prettier --write . && eslint . --ext .vue,.ts --fix"
|
|
35
|
+
"format": "prettier --write . && eslint . --ext .vue,.ts --fix",
|
|
36
|
+
"test": "vitest run",
|
|
37
|
+
"test:watch": "vitest",
|
|
38
|
+
"test:coverage": "vitest run --coverage",
|
|
39
|
+
"test:ui": "vitest --ui"
|
|
33
40
|
},
|
|
34
41
|
"dependencies": {
|
|
35
42
|
"@quasar/extras": "^1.17.0",
|
|
@@ -51,15 +58,26 @@
|
|
|
51
58
|
"@storybook/addon-a11y": "^9.0.8",
|
|
52
59
|
"@storybook/addon-docs": "^9.0.14",
|
|
53
60
|
"@storybook/addon-vitest": "^9.0.8",
|
|
61
|
+
"@storybook/vue3": "^9.0.17",
|
|
54
62
|
"@storybook/vue3-vite": "^9.0.8",
|
|
63
|
+
"@testing-library/dom": "^10.4.0",
|
|
64
|
+
"@testing-library/jest-dom": "^6.6.3",
|
|
65
|
+
"@testing-library/user-event": "^14.6.1",
|
|
66
|
+
"@testing-library/vue": "^8.1.0",
|
|
55
67
|
"@types/node": "^24.0.3",
|
|
68
|
+
"@types/testing-library__jest-dom": "^5.14.9",
|
|
56
69
|
"@typescript-eslint/eslint-plugin": "^8.35.1",
|
|
57
70
|
"@typescript-eslint/parser": "^8.35.1",
|
|
58
71
|
"@vitejs/plugin-vue": "^5.2.3",
|
|
72
|
+
"@vitest/coverage-v8": "^3.2.4",
|
|
73
|
+
"@vitest/ui": "^3.2.4",
|
|
74
|
+
"@vue/test-utils": "^2.4.6",
|
|
59
75
|
"@vue/tsconfig": "^0.7.0",
|
|
60
76
|
"eslint": "^9.30.1",
|
|
61
77
|
"eslint-plugin-prettier": "^5.5.1",
|
|
62
78
|
"eslint-plugin-vue": "^10.3.0",
|
|
79
|
+
"exceljs": "^4.4.0",
|
|
80
|
+
"jsdom": "^26.1.0",
|
|
63
81
|
"prettier": "^3.6.2",
|
|
64
82
|
"rimraf": "^6.0.1",
|
|
65
83
|
"semantic-release": "^24.2.6",
|
|
@@ -67,6 +85,7 @@
|
|
|
67
85
|
"typescript": "~5.8.3",
|
|
68
86
|
"vite": "^6.3.5",
|
|
69
87
|
"vite-plugin-dts": "^4.5.4",
|
|
88
|
+
"vitest": "^3.2.4",
|
|
70
89
|
"vue-tsc": "^2.2.8"
|
|
71
90
|
}
|
|
72
91
|
}
|