Skip to content

Commit 0325854

Browse files
authored
Merge branch 'master' into master
2 parents 6d8dbab + d55a1c0 commit 0325854

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

53 files changed

+443
-218
lines changed

.github/workflows/codeql.yml

Lines changed: 0 additions & 39 deletions
This file was deleted.

.github/workflows/nodejs.yml

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,13 @@ name: CI
33
on:
44
push:
55
branches: [ master ]
6-
76
pull_request:
87
branches: [ master ]
98

10-
workflow_dispatch: {}
11-
129
jobs:
1310
Job:
1411
name: Node.js
1512
uses: node-modules/github-actions/.github/workflows/node-test.yml@master
1613
with:
1714
os: 'ubuntu-latest'
18-
version: '14, 16, 18, 20'
15+
version: '20, 22'

.github/workflows/release.yml

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,10 @@ on:
44
push:
55
branches: [ master ]
66

7-
workflow_dispatch: {}
8-
97
jobs:
108
release:
119
name: Node.js
12-
uses: node-modules/github-actions/.github/workflows/node-release.yml@master
10+
uses: eggjs/github-actions/.github/workflows/node-release.yml@master
1311
secrets:
1412
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
1513
GIT_TOKEN: ${{ secrets.GIT_TOKEN }}
16-
with:
17-
checkTest: false

CHANGELOG.md

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,66 @@
11
# Changelog
22

3+
## [3.1.1](https://github.com/eggjs/egg-ts-helper/compare/v3.1.0...v3.1.1) (2025-03-05)
4+
5+
6+
### Bug Fixes
7+
8+
* make sure parent dir exists ([2a63587](https://github.com/eggjs/egg-ts-helper/commit/2a63587a59000a3a7eebf271e448694514a6cd39))
9+
10+
## [3.1.0](https://github.com/eggjs/egg-ts-helper/compare/v3.0.0...v3.1.0) (2025-03-05)
11+
12+
13+
### Features
14+
15+
* support gen ts defines on esm project ([#115](https://github.com/eggjs/egg-ts-helper/issues/115)) ([5c25621](https://github.com/eggjs/egg-ts-helper/commit/5c256219b684922b026dbe25b2840feb9b09c22d))
16+
17+
## [3.0.0](https://github.com/eggjs/egg-ts-helper/compare/v2.1.1...v3.0.0) (2025-02-04)
18+
19+
20+
### ⚠ BREAKING CHANGES
21+
22+
* drop Node.js < 18.19.0 support
23+
24+
Only support egg >= 4.0.0
25+
26+
part of https://github.com/eggjs/egg/issues/3644
27+
28+
https://github.com/eggjs/egg/issues/5257
29+
30+
<!-- This is an auto-generated comment: release notes by coderabbit.ai
31+
-->
32+
33+
## Summary by CodeRabbit
34+
35+
- **Documentation**
36+
- Introduced a new “Contributors” section in the project documentation
37+
to highlight community involvement.
38+
- **Chores**
39+
- Streamlined CI workflows by removing legacy configurations and
40+
updating triggers for improved efficiency.
41+
- Upgraded key dependencies and increased the minimum required Node.js
42+
version for enhanced performance and security.
43+
- **Refactor**
44+
- Standardized module import practices across the codebase to align with
45+
current Node.js conventions.
46+
- Improved asynchronous handling in core operations.
47+
- **Tests**
48+
- Updated test setups and assertions to reflect the new module import
49+
standards and dependency changes.
50+
51+
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
52+
53+
### Features
54+
55+
* support egg v4 ([#114](https://github.com/eggjs/egg-ts-helper/issues/114)) ([90491cf](https://github.com/eggjs/egg-ts-helper/commit/90491cf758e6a36d006b06caf0bac91065c17afb))
56+
57+
## [2.1.1](https://github.com/eggjs/egg-ts-helper/compare/v2.1.0...v2.1.1) (2025-02-04)
58+
59+
60+
### Bug Fixes
61+
62+
* load the tsconfig extends with the specific extension name ([#111](https://github.com/eggjs/egg-ts-helper/issues/111)) ([2bbc458](https://github.com/eggjs/egg-ts-helper/commit/2bbc458bd1d7d695f482ad88c5f3bbc5b365f2c7))
63+
364
## [2.1.0](https://github.com/eggjs/egg-ts-helper/compare/v2.0.0...v2.1.0) (2023-08-31)
465

566

README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -535,3 +535,9 @@ JS demo: <https://github.com/whxaxes/egg-boilerplate-d-js>
535535
## License
536536

537537
[MIT](LICENSE)
538+
539+
## Contributors
540+
541+
[![Contributors](https://contrib.rocks/image?repo=eggjs/tracer)](https://github.com/eggjs/tracer/graphs/contributors)
542+
543+
Made with [contributors-img](https://contrib.rocks).

README.zh-CN.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -516,3 +516,9 @@ JS 项目: <https://github.com/whxaxes/egg-boilerplate-d-js>
516516
## License
517517

518518
[MIT](LICENSE)
519+
520+
## Contributors
521+
522+
[![Contributors](https://contrib.rocks/image?repo=eggjs/tracer)](https://github.com/eggjs/tracer/graphs/contributors)
523+
524+
Made with [contributors-img](https://contrib.rocks).

package.json

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "egg-ts-helper",
3-
"version": "2.1.0",
3+
"version": "3.1.1",
44
"description": "egg typescript helper",
55
"bin": {
66
"ets": "dist/bin.js"
@@ -10,7 +10,8 @@
1010
"files": [
1111
"src",
1212
"dist",
13-
"register.js"
13+
"register.js",
14+
"save_egg_info.mjs"
1415
],
1516
"repository": {
1617
"type": "git",
@@ -23,9 +24,9 @@
2324
"lint": "eslint . --ext .ts",
2425
"check": "npm run tsc && npm run lint",
2526
"test": "npm run check && npm run test-local",
26-
"test-local": "egg-bin test --ts",
27+
"test-local": "egg-bin test",
2728
"prepublishOnly": "del dist && npm run tsc",
28-
"cov": "egg-bin cov --ts",
29+
"cov": "egg-bin cov",
2930
"ci": "npm run check && npm run cov && npm run tsc"
3031
},
3132
"keywords": [
@@ -35,6 +36,7 @@
3536
"author": "wanghx",
3637
"license": "MIT",
3738
"dependencies": {
39+
"@eggjs/utils": "^4.4.1",
3840
"chalk": "^4.0.0",
3941
"chokidar": "^3.0.0",
4042
"commander": "^2.15.1",
@@ -48,24 +50,24 @@
4850
"yn": "^3.0.0"
4951
},
5052
"devDependencies": {
53+
"@eggjs/bin": "^7.0.4",
54+
"@eggjs/mock": "^6.0.5",
5155
"@eggjs/tsconfig": "^1.0.0",
56+
"@tsconfig/node14": "^14.1.2",
5257
"@types/commander": "^2.12.2",
5358
"@types/del": "^3.0.0",
5459
"@types/globby": "^6.1.0",
5560
"@types/mocha": "^10.0.0",
5661
"@types/node": "^20.4.5",
5762
"del": "^3.0.0",
5863
"del-cli": "^1.1.0",
59-
"egg": "^3.5.0",
60-
"egg-bin": "^6.4.1",
61-
"egg-mock": "^5.2.1",
64+
"egg": "^4.0.9",
6265
"egg-sequelize": "^4.3.1",
6366
"eslint": "^8.28.0",
64-
"eslint-config-egg": "^12.1.0",
65-
"extend2": "^1.0.0",
66-
"runscript": "^1.3.0"
67+
"eslint-config-egg": "14",
68+
"extend2": "^1.0.0"
6769
},
6870
"engines": {
69-
"node": ">= 14.21.3"
71+
"node": ">= 18.19.0"
7072
}
7173
}

save_egg_info.mjs

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
import path from 'node:path';
2+
import fs from 'node:fs/promises';
3+
import { getLoader } from '@eggjs/utils';
4+
5+
// node save_egg_info.mjs baseDir frameworkPath saveEggInfoPath
6+
7+
const [ baseDir, frameworkPath, saveEggInfoPath ] = process.argv.slice(2);
8+
9+
async function main() {
10+
console.warn('[egg-ts-helper] Save egg info, baseDir: %s, frameworkPath: %s', baseDir, frameworkPath);
11+
const startTime = Date.now();
12+
const loader = await getLoader({
13+
framework: frameworkPath,
14+
baseDir,
15+
});
16+
// console.log(loader);
17+
18+
try {
19+
await loader.loadPlugin();
20+
} catch (e) {
21+
console.warn('[egg-ts-helper] WARN loader.loadPlugin() error: %s, baseDir: %s, frameworkPath: %s',
22+
e, baseDir, frameworkPath);
23+
// do nothing
24+
}
25+
26+
try {
27+
await loader.loadConfig();
28+
} catch (e) {
29+
console.warn('[egg-ts-helper] WARN loader.loadConfig() error: %s, baseDir: %s, frameworkPath: %s',
30+
e, baseDir, frameworkPath);
31+
// do nothing
32+
}
33+
34+
const eggInfo = {};
35+
eggInfo.plugins = loader.allPlugins;
36+
eggInfo.config = loader.config;
37+
eggInfo.eggPaths = loader.eggPaths;
38+
eggInfo.timing = Date.now() - startTime;
39+
console.warn('[egg-ts-helper] plugins: %j', Object.keys(eggInfo.plugins));
40+
await fs.mkdir(path.dirname(saveEggInfoPath), { recursive: true });
41+
await fs.writeFile(saveEggInfoPath, JSON.stringify(eggInfo, null, 2));
42+
}
43+
44+
main();

src/cmd/init.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { prompt } from 'enquirer';
22
import * as utils from '../utils';
3-
import path from 'path';
4-
import fs from 'fs';
3+
import path from 'node:path';
4+
import fs from 'node:fs';
55
import { createTsHelperInstance } from '../';
66

77
const TYPE_TS = 'typescript';

src/command.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
1-
2-
import path from 'path';
1+
import path from 'node:path';
32
import { Command } from 'commander';
4-
import assert from 'assert';
3+
import assert from 'node:assert';
54
import TsHelper, { defaultConfig } from './core';
65
import { loadModules, writeJsConfig, checkMaybeIsJsProj, getPkgInfo } from './utils';
76

0 commit comments

Comments
 (0)