Skip to content

Commit 1990797

Browse files
refactor!: Typescript refactoring, separate services, custom methods and vitepress docs (#164)
* refactor: typescript minimum valuable product * refactor: move to typescript - complete typing - update dependencies - semistandard -> eslint-typescript - start converting tests to typescript - ref #144 * test: add typings to tests and fix some bugs - identityChange had no 'field' property - tests fixes * refactor: start seperate services - add passwordField to options - propper typing * test: make nyc report working again * refactor: move to seperate services - call seperate services from main service * docs: add description to service calls * refactor: add better IDE-support - destructure create-data for better IDE support - move AuthenticationManagementService to seperate file * docs: init vuepress * refactor: remove `field` parameter - completely move `passwordField` to options * feat: separate services - Base class with publish-prevention - `useSeparateServicePaths` option - use internal service.options instead of create({ action: 'options' }) - add tests for publish - add tests for `useSeparateServicePaths` - more typings * modify client authenticate * docs: add hooks docs * small changes - export defaultOptions -> addVerification - path - rearrange useSeparateServices * several improvements - divide Service & configure functions - ensure options per Service - types: better types - chore: update dependencies - tests: add tests for separate services - tests: increase about-time to 600 * small changes - better typing (abstract _create with type) - sort actions alphabetically * docs: improvements - overview page - started services page * docs: add example * chore: rename folder "service" to "services" * docs: continue docs * feat: prepare for custom methods from feathers^5 * chore: expose services at root * docs(chore): move vuepress to vitepress * refactor: move methods to seperate folder * docs: align with PR from rma4ok * refactor: add custom methods without '_' - refactor: add import type where necessary - refactor: add newlines for function params - refactor: destructure imports * port #167 to typescript * test: fix basicSpy 'this' on function * chore: update dependencies * chore: major update dependencies & remove unnecessary packages * refactor: move defaultOptions to own file - refactor: rename configureAuth to setupAuth * refactor(methods): Promise.all tokens * types: add GetUserDataCheckProps * perf(addVerification): move promise down * perf(checkUnique): add pagination * refactor(methods): add $limit: 2 to find * test: chore - rename titles '.js' to '.ts' * chore: isDateAfterNow helper to helpers/index * test: add tests for helpers * refactor(test): reorganize test-files - move to test/hooks - move to test/methods - rename test/helpers to test/test-helpers * fix: typo identityChange * tests: test authMgmt/create, /[method], separate service - refactor: remove chai - refactor: move many try-catch - refactor: users - refactor: use [idType] * chore: min-version node@10 - remove chai - npm update * test: chore - rename tests & move idType * re-structures docs and adds new Getting Started * adds new overview and configuration chapters * addschapters process flows and service calls * after docs text review * !feat: remove 'useSeparateServices' * refactor: rename 'configure' to 'setup' * test: add custom path test to 'add-verification' * chore: move npmignore to package.files - remove babel - update badges in readme - update license year * chore: npm update * !refactor: app as first argument for constructor - BREAKING CHANGE * fix: NotifierOptions type * extended regarding feedback * refactor: remove swagger docs from constructor * docs: vuepress@next, improve service calls - move from vitepress to vuepress@next for <CodeGroup> - add logo - remove note about 'docs' of swagger - remove 'prefferedComm' because it's not used anywhere - improve `multi:true` on users-hooks * test: ensure exported members * docs: remove old stuff * chore: lint --fix * docs: add note to pre-release * !refactor: remove 'value' from custom methods & separate services - BREAKING CHANGE * fix: VerifyChanges * 4.0.0-pre.0 * Updating changelog * docs: add pre tag to install script * docs: add feathers-mailer to install script * docs: fix typo * docs: add options to service calls * docs: fix getting-started * feat: add multi support for 'add-verification' hook * docs: add vue example to example folder * fix(client): improve client and export in entry file * refactor: rename and export helpers * docs: add descriptions to type options * docs: center images * docs: comment out stuff in service calls * chore: increase codeclimate thresholds * chore: eslintignore examples * 4.0.0-pre.1 * Updating changelog * docs: init migration guide * docs: migration guide add channels note * docs: update notifier example * docs: add search * docs: add note to 'isVerified' about authenticate before * docs: fix preventChanges first param * chore: shrink helpers-folder * chore: clean test setup * refactor: more declarative methods, $limit: 2 & passwordField - rename user1, user2, user3 to declarative names - use $limit: 2 everywhere - use [passwordField] consequently * chore: update dependencies & import/order * chore: remove eslint-config-standard * ci: update coverage action to v3 * chore: update dependencies * chore: change feathers contributors as author * 4.0.0-pre.2 * Updating changelog * docs: move to vitepress * docs: move to Tabs and dismiss CodeGroup * docs: fix primary color * ci: add node v18 to matrix Co-authored-by: Onno Gabriel <contact@datacodedesign.de>
1 parent db795c8 commit 1990797

File tree

204 files changed

+25107
-13468
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

204 files changed

+25107
-13468
lines changed

.babelrc

Lines changed: 0 additions & 6 deletions
This file was deleted.

.codeclimate.yml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ plugins:
44
checks:
55
argument-count:
66
config:
7-
threshold: 4
7+
threshold: 5
88
complex-logic:
99
config:
1010
threshold: 4
@@ -19,7 +19,7 @@ checks:
1919
threshold: 20
2020
method-lines:
2121
config:
22-
threshold: 50
22+
threshold: 100
2323
nested-control-flow:
2424
config:
2525
threshold: 4
@@ -30,3 +30,7 @@ checks:
3030
enabled: false
3131
identical-code:
3232
enabled: false
33+
34+
exclude_patterns:
35+
- "examples"
36+
- "test"

.eslintignore

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# don't ever lint node_modules
2+
node_modules
3+
# don't lint build output (make sure it's set to your correct build folder name)
4+
dist
5+
# don't lint nyc coverage output
6+
coverage
7+
8+
test/
9+
examples/

.eslintrc

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
{
2+
"root": true,
3+
"env": {
4+
"node": true,
5+
"mocha": true
6+
},
7+
"parser": "@typescript-eslint/parser",
8+
"parserOptions": {
9+
"project": "./tsconfig.json"
10+
},
11+
"plugins": [
12+
"@typescript-eslint"
13+
],
14+
"extends": [
15+
"eslint:recommended",
16+
"plugin:@typescript-eslint/recommended",
17+
"plugin:import/recommended",
18+
"plugin:import/typescript"
19+
],
20+
"rules": {
21+
"semi": ["warn", "always"],
22+
"@typescript-eslint/semi": ["warn", "always"],
23+
"@typescript-eslint/strict-boolean-expressions": ["off"],
24+
"spaced-comment": ["off"],
25+
"@typescript-eslint/consistent-type-imports": ["warn", { "prefer": "type-imports" }],
26+
// import
27+
"import/order": ["warn", { "groups": ["builtin", "external", "internal", "parent", "sibling", "index", "object", "type"] }],
28+
"import/no-duplicates": ["warn"]
29+
},
30+
"overrides": [
31+
{
32+
"files": ["test/**/*.ts"],
33+
"rules": {
34+
"@typescript-eslint/ban-ts-comment": ["off"]
35+
}
36+
}
37+
]
38+
}

.github/contributing.md

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,13 @@ Before creating an issue please make sure you have checked out the docs, specifi
1010

1111
If you haven't found your answer please feel free to join our [slack channel](http://slack.feathersjs.com), create an issue on Github, or post on [Stackoverflow](http://stackoverflow.com) using the `feathers` or `feathersjs` tag. We try our best to monitor Stackoverflow but you're likely to get more immediate responses in Slack and Github.
1212

13-
Issues can be reported in the [issue tracker](https://github.com/feathersjs/feathers/issues). Since feathers combines many modules it can be hard for us to assess the root cause without knowing which modules are being used and what your configuration looks like, so **it helps us immensely if you can link to a simple example that reproduces your issue**.
13+
Issues can be reported in the [issue tracker](https://github.com/feathersjs/feathers/issues). Since feathers combines many modules it can be hard for us to assess the root cause without knowing which modules are being used and what your configuration looks like, so **it helps us immensely if you can link to a simple example that reproduces your issue**.
1414

1515
## Report a Security Concern
1616

1717
We take security very seriously at Feathers. We welcome any peer review of our 100% open source code to ensure nobody's Feathers app is ever compromised or hacked. As a web application developer you are responsible for any security breaches. We do our very best to make sure Feathers is as secure as possible by default.
1818

19-
In order to give the community time to respond and upgrade we strongly urge you report all security issues to us. Send one of the core team members a PM in [Slack](http://slack.feathersjs.com) or email us at hello@feathersjs.com with details and we will respond ASAP.
19+
In order to give the community time to respond and upgrade we strongly urge you report all security issues to us. Send one of the core team members a PM in [Slack](http://slack.feathersjs.com) or e-mail us at hello@feathersjs.com with details and we will respond ASAP.
2020

2121
For full details refer to our [Security docs](https://docs.feathersjs.com/SECURITY.html).
2222

@@ -34,14 +34,6 @@ Although we generally accept many PRs they can be rejected for many reasons. We
3434

3535
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`.
3636

37-
### ES6 compilation
38-
39-
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
40-
41-
> npm run compile
42-
43-
__Note:__ `npm test` will run the compilation automatically before the tests.
44-
4537
### Tests
4638

4739
[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.

.github/workflows/node.js.yml

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,19 +3,14 @@
33

44
name: Node.js CI
55

6-
on:
7-
push:
8-
branches: [ master ]
9-
pull_request:
10-
branches: [ master ]
6+
on: [push, pull_request]
117

128
jobs:
139
test:
1410
runs-on: ubuntu-latest
15-
1611
strategy:
1712
matrix:
18-
node-version: [12.x, 14.x]
13+
node-version: [12.x, 14.x, 16.x, 18.x]
1914
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/
2015

2116
steps:
@@ -26,6 +21,7 @@ jobs:
2621
node-version: ${{ matrix.node-version }}
2722
- run: npm ci
2823
- run: npm test
24+
2925
coverage:
3026
needs: [ test ]
3127
name: coverage
@@ -34,10 +30,10 @@ jobs:
3430
- uses: actions/checkout@master
3531
- uses: actions/setup-node@master
3632
with:
37-
node-version: '12'
38-
- run: npm i
39-
- uses: paambaati/codeclimate-action@v2.7.5
33+
node-version: '14'
34+
- run: npm ci
35+
- uses: paambaati/codeclimate-action@v3.0.0
4036
env:
4137
CC_TEST_REPORTER_ID: ac461a4a35fe5e70a011b20969f4298ad55da3498f1efbe0019d2bc3b99cf885
4238
with:
43-
coverageCommand: npm run test
39+
coverageCommand: npm run coverage

.gitignore

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,13 @@ node_modules
3232
.lock-wscript
3333

3434
# The compiled/babelified modules
35-
lib/
35+
dist/
3636

3737
## editor
3838
.idea/
3939

40-
.vscode/
41-
.prettierrc
40+
#.vscode/
41+
.prettierrc
42+
43+
docs/.vuepress/.cache
44+
docs/.vuepress/.temp

.mocharc.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
'use strict';
2+
const path = require("path");
3+
4+
module.exports = {
5+
extension: ["ts", "js"],
6+
package: path.join(__dirname, "./package.json"),
7+
ui: "bdd",
8+
spec: [
9+
"./test/**/*.test.*",
10+
],
11+
exit: true
12+
};

.npmignore

Lines changed: 0 additions & 7 deletions
This file was deleted.

.nvmrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
v16.15.1

0 commit comments

Comments
 (0)