Skip to content

Commit

Permalink
Migrate to typescript and adjust build step / tests (#211)
Browse files Browse the repository at this point in the history
  • Loading branch information
bitflower authored Jul 7, 2023
1 parent ef33fd7 commit 5c7ce98
Show file tree
Hide file tree
Showing 43 changed files with 11,464 additions and 25,193 deletions.
6 changes: 0 additions & 6 deletions .babelrc

This file was deleted.

10 changes: 1 addition & 9 deletions .github/contributing.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,17 +34,9 @@ Although we generally accept many PRs they can be rejected for many reasons. We

Before running the tests from the `test/` folder `npm test` will run ESlint. You can check your code changes individually by running `npm run lint`.

### ES6 compilation

Feathers uses [Babel](https://babeljs.io/) to leverage the latest developments of the JavaScript language. All code and samples are currently written in ES2015. To transpile the code in this repository run

> npm run compile
__Note:__ `npm test` will run the compilation automatically before the tests.

### Tests

[Mocha](http://mochajs.org/) tests are located in the `test/` folder and can be run using the `npm run mocha` or `npm test` (with ESLint and code coverage) command.
[Vitest](http://mochajs.org/) tests are located in the `test/` folder and can be run using the `npm run test` (with ESLint and code coverage) command.

### Documentation

Expand Down
23 changes: 0 additions & 23 deletions .github/workflows/ci.yml

This file was deleted.

26 changes: 26 additions & 0 deletions .github/workflows/nodejs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: CI
on: [push, pull_request]
jobs:
test:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [16.x, 18.x]
steps:
- uses: actions/checkout@v3
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
- run: npm install
- run: npm run test

build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 18.x
- run: npm install
- run: npm run build
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,6 @@ node_modules
# Users Environment Variables
.lock-wscript

dist/
# dist/
lib/
tmp/
10 changes: 0 additions & 10 deletions .npmignore

This file was deleted.

42 changes: 0 additions & 42 deletions .nycrc

This file was deleted.

4 changes: 4 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"singleQuote": true,
"trailingComma": "none"
}
26 changes: 13 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
## About

`feathers-reactive` adds a `watch()` method to services. The returned object implements all service methods as [RxJS v6](https://github.com/ReactiveX/rxjs/tree/6.x) observables that automatically update on [real-time events](https://docs.feathersjs.com/api/events.html#service-events).
`feathers-reactive` adds a `watch()` method to services. The returned object implements all service methods as [RxJS v7](https://github.com/ReactiveX/rxjs) observables that automatically update on [real-time events](https://docs.feathersjs.com/api/events.html#service-events).

## Options

Expand All @@ -23,10 +23,10 @@ The following options are supported:
#### Application level

```js
const feathers = require('feathers');
const reactive = require('feathers-reactive');
import feathers from '@feathersjs/feathers';
import { rx } from 'feathers-reactive';

const app = feathers().configure(reactive(options));
const app = feathers().configure(rx(options));
```

#### Service level
Expand Down Expand Up @@ -60,9 +60,9 @@ List strategies are used to determine how a data stream behaves. Currently there
## Usage

```js
const feathers = require('@feathersjs/feathers');
const memory = require('feathers-memory');
const rx = require('feathers-reactive');
import {feathers} from '@feathersjs/feathers';
import memory from 'feathers-memory';
import { rx } from 'feathers-reactive';

const app = feathers()
.configure(rx({
Expand Down Expand Up @@ -92,7 +92,7 @@ messages.create({

Will output:

```
```console
My message { text: 'A test message', id: 0 }
Message list [ { text: 'A test message', id: 0 } ]
Message list [ { text: 'A test message', id: 0 },
Expand All @@ -109,9 +109,9 @@ Let's assume a simple Feathers Socket.io server in `app.js` like this:
> npm install @feathersjs/feathers @feathersjs/socketio feathers-memory
```js
const feathers = require('@feathersjs/feathers');
const socketio = require('@feathersjs/socketio');
const memory = require('feathers-memory');
import {feathers} from '@feathersjs/feathers';
import socketio from '@feathersjs/socketio';
import memory from 'feathers-memory';

const app = feathers()
.configure(socketio())
Expand All @@ -123,7 +123,7 @@ app.publish(() => app.channel('everybody'));
app.listen(3030).on('listening', () =>
console.log('Feathers Socket.io server running on localhost:3030')
);
````
```

### Usage

Expand Down Expand Up @@ -229,6 +229,6 @@ export default App;

## License

Copyright (c) 2018
Copyright (c) 2023

Licensed under the [MIT license](LICENSE).
16 changes: 16 additions & 0 deletions build.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import { defineBuildConfig } from 'unbuild';

import pkg from './package.json';

export default defineBuildConfig({
entries: ['./src/index'],
outDir: './dist',
declaration: true,
externals: [
...Object.keys(pkg.dependencies),
...Object.keys(pkg.devDependencies)
],
rollup: {
emitCJS: true
}
});
Loading

0 comments on commit 5c7ce98

Please sign in to comment.