Skip to content

Commit

Permalink
chore: update dependencies & migrate to vitest from mocha/chai (#739)
Browse files Browse the repository at this point in the history
* chore: migrate to vitest from mocha/chai

* chore: update dependencies

* docs: refactor HooksTable to separate component
  • Loading branch information
fratzinger authored Jan 17, 2024
1 parent 15ddaa6 commit 935bbdd
Show file tree
Hide file tree
Showing 98 changed files with 4,450 additions and 4,361 deletions.
17 changes: 7 additions & 10 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -1,26 +1,23 @@
{
"root": true,
"env": {
"browser": true,
"es6": true,
"mocha": true,
"node": true
},
"extends": [
"plugin:@typescript-eslint/recommended",
"plugin:@typescript-eslint/recommended-requiring-type-checking",
"plugin:prettier/recommended"
],
"parser": "@typescript-eslint/parser",
"parserOptions": {
"project": "tsconfig.test.json",
"sourceType": "module"
"project": ["./tsconfig.json"]
},
"plugins": [
"eslint-plugin-import",
"eslint-plugin-prefer-arrow",
"@typescript-eslint",
"prettier"
],
"extends": [
"plugin:@typescript-eslint/recommended",
"plugin:@typescript-eslint/recommended-requiring-type-checking",
"plugin:prettier/recommended"
],
"rules": {
// "indent": ["warn", 2],
"prefer-rest-params": "off",
Expand Down
12 changes: 0 additions & 12 deletions .mocharc.js

This file was deleted.

37 changes: 37 additions & 0 deletions docs/components/HookTable.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
<template>
<table>
<thead>
<tr>
<th>before</th>
<th>after</th>
<th>methods</th>
<th>multi</th>
<th>details</th>
</tr>
</thead>
<tbody>
<tr>
<td>{{ before ? 'yes' : 'no' }}</td>
<td>{{ after ? 'yes' : 'no' }}</td>
<td>{{ methods.join(", ") }}</td>
<td>{{ typeof multi === 'boolean' ? multi ? 'yes' : 'no' : multi }}</td>
<td><a :href="source" target="_blank">source</a></td>
</tr>
</tbody>
</table>
</template>

<script setup lang="ts">
const props = defineProps<{
before: boolean;
after: boolean;
methods: string[];
multi: boolean | string;
source: string;
}>();
</script>

<script lang="ts">
</script>
148 changes: 39 additions & 109 deletions docs/hooks.md

Large diffs are not rendered by default.

26 changes: 8 additions & 18 deletions docs/utilities.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
title: Utilities
---
<script setup>
import HookTable from './components/HookTable.vue'
</script>

# Utilities

Expand Down Expand Up @@ -158,9 +158,7 @@ Restrict a hook to run for certain methods and method types.

Sequentially execute multiple sync or async hooks.

| before | after | methods | multi | details |
| ------ | ----- | ------- | ----- | -------------------------------------------------------------------------------------------------------- |
| yes | yes | all | n/a | [source](https://github.com/feathersjs-ecosystem/feathers-hooks-common/blob/master/src/utils/combine.ts) |
<HookTable :before="true" :after="true" :methods="['all']" multi="n/a" source="https://github.com/feathersjs-ecosystem/feathers-hooks-common/blob/master/src/utils/combine.ts" />

- **Arguments**
- `{Array< Function >} hookFuncs`
Expand Down Expand Up @@ -199,9 +197,7 @@ module.exports = { before: {

Return the and of a series of sync or async predicate functions.

| before | after | methods | multi | details |
| ------ | ----- | ------- | ----- | ------------------------------------------------------------------------------------------------------ |
| yes | yes | all | yes | [source](https://github.com/feathersjs-ecosystem/feathers-hooks-common/blob/master/src/utils/every.ts) |
<HookTable :before="true" :after="true" :methods="['all']" :multi="true" source="https://github.com/feathersjs-ecosystem/feathers-hooks-common/blob/master/src/utils/every.ts" />

- **Arguments**
- `{Array< Function >} predicates`
Expand Down Expand Up @@ -283,9 +279,7 @@ Get the records in `context.data` or `context.result`

Negate a sync or async predicate function.

| before | after | methods | multi | details |
| ------ | ----- | ------- | ----- | ------------------------------------------------------------------------------------------------------- |
| yes | yes | all | yes | [source](https://github.com/feathersjs-ecosystem/feathers-hooks-common/blob/master/src/utils/is-not.ts) |
<HookTable :before="true" :after="true" :methods="['all']" :multi="true" source="https://github.com/feathersjs-ecosystem/feathers-hooks-common/blob/master/src/utils/is-not.ts" />

- **Arguments**

Expand Down Expand Up @@ -322,9 +316,7 @@ Negate a sync or async predicate function.

Check which transport provided the service call.

| before | after | methods | multi | details |
| ------ | ----- | ------- | ----- | ------------------------------------------------------------------------------------------------------------ |
| yes | yes | all | yes | [source](https://github.com/feathersjs-ecosystem/feathers-hooks-common/blob/master/src/utils/is-provider.ts) |
<HookTable :before="true" :after="true" :methods="['all']" :multi="true" source="https://github.com/feathersjs-ecosystem/feathers-hooks-common/blob/master/src/utils/is-provider.ts" />

- **Arguments**
- `{Array< String >} transports`
Expand Down Expand Up @@ -597,9 +589,7 @@ Let's you call a hook right after the service call.

Return the or of a series of sync or async predicate functions.

| before | after | methods | multi | details |
| ------ | ----- | ------- | ----- | ----------------------------------------------------------------------------------------------------- |
| yes | yes | all | yes | [source](https://github.com/feathersjs-ecosystem/feathers-hooks-common/blob/master/src/utils/some.ts) |
<HookTable :before="true" :after="true" :methods="['all']" :multi="true" source="https://github.com/feathersjs-ecosystem/feathers-hooks-common/blob/master/src/utils/some.ts" />

- **Arguments**

Expand Down
Loading

0 comments on commit 935bbdd

Please sign in to comment.