Skip to content

Commit 1fa0763

Browse files
authored
Add documentation (#5)
2 parents 5ce68a1 + ad4062f commit 1fa0763

File tree

10 files changed

+739
-14
lines changed

10 files changed

+739
-14
lines changed

.github/workflows/ci.yml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,14 @@ jobs:
4545
needs: build
4646
if: github.event_name == 'release'
4747
runs-on: ubuntu-latest
48+
permissions:
49+
contents: read
50+
id-token: write
51+
pages: write
4852
steps:
53+
- name: Checkout repository
54+
uses: actions/checkout@v4
55+
4956
- name: Setup Node.js
5057
uses: actions/setup-node@v4
5158
with:
@@ -68,3 +75,18 @@ jobs:
6875
run: npm publish --provenance --access public
6976
env:
7077
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}
78+
79+
- name: Generate docs
80+
run: npm run docs
81+
82+
- name: Set up GitHub pages
83+
uses: actions/configure-pages@v4
84+
85+
- name: Upload docs artifact to pages
86+
uses: actions/upload-pages-artifact@v3
87+
with:
88+
path: docs
89+
90+
- name: Deploy to GitHub Pages
91+
id: deployment
92+
uses: actions/deploy-pages@v4

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
node_modules/
22
dist/
3+
docs/

README.md

Lines changed: 49 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,49 @@
1-
# components
2-
Base classes for web components
1+
# @cldn/components
2+
3+
Base classes for creating web components.
4+
5+
This library is intended for use in a web browser environment. A bundler, such as [Webpack](https://webpack.js.org/)
6+
or [Vite](https://vitejs.dev/) is recommended.
7+
8+
[**Documentation**](https://components.cldn.pro)
9+
10+
## Installation
11+
12+
```shell
13+
npm i @cldn/components
14+
```
15+
16+
## Usage
17+
18+
To create your own components, it's recommended to extend one of the classes provided in this library.
19+
20+
For example:
21+
22+
```ts
23+
import {Component} from "@cldn/components";
24+
25+
class ButtonComponent extends Component<HTMLButtonElement> {
26+
public constructor(text: string) {
27+
super("button");
28+
this.text(text)
29+
.class("bg-blue-500", "px-4", "");
30+
}
31+
}
32+
```
33+
34+
## Licence
35+
36+
Copyright © 2024 Cloudnode OÜ
37+
38+
This file is part of @cldn/components.
39+
40+
@cldn/components is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General
41+
Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any
42+
later version.
43+
44+
@cldn/components is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied
45+
warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
46+
details.
47+
48+
You should have received a copy of the GNU Lesser General Public License along with @cldn/components. If not,
49+
see https://www.gnu.org/licenses/.

0 commit comments

Comments
 (0)