create-egg 4.0.1-beta.0 → 4.1.0-beta.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/templates/egg3-simple-js/package.json +2 -2
- package/dist/templates/egg3-simple-ts/package.json +2 -2
- package/dist/templates/egg3-tegg/app/module/bar/controller/home.ts +1 -6
- package/dist/templates/egg3-tegg/app/module/bar/controller/user.ts +1 -7
- package/dist/templates/egg3-tegg/package.json +2 -2
- package/dist/templates/egg3-tegg/test/app/module/bar/controller/user.test.ts +1 -4
- package/dist/templates/simple-ts/config/config.default.ts +9 -10
- package/dist/templates/simple-ts/config/config.local.ts +4 -5
- package/dist/templates/simple-ts/config/config.prod.ts +4 -5
- package/dist/templates/simple-ts/test/app/controller/home.test.ts +1 -1
- package/dist/templates/simple-ts/test/app/service/Test.test.ts +1 -1
- package/dist/templates/simple-ts/test/setup.ts +5 -0
- package/dist/templates/simple-ts/vitest.config.ts +7 -0
- package/dist/templates/tegg/app/module/bar/controller/home.ts +2 -7
- package/dist/templates/tegg/app/module/bar/controller/user.ts +2 -8
- package/dist/templates/tegg/app/module/bar/package.json +2 -1
- package/dist/templates/tegg/app/module/foo/package.json +2 -1
- package/dist/templates/tegg/app/module/foo/service/HelloService.ts +1 -1
- package/dist/templates/tegg/config/config.default.ts +14 -15
- package/dist/templates/tegg/config/config.local.ts +4 -5
- package/dist/templates/tegg/config/config.prod.ts +4 -5
- package/dist/templates/tegg/config/config.unittest.ts +4 -5
- package/dist/templates/tegg/config/plugin.ts +1 -1
- package/dist/templates/tegg/package.json +15 -11
- package/dist/templates/tegg/test/app/module/bar/controller/user.test.ts +1 -4
- package/dist/templates/tegg/test/app/module/foo/service/{HelloService.test.ts → HelloService.test.skip.ts} +2 -1
- package/dist/templates/tegg/test/setup.ts +5 -0
- package/dist/templates/tegg/tsconfig.json +0 -3
- package/dist/templates/tegg/vitest.config.ts +7 -0
- package/package.json +2 -2
|
@@ -8,13 +8,13 @@
|
|
|
8
8
|
},
|
|
9
9
|
"dependencies": {
|
|
10
10
|
"egg": "^3.17.5",
|
|
11
|
-
"egg-scripts": "
|
|
11
|
+
"egg-scripts": "3"
|
|
12
12
|
},
|
|
13
13
|
"devDependencies": {
|
|
14
14
|
"egg-bin": "6",
|
|
15
15
|
"egg-mock": "5",
|
|
16
16
|
"eslint": "8",
|
|
17
|
-
"eslint-config-egg": "
|
|
17
|
+
"eslint-config-egg": "14"
|
|
18
18
|
},
|
|
19
19
|
"engines": {
|
|
20
20
|
"node": ">=18.0.0"
|
|
@@ -26,11 +26,11 @@
|
|
|
26
26
|
"devDependencies": {
|
|
27
27
|
"@types/mocha": "10",
|
|
28
28
|
"@types/node": "24",
|
|
29
|
-
"@eggjs/tsconfig": "
|
|
29
|
+
"@eggjs/tsconfig": "3",
|
|
30
30
|
"egg-bin": "6",
|
|
31
31
|
"egg-mock": "5",
|
|
32
32
|
"eslint": "8",
|
|
33
|
-
"eslint-config-egg": "
|
|
33
|
+
"eslint-config-egg": "14",
|
|
34
34
|
"typescript": "5"
|
|
35
35
|
},
|
|
36
36
|
"engines": {
|
|
@@ -1,10 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
Inject,
|
|
3
|
-
HTTPController,
|
|
4
|
-
HTTPMethod,
|
|
5
|
-
HTTPMethodEnum,
|
|
6
|
-
HTTPQuery,
|
|
7
|
-
} from '@eggjs/tegg';
|
|
1
|
+
import { Inject, HTTPController, HTTPMethod, HTTPMethodEnum, HTTPQuery } from '@eggjs/tegg';
|
|
8
2
|
import { HelloService } from '@/module/foo';
|
|
9
3
|
|
|
10
4
|
@HTTPController({
|
|
@@ -28,14 +28,14 @@
|
|
|
28
28
|
"@eggjs/tegg-eventbus-plugin": "^3.5.2",
|
|
29
29
|
"@eggjs/tegg-plugin": "^3.5.2",
|
|
30
30
|
"@eggjs/tegg-schedule-plugin": "^3.5.2",
|
|
31
|
-
"egg-scripts": "^
|
|
31
|
+
"egg-scripts": "^3.0.0",
|
|
32
32
|
"egg-tracer": "^2.0.0",
|
|
33
33
|
"egg": "^3.31.0"
|
|
34
34
|
},
|
|
35
35
|
"devDependencies": {
|
|
36
36
|
"egg-bin": "^6.13.0",
|
|
37
37
|
"egg-mock": "^5.15.2",
|
|
38
|
-
"@eggjs/tsconfig": "
|
|
38
|
+
"@eggjs/tsconfig": "3",
|
|
39
39
|
"@types/mocha": "10",
|
|
40
40
|
"@types/node": "24",
|
|
41
41
|
"oxlint": "1",
|
|
@@ -4,10 +4,7 @@ import { app } from 'egg-mock/bootstrap';
|
|
|
4
4
|
|
|
5
5
|
describe('test/app/module/bar/controller/user.test.ts', () => {
|
|
6
6
|
it('should GET /bar/user status 200', async () => {
|
|
7
|
-
const res = await app
|
|
8
|
-
.httpRequest()
|
|
9
|
-
.get('/bar/user')
|
|
10
|
-
.query({ userId: '20170901' });
|
|
7
|
+
const res = await app.httpRequest().get('/bar/user').query({ userId: '20170901' });
|
|
11
8
|
assert.equal(res.status, 200);
|
|
12
9
|
assert.equal(res.text, 'hello, 20170901');
|
|
13
10
|
});
|
|
@@ -1,14 +1,13 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { defineConfig, type PartialEggConfig } from 'egg';
|
|
2
2
|
|
|
3
|
-
export default (appInfo
|
|
4
|
-
const config = {
|
|
3
|
+
export default defineConfig(appInfo => {
|
|
4
|
+
const config = {
|
|
5
|
+
// use for cookie sign key, should change to your own and keep security
|
|
6
|
+
keys: appInfo.name + '_{{keys}}',
|
|
5
7
|
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
// add your egg config in here
|
|
11
|
-
config.middleware = [];
|
|
8
|
+
// add your egg config in here
|
|
9
|
+
middleware: [] as string[],
|
|
10
|
+
} as PartialEggConfig;
|
|
12
11
|
|
|
13
12
|
// add your special config in here
|
|
14
13
|
const bizConfig = {
|
|
@@ -20,4 +19,4 @@ export default (appInfo: EggAppInfo) => {
|
|
|
20
19
|
...config,
|
|
21
20
|
...bizConfig,
|
|
22
21
|
};
|
|
23
|
-
};
|
|
22
|
+
});
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { PartialEggConfig } from 'egg';
|
|
2
2
|
|
|
3
|
-
export default
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
};
|
|
3
|
+
export default {
|
|
4
|
+
// add your config here
|
|
5
|
+
} as PartialEggConfig;
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { PartialEggConfig } from 'egg';
|
|
2
2
|
|
|
3
|
-
export default
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
};
|
|
3
|
+
export default {
|
|
4
|
+
// add your config here
|
|
5
|
+
} as PartialEggConfig;
|
|
@@ -1,10 +1,5 @@
|
|
|
1
|
-
import { EggLogger } from 'egg';
|
|
2
|
-
import {
|
|
3
|
-
Inject,
|
|
4
|
-
HTTPController,
|
|
5
|
-
HTTPMethod,
|
|
6
|
-
HTTPMethodEnum,
|
|
7
|
-
} from '@eggjs/tegg';
|
|
1
|
+
import type { EggLogger } from 'egg';
|
|
2
|
+
import { Inject, HTTPController, HTTPMethod, HTTPMethodEnum } from '@eggjs/tegg';
|
|
8
3
|
|
|
9
4
|
@HTTPController({
|
|
10
5
|
path: '/',
|
|
@@ -1,11 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
HTTPController,
|
|
4
|
-
HTTPMethod,
|
|
5
|
-
HTTPMethodEnum,
|
|
6
|
-
HTTPQuery,
|
|
7
|
-
} from '@eggjs/tegg';
|
|
8
|
-
import { HelloService } from '@/module/foo';
|
|
1
|
+
import { Inject, HTTPController, HTTPMethod, HTTPMethodEnum, HTTPQuery } from '@eggjs/tegg';
|
|
2
|
+
import { HelloService } from '../../foo/index.ts';
|
|
9
3
|
|
|
10
4
|
@HTTPController({
|
|
11
5
|
path: '/bar',
|
|
@@ -1,20 +1,19 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { defineConfig, type PartialEggConfig } from 'egg';
|
|
2
2
|
|
|
3
|
-
export default (appInfo
|
|
4
|
-
const config = {
|
|
3
|
+
export default defineConfig(appInfo => {
|
|
4
|
+
const config = {
|
|
5
|
+
// use for cookie sign key, should change to your own and keep security
|
|
6
|
+
keys: appInfo.name + '_{{keys}}',
|
|
5
7
|
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
config.keys = appInfo.name + '_{{keys}}';
|
|
8
|
+
// add your egg config in here
|
|
9
|
+
middleware: [] as string[],
|
|
9
10
|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
mode: 'file',
|
|
17
|
-
};
|
|
11
|
+
// change multipart mode to file
|
|
12
|
+
// @see https://github.com/eggjs/multipart/blob/master/src/config/config.default.ts#L104
|
|
13
|
+
multipart: {
|
|
14
|
+
mode: 'file' as const,
|
|
15
|
+
},
|
|
16
|
+
} as PartialEggConfig;
|
|
18
17
|
|
|
19
18
|
// add your special config in here
|
|
20
19
|
// Usage: `app.config.bizConfig.sourceUrl`
|
|
@@ -27,4 +26,4 @@ export default (appInfo: EggAppInfo) => {
|
|
|
27
26
|
...config,
|
|
28
27
|
bizConfig,
|
|
29
28
|
};
|
|
30
|
-
};
|
|
29
|
+
});
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { PartialEggConfig } from 'egg';
|
|
2
2
|
|
|
3
|
-
export default
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
};
|
|
3
|
+
export default {
|
|
4
|
+
// add your config here
|
|
5
|
+
} as PartialEggConfig;
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { PartialEggConfig } from 'egg';
|
|
2
2
|
|
|
3
|
-
export default
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
};
|
|
3
|
+
export default {
|
|
4
|
+
// add your config here
|
|
5
|
+
} as PartialEggConfig;
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { PartialEggConfig } from 'egg';
|
|
2
2
|
|
|
3
|
-
export default
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
};
|
|
3
|
+
export default {
|
|
4
|
+
// add your config here
|
|
5
|
+
} as PartialEggConfig;
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
"name": "{{name}}",
|
|
3
3
|
"description": "Hello Egg.js",
|
|
4
4
|
"private": true,
|
|
5
|
+
"type": "module",
|
|
5
6
|
"egg": {
|
|
6
7
|
"typescript": true
|
|
7
8
|
},
|
|
@@ -9,11 +10,11 @@
|
|
|
9
10
|
"start": "eggctl start --daemon --title=egg-server-{{name}}",
|
|
10
11
|
"stop": "eggctl stop --title=egg-server-{{name}}",
|
|
11
12
|
"dev": "egg-bin dev",
|
|
12
|
-
"test:local": "vitest run",
|
|
13
|
+
"test:local": "cross-env NODE_OPTIONS=\"--import @oxc-node/core/register\" vitest run",
|
|
13
14
|
"pretest": "npm run clean && npm run lint -- --fix",
|
|
14
|
-
"test": "
|
|
15
|
+
"test": "npm run test:local",
|
|
15
16
|
"preci": "npm run clean && npm run lint",
|
|
16
|
-
"ci": "
|
|
17
|
+
"ci": "npm run test:local -- --coverage",
|
|
17
18
|
"postci": "npm run prepublishOnly && npm start && sleep 10 && npm stop && npm run clean",
|
|
18
19
|
"lint": "oxlint --type-aware",
|
|
19
20
|
"tsc": "tsc",
|
|
@@ -22,13 +23,13 @@
|
|
|
22
23
|
},
|
|
23
24
|
"dependencies": {
|
|
24
25
|
"@eggjs/scripts": "^4.0.0",
|
|
25
|
-
"@eggjs/tegg": "
|
|
26
|
-
"@eggjs/tegg-aop-plugin": "
|
|
27
|
-
"@eggjs/tegg-config": "
|
|
28
|
-
"@eggjs/tegg-controller-plugin": "
|
|
29
|
-
"@eggjs/tegg-eventbus-plugin": "
|
|
30
|
-
"@eggjs/tegg-plugin": "
|
|
31
|
-
"@eggjs/tegg-schedule-plugin": "
|
|
26
|
+
"@eggjs/tegg": "beta",
|
|
27
|
+
"@eggjs/tegg-aop-plugin": "beta",
|
|
28
|
+
"@eggjs/tegg-config": "beta",
|
|
29
|
+
"@eggjs/tegg-controller-plugin": "beta",
|
|
30
|
+
"@eggjs/tegg-eventbus-plugin": "beta",
|
|
31
|
+
"@eggjs/tegg-plugin": "beta",
|
|
32
|
+
"@eggjs/tegg-schedule-plugin": "beta",
|
|
32
33
|
"@eggjs/tracer": "^3.0.0",
|
|
33
34
|
"egg": "beta"
|
|
34
35
|
},
|
|
@@ -36,11 +37,14 @@
|
|
|
36
37
|
"@eggjs/bin": "beta",
|
|
37
38
|
"@eggjs/mock": "beta",
|
|
38
39
|
"@eggjs/tsconfig": "beta",
|
|
40
|
+
"@oxc-node/core": "^0.0.32",
|
|
39
41
|
"@types/node": "24",
|
|
42
|
+
"cross-env": "10",
|
|
40
43
|
"oxlint": "1",
|
|
41
44
|
"oxlint-tsgolint": "^0.2.0",
|
|
42
45
|
"typescript": "5",
|
|
43
|
-
"vitest": "beta"
|
|
46
|
+
"vitest": "beta",
|
|
47
|
+
"@vitest/coverage-v8": "beta"
|
|
44
48
|
},
|
|
45
49
|
"engines": {
|
|
46
50
|
"node": ">=20.19.0"
|
|
@@ -2,10 +2,7 @@ import { test, expect } from 'vitest';
|
|
|
2
2
|
import { app } from '@eggjs/mock/bootstrap';
|
|
3
3
|
|
|
4
4
|
test('should GET /bar/user status 200', async () => {
|
|
5
|
-
const res = await app
|
|
6
|
-
.httpRequest()
|
|
7
|
-
.get('/bar/user')
|
|
8
|
-
.query({ userId: '20170901' });
|
|
5
|
+
const res = await app.httpRequest().get('/bar/user').query({ userId: '20170901' });
|
|
9
6
|
expect(res.status).toBe(200);
|
|
10
7
|
expect(res.text).toBe('hello, 20170901');
|
|
11
8
|
});
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { test, expect } from 'vitest';
|
|
2
2
|
import { app } from '@eggjs/mock/bootstrap';
|
|
3
|
-
|
|
3
|
+
|
|
4
|
+
import { HelloService } from '../../../../../app/module/foo/index.ts';
|
|
4
5
|
|
|
5
6
|
test('should hello() work', async () => {
|
|
6
7
|
const helloService = await app.getEggObject(HelloService);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-egg",
|
|
3
|
-
"version": "4.0
|
|
3
|
+
"version": "4.1.0-beta.11",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
"@types/cross-spawn": "^6.0.6",
|
|
11
11
|
"@types/node": "24.5.2",
|
|
12
12
|
"execa": "^9.6.0",
|
|
13
|
-
"tsdown": "0.15.
|
|
13
|
+
"tsdown": "^0.15.4"
|
|
14
14
|
},
|
|
15
15
|
"engines": {
|
|
16
16
|
"node": ">=20.19.0"
|