Merge pull request #368 from idrawjs/dev-v0.4

chore: bump deps and action scripts
This commit is contained in:
Deepsea 2025-09-06 14:06:41 +08:00 committed by GitHub
commit 643dd59cdd
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
11 changed files with 3481 additions and 2462 deletions

View file

@ -15,18 +15,18 @@ jobs:
if: github.repository == 'idrawjs/idraw'
strategy:
matrix:
node-version: [22.x]
node-version: [24.x]
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v5
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
uses: actions/setup-node@v5
with:
node-version: ${{ matrix.node-version }}
- run: npm config set registry https://registry.yarnpkg.com/
# - run: npm install
- run: npm install --global pnpm
- run: npm install --global pnpm@10
- run: pnpm i
- run: npm run beforetest
- run: npm run cover

View file

@ -15,18 +15,18 @@ jobs:
if: github.repository == 'idrawjs/idraw'
strategy:
matrix:
node-version: [22.x]
node-version: [24.x]
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v5
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
uses: actions/setup-node@v5
with:
node-version: ${{ matrix.node-version }}
- run: npm config set registry https://registry.yarnpkg.com/
# - run: npm install
- run: npm install --global pnpm
- run: npm install --global pnpm@10
- run: pnpm i
- run: npm run beforetest
- run: npm run test

View file

@ -10,13 +10,13 @@ jobs:
contents: read
id-token: write
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v5
# Setup .npmrc file to publish to npm
- uses: actions/setup-node@v4
- uses: actions/setup-node@v5
with:
node-version: '22.x'
node-version: '24.x'
registry-url: 'https://registry.npmjs.org'
- run: npm install --global pnpm
- run: npm install --global pnpm@10
- run: pnpm i
- run: npm run test
- run: npm run build

13
.vscode/settings.json vendored
View file

@ -1,6 +1,19 @@
{
"editor.formatOnSave": true,
"eslint.format.enable": true,
"eslint.useFlatConfig": true,
"eslint.lintTask.enable": true,
"eslint.lintTask.options": "--config eslint.config.js .",
"eslint.validate": [
"javascript",
"javascriptreact",
"typescript",
"typescriptreact",
"html"
],
"editor.codeActionsOnSave": {
"source.fixAll.eslint": "explicit"
},
"prettier.configPath": ".prettierrc.json",
"[typescript]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"

45
eslint.config.mjs Normal file
View file

@ -0,0 +1,45 @@
import globals from 'globals';
import pluginJs from '@eslint/js';
import tsESLint from 'typescript-eslint';
import eslintPluginReact from 'eslint-plugin-react';
import eslintPluginNode from 'eslint-plugin-n';
import typescriptEslint from '@typescript-eslint/eslint-plugin';
import tsParser from '@typescript-eslint/parser';
/** @type {import('eslint').Linter.Config[]} */
export default [
pluginJs.configs.recommended,
...tsESLint.configs.recommended,
eslintPluginReact.configs.flat.recommended,
{
...eslintPluginNode.configs['flat/recommended-script'],
files: ['scripts/**/*.ts', 'babel.config.js', 'jest.*.js', 'jest.*.*.js'],
rules: {
// 'no-console': 'error'
}
},
{
// files: ['src/**/*.{js,mjs,cjs,ts,jsx,tsx}'],
files: ['packages/*/src/**/*.ts'],
languageOptions: {
globals: globals.browser,
parser: tsParser,
ecmaVersion: 'latest',
sourceType: 'module',
parserOptions: {}
},
plugins: {
'@typescript-eslint': typescriptEslint
},
ignores: ['node_modules'],
rules: {
semi: 'error',
'no-console': 'error',
'comma-dangle': ['always-multiline'],
'@typescript-eslint/rule-name': 0,
'@typescript-eslint/no-explicit-any': 0,
'@typescript-eslint/explicit-module-boundary-types': 0,
'@typescript-eslint/no-unnecessary-type-constraint': 0
}
}
];

View file

@ -30,47 +30,56 @@
"upgrade:version": "npm run version:reset && pnpm i"
},
"devDependencies": {
"@babel/core": "^7.27.1",
"@babel/preset-env": "^7.27.2",
"@babel/core": "^7.28.4",
"@babel/preset-env": "^7.28.3",
"@babel/preset-typescript": "^7.27.1",
"@eslint/js": "^9.35.0",
"@rollup/plugin-json": "^6.1.0",
"@types/glob": "^8.1.0",
"@types/jest": "^29.5.14",
"@types/jest": "^30.0.0",
"@types/koa-compose": "^3.2.8",
"@types/node": "^22.15.17",
"@types/node": "^24.3.1",
"@types/serve-handler": "^6.1.4",
"@typescript-eslint/eslint-plugin": "^8.32.0",
"@typescript-eslint/parser": "^8.32.0",
"@vitejs/plugin-react": "^4.4.1",
"babel-jest": "^29.7.0",
"chalk": "^5.4.1",
"dotenv": "^16.5.0",
"@typescript-eslint/eslint-plugin": "^8.42.0",
"@typescript-eslint/parser": "^8.42.0",
"@vitejs/plugin-react": "^5.0.2",
"babel-jest": "^30.1.2",
"chalk": "^5.6.0",
"dotenv": "^17.2.2",
"enquirer": "^2.4.1",
"esbuild": "^0.25.4",
"eslint": "^9.26.0",
"execa": "^9.5.3",
"fs-extra": "^11.3.0",
"glob": "^11.0.2",
"esbuild": "^0.25.9",
"eslint": "^9.35.0",
"eslint-plugin-n": "^17.21.3",
"eslint-plugin-react": "^7.37.5",
"execa": "^9.6.0",
"fs-extra": "^11.3.1",
"glob": "^11.0.3",
"globals": "^16.3.0",
"http-server": "^14.1.1",
"husky": "^9.1.7",
"jest": "^29.7.0",
"jest": "^30.1.3",
"jest-canvas-mock": "^2.5.2",
"jest-environment-jsdom": "^29.7.0",
"jest-environment-jsdom": "^30.1.2",
"jimp": "^1.6.0",
"koa-compose": "^4.1.0",
"less": "^4.3.0",
"less": "^4.4.1",
"pixelmatch": "^7.1.0",
"pngjs": "^7.0.0",
"puppeteer": "^24.8.2",
"rollup": "^4.40.2",
"rollup-plugin-dts": "^6.2.1",
"puppeteer": "^24.19.0",
"rollup": "^4.50.0",
"rollup-plugin-dts": "^6.2.3",
"rollup-plugin-esbuild": "^6.2.1",
"serve-handler": "^6.1.6",
"terser": "^5.39.0",
"ts-morph": "^25.0.1",
"terser": "^5.44.0",
"ts-morph": "^26.0.0",
"ts-node": "^10.9.2",
"tslib": "^2.8.1",
"typescript": "^5.8.3",
"vite": "^6.3.5"
"typescript": "^5.9.2",
"typescript-eslint": "^8.42.0",
"vite": "^7.1.4"
},
"engines": {
"pnpm": ">=10",
"node": ">=24"
}
}

View file

@ -1,4 +1,4 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
// Jest Snapshot v1, https://jestjs.io/docs/snapshot-testing
exports[`@idraw/board: src/lib/context Context 1`] = `
[

View file

@ -1,3 +1,3 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
// Jest Snapshot v1, https://jestjs.io/docs/snapshot-testing
exports[`@idraw/util: lib/file downloadImageFromCanvas 1`] = `<canvas />`;

File diff suppressed because it is too large Load diff

View file

@ -21,6 +21,13 @@ async function buildBundle(opts: { dirName: string; globalName: string }) {
}
},
outDir: distDir
},
resolve: {
alias: {
'@idraw/util': joinPackagePath('util', 'src', 'index.ts'),
'@idraw/renderer': joinPackagePath('renderer', 'src', 'index.ts'),
'@idraw/core': joinPackagePath('core', 'src', 'index.ts')
}
}
};
console.log(`Start build bundle [${dirName}] ...`);

View file

@ -1,6 +1,7 @@
import ts from 'typescript';
import type { CompilerOptions } from 'typescript';
import { Project } from 'ts-morph';
import type { CompilerOptions } from 'ts-morph';
import type { CompilerOptions as TsMorphCompilerOptions } from 'ts-morph';
import path from 'path';
import fs from 'fs';
import * as glob from 'glob';
@ -54,7 +55,7 @@ function buildPackage(dirName: string) {
{
// const tsConfig = getTsConfig();
// const compilerOptions = tsConfig.compilerOptions;
const compilerOptions: CompilerOptions = {
const compilerOptions: TsMorphCompilerOptions = {
noUnusedLocals: true,
declaration: true,
sourceMap: false,
@ -76,7 +77,10 @@ function buildPackage(dirName: string) {
// tsConfigFilePath: joinProjectPath('tsconfig.web.json')
});
const program = ts.createProgram(targetFiles, compilerOptions);
const program = ts.createProgram({
rootNames: targetFiles,
options: compilerOptions as CompilerOptions
});
// const diagnostics = ts.getPreEmitDiagnostics(program);
// if (diagnostics.length) {