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 Feb 4, 2025
1 parent 1b5f8c0 commit ab5e56c
Show file tree
Hide file tree
Showing 26 changed files with 231 additions and 231 deletions.
5 changes: 4 additions & 1 deletion .eslintrc
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
{
"extends": "eslint-config-egg"
"extends": [
"eslint-config-egg",
"eslint-config-egg/lib/rules/enforce-node-prefix"
]
}
24 changes: 0 additions & 24 deletions .github/PULL_REQUEST_TEMPLATE.md

This file was deleted.

41 changes: 0 additions & 41 deletions .github/workflows/codeql.yml

This file was deleted.

51 changes: 11 additions & 40 deletions .github/workflows/nodejs.yml
Original file line number Diff line number Diff line change
@@ -1,46 +1,17 @@
# This workflow will do a clean install of node dependencies, build the source code and run tests across different versions of node
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions

name: Node.js CI
name: CI

on:
push:
branches:
- main
- master
branches: [ master ]
pull_request:
branches:
- main
- master
schedule:
- cron: '0 2 * * *'
branches: [ master ]

jobs:
build:
runs-on: ${{ matrix.os }}

strategy:
fail-fast: false
matrix:
node-version: [16]
os: [ubuntu-latest, windows-latest, macos-latest]

steps:
- name: Checkout Git Source
uses: actions/checkout@v2

- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}

- name: Install Dependencies
run: npm i

- name: Continuous Integration
run: npm run ci

- name: Code Coverage
uses: codecov/codecov-action@v1
with:
token: ${{ secrets.CODECOV_TOKEN }}
Job:
name: Node.js
uses: node-modules/github-actions/.github/workflows/node-test.yml@master
with:
os: 'ubuntu-latest, macos-latest, windows-latest'
version: '18, 20, 22'
secrets:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
12 changes: 12 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
name: Release
on:
push:
branches: [ master ]

jobs:
release:
name: Node.js
uses: eggjs/github-actions/.github/workflows/node-release.yml@master
secrets:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
GIT_TOKEN: ${{ secrets.GIT_TOKEN }}
File renamed without changes.
14 changes: 14 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,17 @@
# egg-boilerplate-plugin

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

## Questions & Suggestions

Please open an issue [here](https://github.com/eggjs/egg/issues).

## License

[MIT](LICENSE)

## Contributors

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

Made with [contributors-img](https://contrib.rocks).
2 changes: 2 additions & 0 deletions boilerplate/.eslintignore
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
test/fixtures
coverage
__snapshots__
5 changes: 4 additions & 1 deletion boilerplate/.eslintrc
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
{
"extends": "eslint-config-egg",
"extends": [
"eslint-config-egg/typescript",
"eslint-config-egg/lib/rules/enforce-node-prefix"
],
"root": true
}
24 changes: 0 additions & 24 deletions boilerplate/.github/PULL_REQUEST_TEMPLATE.md

This file was deleted.

17 changes: 17 additions & 0 deletions boilerplate/.github/workflows/nodejs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
name: CI

on:
push:
branches: [ master ]
pull_request:
branches: [ master ]

jobs:
Job:
name: Node.js
uses: node-modules/github-actions/.github/workflows/node-test.yml@master
with:
os: 'ubuntu-latest, macos-latest, windows-latest'
version: '18, 20, 22'
secrets:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
12 changes: 12 additions & 0 deletions boilerplate/.github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
name: Release
on:
push:
branches: [ master ]

jobs:
release:
name: Node.js
uses: eggjs/github-actions/.github/workflows/node-release.yml@master
secrets:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
GIT_TOKEN: ${{ secrets.GIT_TOKEN }}
36 changes: 18 additions & 18 deletions boilerplate/README.md
Original file line number Diff line number Diff line change
@@ -1,24 +1,18 @@
# egg-{{name}}
# @eggjs/{{name}}

[![NPM version][npm-image]][npm-url]
[![build status][travis-image]][travis-url]
[![Test coverage][codecov-image]][codecov-url]
[![David deps][david-image]][david-url]
[![Known Vulnerabilities][snyk-image]][snyk-url]
[![npm download][download-image]][download-url]

[npm-image]: https://img.shields.io/npm/v/egg-{{name}}.svg?style=flat-square
[npm-url]: https://npmjs.org/package/egg-{{name}}
[travis-image]: https://img.shields.io/travis/eggjs/egg-{{name}}.svg?style=flat-square
[travis-url]: https://travis-ci.org/eggjs/egg-{{name}}
[codecov-image]: https://img.shields.io/codecov/c/github/eggjs/egg-{{name}}.svg?style=flat-square
[codecov-url]: https://codecov.io/github/eggjs/egg-{{name}}?branch=master
[david-image]: https://img.shields.io/david/eggjs/egg-{{name}}.svg?style=flat-square
[david-url]: https://david-dm.org/eggjs/egg-{{name}}
[snyk-image]: https://snyk.io/test/npm/egg-{{name}}/badge.svg?style=flat-square
[snyk-url]: https://snyk.io/test/npm/egg-{{name}}
[download-image]: https://img.shields.io/npm/dm/egg-{{name}}.svg?style=flat-square
[download-url]: https://npmjs.org/package/egg-{{name}}
[npm-image]: https://img.shields.io/npm/v/@eggjs/{{name}}.svg?style=flat-square
[npm-url]: https://npmjs.org/package/@eggjs/{{name}}
[codecov-image]: https://img.shields.io/codecov/c/github/eggjs/{{name}}.svg?style=flat-square
[codecov-url]: https://codecov.io/github/eggjs/{{name}}?branch=master
[snyk-image]: https://snyk.io/test/npm/@eggjs/{{name}}/badge.svg?style=flat-square
[snyk-url]: https://snyk.io/test/npm/@eggjs/{{name}}
[download-image]: https://img.shields.io/npm/dm/@eggjs/{{name}}.svg?style=flat-square
[download-url]: https://npmjs.org/package/@eggjs/{{name}}

<!--
Description here.
Expand All @@ -27,7 +21,7 @@ Description here.
## Install

```bash
$ npm i egg-{{name}} --save
npm i @eggjs/{{name}}
```

## Usage
Expand All @@ -36,7 +30,7 @@ $ npm i egg-{{name}} --save
// {app_root}/config/plugin.js
exports.{{pluginName}} = {
enable: true,
package: 'egg-{{name}}',
package: '@eggjs/{{name}}',
};
```

Expand All @@ -48,7 +42,7 @@ exports.{{pluginName}} = {
};
```

see [config/config.default.js](config/config.default.js) for more detail.
see [src/config/config.default.ts](src/config/config.default.ts) for more detail.

## Example

Expand All @@ -61,3 +55,9 @@ Please open an issue [here](https://github.com/eggjs/egg/issues).
## License

[MIT](LICENSE)

## Contributors

[![Contributors](https://contrib.rocks/image?repo=eggjs/{{name}})](https://github.com/eggjs/{{name}}/graphs/contributors)

Made with [contributors-img](https://contrib.rocks).
Loading

0 comments on commit ab5e56c

Please sign in to comment.