diff --git a/.gitignore b/.gitignore index 5ae36ab..972debc 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,6 @@ # TypeScript output dist/ +build/ *.tsbuildinfo # Node modules diff --git a/push b/push index a18a96b..cd166c2 100755 --- a/push +++ b/push @@ -1,27 +1,38 @@ #!/bin/bash set -e -# ๐Ÿšช Move into the NPM project directory -cd "$(dirname "$0")/source" +# ๐Ÿ“ Directories +ROOT_DIR="$(dirname "$0")" +SOURCE_DIR="$ROOT_DIR/source" +BUILD_DIR="$ROOT_DIR/build" -# ๐Ÿ” Load secrets from root .env -echo "๐Ÿ“ฆ Loading .env from root dir" -export $(grep -v '^#' ../.env | xargs) +cd "$ROOT_DIR" -# ๐Ÿงผ Clean (optional) -echo "๐Ÿงน Cleaning dist (if exists)..." -rm -rf dist || true - -# ๐Ÿ› ๏ธ Build if tsc is present -if npx --no-install tsc --version > /dev/null 2>&1; then - echo "๐Ÿ› ๏ธ Building with tsc..." - npx tsc +# ๐Ÿ” Load secrets +if [ -f .env ]; then + echo "๐Ÿ“ฆ Loading .env..." + export $(grep -v '^#' .env | xargs) else - echo "โš ๏ธ No TypeScript build step found. Skipping..." + echo "โš ๏ธ .env file not found." fi -# ๐Ÿš€ Publish to Gitea registry using token from .env -echo "๐Ÿš€ Publishing to Gitea NPM registry..." +# ๐Ÿงผ Reset build +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"/ + +# ๐Ÿ”ง Build inside build dir +cd "$BUILD_DIR" +echo "๐Ÿ›  Building in build dir..." +rm -rf dist +npx --yes tsc + +# ๐Ÿš€ 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" diff --git a/source/package-lock.json b/source/package-lock.json index ddb8a7d..f9f82ac 100644 --- a/source/package-lock.json +++ b/source/package-lock.json @@ -1,12 +1,12 @@ { "name": "testosmaximus", - "version": "1.0.2", + "version": "1.0.5", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "testosmaximus", - "version": "1.0.2", + "version": "1.0.5", "license": "ISC", "devDependencies": { "typescript": "^5.8.3" diff --git a/source/package.json b/source/package.json index 0c20778..8b317cd 100644 --- a/source/package.json +++ b/source/package.json @@ -1,6 +1,6 @@ { - "name": "testosmaximus", - "version": "1.0.2", + "name": "@testosmaximus/testosmaximus", + "version": "1.0.5", "description": "", "main": "dist/index.js", "types": "dist/index.d.ts", diff --git a/source/tsconfig.json b/source/tsconfig.json index 88772d0..ef135e3 100644 --- a/source/tsconfig.json +++ b/source/tsconfig.json @@ -1,7 +1,7 @@ { "compilerOptions": { "target": "ES2020", - "module": "ESNext", + "module": "CommonJS", "moduleResolution": "Node", "outDir": "dist", "declaration": true,