move to vite

This commit is contained in:
Niccolo Borgioli 2023-07-12 23:05:30 +02:00
parent bcfd32ea8f
commit 3a2339002d
No known key found for this signature in database
GPG Key ID: D93C615F75EE4F0B
6 changed files with 57 additions and 1751 deletions

1
.gitignore vendored
View File

@ -6,5 +6,4 @@ node_modules/
dist dist
build build
.cache .cache
.parcel-cache
.vercel .vercel

View File

@ -3,6 +3,7 @@
<head> <head>
<title>canihazusername</title> <title>canihazusername</title>
<meta name="viewport" content="width=device-width, initial-scale=1" /> <meta name="viewport" content="width=device-width, initial-scale=1" />
<meta charset="utf-8" />
<link rel="stylesheet" href="./main.css" /> <link rel="stylesheet" href="./main.css" />
</head> </head>
@ -22,7 +23,7 @@
<a target="blank" href="https://github.com/cupcakearmy/canihazusername"> <a target="blank" href="https://github.com/cupcakearmy/canihazusername">
<button id="button" class="button is-link is-rounded is-fullwidth mb-3">🔗 Github & Docs 🔗</button> <button id="button" class="button is-link is-rounded is-fullwidth mb-3">🔗 Github & Docs 🔗</button>
</a> </a>
<pre>yarn add canihazusername</pre> <pre>pnpm i canihazusername</pre>
<pre> <pre>
import { generate } from 'canihazusername' import { generate } from 'canihazusername'
generate('{character}_{english}')</pre generate('{character}_{english}')</pre

View File

@ -1,3 +1,5 @@
@import 'bulma/css/bulma.css';
* { * {
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif, 'Apple Color Emoji', font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif, 'Apple Color Emoji',
'Segoe UI Emoji', 'Segoe UI Symbol'; 'Segoe UI Emoji', 'Segoe UI Symbol';

View File

@ -1,16 +1,15 @@
import 'bulma/css/bulma.css' import { generate, showAvailableLists } from '../src/index'
import { generate, showAvailableLists } from '../'
const input = window.document.getElementById('format') as HTMLInputElement const input = window.document.getElementById('format') as HTMLInputElement
const output = window.document.getElementById('username') as HTMLInputElement const output = window.document.getElementById('username') as HTMLInputElement
const list = window.document.getElementById('lists') const list = window.document.getElementById('lists')
const button = window.document.getElementById('button') const button = window.document.getElementById('button')
const calculate = () => { function calculate() {
output.value = generate(input.value) output.value = generate(input.value)
} }
// Init // Init
button.addEventListener('click', calculate) button?.addEventListener('click', calculate)
calculate() calculate()
list.innerHTML = showAvailableLists().join(', ') if (list) list.innerHTML = showAvailableLists().join(', ')

View File

@ -27,10 +27,10 @@
"generate": "git submodule update --recursive --remote --init && node ./generate/wordlist.js", "generate": "git submodule update --recursive --remote --init && node ./generate/wordlist.js",
"dev": "tsc -w", "dev": "tsc -w",
"build": "tsup src/index.ts --format cjs,esm --dts --sourcemap", "build": "tsup src/index.ts --format cjs,esm --dts --sourcemap",
"docs": "pnpm run build && parcel build --target docs demo/index.html", "docs": "vite build demo --outDir ../build",
"docs:dev": "parcel --target docs demo/index.html", "docs:dev": "vite demo",
"prepublishOnly": "rm -rf ./dist && pnpm run build", "prepublishOnly": "rm -rf ./dist && pnpm run build",
"clean": "rm -rf ./dist ./build ./.parcel-cache" "clean": "rm -rf ./dist ./build"
}, },
"repository": { "repository": {
"type": "git", "type": "git",
@ -50,8 +50,8 @@
"homepage": "https://github.com/CupCakeArmy/canihazusername#readme", "homepage": "https://github.com/CupCakeArmy/canihazusername#readme",
"devDependencies": { "devDependencies": {
"bulma": "^0.9.4", "bulma": "^0.9.4",
"parcel": "^2.9.3",
"tsup": "^7.1.0", "tsup": "^7.1.0",
"typescript": "^5.1.6" "typescript": "^5.1.6",
"vite": "^4.4.3"
} }
} }

File diff suppressed because it is too large Load Diff