Skip to content

Commit

Permalink
feat: support cjs and esm both by tshy
Browse files Browse the repository at this point in the history
BREAKING CHANGE: drop Node.js < 18.19.0 support

part of eggjs/egg#3644

eggjs/egg#5257
  • Loading branch information
fengmk2 committed Jan 3, 2025
1 parent 4a77f8b commit 05ed034
Show file tree
Hide file tree
Showing 16 changed files with 48 additions and 56 deletions.
24 changes: 0 additions & 24 deletions .github/PULL_REQUEST_TEMPLATE.md

This file was deleted.

3 changes: 1 addition & 2 deletions .github/workflows/nodejs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ name: CI
on:
push:
branches: [ master ]

pull_request:
branches: [ master ]

Expand All @@ -13,4 +12,4 @@ jobs:
uses: node-modules/github-actions/.github/workflows/node-test.yml@master
with:
os: 'ubuntu-latest'
version: '16, 18, 20'
version: '18, 20, 22'
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,5 @@ logs
run
*.sw*
*.un~
package-lock.json
.package-lock.json
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,3 +27,9 @@ open http://localhost:7001
```

See [egg-init](https://github.com/eggjs/egg-init) for more detail.

## Contributors

[![Contributors](https://contrib.rocks/image?repo=eggjs/egg-boilerplate-ts)](https://github.com/eggjs/egg-boilerplate-ts/graphs/contributors)

Made with [contributors-img](https://contrib.rocks).
4 changes: 2 additions & 2 deletions boilerplate/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,5 +29,5 @@ npm start

### Requirement

- Node.js >= 16.x
- Typescript >= 4.x
- Node.js >= 18.x
- Typescript >= 5.x
2 changes: 2 additions & 0 deletions boilerplate/_.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,5 @@ config/**/*.js
app/**/*.map
test/**/*.map
config/**/*.map
package-lock.json
.package-lock.json
33 changes: 18 additions & 15 deletions boilerplate/_package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,41 +7,44 @@
"typescript": true
},
"scripts": {
"start": "egg-scripts start --daemon --title=egg-server-{{name}}",
"stop": "egg-scripts stop --title=egg-server-{{name}}",
"start": "eggctl start --daemon --title=egg-server-{{name}}",
"stop": "eggctl stop --title=egg-server-{{name}}",
"dev": "egg-bin dev",
"test:local": "egg-bin test -p",
"test": "npm run lint -- --fix && npm run test:local",
"cov": "egg-bin cov -p",
"ci": "npm run lint && npm run cov && npm run tsc && npm run clean",
"test:local": "egg-bin test",
"pretest": "npm run clean && npm run lint -- --fix",
"test": "egg-bin test",
"preci": "npm run clean && npm run lint",
"ci": "egg-bin cov",
"postci": "npm run tsc && npm run clean",
"lint": "eslint . --ext .ts --cache",
"tsc": "tsc",
"clean": "tsc -b --clean"
"clean": "tsc -b --clean",
"prepublishOnly": "npm run clean && npm run tsc"
},
"dependencies": {
"@eggjs/tegg": "^3.5.2",
"@eggjs/tegg-aop-plugin": "^3.5.2",
"@eggjs/tegg-config": "^3.2.3",
"@eggjs/tegg-config": "^3.5.2",
"@eggjs/tegg-controller-plugin": "^3.5.2",
"@eggjs/tegg-eventbus-plugin": "^3.5.2",
"@eggjs/tegg-plugin": "^3.5.2",
"@eggjs/tegg-schedule-plugin": "^3.5.2",
"egg": "^3.15.0",
"egg-scripts": "^2.17.0",
"egg": "beta",
"@eggjs/scripts": "^4.0.0",
"egg-tracer": "^2.0.0"
},
"devDependencies": {
"@types/mocha": "10",
"@types/node": "20",
"@types/node": "22",
"@eggjs/tsconfig": "1",
"egg-bin": "6",
"egg-mock": "5",
"@eggjs/bin": "7",
"@eggjs/mock": "6",
"eslint": "8",
"eslint-config-egg": "13",
"eslint-config-egg": "14",
"typescript": "5"
},
"engines": {
"node": ">=20.10.0"
"node": ">=20.18.1"
},
"repository": {
"type": "git",
Expand Down
2 changes: 1 addition & 1 deletion boilerplate/app/module/foo/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@
"eggModule": {
"name": "foo"
}
}
}
4 changes: 2 additions & 2 deletions boilerplate/config/config.default.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { EggAppConfig, EggAppInfo, PowerPartial } from 'egg';
import { EggAppConfig, EggAppInfo } from 'egg';

export default (appInfo: EggAppInfo) => {
const config = {} as PowerPartial<EggAppConfig>;
const config = {} as EggAppConfig;

// override config from framework / plugin
// use for cookie sign key, should change to your own and keep security
Expand Down
4 changes: 2 additions & 2 deletions boilerplate/config/config.local.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { EggAppConfig, PowerPartial } from 'egg';
import { EggAppConfig } from 'egg';

export default () => {
const config: PowerPartial<EggAppConfig> = {};
const config = {} as EggAppConfig;
return config;
};
4 changes: 2 additions & 2 deletions boilerplate/config/config.prod.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { EggAppConfig, PowerPartial } from 'egg';
import { EggAppConfig } from 'egg';

export default () => {
const config: PowerPartial<EggAppConfig> = {};
const config = {} as EggAppConfig;
return config;
};
2 changes: 1 addition & 1 deletion boilerplate/test/app/module/bar/controller/home.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { strict as assert } from 'node:assert';
import { app } from 'egg-mock/bootstrap';
import { app } from '@eggjs/mock/bootstrap';

describe('test/app/module/bar/controller/home.test.ts', () => {
it('should GET /', async () => {
Expand Down
2 changes: 1 addition & 1 deletion boilerplate/test/app/module/bar/controller/user.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { strict as assert } from 'node:assert';
import { app } from 'egg-mock/bootstrap';
import { app } from '@eggjs/mock/bootstrap';

describe('test/app/module/bar/controller/user.test.ts', () => {
it('should GET /', async () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { strict as assert } from 'node:assert';
import { app } from 'egg-mock/bootstrap';
import { app } from '@eggjs/mock/bootstrap';
import { HelloService } from '@/module/foo/service/HelloService';

describe('test/app/module/foo/service/HelloService.test.js', () => {
Expand Down
3 changes: 3 additions & 0 deletions boilerplate/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
{
"extends": "@eggjs/tsconfig",
"compilerOptions": {
"target": "ES2022",
"module": "NodeNext",
"moduleResolution": "NodeNext",
"declaration": false,
"paths": {
"@/module/*": ["app/module/*"]
Expand Down
7 changes: 4 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@
"author": "TZ <[email protected]>",
"devDependencies": {
"egg-init": "^3.0.2",
"eslint": "^8.34.0",
"eslint-config-egg": "13"
}
"eslint": "8",
"eslint-config-egg": "14"
},
"license": "MIT"
}

0 comments on commit 05ed034

Please sign in to comment.