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
|
# Dependencies
|
||||||
node_modules
|
node_modules/
|
||||||
npm-debug.log
|
npm-debug.log*
|
||||||
yarn-debug.log
|
yarn-debug.log*
|
||||||
yarn-error.log
|
yarn-error.log*
|
||||||
|
.pnpm-debug.log*
|
||||||
|
package-lock.json
|
||||||
|
yarn.lock
|
||||||
|
pnpm-lock.yaml
|
||||||
|
bun.lockb
|
||||||
|
|
||||||
# Build output
|
# Build output
|
||||||
dist
|
dist/
|
||||||
|
build/
|
||||||
|
*.egg-info/
|
||||||
|
__pycache__/
|
||||||
|
*.py[cod]
|
||||||
|
*$py.class
|
||||||
|
*.so
|
||||||
|
|
||||||
# Environment files
|
# Environment files
|
||||||
.env*
|
.env
|
||||||
|
.env.*
|
||||||
!.env.example
|
!.env.example
|
||||||
|
venv/
|
||||||
|
ENV/
|
||||||
|
env/
|
||||||
|
|
||||||
# Git
|
# Version control
|
||||||
.git
|
.git/
|
||||||
.gitignore
|
.gitignore
|
||||||
|
.gitattributes
|
||||||
|
|
||||||
# IDE
|
# IDE and editor files
|
||||||
.vscode
|
.idea/
|
||||||
.idea
|
.vscode/
|
||||||
|
*.swp
|
||||||
|
*.swo
|
||||||
|
.DS_Store
|
||||||
|
Thumbs.db
|
||||||
|
|
||||||
# Test files
|
# Test files
|
||||||
coverage
|
coverage/
|
||||||
__tests__
|
__tests__/
|
||||||
jest.config.*
|
jest.config.*
|
||||||
*.test.ts
|
*.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
|
# Misc
|
||||||
*.md
|
.cursorrules
|
||||||
.DS_Store
|
.mypy_cache/
|
||||||
*.log
|
.storage/
|
||||||
|
.cloud/
|
||||||
|
*.db
|
||||||
|
*.db-*
|
||||||
15
Dockerfile
15
Dockerfile
@@ -1,23 +1,20 @@
|
|||||||
# Use Node.js 20 as the base image
|
# Use Bun as the base image
|
||||||
FROM node:20-slim
|
FROM oven/bun:1.0.26
|
||||||
|
|
||||||
# Install curl for healthcheck
|
|
||||||
RUN apt-get update && apt-get install -y curl && rm -rf /var/lib/apt/lists/*
|
|
||||||
|
|
||||||
# Set working directory
|
# Set working directory
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
|
||||||
# Copy source code first
|
# Copy source code
|
||||||
COPY . .
|
COPY . .
|
||||||
|
|
||||||
# Install dependencies
|
# Install dependencies
|
||||||
RUN npm install
|
RUN bun install
|
||||||
|
|
||||||
# Build TypeScript
|
# Build TypeScript
|
||||||
RUN npm run build
|
RUN bun run build
|
||||||
|
|
||||||
# Expose the port the app runs on
|
# Expose the port the app runs on
|
||||||
EXPOSE 3000
|
EXPOSE 3000
|
||||||
|
|
||||||
# Start the application
|
# 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 = {
|
module.exports = {
|
||||||
preset: 'ts-jest',
|
|
||||||
testEnvironment: 'node',
|
testEnvironment: 'node',
|
||||||
resolver: './jest-resolver.cjs',
|
|
||||||
moduleFileExtensions: ['ts', 'js', 'json', 'node'],
|
moduleFileExtensions: ['ts', 'js', 'json', 'node'],
|
||||||
transform: {
|
|
||||||
'^.+\\.ts$': ['ts-jest', {
|
|
||||||
useESM: true,
|
|
||||||
tsconfig: 'tsconfig.json'
|
|
||||||
}]
|
|
||||||
},
|
|
||||||
moduleNameMapper: {
|
|
||||||
'^(\\.{1,2}/.*)\\.js$': '$1'
|
|
||||||
},
|
|
||||||
testMatch: ['**/__tests__/**/*.test.ts'],
|
testMatch: ['**/__tests__/**/*.test.ts'],
|
||||||
collectCoverage: true,
|
collectCoverage: true,
|
||||||
coverageDirectory: 'coverage',
|
coverageDirectory: 'coverage',
|
||||||
|
|||||||
22
package.json
22
package.json
@@ -5,19 +5,19 @@
|
|||||||
"type": "module",
|
"type": "module",
|
||||||
"main": "dist/index.js",
|
"main": "dist/index.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"build": "npx tsc",
|
"build": "bun run tsc",
|
||||||
"start": "node dist/src/index.js",
|
"start": "bun run dist/src/index.js",
|
||||||
"dev": "tsx watch src/index.ts",
|
"dev": "bun --watch src/index.ts",
|
||||||
"test": "NODE_OPTIONS=--experimental-vm-modules jest --config=jest.config.cjs",
|
"test": "bun test",
|
||||||
"test:coverage": "NODE_OPTIONS=--experimental-vm-modules jest --config=jest.config.cjs --coverage",
|
"test:coverage": "bun test --coverage",
|
||||||
"test:watch": "NODE_OPTIONS=--experimental-vm-modules jest --config=jest.config.cjs --watch",
|
"test:watch": "bun test --watch",
|
||||||
"test:openai": "tsx openai_test.ts",
|
"test:openai": "bun run openai_test.ts",
|
||||||
"lint": "eslint src --ext .ts",
|
"lint": "eslint src --ext .ts",
|
||||||
"lint:fix": "eslint src --ext .ts --fix",
|
"lint:fix": "eslint src --ext .ts --fix",
|
||||||
"prepare": "npm run build",
|
"prepare": "bun run build",
|
||||||
"clean": "rimraf dist",
|
"clean": "rimraf dist",
|
||||||
"types:check": "tsc --noEmit",
|
"types:check": "tsc --noEmit",
|
||||||
"types:install": "npm install --save-dev @types/node @types/jest"
|
"types:install": "bun add -d @types/node @types/jest"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@digital-alchemy/core": "^24.11.4",
|
"@digital-alchemy/core": "^24.11.4",
|
||||||
@@ -62,5 +62,5 @@
|
|||||||
},
|
},
|
||||||
"author": "Jango Blockchained",
|
"author": "Jango Blockchained",
|
||||||
"license": "MIT",
|
"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