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 21, 2025
1 parent 0d4a6f0 commit a29050e
Show file tree
Hide file tree
Showing 27 changed files with 291 additions and 239 deletions.
25 changes: 0 additions & 25 deletions .autod.conf.js

This file was deleted.

1 change: 1 addition & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
test/fixtures
coverage
__snapshots__
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/typescript",
"eslint-config-egg/lib/rules/enforce-node-prefix"
]
}
24 changes: 0 additions & 24 deletions .github/PULL_REQUEST_TEMPLATE.md

This file was deleted.

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

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

jobs:
Job:
name: Node.js
uses: node-modules/github-actions/.github/workflows/node-test-mysql.yml@master
with:
version: '18.19.0, 18, 20, 22'
secrets:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
23 changes: 23 additions & 0 deletions .github/workflows/pkg.pr.new.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: Publish Any Commit
on: [push, pull_request]

jobs:
build:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v4

- run: corepack enable
- uses: actions/setup-node@v4
with:
node-version: 20

- name: Install dependencies
run: npm install

- name: Build
run: npm run prepublishOnly --if-present

- run: npx pkg-pr-new publish
13 changes: 13 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
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 }}
12 changes: 8 additions & 4 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,12 @@ logs/
npm-debug.log
node_modules/
coverage/
.idea/
run/
test/fixtures/**/run
.DS_Store
*.swp

.tshy*
.eslintcache
dist
package-lock.json
.package-lock.json
test/fixtures/**/*.d.ts
run/
13 changes: 0 additions & 13 deletions .travis.yml

This file was deleted.

File renamed without changes.
45 changes: 23 additions & 22 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,48 +1,45 @@
# egg-session-redis
# @eggjs/session-redis

[![NPM version][npm-image]][npm-url]
[![build status][travis-image]][travis-url]
[![Node.js CI](https://github.com/eggjs/session-redis/actions/workflows/nodejs.yml/badge.svg)](https://github.com/eggjs/session-redis/actions/workflows/nodejs.yml)
[![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-session-redis.svg?style=flat-square
[npm-url]: https://npmjs.org/package/egg-session-redis
[travis-image]: https://img.shields.io/travis/eggjs/egg-session-redis.svg?style=flat-square
[travis-url]: https://travis-ci.org/eggjs/egg-session-redis
[codecov-image]: https://img.shields.io/codecov/c/github/eggjs/egg-session-redis.svg?style=flat-square
[codecov-url]: https://codecov.io/github/eggjs/egg-session-redis?branch=master
[david-image]: https://img.shields.io/david/eggjs/egg-session-redis.svg?style=flat-square
[david-url]: https://david-dm.org/eggjs/egg-session-redis
[snyk-image]: https://snyk.io/test/npm/egg-session-redis/badge.svg?style=flat-square
[snyk-url]: https://snyk.io/test/npm/egg-session-redis
[download-image]: https://img.shields.io/npm/dm/egg-session-redis.svg?style=flat-square
[download-url]: https://npmjs.org/package/egg-session-redis
[![Node.js Version](https://img.shields.io/node/v/@eggjs/session-redis.svg?style=flat)](https://nodejs.org/en/download/)
[![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg?style=flat-square)](https://makeapullrequest.com)
![CodeRabbit Pull Request Reviews](https://img.shields.io/coderabbit/prs/github/eggjs/session-redis)

[npm-image]: https://img.shields.io/npm/v/@eggjs/session-redis.svg?style=flat-square
[npm-url]: https://npmjs.org/package/@eggjs/session-redis
[codecov-image]: https://img.shields.io/codecov/c/github/eggjs/session-redis.svg?style=flat-square
[codecov-url]: https://codecov.io/github/eggjs/session-redis?branch=master
[snyk-image]: https://snyk.io/test/npm/@eggjs/session-redis/badge.svg?style=flat-square
[snyk-url]: https://snyk.io/test/npm/@eggjs/session-redis
[download-image]: https://img.shields.io/npm/dm/@eggjs/session-redis.svg?style=flat-square
[download-url]: https://npmjs.org/package/@eggjs/session-redis

A session extension for store session in redis.

## Install


```bash
$ npm i egg-session-redis egg-redis --save
npm i @eggjs/session-redis @eggjs/redis
```

## Usage

This module dependent on [egg-redis] plugin, so we must enable both.
This module dependent on [@eggjs/redis](https://github.com/eggjs/redis) plugin, so we must enable both.

```js
// {app_root}/config/plugin.js
exports.sessionRedis = {
enable: true,
package: 'egg-session-redis',
package: '@eggjs/session-redis',
};

exports.redis = {
enable: true,
package: 'egg-redis',
package: '@eggjs/redis',
};
```

Expand Down Expand Up @@ -89,4 +86,8 @@ Please open an issue [here](https://github.com/eggjs/egg/issues).

[MIT](LICENSE)

[egg-redis]: https://github.com/eggjs/egg-redis
## Contributors

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

Made with [contributors-img](https://contrib.rocks).
3 changes: 3 additions & 0 deletions __snapshots__/app.test.ts.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
exports['test/app.test.ts single should keep config stable 1'] = {
"name": ""
}
29 changes: 0 additions & 29 deletions app.js

This file was deleted.

10 changes: 0 additions & 10 deletions config/config.default.js

This file was deleted.

27 changes: 0 additions & 27 deletions index.d.ts

This file was deleted.

Loading

0 comments on commit a29050e

Please sign in to comment.