feat: migrate project to Bun runtime with comprehensive configuration updates
- Updated Dockerfile to use Bun 1.0.26 as base image - Replaced npm/yarn scripts with Bun equivalents in package.json - Modernized .dockerignore with expanded file and directory exclusions - Simplified jest.config.cjs to use Bun's native testing framework - Added new ha-analyzer-cli.ts and health-check.ts utility scripts - Configured package manager to use Bun 1.0.26
This commit is contained in:
@@ -1,31 +1,76 @@
|
||||
# Dependencies
|
||||
node_modules
|
||||
npm-debug.log
|
||||
yarn-debug.log
|
||||
yarn-error.log
|
||||
node_modules/
|
||||
npm-debug.log*
|
||||
yarn-debug.log*
|
||||
yarn-error.log*
|
||||
.pnpm-debug.log*
|
||||
package-lock.json
|
||||
yarn.lock
|
||||
pnpm-lock.yaml
|
||||
bun.lockb
|
||||
|
||||
# Build output
|
||||
dist
|
||||
dist/
|
||||
build/
|
||||
*.egg-info/
|
||||
__pycache__/
|
||||
*.py[cod]
|
||||
*$py.class
|
||||
*.so
|
||||
|
||||
# Environment files
|
||||
.env*
|
||||
.env
|
||||
.env.*
|
||||
!.env.example
|
||||
venv/
|
||||
ENV/
|
||||
env/
|
||||
|
||||
# Git
|
||||
.git
|
||||
# Version control
|
||||
.git/
|
||||
.gitignore
|
||||
.gitattributes
|
||||
|
||||
# IDE
|
||||
.vscode
|
||||
.idea
|
||||
# IDE and editor files
|
||||
.idea/
|
||||
.vscode/
|
||||
*.swp
|
||||
*.swo
|
||||
.DS_Store
|
||||
Thumbs.db
|
||||
|
||||
# Test files
|
||||
coverage
|
||||
__tests__
|
||||
coverage/
|
||||
__tests__/
|
||||
jest.config.*
|
||||
*.test.ts
|
||||
.nyc_output
|
||||
|
||||
# Logs
|
||||
logs/
|
||||
*.log
|
||||
|
||||
# Documentation
|
||||
*.md
|
||||
docs/
|
||||
CHANGELOG
|
||||
LICENSE
|
||||
|
||||
# Docker
|
||||
docker-compose*.yml
|
||||
docker-compose*.yaml
|
||||
Dockerfile*
|
||||
|
||||
# Temporary files
|
||||
tmp/
|
||||
temp/
|
||||
.tmp/
|
||||
*.tmp
|
||||
|
||||
# Misc
|
||||
*.md
|
||||
.DS_Store
|
||||
*.log
|
||||
.cursorrules
|
||||
.mypy_cache/
|
||||
.storage/
|
||||
.cloud/
|
||||
*.db
|
||||
*.db-*
|
||||
15
Dockerfile
15
Dockerfile
@@ -1,23 +1,20 @@
|
||||
# Use Node.js 20 as the base image
|
||||
FROM node:20-slim
|
||||
|
||||
# Install curl for healthcheck
|
||||
RUN apt-get update && apt-get install -y curl && rm -rf /var/lib/apt/lists/*
|
||||
# Use Bun as the base image
|
||||
FROM oven/bun:1.0.26
|
||||
|
||||
# Set working directory
|
||||
WORKDIR /app
|
||||
|
||||
# Copy source code first
|
||||
# Copy source code
|
||||
COPY . .
|
||||
|
||||
# Install dependencies
|
||||
RUN npm install
|
||||
RUN bun install
|
||||
|
||||
# Build TypeScript
|
||||
RUN npm run build
|
||||
RUN bun run build
|
||||
|
||||
# Expose the port the app runs on
|
||||
EXPOSE 3000
|
||||
|
||||
# Start the application
|
||||
CMD ["node", "dist/src/index.js"]
|
||||
CMD ["bun", "run", "start"]
|
||||
@@ -1,18 +1,7 @@
|
||||
/** @type {import('ts-jest').JestConfigWithTsJest} */
|
||||
/** @type {import('bun:test').BunTestConfig} */
|
||||
module.exports = {
|
||||
preset: 'ts-jest',
|
||||
testEnvironment: 'node',
|
||||
resolver: './jest-resolver.cjs',
|
||||
moduleFileExtensions: ['ts', 'js', 'json', 'node'],
|
||||
transform: {
|
||||
'^.+\\.ts$': ['ts-jest', {
|
||||
useESM: true,
|
||||
tsconfig: 'tsconfig.json'
|
||||
}]
|
||||
},
|
||||
moduleNameMapper: {
|
||||
'^(\\.{1,2}/.*)\\.js$': '$1'
|
||||
},
|
||||
testMatch: ['**/__tests__/**/*.test.ts'],
|
||||
collectCoverage: true,
|
||||
coverageDirectory: 'coverage',
|
||||
|
||||
20
package.json
20
package.json
@@ -5,19 +5,19 @@
|
||||
"type": "module",
|
||||
"main": "dist/index.js",
|
||||
"scripts": {
|
||||
"build": "npx tsc",
|
||||
"start": "node dist/src/index.js",
|
||||
"dev": "tsx watch src/index.ts",
|
||||
"test": "NODE_OPTIONS=--experimental-vm-modules jest --config=jest.config.cjs",
|
||||
"test:coverage": "NODE_OPTIONS=--experimental-vm-modules jest --config=jest.config.cjs --coverage",
|
||||
"test:watch": "NODE_OPTIONS=--experimental-vm-modules jest --config=jest.config.cjs --watch",
|
||||
"test:openai": "tsx openai_test.ts",
|
||||
"build": "bun run tsc",
|
||||
"start": "bun run dist/src/index.js",
|
||||
"dev": "bun --watch src/index.ts",
|
||||
"test": "bun test",
|
||||
"test:coverage": "bun test --coverage",
|
||||
"test:watch": "bun test --watch",
|
||||
"test:openai": "bun run openai_test.ts",
|
||||
"lint": "eslint src --ext .ts",
|
||||
"lint:fix": "eslint src --ext .ts --fix",
|
||||
"prepare": "npm run build",
|
||||
"prepare": "bun run build",
|
||||
"clean": "rimraf dist",
|
||||
"types:check": "tsc --noEmit",
|
||||
"types:install": "npm install --save-dev @types/node @types/jest"
|
||||
"types:install": "bun add -d @types/node @types/jest"
|
||||
},
|
||||
"dependencies": {
|
||||
"@digital-alchemy/core": "^24.11.4",
|
||||
@@ -62,5 +62,5 @@
|
||||
},
|
||||
"author": "Jango Blockchained",
|
||||
"license": "MIT",
|
||||
"packageManager": "yarn@1.22.22+sha512.a6b2f7906b721bba3d67d4aff083df04dad64c399707841b7acf00f6b133b7ac24255f2652fa22ae3534329dc6180534e98d17432037ff6fd140556e2bb3137e"
|
||||
"packageManager": "bun@1.0.26"
|
||||
}
|
||||
16
src/health-check.ts
Normal file
16
src/health-check.ts
Normal file
@@ -0,0 +1,16 @@
|
||||
const check = async () => {
|
||||
try {
|
||||
const response = await fetch('http://localhost:3000/health');
|
||||
if (!response.ok) {
|
||||
console.error('Health check failed:', response.status);
|
||||
process.exit(1);
|
||||
}
|
||||
console.log('Health check passed');
|
||||
process.exit(0);
|
||||
} catch (error) {
|
||||
console.error('Health check failed:', error);
|
||||
process.exit(1);
|
||||
}
|
||||
};
|
||||
|
||||
check();
|
||||
Reference in New Issue
Block a user