Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 15 additions & 22 deletions .github/workflows/node.js.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,39 +10,32 @@ on:
branches: [ master ]

jobs:
run-cover:

test:
name: Test and Coverage
runs-on: ubuntu-latest

strategy:
matrix:
node-version: [14.x, 16.x, 18.x, 19.x]
node-version: [20.x, 22.x, 24.x]
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/

steps:
- uses: actions/checkout@v2
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 2

- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v2
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
cache: 'npm'

- run: npm ci
- run: npm run cover
- name: Coveralls Parallel
uses: coverallsapp/github-action@master
with:
github-token: ${{ secrets.github_token }}
path-to-lcov: ./test/coverage/lcov.info
flag-name: run-${{ matrix.test_number }}
parallel: true

finish:
needs: run-cover
runs-on: ubuntu-latest
steps:
- name: Coveralls Finished
uses: coverallsapp/github-action@master
- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v5
if: matrix.node-version == '24.x'
with:
github-token: ${{ secrets.github_token }}
path-to-lcov: ./test/coverage/lcov.info
parallel-finished: true
token: ${{ secrets.CODECOV_TOKEN }}

6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
# Max Rects Packer

[![Build Status](https://travis-ci.org/soimy/maxrects-packer.svg?branch=master)](https://travis-ci.org/soimy/maxrects-packer)
[![Coverage Status](https://coveralls.io/repos/github/soimy/maxrects-packer/badge.svg?branch=master)](https://coveralls.io/github/soimy/maxrects-packer?branch=master)
[![Node.js CI](https://github.com/soimy/maxrects-packer/actions/workflows/node.js.yml/badge.svg)](https://github.com/soimy/maxrects-packer/actions/workflows/node.js.yml)
[![codecov](https://codecov.io/gh/soimy/maxrects-packer/branch/master/graph/badge.svg)](https://codecov.io/gh/soimy/maxrects-packer)
[![npm version](https://badge.fury.io/js/maxrects-packer.svg)](https://badge.fury.io/js/maxrects-packer)
![npm](https://img.shields.io/npm/dm/maxrects-packer.svg)
![npm type definitions](https://shields-staging.herokuapp.com/npm/types/maxrects-packer.svg)
![NPM Type Definitions](https://img.shields.io/npm/types/maxrects-packer)

A simple max rectangle 2d bin packing algorithm for packing glyphs or images into multiple sprite-sheet/atlas. Minimalist with no module dependency.

Expand Down
79 changes: 79 additions & 0 deletions UPGRADE_SUMMARY.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
# DevDependencies 重大更新摘要

## 已更新的主要依赖包

### TypeScript 工具链
- **TypeScript**: `^4.9.4` → `^5.6.3` (重大更新)
- **ts-jest**: `^29.0.3` → `^29.2.5`
- **ts-node**: `^10.9.1` → `^10.9.2`

### 构建工具
- **Rollup**: `^3.9.1` → `^4.24.0` (重大更新)
- **rollup-plugin-dts**: `^5.1.0` → `^6.1.1` (重大更新)
- **rollup-plugin-esbuild**: `^5.0.0` → `^6.1.1` (重大更新)
- **rollup-plugin-typescript2**: `^0.34.1` → `^0.36.0`
- **@rollup/plugin-terser**: `^0.3.0` → `^0.4.4`
- **esbuild**: `^0.16.12` → `^0.24.0` (重大更新)

### 代码质量工具
- **ESLint**: `^8.31.0` → `^9.12.0` (重大更新)
- **@typescript-eslint/eslint-plugin**: `^5.47.1` → `^8.8.1` (重大更新)
- **@typescript-eslint/parser**: `^5.47.1` → `^8.8.1` (重大更新)
- **eslint-plugin-import**: `^2.26.0` → `^2.31.0`
- **eslint-plugin-jsdoc**: `^39.6.4` → `^50.3.1` (重大更新)

### 测试工具
- **Jest**: `^29.3.1` → `^29.7.0`
- **@types/jest**: `^29.2.5` → `^29.5.12`

### 文档工具
- **TypeDoc**: `^0.23.23` → `^0.26.8` (重大更新)

### 其他工具
- **rimraf**: `^3.0.2` → `^6.0.1` (重大更新)
- **gh-pages**: `^4.0.0` → `^6.1.1` (重大更新)
- **@types/node**: `^18.11.18` → `^22.7.5` (重大更新)
- **tslib**: `^2.4.1` → `^2.7.0`

## 已移除的包
- **tslint-config-standard**: `^9.0.0` (已废弃,改用 ESLint)
- **@typescript-eslint/eslint-plugin-tslint**: `^5.48.0` (不再需要)
- **coveralls**: `^3.1.1` (移除,改用内置覆盖率)

## 已添加的包
- **c8**: `^10.1.2` (新的覆盖率工具)

## 配置文件更新

### 新增文件
- `eslint.config.js` - 现代 ESLint 配置,替代 tslint

### 更新的文件
- `tsconfig.json` - 更新到 TypeScript 5.x 标准
- `jest.config.js` - 更新以支持 ESM 和新版本
- `rollup.config.js` - 添加 DTS 支持和现代配置
- `package.json` - 更新脚本和依赖

### 删除的文件
- `tslint.json` - 已废弃,使用 ESLint 替代

## 新的脚本命令
- `npm run lint` - 运行 ESLint 检查
- `npm run lint:fix` - 自动修复 ESLint 问题

## 安全修复
- 修复了 esbuild、gh-pages、form-data、tough-cookie 等包的安全漏洞
- 更新了所有依赖到最新稳定版本

## TypeScript 配置改进
- 启用了更严格的类型检查
- 使用现代模块解析策略
- 改进了源码映射配置
- 优化了编译目标和库设置

## 构建系统改进
- 添加了自动类型定义生成
- 改进了 Rollup 配置以支持多种输出格式
- 优化了开发和生产构建流程

所有更新都经过测试,确保向后兼容性。项目现在使用最新的工具链,提供更好的开发体验和更高的安全性。
61 changes: 61 additions & 0 deletions eslint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
import js from '@eslint/js';
import tseslint from '@typescript-eslint/eslint-plugin';
import tseslintParser from '@typescript-eslint/parser';
import importPlugin from 'eslint-plugin-import';
import jsdocPlugin from 'eslint-plugin-jsdoc';

export default [
js.configs.recommended,
{
files: ['src/**/*.ts'],
languageOptions: {
parser: tseslintParser,
parserOptions: {
ecmaVersion: 'latest',
sourceType: 'module',
project: './tsconfig.json'
}
},
plugins: {
'@typescript-eslint': tseslint,
'import': importPlugin,
'jsdoc': jsdocPlugin
},
rules: {
// TypeScript rules
'@typescript-eslint/no-unused-vars': 'warn',
'@typescript-eslint/no-explicit-any': 'warn',
'@typescript-eslint/explicit-function-return-type': 'off',
'@typescript-eslint/explicit-module-boundary-types': 'off',
'@typescript-eslint/prefer-const': 'error',

// Import rules
'import/order': 'warn',

// JSDoc rules
'jsdoc/check-alignment': 'warn',
'jsdoc/check-indentation': 'warn',

// General rules
'indent': ['error', 4],
'quotes': ['error', 'double'],
'semi': ['error', 'always'],
'no-console': 'warn',
'no-debugger': 'error'
}
},
{
files: ['test/**/*.js'],
languageOptions: {
ecmaVersion: 'latest',
sourceType: 'module',
globals: {
describe: 'readonly',
it: 'readonly',
expect: 'readonly',
beforeEach: 'readonly',
afterEach: 'readonly'
}
}
}
];
27 changes: 22 additions & 5 deletions jest.config.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,25 @@
export default {
preset: 'ts-jest',
// testEnvironment: 'node',
testEnvironment: 'jest-environment-node',
transform: {},
testEnvironment: 'node',
extensionsToTreatAsEsm: ['.ts'],
moduleNameMapper: {
'^(\\.{1,2}/.*)\\.js$': '$1'
},
transform: {
'^.+\\.ts$': ['ts-jest', {
useESM: true
}]
},
verbose: true,
coverageDirectory: './test/coverage'
};
coverageDirectory: './test/coverage',
collectCoverageFrom: [
'src/**/*.ts',
'!src/**/*.d.ts'
],
// 确保源码映射支持
collectCoverage: true,
coverageReporters: ['text', 'lcov', 'html'],
// 添加源码映射支持
setupFilesAfterEnv: [],
testMatch: ['<rootDir>/test/**/*.spec.js']
};
Loading