Skip to content

Commit 853a612

Browse files
committed
Update version to 0.2.1, add build example script, and update README for package name. Introduce Vite configuration and GitHub Pages deployment workflow.
1 parent 669b9bf commit 853a612

7 files changed

Lines changed: 125 additions & 8 deletions

File tree

.github/workflows/pages.yml

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
name: Deploy example to GitHub Pages
2+
3+
on:
4+
push:
5+
branches: [main]
6+
workflow_dispatch:
7+
8+
permissions:
9+
contents: read
10+
pages: write
11+
id-token: write
12+
13+
# Only one deployment runs at a time; a new push cancels the in-progress one.
14+
concurrency:
15+
group: pages
16+
cancel-in-progress: true
17+
18+
jobs:
19+
deploy:
20+
environment:
21+
name: github-pages
22+
url: ${{ steps.deployment.outputs.page_url }}
23+
runs-on: ubuntu-latest
24+
25+
steps:
26+
- name: Checkout
27+
uses: actions/checkout@v4
28+
29+
- name: Set up Node
30+
uses: actions/setup-node@v4
31+
with:
32+
node-version: 20
33+
cache: npm
34+
35+
- name: Install dependencies
36+
run: npm ci
37+
38+
- name: Build example
39+
run: npm run build:example
40+
41+
- name: Configure Pages
42+
uses: actions/configure-pages@v4
43+
44+
- name: Upload artifact
45+
uses: actions/upload-pages-artifact@v3
46+
with:
47+
path: dist-example
48+
49+
- name: Deploy to GitHub Pages
50+
id: deployment
51+
uses: actions/deploy-pages@v4

README.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# react-jq-cloud
1+
# @basone01/react-jq-cloud
22

33
A React + TypeScript word cloud component based on the layout algorithm from [jQCloud](https://github.com/lucaong/jQCloud).
44

@@ -31,7 +31,7 @@ Words are placed on a spiral (elliptic or rectangular) starting from the center
3131
## Installation
3232

3333
```bash
34-
npm install react-jq-cloud
34+
npm install @basone01/react-jq-cloud
3535
```
3636

3737
Peer dependencies (`react` and `react-dom` ≥ 17) must already be installed in your project.
@@ -41,8 +41,8 @@ Peer dependencies (`react` and `react-dom` ≥ 17) must already be installed in
4141
## Quick start
4242

4343
```tsx
44-
import { WordCloud } from 'react-jq-cloud';
45-
import 'react-jq-cloud/styles.css';
44+
import { WordCloud } from '@basone01/react-jq-cloud';
45+
import '@basone01/react-jq-cloud/styles.css';
4646

4747
const words = [
4848
{ text: 'React', weight: 10 },
@@ -102,7 +102,7 @@ interface Word {
102102

103103
### CSS weight classes
104104

105-
When you import `react-jq-cloud/styles.css` each word receives a class `w1``w10` (1 = lightest, 10 = heaviest). You can override these classes in your own stylesheet:
105+
When you import `@basone01/react-jq-cloud/styles.css` each word receives a class `w1``w10` (1 = lightest, 10 = heaviest). You can override these classes in your own stylesheet:
106106

107107
```css
108108
/* your-styles.css */
@@ -277,8 +277,8 @@ Contributions are welcome — bug reports, feature requests, and pull requests a
277277
### Development setup
278278

279279
```bash
280-
git clone https://github.com/your-org/react-jq-cloud.git
281-
cd react-jq-cloud
280+
git clone https://github.com/basone01/react-jq-cloud.git
281+
cd react-jq-cloud # or your fork
282282
npm install
283283
```
284284

dist-example/assets/index-DB0nGE1w.js

Lines changed: 40 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist-example/assets/index-DPvf6Mmb.css

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist-example/index.html

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8" />
5+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
6+
<title>React JQCloud — Example</title>
7+
<script type="module" crossorigin src="/assets/index-DB0nGE1w.js"></script>
8+
<link rel="stylesheet" crossorigin href="/assets/index-DPvf6Mmb.css">
9+
</head>
10+
<body>
11+
<div id="root"></div>
12+
</body>
13+
</html>

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@basone01/react-jq-cloud",
3-
"version": "0.2.0",
3+
"version": "0.2.1",
44
"description": "React word cloud component based on jQCloud layout algorithm",
55
"keywords": [
66
"react",
@@ -30,6 +30,7 @@
3030
"test": "vitest run",
3131
"test:watch": "vitest",
3232
"example": "vite example",
33+
"build:example": "vite build example --outDir ../dist-example --emptyOutDir",
3334
"typecheck": "tsc --noEmit",
3435
"prepublishOnly": "npm run build"
3536
},

vite.config.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
import { defineConfig } from 'vite';
2+
import react from '@vitejs/plugin-react';
3+
4+
// When building in GitHub Actions, set base to the repo name so all asset
5+
// paths are relative to https://basone01.github.io/react-jq-cloud/
6+
const base = process.env.GITHUB_ACTIONS ? '/react-jq-cloud/' : '/';
7+
8+
export default defineConfig({
9+
plugins: [react()],
10+
base,
11+
});

0 commit comments

Comments
 (0)