diff --git a/.gitignore b/.gitignore index 972debc..6bd94bb 100644 --- a/.gitignore +++ b/.gitignore @@ -22,3 +22,4 @@ Thumbs.db # Env stuff .env +.npmrc \ No newline at end of file diff --git a/push b/push index 4fcc759..506421b 100755 --- a/push +++ b/push @@ -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 <=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", diff --git a/source/package.json b/source/package.json index c8eaf0c..a860289 100644 --- a/source/package.json +++ b/source/package.json @@ -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" } } diff --git a/source/src/index.ts b/source/src/index.tsx similarity index 70% rename from source/src/index.ts rename to source/src/index.tsx index d6aa5b8..7db028d 100644 --- a/source/src/index.ts +++ b/source/src/index.tsx @@ -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(, container) +export function insertRickLabel(target: HTMLElement | string = document.body): void { + const container = typeof target === 'string' + ? document.querySelector(target) + : target + + if (container instanceof HTMLElement) { + render(, container) + } } diff --git a/source/tsconfig.json b/source/tsconfig.json index 516c5b1..6dd0e89 100644 --- a/source/tsconfig.json +++ b/source/tsconfig.json @@ -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"] }