Skip to content

Commit f9c2f33

Browse files
committed
chore: use vite instead webpack
1 parent 27f54a0 commit f9c2f33

30 files changed

Lines changed: 4528 additions & 44603 deletions

.github/workflows/ci.yml

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,22 +13,22 @@ jobs:
1313
- uses: actions/checkout@v4
1414
- uses: actions/setup-node@v4
1515
with:
16-
node-version: 18
16+
node-version: 24
1717
cache: 'npm'
1818
- run: npm install
19-
- run: npm install --prefix examples/react-webpack
20-
- run: npm install --prefix examples/vue-webpack
19+
- run: npm install --prefix examples/react-vite
20+
- run: npm install --prefix examples/vue-vite
2121
- run: npm run build
22-
- run: NODE_OPTIONS=--openssl-legacy-provider npm run build:examples
22+
- run: npm run build:examples
2323
- name: Prepare examples for deployment
2424
run: |
2525
mkdir gh-pages
2626
mv dist gh-pages/superhero-utils
2727
mv examples/*.html gh-pages/
28-
mkdir gh-pages/react-webpack
29-
mv examples/react-webpack/build gh-pages/react-webpack/build
30-
mkdir gh-pages/vue-webpack
31-
mv examples/vue-webpack/dist gh-pages/vue-webpack/dist
28+
mkdir gh-pages/react-vite
29+
mv examples/react-vite/build gh-pages/react-vite/build
30+
mkdir gh-pages/vue-vite
31+
mv examples/vue-vite/dist gh-pages/vue-vite/dist
3232
- uses: actions/upload-artifact@v4
3333
if: github.ref == 'refs/heads/master'
3434
with:

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -116,8 +116,8 @@ You need to install [Node.js](https://nodejs.org/) firstly.
116116

117117
```sh
118118
$ npm install
119-
$ npm install --prefix examples/react-webpack
120-
$ npm install --prefix examples/vue-webpack
119+
$ npm install --prefix examples/react-vite
120+
$ npm install --prefix examples/vue-vite
121121
$ npm start
122122
```
123123

examples/index.html

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
<h3>superhero-utils example using plain js</h3>
22

33
Other examples:
4-
<a href="./react-unpkg.html">react unpkg</a>, <a href="./react-webpack/build/">react webpack</a>,
4+
<a href="./react-unpkg.html">react unpkg</a>, <a href="./react-vite/dist/">react vite</a>,
55
<a href="./vue-unpkg.html">vue unpkg</a>,
6-
<a href="./vue-webpack/dist/">vue webpack</a>
6+
<a href="./vue-vite/dist/">vue vite</a>
77

88
<hr />
99
<div class="icon">Donate</div>
@@ -129,32 +129,34 @@ <h3>superhero-utils example using plain js</h3>
129129
senectus et netus et malesuada fames ac turpis egestas. Donec convallis non odio a commodo.
130130
</p>
131131

132-
<script src="./superhero-utils/index.js"></script>
133-
<script>
132+
<link rel="stylesheet" href="./superhero-utils/index.css" />
133+
<script type="module">
134+
import { createButton, ensurePaid } from './superhero-utils/index-without-styles.js';
135+
134136
const target = 'ak_gvxNbZf5CuxYVfcUFoKAP4geZatWaC2Yy4jpx5vZoCKank4Gc';
135137

136138
/*
137139
* Create superhero button instance by pointing element with its selector
138140
*/
139-
superheroUtils.createButton('.icon', target, { size: 'icon' });
140-
superheroUtils.createButton('.small', 2707, { size: 'small' });
141-
superheroUtils.createButton('.medium', 'nancyismyname.chain', { size: 'medium' });
141+
createButton('.icon', target, { size: 'icon' });
142+
createButton('.small', 2707, { size: 'small' });
143+
createButton('.medium', 'nancyismyname.chain', { size: 'medium' });
142144

143145
/*
144146
* Create superhero button instance by passing DOM element instance
145147
*/
146-
superheroUtils.createButton(document.querySelector('.large'), target, { size: 'large' });
148+
createButton(document.querySelector('.large'), target, { size: 'large' });
147149

148150
// Initialize button a.superhero-tip-button appears dynamically
149151
setTimeout(function () {
150152
var btn = document.createElement('div');
151153
document.body.appendChild(btn);
152-
superheroUtils.createButton(btn, target);
154+
createButton(btn, target);
153155
}, 5000);
154156

155157
document
156158
.querySelector('.ensure-paid')
157-
.addEventListener('click', () => superheroUtils.ensurePaid(target));
159+
.addEventListener('click', () => ensurePaid(target));
158160

159161
document
160162
.querySelector('.reset-paid-state')

examples/react-vite/index.html

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<!doctype html>
2+
<html>
3+
<head>
4+
<meta charset="UTF-8" />
5+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
6+
<title>superhero-utils react vite</title>
7+
</head>
8+
<body>
9+
<div id="app"></div>
10+
<script type="module" src="/src/main.jsx"></script>
11+
</body>
12+
</html>

0 commit comments

Comments
 (0)