-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
127 additions
and
33 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,100 @@ | ||
# Contribution Guidelines | ||
|
||
## Prerequisites | ||
|
||
The development is enclosed in a container, you'll only need [podman](https://podman.io/) to be installed. Everything will be run calling the `dev.sh` script, which will take care of building the container and providing a standardized environment for every need. | ||
|
||
## Run a development environment | ||
|
||
You can start Storybook: | ||
|
||
```bash | ||
./dev.sh | ||
``` | ||
|
||
This will build the image (if not already built), install `node_modules` and run the UI in development mode. You'll find it served at http://localhost:6006. The UI will be hot-reloaded on any change. | ||
|
||
### Accessing the container | ||
|
||
To access the container's shell, run | ||
|
||
```bash | ||
./dev.sh bash | ||
``` | ||
|
||
With `bash` you can replace any command you want to run inside the container, bash since it's an interactive command will keep the container open. The only special command is `build`, which will rebuild the container even if it already exists. | ||
|
||
## IDE support | ||
|
||
Due to the usage of podman, you need to configure the IDE to use `podman` instead of `docker` as container runtime. | ||
|
||
Following instructions are for VSCode, which is the recommended IDE. You need to install the [Remote Containers](https://marketplace.visualstudio.com/items?itemName=ms-vscode-remote.remote-containers) extension and configure it to use `podman` as container runtime. | ||
|
||
You can do this by going to `File > Preferences > Settings`, search `dev containers docker path` and type `podman` as `Docker path`. | ||
|
||
This will provide the same environment as it's been called through `./dev.sh`. | ||
|
||
## Quality Standards | ||
|
||
### Code Style | ||
|
||
Code style is enforced by [ESLint](https://eslint.org/) and [Prettier](https://prettier.io/). You can run the linter with: | ||
|
||
```bash | ||
./dev.sh npm run lint | ||
``` | ||
|
||
and to format the code: | ||
|
||
```bash | ||
./dev.sh npm run format | ||
``` | ||
|
||
During PRs the linter will be run automatically and report any error. | ||
|
||
### Commit messages | ||
|
||
Commit messages MUST follow the [Conventional Commits](https://www.conventionalcommits.org/en/v1.0.0/) specification. During development on a branch you can avoid this format IF you plan to squash the commits before merging the PR, in this case the final commit message MUST follow the specification. | ||
|
||
## Building the library | ||
|
||
To ensure that the build is agnostic to the environment, it's run inside a container. You can build the components with: | ||
|
||
```bash | ||
./build.sh dist | ||
``` | ||
|
||
the result will be put in the `dist` folder. | ||
|
||
## Building the storybook | ||
|
||
To build the storybook, run: | ||
|
||
```bash | ||
./build.sh storybook | ||
``` | ||
|
||
the result will be put in the `storybook-static` folder, which can be served with any web server. | ||
|
||
## Publishing the library | ||
|
||
To publish the library, a GitHub action in provided in `.github/workflows/publish.yml`, when you're ready to publish, just manually trigger the action, this will open a PR with the following changes: | ||
|
||
- Changelog | ||
- Package version automatically bumped based off the commit messages | ||
|
||
Once the PR is merged, the action will automatically generate the release, tag the new version and publish the package to NPM. | ||
|
||
### Manual publishing | ||
|
||
To publish the library manually, you'll need to have a NPM account with write access to the package. You'll need to follow this procedure: | ||
|
||
- write a changelog entry in `CHANGELOG.md` | ||
- bump the version in `package.json` and `package-lock.json` | ||
- build the library using the command provided in [Building the library](#building-the-library) | ||
|
||
Finally, publish the library with: | ||
|
||
```bash | ||
npm publish | ||
``` |
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,46 +1,40 @@ | ||
# @nethesis/vue-components | ||
|
||
This template should help get you started developing with Vue 3 in Vite. | ||
This library contains a set of Vue components used in Nethesis products. | ||
|
||
## Recommended IDE Setup | ||
## Installation | ||
|
||
[VSCode](https://code.visualstudio.com/) + [Volar](https://marketplace.visualstudio.com/items?itemName=Vue.volar) (and disable Vetur) + [TypeScript Vue Plugin (Volar)](https://marketplace.visualstudio.com/items?itemName=Vue.vscode-typescript-vue-plugin). | ||
|
||
## Type Support for `.vue` Imports in TS | ||
|
||
TypeScript cannot handle type information for `.vue` imports by default, so we replace the `tsc` CLI with `vue-tsc` for type checking. In editors, we need [TypeScript Vue Plugin (Volar)](https://marketplace.visualstudio.com/items?itemName=Vue.vscode-typescript-vue-plugin) to make the TypeScript language service aware of `.vue` types. | ||
|
||
If the standalone TypeScript plugin doesn't feel fast enough to you, Volar has also implemented a [Take Over Mode](https://github.com/johnsoncodehk/volar/discussions/471#discussioncomment-1361669) that is more performant. You can enable it by the following steps: | ||
|
||
1. Disable the built-in TypeScript Extension | ||
1) Run `Extensions: Show Built-in Extensions` from VSCode's command palette | ||
2) Find `TypeScript and JavaScript Language Features`, right click and select `Disable (Workspace)` | ||
2. Reload the VSCode window by running `Developer: Reload Window` from the command palette. | ||
|
||
## Customize configuration | ||
|
||
See [Vite Configuration Reference](https://vitejs.dev/config/). | ||
|
||
## Project Setup | ||
You can add this library via npm: | ||
|
||
```sh | ||
npm install | ||
npm install @nethesis/vue-components | ||
``` | ||
|
||
### Compile and Hot-Reload for Development | ||
|
||
```sh | ||
npm run dev | ||
Then, before using them, you need to update the `tailwind.config.js/ts` with the following lines: | ||
|
||
```js | ||
export default { | ||
// ... | ||
presets: [require('@nethesis/vue-components/tailwind.config.ts')], | ||
content: [ | ||
// ... | ||
'./node_modules/@nethesis/vue-components/dist/**/*.js', | ||
// ... | ||
], | ||
// ... | ||
} | ||
``` | ||
|
||
### Type-Check, Compile and Minify for Production | ||
the preset is optional, however it is recommended to inherit the correct theme for the components. | ||
|
||
```sh | ||
npm run build | ||
``` | ||
You can still override the theme adding your customizations, more info can be found in the [Tailwind documentation](https://tailwindcss.com/docs/presets). | ||
|
||
### Lint with [ESLint](https://eslint.org/) | ||
After this, you're golden! You can browse the [Storybook](https://nethesis.github.io/vue-components) to see the available components and their usage. | ||
|
||
```sh | ||
npm run lint | ||
``` | ||
## Contributing | ||
|
||
You can read the [contributing guidelines](CONTRIBUTING.md) to know how to contribute to this project. | ||
|
||
## License | ||
|
||
All the repo is licensed under [GPL 3.0 or later](LICENSE) license. |