generated from projects/testosmaximus
feat: implement RickLabel component with click handling and YouTube link, update package.json and tsconfig.json for new dependencies
This commit is contained in:
parent
6f633d33f4
commit
78ab32c808
1
.gitignore
vendored
1
.gitignore
vendored
@ -22,3 +22,4 @@ Thumbs.db
|
|||||||
|
|
||||||
# Env stuff
|
# Env stuff
|
||||||
.env
|
.env
|
||||||
|
.npmrc
|
||||||
43
push
43
push
@ -8,7 +8,7 @@ BUILD_DIR="$ROOT_DIR/build"
|
|||||||
|
|
||||||
cd "$ROOT_DIR"
|
cd "$ROOT_DIR"
|
||||||
|
|
||||||
# 🔐 Load secrets
|
# 🔐 Load .env
|
||||||
if [ -f .env ]; then
|
if [ -f .env ]; then
|
||||||
echo "📦 Loading .env..."
|
echo "📦 Loading .env..."
|
||||||
export $(grep -v '^#' .env | xargs)
|
export $(grep -v '^#' .env | xargs)
|
||||||
@ -16,24 +16,45 @@ else
|
|||||||
echo "⚠️ .env file not found."
|
echo "⚠️ .env file not found."
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# 🧼 Reset build
|
# 🧹 Clean build dir
|
||||||
echo "🧹 Cleaning build dir..."
|
echo "🧹 Cleaning build dir..."
|
||||||
rm -rf "$BUILD_DIR"
|
rm -rf "$BUILD_DIR"
|
||||||
mkdir -p "$BUILD_DIR"
|
mkdir -p "$BUILD_DIR"
|
||||||
|
|
||||||
# 📦 Copy entire source
|
# 📁 Copy full source (including src/, tsconfig.json, etc.)
|
||||||
echo "📁 Copying full source into build..."
|
echo "📁 Copying full source to build dir..."
|
||||||
cp -r "$SOURCE_DIR"/* "$BUILD_DIR"/
|
cp -r "$SOURCE_DIR/"* "$BUILD_DIR/"
|
||||||
cp -r "$ROOT_DIR"/README.md "$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"
|
cd "$BUILD_DIR"
|
||||||
echo "🛠 Building in build dir..."
|
echo "🧱 Running tsc..."
|
||||||
rm -rf dist
|
rm -rf dist
|
||||||
npx --yes tsc
|
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
|
# 🚀 Publish
|
||||||
echo "🚀 Publishing to Gitea registry..."
|
echo "🚀 Publishing to Gitea registry..."
|
||||||
npm publish \
|
npm publish
|
||||||
--registry=https://git.chipperfluff.at/api/packages/projects/npm/ \
|
|
||||||
--//git.chipperfluff.at/api/packages/projects/npm/:_authToken="$NPM_TOKEN"
|
# 🧽 Cleanup
|
||||||
|
rm .npmrc
|
||||||
|
|
||||||
|
echo "✅ All done! Built and published from build dir."
|
||||||
|
|||||||
37
source/package-lock.json
generated
37
source/package-lock.json
generated
@ -1,13 +1,17 @@
|
|||||||
{
|
{
|
||||||
"name": "@funky-flask-test/funky-flask-test",
|
"name": "@funky-flask-test/funky-flask-test",
|
||||||
"version": "1.1.0",
|
"version": "1.1.1",
|
||||||
"lockfileVersion": 3,
|
"lockfileVersion": 3,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
"": {
|
"": {
|
||||||
"name": "@funky-flask-test/funky-flask-test",
|
"name": "@funky-flask-test/funky-flask-test",
|
||||||
"version": "1.1.0",
|
"version": "1.1.1",
|
||||||
|
"dependencies": {
|
||||||
|
"nano-jsx": "^0.1.0"
|
||||||
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
|
"@types/node": "^24.0.15",
|
||||||
"typescript": "^5.8.3",
|
"typescript": "^5.8.3",
|
||||||
"vite": "^5.0.0"
|
"vite": "^5.0.0"
|
||||||
}
|
}
|
||||||
@ -690,6 +694,16 @@
|
|||||||
"dev": true,
|
"dev": true,
|
||||||
"license": "MIT"
|
"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": {
|
"node_modules/esbuild": {
|
||||||
"version": "0.21.5",
|
"version": "0.21.5",
|
||||||
"resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.21.5.tgz",
|
"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": "^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": {
|
"node_modules/nanoid": {
|
||||||
"version": "3.3.11",
|
"version": "3.3.11",
|
||||||
"resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.11.tgz",
|
"resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.11.tgz",
|
||||||
@ -863,6 +889,13 @@
|
|||||||
"node": ">=14.17"
|
"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": {
|
"node_modules/vite": {
|
||||||
"version": "5.4.19",
|
"version": "5.4.19",
|
||||||
"resolved": "https://registry.npmjs.org/vite/-/vite-5.4.19.tgz",
|
"resolved": "https://registry.npmjs.org/vite/-/vite-5.4.19.tgz",
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@funky-flask-test/funky-flask-test",
|
"name": "@funky-flask-test/funky-flask-test",
|
||||||
"version": "1.1.0",
|
"version": "1.1.1",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"main": "./dist/index.js",
|
"main": "./dist/index.js",
|
||||||
"exports": {
|
"exports": {
|
||||||
@ -19,7 +19,11 @@
|
|||||||
"preview": "vite preview"
|
"preview": "vite preview"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
|
"@types/node": "^24.0.15",
|
||||||
"typescript": "^5.8.3",
|
"typescript": "^5.8.3",
|
||||||
"vite": "^5.0.0"
|
"vite": "^5.0.0"
|
||||||
|
},
|
||||||
|
"dependencies": {
|
||||||
|
"nano-jsx": "^0.1.0"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -6,7 +6,7 @@ class RickLabel extends Component {
|
|||||||
handleClick = () => {
|
handleClick = () => {
|
||||||
this.count++
|
this.count++
|
||||||
window.open('https://www.youtube.com/watch?v=dQw4w9WgXcQ', '_blank')
|
window.open('https://www.youtube.com/watch?v=dQw4w9WgXcQ', '_blank')
|
||||||
this.update()
|
this.update?.()
|
||||||
}
|
}
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
@ -21,7 +21,12 @@ class RickLabel extends Component {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export function insertRickLabel(target: HTMLElement | string = document.body) {
|
export function insertRickLabel(target: HTMLElement | string = document.body): void {
|
||||||
const container = typeof target === 'string' ? document.querySelector(target) : target
|
const container = typeof target === 'string'
|
||||||
if (container) render(<RickLabel />, container)
|
? document.querySelector(target)
|
||||||
|
: target
|
||||||
|
|
||||||
|
if (container instanceof HTMLElement) {
|
||||||
|
render(<RickLabel />, container)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@ -7,7 +7,12 @@
|
|||||||
"rootDir": "./src",
|
"rootDir": "./src",
|
||||||
"moduleResolution": "node",
|
"moduleResolution": "node",
|
||||||
"strict": true,
|
"strict": true,
|
||||||
"esModuleInterop": true
|
"esModuleInterop": true,
|
||||||
|
"jsx": "preserve",
|
||||||
|
"jsxFactory": "h",
|
||||||
|
"jsxFragmentFactory": "Fragment",
|
||||||
|
"allowSyntheticDefaultImports": true,
|
||||||
|
"types": ["node"]
|
||||||
},
|
},
|
||||||
"include": ["src"]
|
"include": ["src"]
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user