- Create push script for NPM project management - Add .npmignore to exclude unnecessary files from package - Set up .npmrc for registry configuration - Write README.md with usage instructions and features - Initialize package.json and package-lock.json for project metadata - Implement crackNut function in src/index.ts - Create test.ts to demonstrate crackNut functionality - Configure TypeScript with tsconfig.json
28 lines
770 B
Bash
Executable File
28 lines
770 B
Bash
Executable File
#!/bin/bash
|
|
set -e
|
|
|
|
# 🚪 Move into the NPM project directory
|
|
cd "$(dirname "$0")/source"
|
|
|
|
# 🔐 Load secrets from root .env
|
|
echo "📦 Loading .env from root dir"
|
|
export $(grep -v '^#' ../.env | xargs)
|
|
|
|
# 🧼 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
|
|
else
|
|
echo "⚠️ No TypeScript build step found. Skipping..."
|
|
fi
|
|
|
|
# 🚀 Publish to Gitea registry using token from .env
|
|
echo "🚀 Publishing to Gitea NPM registry..."
|
|
npm publish \
|
|
--registry=https://git.chipperfluff.at/api/packages/projects/npm/ \
|
|
--//git.chipperfluff.at/api/packages/projects/npm/:_authToken="$NPM_TOKEN"
|