feat: implement RickLabel component with click handling and YouTube link, update package.json and tsconfig.json for new dependencies

This commit is contained in:
Chipperfluff 2025-07-19 23:13:31 +02:00
parent 6f633d33f4
commit 78ab32c808
6 changed files with 88 additions and 19 deletions

1
.gitignore vendored
View File

@ -22,3 +22,4 @@ Thumbs.db
# Env stuff
.env
.npmrc

43
push
View File

@ -8,7 +8,7 @@ BUILD_DIR="$ROOT_DIR/build"
cd "$ROOT_DIR"
# 🔐 Load secrets
# 🔐 Load .env
if [ -f .env ]; then
echo "📦 Loading .env..."
export $(grep -v '^#' .env | xargs)
@ -16,24 +16,45 @@ else
echo "⚠️ .env file not found."
fi
# 🧼 Reset build
# 🧹 Clean build dir
echo "🧹 Cleaning build dir..."
rm -rf "$BUILD_DIR"
mkdir -p "$BUILD_DIR"
# 📦 Copy entire source
echo "📁 Copying full source into build..."
cp -r "$SOURCE_DIR"/* "$BUILD_DIR"/
cp -r "$ROOT_DIR"/README.md "$BUILD_DIR"/
# 📁 Copy full source (including src/, tsconfig.json, etc.)
echo "📁 Copying full source to build dir..."
cp -r "$SOURCE_DIR/"* "$BUILD_DIR/"
cp -r "$SOURCE_DIR/src" "$BUILD_DIR/" # ensure src/ structure preserved
# 🔧 Build inside build dir
# 🩹 Patch tsconfig.json inside build dir to make it build in-place
echo "🛠 Patching tsconfig.json..."
sed -i 's#"rootDir": "./src"#"rootDir": "./src"#' "$BUILD_DIR/tsconfig.json"
sed -i 's#"include": \["src"\]#"include": ["./src"]#' "$BUILD_DIR/tsconfig.json"
# 🔧 Build from inside build dir
cd "$BUILD_DIR"
echo "🛠 Building in build dir..."
echo "🧱 Running tsc..."
rm -rf dist
npx --yes tsc
# ✅ Confirm output exists
if [ ! -f dist/index.js ]; then
echo "❌ ERROR: Build failed. dist/index.js not found."
exit 1
fi
# ✍️ Write .npmrc for registry
cat > .npmrc <<EOF
registry=https://git.chipperfluff.at/api/packages/projects/npm/
//git.chipperfluff.at/api/packages/projects/npm/:_authToken=$NPM_TOKEN
always-auth=true
EOF
# 🚀 Publish
echo "🚀 Publishing to Gitea registry..."
npm publish \
--registry=https://git.chipperfluff.at/api/packages/projects/npm/ \
--//git.chipperfluff.at/api/packages/projects/npm/:_authToken="$NPM_TOKEN"
npm publish
# 🧽 Cleanup
rm .npmrc
echo "✅ All done! Built and published from build dir."

View File

@ -1,13 +1,17 @@
{
"name": "@funky-flask-test/funky-flask-test",
"version": "1.1.0",
"version": "1.1.1",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "@funky-flask-test/funky-flask-test",
"version": "1.1.0",
"version": "1.1.1",
"dependencies": {
"nano-jsx": "^0.1.0"
},
"devDependencies": {
"@types/node": "^24.0.15",
"typescript": "^5.8.3",
"vite": "^5.0.0"
}
@ -690,6 +694,16 @@
"dev": true,
"license": "MIT"
},
"node_modules/@types/node": {
"version": "24.0.15",
"resolved": "https://registry.npmjs.org/@types/node/-/node-24.0.15.tgz",
"integrity": "sha512-oaeTSbCef7U/z7rDeJA138xpG3NuKc64/rZ2qmUFkFJmnMsAPaluIifqyWd8hSSMxyP9oie3dLAqYPblag9KgA==",
"dev": true,
"license": "MIT",
"dependencies": {
"undici-types": "~7.8.0"
}
},
"node_modules/esbuild": {
"version": "0.21.5",
"resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.21.5.tgz",
@ -744,6 +758,18 @@
"node": "^8.16.0 || ^10.6.0 || >=11.0.0"
}
},
"node_modules/nano-jsx": {
"version": "0.1.0",
"resolved": "https://registry.npmjs.org/nano-jsx/-/nano-jsx-0.1.0.tgz",
"integrity": "sha512-S4qJM9ayruMdDnn3hiHNK6kq0ZvCaNrDL3RD5jc4AVhmsW1Ufk3xE64Q6xrjAzq1Gff+6VZ5+Au8For4FT/6LA==",
"license": "MIT",
"engines": {
"node": ">=16"
},
"funding": {
"url": "https://github.com/sponsors/yandeu"
}
},
"node_modules/nanoid": {
"version": "3.3.11",
"resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.11.tgz",
@ -863,6 +889,13 @@
"node": ">=14.17"
}
},
"node_modules/undici-types": {
"version": "7.8.0",
"resolved": "https://registry.npmjs.org/undici-types/-/undici-types-7.8.0.tgz",
"integrity": "sha512-9UJ2xGDvQ43tYyVMpuHlsgApydB8ZKfVYTsLDhXkFL/6gfkp+U8xTGdh8pMJv1SpZna0zxG1DwsKZsreLbXBxw==",
"dev": true,
"license": "MIT"
},
"node_modules/vite": {
"version": "5.4.19",
"resolved": "https://registry.npmjs.org/vite/-/vite-5.4.19.tgz",

View File

@ -1,6 +1,6 @@
{
"name": "@funky-flask-test/funky-flask-test",
"version": "1.1.0",
"version": "1.1.1",
"type": "module",
"main": "./dist/index.js",
"exports": {
@ -19,7 +19,11 @@
"preview": "vite preview"
},
"devDependencies": {
"@types/node": "^24.0.15",
"typescript": "^5.8.3",
"vite": "^5.0.0"
},
"dependencies": {
"nano-jsx": "^0.1.0"
}
}

View File

@ -6,7 +6,7 @@ class RickLabel extends Component {
handleClick = () => {
this.count++
window.open('https://www.youtube.com/watch?v=dQw4w9WgXcQ', '_blank')
this.update()
this.update?.()
}
render() {
@ -21,7 +21,12 @@ class RickLabel extends Component {
}
}
export function insertRickLabel(target: HTMLElement | string = document.body) {
const container = typeof target === 'string' ? document.querySelector(target) : target
if (container) render(<RickLabel />, container)
export function insertRickLabel(target: HTMLElement | string = document.body): void {
const container = typeof target === 'string'
? document.querySelector(target)
: target
if (container instanceof HTMLElement) {
render(<RickLabel />, container)
}
}

View File

@ -7,7 +7,12 @@
"rootDir": "./src",
"moduleResolution": "node",
"strict": true,
"esModuleInterop": true
"esModuleInterop": true,
"jsx": "preserve",
"jsxFactory": "h",
"jsxFragmentFactory": "Fragment",
"allowSyntheticDefaultImports": true,
"types": ["node"]
},
"include": ["src"]
}