@unbabel/samora-vue3-components 0.0.4 → 0.1.1
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 +155 -5
- package/package.json +3 -2
- package/vue3-components.es.js +2197 -1833
- package/vue3-components.umd.js +3 -2
- package/style.css +0 -1
package/README.md
CHANGED
|
@@ -1,9 +1,159 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Samora Vue3 Components
|
|
2
2
|
|
|
3
|
-
This
|
|
3
|
+
This is the Unbabel Design System Vue3 component library.
|
|
4
4
|
|
|
5
|
-
##
|
|
5
|
+
## Table of Contents
|
|
6
6
|
|
|
7
|
-
- [
|
|
7
|
+
- [Table of Contents](#table-of-contents)
|
|
8
|
+
- [Prerequisites](#prerequisites)
|
|
9
|
+
- [Install](#install)
|
|
10
|
+
- [Usage](#usage)
|
|
11
|
+
- [Uncompiled version](#uncompiled-version)
|
|
12
|
+
- [Compiled as UMD](#compiled-as-umd)
|
|
13
|
+
- [Compiled as Web Components](#compiled-as-web-components)
|
|
14
|
+
- [Compiled as ES module](#compiled-as-es-module)
|
|
15
|
+
- [Other build modes](#other-build-modes)
|
|
16
|
+
- [Compiled as CommonJS](#compiled-as-commonjs)
|
|
17
|
+
- [Troubleshooting](#troubleshooting)
|
|
18
|
+
- [Components List](#components-list)
|
|
19
|
+
- [UI preview](#ui-preview)
|
|
20
|
+
- [Development](#development)
|
|
21
|
+
- [Testing](#testing)
|
|
22
|
+
- [Guidelines](#guidelines)
|
|
23
|
+
- [How to release a new version](#how-to-release-a-new-version)
|
|
8
24
|
|
|
9
|
-
|
|
25
|
+
## Prerequisites
|
|
26
|
+
⚠️ **Requires node >= 20** ⚠️
|
|
27
|
+
|
|
28
|
+
## Install
|
|
29
|
+
**1) Install it using `npm`**
|
|
30
|
+
|
|
31
|
+
```shell
|
|
32
|
+
npm i --save @unbabel/samora-vue3-components
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
**2) Add Erik Meyer's CSS reset to your App, which can be found [here](https://meyerweb.com/eric/tools/css/reset/), so that all CSS styles are rendered properly.**
|
|
36
|
+
|
|
37
|
+
## Usage
|
|
38
|
+
There are currently 4 (tested) ways of using Samora:
|
|
39
|
+
|
|
40
|
+
### Uncompiled version
|
|
41
|
+
Install Samora via NPM, saving it as a dependency
|
|
42
|
+
```shell
|
|
43
|
+
npm i --save @unbabel/samora-vue3-components
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
Import the components into your app using:
|
|
47
|
+
|
|
48
|
+
```vue
|
|
49
|
+
<script setup>
|
|
50
|
+
import { SamButton } from '@unbabel/samora-vue3-components';
|
|
51
|
+
</script>
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
And set it as a component on VueJS:
|
|
55
|
+
```vue
|
|
56
|
+
<template>
|
|
57
|
+
<SamButton label="CLICK ME" />
|
|
58
|
+
</template>
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
### Compiled as UMD
|
|
62
|
+
Import Samora as a script from one of the CDN providers with the appropriate version you want to include on your project
|
|
63
|
+
```javascript
|
|
64
|
+
// UMD
|
|
65
|
+
<script src="https://unpkg.com/@unbabel/samora-vue3-components@0.1.0/vue3-components.umd.js"></script>
|
|
66
|
+
|
|
67
|
+
// or ES
|
|
68
|
+
<script src="https://unpkg.com/@unbabel/samora-vue3-components@0.1.0/vue3-components.es.js"></script>
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
If you are using import maps, you can also add this library to it:
|
|
72
|
+
|
|
73
|
+
```json
|
|
74
|
+
{
|
|
75
|
+
"@unbabel/samora-vue3-components": "https://unpkg.com/@unbabel/samora-vue3-components@0.1.0/vue3-components.umd.js"
|
|
76
|
+
}
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
## Documentation preview
|
|
80
|
+
|
|
81
|
+
The library preview can be found [here](https://samora.unbabel.com/) along with the documentation on how to use the components
|
|
82
|
+
|
|
83
|
+
## Development
|
|
84
|
+
|
|
85
|
+
### Guidelines
|
|
86
|
+
Be sure to follow [Samora Operational Guidelines](https://gitlab.com/Unbabel/frontend-tribe/frontend-tribe/-/wikis/Samora) on the Frontend Tribe's wiki
|
|
87
|
+
|
|
88
|
+
### Process
|
|
89
|
+
1. From the main branch, get the latest changes from remote - `git pull origin main`
|
|
90
|
+
2. Create a new feature branch prefixed with the jira ticket id - `git checkout -b UFE-1234/brief-description`
|
|
91
|
+
3. Update package version (follow the [Samora Operational Guidelines](https://gitlab.com/Unbabel/frontend-tribe/frontend-tribe/-/wikis/Samora) to decide the type of version) - `npm version <major|minor|patch>`
|
|
92
|
+
4. Push your first commit and create an MR marking it as draft
|
|
93
|
+
5. Develop the solution for your task (Don't forget to add tests!)
|
|
94
|
+
6. Once the implementation is completed, mark your MR as ready and submit it for review
|
|
95
|
+
7. Merge MR and back to the first step
|
|
96
|
+
|
|
97
|
+
⚠️ Commits messages to follow the following format:\
|
|
98
|
+
**"[vue3-components] custom message"**
|
|
99
|
+
|
|
100
|
+
### Running your local environment
|
|
101
|
+
To develop or add new components, install the project dependencies and launch [Storybook](https://storybook.js.org/) server to preview your components:
|
|
102
|
+
|
|
103
|
+
```shell
|
|
104
|
+
npm i
|
|
105
|
+
npm run storybook
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
Don't forget to "register" your new component on the `src/components/index.ts` file.
|
|
109
|
+
If this is not done, even if the component has been coded, it won't be available to be used.
|
|
110
|
+
|
|
111
|
+
### Implementing a new component
|
|
112
|
+
- Following the [Atomic Design principles](https://bradfrost.com/blog/post/atomic-web-design/), identify the type of component you are going to develop
|
|
113
|
+
- Create a new folder ```src/components/<ComponentType>/<NewComponentName```
|
|
114
|
+
- In the _<NewComponentFolder\>_ implement the following:
|
|
115
|
+
- _<NewComponentName\>_**.stories.ts**
|
|
116
|
+
- _<NewComponentName\>_**.types.ts**
|
|
117
|
+
- _<NewComponentName\>_**.vue**
|
|
118
|
+
- **\_\_tests__**/_<NewComponentName\>_**.spec.ts**
|
|
119
|
+
- Register your component (as previously mentioned)
|
|
120
|
+
- `src/components/index.ts` **import** and **export** _<NewComponentName\>_
|
|
121
|
+
|
|
122
|
+
## Testing a component
|
|
123
|
+
### Running all tests
|
|
124
|
+
`npm run test` or `npm run test:ui` to get a prettier visualisation.
|
|
125
|
+
|
|
126
|
+
### Running specific test
|
|
127
|
+
`vitest --run --testNamePattern=<describeName>.<testCaseName> <ComponentName>.spec.ts`
|
|
128
|
+
|
|
129
|
+
#### ⚠️ Running tests from IDEs shortcuts ⚠️
|
|
130
|
+
Ensure that your IDE terminal is configured to run on node >= 20
|
|
131
|
+
|
|
132
|
+
## Testing your builds
|
|
133
|
+
This Samora module creates two builds
|
|
134
|
+
|
|
135
|
+
### Samora documentation
|
|
136
|
+
- Build `npm run storybook:build`
|
|
137
|
+
- Test `cd storybook-static && hostr --port 11000`
|
|
138
|
+
|
|
139
|
+
### Vue3 components package
|
|
140
|
+
- Build `npm run build`
|
|
141
|
+
- Package Build `cp package.json dist && cd dist && npm pack`
|
|
142
|
+
- Test Package in your vue3 app `npm i <absolutePathToDistFolder>/unbabel-samora-vue3-components-<version>.tgz`
|
|
143
|
+
|
|
144
|
+
## How to release a new version
|
|
145
|
+
|
|
146
|
+
1. Ensure your main branch has the latest changes - `npm pull origin main`
|
|
147
|
+
2. Create a tag to match the new npm version in your package.json - `git tag vue3-components/vX.Y.Z`
|
|
148
|
+
3. Push the new Gitlab tag - `git push origin tag vX.Y.Z`
|
|
149
|
+
4. The CI will pick up the new tag and initiate the process of deployment,
|
|
150
|
+
with needs to be finalised by manually triggering the components package
|
|
151
|
+
deployment to NPM and the documentation (storybook) updates to aws
|
|
152
|
+
([Samora Gitlab's Pipelines](https://gitlab.com/Unbabel/frontend/samora/-/pipelines))
|
|
153
|
+
5. Open the last step of the pipeline (Release Notes -
|
|
154
|
+
[example](https://gitlab.com/Unbabel/frontend/samora/-/jobs/7733828939)) and copy the changelog outputted in the console
|
|
155
|
+
6. Go to the [Tags page on Samora](https://gitlab.com/Unbabel/frontend/samora/-/tags)
|
|
156
|
+
7. Click on 'Create Release' button for the tag just deployed
|
|
157
|
+
8. Paste & manually prettify the changelog and save
|
|
158
|
+
9. Manually share the release in the #samora Slack channel
|
|
159
|
+
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@unbabel/samora-vue3-components",
|
|
3
3
|
"description": "Samora - the Unbabel design system - Vue3 components",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.1.1",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./vue3-components.umd.js",
|
|
7
7
|
"module": "./vue3-components.es.js",
|
|
@@ -67,8 +67,8 @@
|
|
|
67
67
|
"eslint-plugin-vuejs-accessibility": "^2.3.0",
|
|
68
68
|
"glob": "^10.4.1",
|
|
69
69
|
"globals": "^15.3.0",
|
|
70
|
-
"prettier": "^3.3.1",
|
|
71
70
|
"jsdom": "^24.1.0",
|
|
71
|
+
"prettier": "^3.3.1",
|
|
72
72
|
"rimraf": "^5.0.7",
|
|
73
73
|
"rollup": "^4.18.0",
|
|
74
74
|
"rollup-plugin-typescript2": "^0.36.0",
|
|
@@ -80,6 +80,7 @@
|
|
|
80
80
|
"typescript": "^5.2.2",
|
|
81
81
|
"typescript-eslint": "^7.11.0",
|
|
82
82
|
"vite": "^5.2.0",
|
|
83
|
+
"vite-plugin-css-injected-by-js": "^3.5.1",
|
|
83
84
|
"vite-plugin-sass": "^0.1.0",
|
|
84
85
|
"vite-svg-loader": "^5.1.0",
|
|
85
86
|
"vitest": "^1.6.0",
|