create-vite-extra 0.1.0 → 0.1.2
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 +10 -0
- package/index.js +59 -23
- package/package.json +2 -2
- package/template-deno-lit/README.md +30 -0
- package/template-deno-lit/deno.json +8 -0
- package/template-deno-lit/index.html +16 -0
- package/template-deno-lit/public/vite.svg +1 -0
- package/template-deno-lit/src/assets/lit.svg +1 -0
- package/template-deno-lit/src/index.css +31 -0
- package/template-deno-lit/src/my-element.js +129 -0
- package/template-deno-lit/vite.config.mjs +16 -0
- package/template-deno-preact/README.md +30 -0
- package/template-deno-preact/deno.json +8 -0
- package/template-deno-preact/index.html +13 -0
- package/template-deno-preact/public/vite.svg +1 -0
- package/template-deno-preact/src/app.css +25 -0
- package/template-deno-preact/src/app.jsx +32 -0
- package/template-deno-preact/src/assets/preact.svg +1 -0
- package/template-deno-preact/src/index.css +70 -0
- package/template-deno-preact/src/main.jsx +5 -0
- package/template-deno-preact/vite.config.mjs +10 -0
- package/template-deno-react/README.md +30 -0
- package/template-deno-react/deno.json +8 -0
- package/template-deno-react/index.html +13 -0
- package/template-deno-react/public/vite.svg +1 -0
- package/template-deno-react/src/App.css +41 -0
- package/template-deno-react/src/App.jsx +34 -0
- package/template-deno-react/src/assets/react.svg +1 -0
- package/template-deno-react/src/index.css +70 -0
- package/template-deno-react/src/main.jsx +10 -0
- package/template-deno-react/vite.config.mjs +10 -0
- package/template-deno-svelte/.vscode/extensions.json +3 -0
- package/template-deno-svelte/README.md +30 -0
- package/template-deno-svelte/deno.json +8 -0
- package/template-deno-svelte/index.html +13 -0
- package/template-deno-svelte/jsconfig.json +34 -0
- package/template-deno-svelte/public/vite.svg +1 -0
- package/template-deno-svelte/src/App.svelte +45 -0
- package/template-deno-svelte/src/app.css +81 -0
- package/template-deno-svelte/src/assets/svelte.svg +1 -0
- package/template-deno-svelte/src/lib/Counter.svelte +10 -0
- package/template-deno-svelte/src/main.js +8 -0
- package/template-deno-svelte/src/vite-env.d.ts +2 -0
- package/template-deno-svelte/vite.config.mjs +9 -0
- package/template-deno-vanilla/counter.js +9 -0
- package/template-deno-vanilla/deno.json +8 -0
- package/template-deno-vanilla/index.html +13 -0
- package/template-deno-vanilla/javascript.svg +1 -0
- package/template-deno-vanilla/main.js +23 -0
- package/template-deno-vanilla/public/vite.svg +1 -0
- package/template-deno-vanilla/style.css +97 -0
- package/template-deno-vue/README.md +30 -0
- package/template-deno-vue/deno.json +8 -0
- package/template-deno-vue/index.html +13 -0
- package/template-deno-vue/public/vite.svg +1 -0
- package/template-deno-vue/src/App.vue +31 -0
- package/template-deno-vue/src/assets/vue.svg +1 -0
- package/template-deno-vue/src/components/HelloWorld.vue +40 -0
- package/template-deno-vue/src/main.js +5 -0
- package/template-deno-vue/src/style.css +90 -0
- package/template-deno-vue/vite.config.mjs +10 -0
- package/template-library/package.json +5 -2
- package/template-library-ts/package.json +6 -3
- package/template-ssr-preact/package.json +4 -4
- package/template-ssr-preact-ts/package.json +6 -6
- package/template-ssr-react/package.json +3 -3
- package/template-ssr-react-ts/package.json +4 -4
- package/template-ssr-svelte/package.json +3 -3
- package/template-ssr-svelte-ts/package.json +5 -5
- package/template-ssr-transform/package.json +1 -1
- package/template-ssr-vanilla/package.json +1 -1
- package/template-ssr-vanilla-ts/package.json +4 -4
- package/template-ssr-vue/package.json +3 -3
- package/template-ssr-vue-ts/package.json +5 -5
package/README.md
CHANGED
|
@@ -23,6 +23,12 @@ With PNPM:
|
|
|
23
23
|
$ pnpm create vite-extra
|
|
24
24
|
```
|
|
25
25
|
|
|
26
|
+
With Deno:
|
|
27
|
+
|
|
28
|
+
```bash
|
|
29
|
+
$ deno run -A --unstable npm:create-vite-extra
|
|
30
|
+
```
|
|
31
|
+
|
|
26
32
|
Then follow the prompts!
|
|
27
33
|
|
|
28
34
|
You can also directly specify the project name and the template you want to use via additional command line options. For example, to scaffold a Vite + SSR + Vue project, run:
|
|
@@ -36,6 +42,9 @@ yarn create vite-extra my-vue-app --template ssr-vue
|
|
|
36
42
|
|
|
37
43
|
# pnpm
|
|
38
44
|
pnpm create vite-extra my-vue-app --template ssr-vue
|
|
45
|
+
|
|
46
|
+
# Deno
|
|
47
|
+
deno run -A --unstable npm:create-vite-extra --template deno-vue
|
|
39
48
|
```
|
|
40
49
|
|
|
41
50
|
Currently supported template presets include:
|
|
@@ -53,6 +62,7 @@ Currently supported template presets include:
|
|
|
53
62
|
- `ssr-transform`
|
|
54
63
|
- `library`
|
|
55
64
|
- `library-ts`
|
|
65
|
+
- `deno-vue`
|
|
56
66
|
|
|
57
67
|
You can use `.` for the project name to scaffold in the current directory.
|
|
58
68
|
|
package/index.js
CHANGED
|
@@ -104,11 +104,30 @@ const FRAMEWORKS = [
|
|
|
104
104
|
}
|
|
105
105
|
]
|
|
106
106
|
},
|
|
107
|
-
|
|
108
107
|
{
|
|
109
|
-
name: '
|
|
108
|
+
name: 'deno-vanilla',
|
|
109
|
+
color: yellow
|
|
110
|
+
},
|
|
111
|
+
{
|
|
112
|
+
name: 'deno-vue',
|
|
113
|
+
color: green
|
|
114
|
+
},
|
|
115
|
+
{
|
|
116
|
+
name: 'deno-react',
|
|
117
|
+
color: cyan
|
|
118
|
+
},
|
|
119
|
+
{
|
|
120
|
+
name: 'deno-preact',
|
|
121
|
+
color: magenta
|
|
122
|
+
},
|
|
123
|
+
{
|
|
124
|
+
name: 'deno-lit',
|
|
110
125
|
color: lightRed
|
|
111
126
|
},
|
|
127
|
+
{
|
|
128
|
+
name: 'deno-svelte',
|
|
129
|
+
color: red
|
|
130
|
+
},
|
|
112
131
|
{
|
|
113
132
|
name: 'library',
|
|
114
133
|
color: lightMagenta,
|
|
@@ -124,6 +143,10 @@ const FRAMEWORKS = [
|
|
|
124
143
|
color: blue
|
|
125
144
|
}
|
|
126
145
|
]
|
|
146
|
+
},
|
|
147
|
+
{
|
|
148
|
+
name: 'ssr-transform',
|
|
149
|
+
color: lightRed
|
|
127
150
|
}
|
|
128
151
|
]
|
|
129
152
|
|
|
@@ -136,6 +159,8 @@ const renameFiles = {
|
|
|
136
159
|
}
|
|
137
160
|
|
|
138
161
|
async function init() {
|
|
162
|
+
/** @type {string} */
|
|
163
|
+
// @ts-ignore
|
|
139
164
|
let targetDir = formatTargetDir(argv._[0])
|
|
140
165
|
let template = argv.template || argv.t
|
|
141
166
|
|
|
@@ -168,6 +193,7 @@ async function init() {
|
|
|
168
193
|
` is not empty. Remove existing files and continue?`
|
|
169
194
|
},
|
|
170
195
|
{
|
|
196
|
+
// @ts-ignore
|
|
171
197
|
type: (_, { overwrite } = {}) => {
|
|
172
198
|
if (overwrite === false) {
|
|
173
199
|
throw new Error(red('✖') + ' Operation cancelled')
|
|
@@ -267,32 +293,42 @@ async function init() {
|
|
|
267
293
|
write(file)
|
|
268
294
|
}
|
|
269
295
|
|
|
270
|
-
const
|
|
271
|
-
|
|
272
|
-
|
|
296
|
+
const isDeno = template.startsWith('deno-')
|
|
297
|
+
if (isDeno) {
|
|
298
|
+
console.log(`\nDone. Now run:\n`)
|
|
299
|
+
if (root !== cwd) {
|
|
300
|
+
console.log(` cd ${path.relative(cwd, root)}`)
|
|
301
|
+
}
|
|
302
|
+
console.log(' deno task dev')
|
|
303
|
+
console.log()
|
|
304
|
+
} else {
|
|
305
|
+
const pkg = JSON.parse(
|
|
306
|
+
fs.readFileSync(path.join(templateDir, `package.json`), 'utf-8')
|
|
307
|
+
)
|
|
273
308
|
|
|
274
|
-
|
|
309
|
+
pkg.name = packageName || getProjectName()
|
|
275
310
|
|
|
276
|
-
|
|
311
|
+
write('package.json', JSON.stringify(pkg, null, 2))
|
|
277
312
|
|
|
278
|
-
|
|
279
|
-
|
|
313
|
+
const pkgInfo = pkgFromUserAgent(process.env.npm_config_user_agent)
|
|
314
|
+
const pkgManager = pkgInfo ? pkgInfo.name : 'npm'
|
|
280
315
|
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
316
|
+
console.log(`\nDone. Now run:\n`)
|
|
317
|
+
if (root !== cwd) {
|
|
318
|
+
console.log(` cd ${path.relative(cwd, root)}`)
|
|
319
|
+
}
|
|
320
|
+
switch (pkgManager) {
|
|
321
|
+
case 'yarn':
|
|
322
|
+
console.log(' yarn')
|
|
323
|
+
console.log(' yarn dev')
|
|
324
|
+
break
|
|
325
|
+
default:
|
|
326
|
+
console.log(` ${pkgManager} install`)
|
|
327
|
+
console.log(` ${pkgManager} run dev`)
|
|
328
|
+
break
|
|
329
|
+
}
|
|
330
|
+
console.log()
|
|
294
331
|
}
|
|
295
|
-
console.log()
|
|
296
332
|
}
|
|
297
333
|
|
|
298
334
|
/**
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-vite-extra",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.2",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Bjorn Lu",
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
},
|
|
28
28
|
"homepage": "https://github.com/bluwy/create-vite-extra#readme",
|
|
29
29
|
"dependencies": {
|
|
30
|
-
"kolorist": "^1.
|
|
30
|
+
"kolorist": "^1.6.0",
|
|
31
31
|
"minimist": "^1.2.6",
|
|
32
32
|
"prompts": "^2.4.2"
|
|
33
33
|
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
# Vite + Vue + Lit
|
|
2
|
+
|
|
3
|
+
## Running
|
|
4
|
+
|
|
5
|
+
You need to have Deno v1.25.4 or later intalled to run this repo.
|
|
6
|
+
|
|
7
|
+
Start a dev server:
|
|
8
|
+
|
|
9
|
+
```
|
|
10
|
+
$ deno task dev
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## Deploy
|
|
14
|
+
|
|
15
|
+
Build production assets:
|
|
16
|
+
|
|
17
|
+
```
|
|
18
|
+
$ deno task build
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
## Notes
|
|
22
|
+
|
|
23
|
+
- You need to use `.mjs` or `.mts` extension for the `vite.config.[ext]` file.
|
|
24
|
+
|
|
25
|
+
## Papercuts
|
|
26
|
+
|
|
27
|
+
Currently there's a "papercut" for Deno users:
|
|
28
|
+
|
|
29
|
+
- peer dependencies need to be referenced in `vite.config.js` - in this example
|
|
30
|
+
it is `lit` package that needs to be referenced
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
{
|
|
2
|
+
"tasks": {
|
|
3
|
+
"dev": "deno run -A --unstable --node-modules-dir npm:vite",
|
|
4
|
+
"build": "deno run -A --unstable --node-modules-dir npm:vite build",
|
|
5
|
+
"preview": "deno run -A --unstable --node-modules-dir npm:vite preview",
|
|
6
|
+
"serve": "deno run --allow-net --allow-read main.ts"
|
|
7
|
+
}
|
|
8
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="UTF-8" />
|
|
5
|
+
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
|
|
6
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
7
|
+
<title>Vite + Lit</title>
|
|
8
|
+
<link rel="stylesheet" href="./src/index.css" />
|
|
9
|
+
<script type="module" src="/src/my-element.js"></script>
|
|
10
|
+
</head>
|
|
11
|
+
<body>
|
|
12
|
+
<my-element>
|
|
13
|
+
<h1>Vite + Lit</h1>
|
|
14
|
+
</my-element>
|
|
15
|
+
</body>
|
|
16
|
+
</html>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" class="iconify iconify--logos" width="31.88" height="32" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 257"><defs><linearGradient id="IconifyId1813088fe1fbc01fb466" x1="-.828%" x2="57.636%" y1="7.652%" y2="78.411%"><stop offset="0%" stop-color="#41D1FF"></stop><stop offset="100%" stop-color="#BD34FE"></stop></linearGradient><linearGradient id="IconifyId1813088fe1fbc01fb467" x1="43.376%" x2="50.316%" y1="2.242%" y2="89.03%"><stop offset="0%" stop-color="#FFEA83"></stop><stop offset="8.333%" stop-color="#FFDD35"></stop><stop offset="100%" stop-color="#FFA800"></stop></linearGradient></defs><path fill="url(#IconifyId1813088fe1fbc01fb466)" d="M255.153 37.938L134.897 252.976c-2.483 4.44-8.862 4.466-11.382.048L.875 37.958c-2.746-4.814 1.371-10.646 6.827-9.67l120.385 21.517a6.537 6.537 0 0 0 2.322-.004l117.867-21.483c5.438-.991 9.574 4.796 6.877 9.62Z"></path><path fill="url(#IconifyId1813088fe1fbc01fb467)" d="M185.432.063L96.44 17.501a3.268 3.268 0 0 0-2.634 3.014l-5.474 92.456a3.268 3.268 0 0 0 3.997 3.378l24.777-5.718c2.318-.535 4.413 1.507 3.936 3.838l-7.361 36.047c-.495 2.426 1.782 4.5 4.151 3.78l15.304-4.649c2.372-.72 4.652 1.36 4.15 3.788l-11.698 56.621c-.732 3.542 3.979 5.473 5.943 2.437l1.313-2.028l72.516-144.72c1.215-2.423-.88-5.186-3.54-4.672l-25.505 4.922c-2.396.462-4.435-1.77-3.759-4.114l16.646-57.705c.677-2.35-1.37-4.583-3.769-4.113Z"></path></svg>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" class="iconify iconify--logos" width="25.6" height="32" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 320"><path fill="#00E8FF" d="m64 192l25.926-44.727l38.233-19.114l63.974 63.974l10.833 61.754L192 320l-64-64l-38.074-25.615z"></path><path fill="#283198" d="M128 256V128l64-64v128l-64 64ZM0 256l64 64l9.202-60.602L64 192l-37.542 23.71L0 256Z"></path><path fill="#324FFF" d="M64 192V64l64-64v128l-64 64Zm128 128V192l64-64v128l-64 64ZM0 256V128l64 64l-64 64Z"></path><path fill="#0FF" d="M64 320V192l64 64z"></path></svg>
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
:root {
|
|
2
|
+
font-family: Inter, Avenir, Helvetica, Arial, sans-serif;
|
|
3
|
+
font-size: 16px;
|
|
4
|
+
line-height: 24px;
|
|
5
|
+
font-weight: 400;
|
|
6
|
+
|
|
7
|
+
color-scheme: light dark;
|
|
8
|
+
color: rgba(255, 255, 255, 0.87);
|
|
9
|
+
background-color: #242424;
|
|
10
|
+
|
|
11
|
+
font-synthesis: none;
|
|
12
|
+
text-rendering: optimizeLegibility;
|
|
13
|
+
-webkit-font-smoothing: antialiased;
|
|
14
|
+
-moz-osx-font-smoothing: grayscale;
|
|
15
|
+
-webkit-text-size-adjust: 100%;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
body {
|
|
19
|
+
margin: 0;
|
|
20
|
+
display: flex;
|
|
21
|
+
place-items: center;
|
|
22
|
+
min-width: 320px;
|
|
23
|
+
min-height: 100vh;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
@media (prefers-color-scheme: light) {
|
|
27
|
+
:root {
|
|
28
|
+
color: #213547;
|
|
29
|
+
background-color: #ffffff;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
import { LitElement, css, html } from 'lit'
|
|
2
|
+
import litLogo from './assets/lit.svg'
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* An example element.
|
|
6
|
+
*
|
|
7
|
+
* @slot - This element has a slot
|
|
8
|
+
* @csspart button - The button
|
|
9
|
+
*/
|
|
10
|
+
export class MyElement extends LitElement {
|
|
11
|
+
static get properties() {
|
|
12
|
+
return {
|
|
13
|
+
/**
|
|
14
|
+
* Copy for the read the docs hint.
|
|
15
|
+
*/
|
|
16
|
+
docsHint: { type: String },
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* The number of times the button has been clicked.
|
|
20
|
+
*/
|
|
21
|
+
count: { type: Number }
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
constructor() {
|
|
26
|
+
super()
|
|
27
|
+
this.docsHint = 'Click on the Vite and Lit logos to learn more'
|
|
28
|
+
this.count = 0
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
render() {
|
|
32
|
+
return html`
|
|
33
|
+
<div>
|
|
34
|
+
<a href="https://vitejs.dev" target="_blank">
|
|
35
|
+
<img src="/vite.svg" class="logo" alt="Vite logo" />
|
|
36
|
+
</a>
|
|
37
|
+
<a href="https://lit.dev" target="_blank">
|
|
38
|
+
<img src=${litLogo} class="logo lit" alt="Lit logo" />
|
|
39
|
+
</a>
|
|
40
|
+
</div>
|
|
41
|
+
<slot></slot>
|
|
42
|
+
<div class="card">
|
|
43
|
+
<button @click=${this._onClick} part="button">
|
|
44
|
+
count is ${this.count}
|
|
45
|
+
</button>
|
|
46
|
+
</div>
|
|
47
|
+
<p class="read-the-docs">${this.docsHint}</p>
|
|
48
|
+
`
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
_onClick() {
|
|
52
|
+
this.count++
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
static get styles() {
|
|
56
|
+
return css`
|
|
57
|
+
:host {
|
|
58
|
+
max-width: 1280px;
|
|
59
|
+
margin: 0 auto;
|
|
60
|
+
padding: 2rem;
|
|
61
|
+
text-align: center;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
.logo {
|
|
65
|
+
height: 6em;
|
|
66
|
+
padding: 1.5em;
|
|
67
|
+
will-change: filter;
|
|
68
|
+
}
|
|
69
|
+
.logo:hover {
|
|
70
|
+
filter: drop-shadow(0 0 2em #646cffaa);
|
|
71
|
+
}
|
|
72
|
+
.logo.lit:hover {
|
|
73
|
+
filter: drop-shadow(0 0 2em #325cffaa);
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
.card {
|
|
77
|
+
padding: 2em;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
.read-the-docs {
|
|
81
|
+
color: #888;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
a {
|
|
85
|
+
font-weight: 500;
|
|
86
|
+
color: #646cff;
|
|
87
|
+
text-decoration: inherit;
|
|
88
|
+
}
|
|
89
|
+
a:hover {
|
|
90
|
+
color: #535bf2;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
h1 {
|
|
94
|
+
font-size: 3.2em;
|
|
95
|
+
line-height: 1.1;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
button {
|
|
99
|
+
border-radius: 8px;
|
|
100
|
+
border: 1px solid transparent;
|
|
101
|
+
padding: 0.6em 1.2em;
|
|
102
|
+
font-size: 1em;
|
|
103
|
+
font-weight: 500;
|
|
104
|
+
font-family: inherit;
|
|
105
|
+
background-color: #1a1a1a;
|
|
106
|
+
cursor: pointer;
|
|
107
|
+
transition: border-color 0.25s;
|
|
108
|
+
}
|
|
109
|
+
button:hover {
|
|
110
|
+
border-color: #646cff;
|
|
111
|
+
}
|
|
112
|
+
button:focus,
|
|
113
|
+
button:focus-visible {
|
|
114
|
+
outline: 4px auto -webkit-focus-ring-color;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
@media (prefers-color-scheme: light) {
|
|
118
|
+
a:hover {
|
|
119
|
+
color: #747bff;
|
|
120
|
+
}
|
|
121
|
+
button {
|
|
122
|
+
background-color: #f9f9f9;
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
`
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
window.customElements.define('my-element', MyElement)
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { defineConfig } from 'npm:vite'
|
|
2
|
+
|
|
3
|
+
import "npm:lit";
|
|
4
|
+
|
|
5
|
+
// https://vitejs.dev/config/
|
|
6
|
+
export default defineConfig({
|
|
7
|
+
build: {
|
|
8
|
+
lib: {
|
|
9
|
+
entry: 'src/my-element.js',
|
|
10
|
+
formats: ['es']
|
|
11
|
+
},
|
|
12
|
+
rollupOptions: {
|
|
13
|
+
external: /^lit/
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
})
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
# Vite + Vue + Preact
|
|
2
|
+
|
|
3
|
+
## Running
|
|
4
|
+
|
|
5
|
+
You need to have Deno v1.25.4 or later intalled to run this repo.
|
|
6
|
+
|
|
7
|
+
Start a dev server:
|
|
8
|
+
|
|
9
|
+
```
|
|
10
|
+
$ deno task dev
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## Deploy
|
|
14
|
+
|
|
15
|
+
Build production assets:
|
|
16
|
+
|
|
17
|
+
```
|
|
18
|
+
$ deno task build
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
## Notes
|
|
22
|
+
|
|
23
|
+
- You need to use `.mjs` or `.mts` extension for the `vite.config.[ext]` file.
|
|
24
|
+
|
|
25
|
+
## Papercuts
|
|
26
|
+
|
|
27
|
+
Currently there's a "papercut" for Deno users:
|
|
28
|
+
|
|
29
|
+
- peer dependencies need to be referenced in `vite.config.js` - in this example
|
|
30
|
+
it is `preact` and `preact/hooks` packages that need to be referenced
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
{
|
|
2
|
+
"tasks": {
|
|
3
|
+
"dev": "deno run -A --unstable --node-modules-dir npm:vite",
|
|
4
|
+
"build": "deno run -A --unstable --node-modules-dir npm:vite build",
|
|
5
|
+
"preview": "deno run -A --unstable --node-modules-dir npm:vite preview",
|
|
6
|
+
"serve": "deno run --allow-net --allow-read main.ts"
|
|
7
|
+
}
|
|
8
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="UTF-8" />
|
|
5
|
+
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
|
|
6
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
7
|
+
<title>Vite + Preact</title>
|
|
8
|
+
</head>
|
|
9
|
+
<body>
|
|
10
|
+
<div id="app"></div>
|
|
11
|
+
<script type="module" src="/src/main.jsx"></script>
|
|
12
|
+
</body>
|
|
13
|
+
</html>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" class="iconify iconify--logos" width="31.88" height="32" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 257"><defs><linearGradient id="IconifyId1813088fe1fbc01fb466" x1="-.828%" x2="57.636%" y1="7.652%" y2="78.411%"><stop offset="0%" stop-color="#41D1FF"></stop><stop offset="100%" stop-color="#BD34FE"></stop></linearGradient><linearGradient id="IconifyId1813088fe1fbc01fb467" x1="43.376%" x2="50.316%" y1="2.242%" y2="89.03%"><stop offset="0%" stop-color="#FFEA83"></stop><stop offset="8.333%" stop-color="#FFDD35"></stop><stop offset="100%" stop-color="#FFA800"></stop></linearGradient></defs><path fill="url(#IconifyId1813088fe1fbc01fb466)" d="M255.153 37.938L134.897 252.976c-2.483 4.44-8.862 4.466-11.382.048L.875 37.958c-2.746-4.814 1.371-10.646 6.827-9.67l120.385 21.517a6.537 6.537 0 0 0 2.322-.004l117.867-21.483c5.438-.991 9.574 4.796 6.877 9.62Z"></path><path fill="url(#IconifyId1813088fe1fbc01fb467)" d="M185.432.063L96.44 17.501a3.268 3.268 0 0 0-2.634 3.014l-5.474 92.456a3.268 3.268 0 0 0 3.997 3.378l24.777-5.718c2.318-.535 4.413 1.507 3.936 3.838l-7.361 36.047c-.495 2.426 1.782 4.5 4.151 3.78l15.304-4.649c2.372-.72 4.652 1.36 4.15 3.788l-11.698 56.621c-.732 3.542 3.979 5.473 5.943 2.437l1.313-2.028l72.516-144.72c1.215-2.423-.88-5.186-3.54-4.672l-25.505 4.922c-2.396.462-4.435-1.77-3.759-4.114l16.646-57.705c.677-2.35-1.37-4.583-3.769-4.113Z"></path></svg>
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
#app {
|
|
2
|
+
max-width: 1280px;
|
|
3
|
+
margin: 0 auto;
|
|
4
|
+
padding: 2rem;
|
|
5
|
+
text-align: center;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
.logo {
|
|
9
|
+
height: 6em;
|
|
10
|
+
padding: 1.5em;
|
|
11
|
+
}
|
|
12
|
+
.logo:hover {
|
|
13
|
+
filter: drop-shadow(0 0 2em #646cffaa);
|
|
14
|
+
}
|
|
15
|
+
.logo.preact:hover {
|
|
16
|
+
filter: drop-shadow(0 0 2em #673ab8aa);
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
.card {
|
|
20
|
+
padding: 2em;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
.read-the-docs {
|
|
24
|
+
color: #888;
|
|
25
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { useState } from 'preact/hooks'
|
|
2
|
+
import preactLogo from './assets/preact.svg'
|
|
3
|
+
import './app.css'
|
|
4
|
+
|
|
5
|
+
export function App() {
|
|
6
|
+
const [count, setCount] = useState(0)
|
|
7
|
+
|
|
8
|
+
return (
|
|
9
|
+
<>
|
|
10
|
+
<div>
|
|
11
|
+
<a href="https://vitejs.dev" target="_blank">
|
|
12
|
+
<img src="/vite.svg" class="logo" alt="Vite logo" />
|
|
13
|
+
</a>
|
|
14
|
+
<a href="https://preactjs.com" target="_blank">
|
|
15
|
+
<img src={preactLogo} class="logo preact" alt="Preact logo" />
|
|
16
|
+
</a>
|
|
17
|
+
</div>
|
|
18
|
+
<h1>Vite + Preact</h1>
|
|
19
|
+
<div class="card">
|
|
20
|
+
<button onClick={() => setCount((count) => count + 1)}>
|
|
21
|
+
count is {count}
|
|
22
|
+
</button>
|
|
23
|
+
<p>
|
|
24
|
+
Edit <code>src/app.jsx</code> and save to test HMR
|
|
25
|
+
</p>
|
|
26
|
+
</div>
|
|
27
|
+
<p class="read-the-docs">
|
|
28
|
+
Click on the Vite and Preact logos to learn more
|
|
29
|
+
</p>
|
|
30
|
+
</>
|
|
31
|
+
)
|
|
32
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" class="iconify iconify--logos" width="27.68" height="32" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 296"><path fill="#673AB8" d="m128 0l128 73.9v147.8l-128 73.9L0 221.7V73.9z"></path><path fill="#FFF" d="M34.865 220.478c17.016 21.78 71.095 5.185 122.15-34.704c51.055-39.888 80.24-88.345 63.224-110.126c-17.017-21.78-71.095-5.184-122.15 34.704c-51.055 39.89-80.24 88.346-63.224 110.126Zm7.27-5.68c-5.644-7.222-3.178-21.402 7.573-39.253c11.322-18.797 30.541-39.548 54.06-57.923c23.52-18.375 48.303-32.004 69.281-38.442c19.922-6.113 34.277-5.075 39.92 2.148c5.644 7.223 3.178 21.403-7.573 39.254c-11.322 18.797-30.541 39.547-54.06 57.923c-23.52 18.375-48.304 32.004-69.281 38.441c-19.922 6.114-34.277 5.076-39.92-2.147Z"></path><path fill="#FFF" d="M220.239 220.478c17.017-21.78-12.169-70.237-63.224-110.126C105.96 70.464 51.88 53.868 34.865 75.648c-17.017 21.78 12.169 70.238 63.224 110.126c51.055 39.889 105.133 56.485 122.15 34.704Zm-7.27-5.68c-5.643 7.224-19.998 8.262-39.92 2.148c-20.978-6.437-45.761-20.066-69.28-38.441c-23.52-18.376-42.74-39.126-54.06-57.923c-10.752-17.851-13.218-32.03-7.575-39.254c5.644-7.223 19.999-8.261 39.92-2.148c20.978 6.438 45.762 20.067 69.281 38.442c23.52 18.375 42.739 39.126 54.06 57.923c10.752 17.85 13.218 32.03 7.574 39.254Z"></path><path fill="#FFF" d="M127.552 167.667c10.827 0 19.603-8.777 19.603-19.604c0-10.826-8.776-19.603-19.603-19.603c-10.827 0-19.604 8.777-19.604 19.603c0 10.827 8.777 19.604 19.604 19.604Z"></path></svg>
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
:root {
|
|
2
|
+
font-family: Inter, Avenir, Helvetica, Arial, sans-serif;
|
|
3
|
+
font-size: 16px;
|
|
4
|
+
line-height: 24px;
|
|
5
|
+
font-weight: 400;
|
|
6
|
+
|
|
7
|
+
color-scheme: light dark;
|
|
8
|
+
color: rgba(255, 255, 255, 0.87);
|
|
9
|
+
background-color: #242424;
|
|
10
|
+
|
|
11
|
+
font-synthesis: none;
|
|
12
|
+
text-rendering: optimizeLegibility;
|
|
13
|
+
-webkit-font-smoothing: antialiased;
|
|
14
|
+
-moz-osx-font-smoothing: grayscale;
|
|
15
|
+
-webkit-text-size-adjust: 100%;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
a {
|
|
19
|
+
font-weight: 500;
|
|
20
|
+
color: #646cff;
|
|
21
|
+
text-decoration: inherit;
|
|
22
|
+
}
|
|
23
|
+
a:hover {
|
|
24
|
+
color: #535bf2;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
body {
|
|
28
|
+
margin: 0;
|
|
29
|
+
display: flex;
|
|
30
|
+
place-items: center;
|
|
31
|
+
min-width: 320px;
|
|
32
|
+
min-height: 100vh;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
h1 {
|
|
36
|
+
font-size: 3.2em;
|
|
37
|
+
line-height: 1.1;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
button {
|
|
41
|
+
border-radius: 8px;
|
|
42
|
+
border: 1px solid transparent;
|
|
43
|
+
padding: 0.6em 1.2em;
|
|
44
|
+
font-size: 1em;
|
|
45
|
+
font-weight: 500;
|
|
46
|
+
font-family: inherit;
|
|
47
|
+
background-color: #1a1a1a;
|
|
48
|
+
cursor: pointer;
|
|
49
|
+
transition: border-color 0.25s;
|
|
50
|
+
}
|
|
51
|
+
button:hover {
|
|
52
|
+
border-color: #646cff;
|
|
53
|
+
}
|
|
54
|
+
button:focus,
|
|
55
|
+
button:focus-visible {
|
|
56
|
+
outline: 4px auto -webkit-focus-ring-color;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
@media (prefers-color-scheme: light) {
|
|
60
|
+
:root {
|
|
61
|
+
color: #213547;
|
|
62
|
+
background-color: #ffffff;
|
|
63
|
+
}
|
|
64
|
+
a:hover {
|
|
65
|
+
color: #747bff;
|
|
66
|
+
}
|
|
67
|
+
button {
|
|
68
|
+
background-color: #f9f9f9;
|
|
69
|
+
}
|
|
70
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
# Vite + Vue + React
|
|
2
|
+
|
|
3
|
+
## Running
|
|
4
|
+
|
|
5
|
+
You need to have Deno v1.25.4 or later intalled to run this repo.
|
|
6
|
+
|
|
7
|
+
Start a dev server:
|
|
8
|
+
|
|
9
|
+
```
|
|
10
|
+
$ deno task dev
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## Deploy
|
|
14
|
+
|
|
15
|
+
Build production assets:
|
|
16
|
+
|
|
17
|
+
```
|
|
18
|
+
$ deno task build
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
## Notes
|
|
22
|
+
|
|
23
|
+
- You need to use `.mjs` or `.mts` extension for the `vite.config.[ext]` file.
|
|
24
|
+
|
|
25
|
+
## Papercuts
|
|
26
|
+
|
|
27
|
+
Currently there's a "papercut" for Deno users:
|
|
28
|
+
|
|
29
|
+
- peer dependencies need to be referenced in `vite.config.js` - in this example
|
|
30
|
+
it is `react` and `react-dom` packages that need to be referenced
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
{
|
|
2
|
+
"tasks": {
|
|
3
|
+
"dev": "deno run -A --unstable --node-modules-dir npm:vite",
|
|
4
|
+
"build": "deno run -A --unstable --node-modules-dir npm:vite build",
|
|
5
|
+
"preview": "deno run -A --unstable --node-modules-dir npm:vite preview",
|
|
6
|
+
"serve": "deno run --allow-net --allow-read main.ts"
|
|
7
|
+
}
|
|
8
|
+
}
|