Skip to content

Commit 4bb33a9

Browse files
authored
Merge pull request #101 from frouriojs/develop
chore(release): 0.19.1
2 parents af88bb0 + 97d37f8 commit 4bb33a9

File tree

7 files changed

+481
-394
lines changed

7 files changed

+481
-394
lines changed

.github/workflows/nodejs.yml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,11 @@ jobs:
88
runs-on: ${{ matrix.os }}
99
strategy:
1010
matrix:
11-
node-version: [12, 14]
12-
os: [windows-latest, ubuntu-latest]
11+
node-version: [10, 12, 14]
12+
os: [ubuntu-latest]
13+
include:
14+
- os: windows-latest
15+
node-version: 14
1316
steps:
1417
- uses: actions/checkout@v2
1518
- name: setup Node.js ${{ matrix.node-version }}

CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,13 @@
22

33
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
44

5+
### [0.19.1](https://github.com/frouriojs/frourio/compare/v0.19.0...v0.19.1) (2020-11-07)
6+
7+
8+
### Bug Fixes
9+
10+
* remove flatMap for node v10 ([b1cb1aa](https://github.com/frouriojs/frourio/commit/b1cb1aa8e95b63898650f0d0976042d9b8169142))
11+
512
## [0.19.0](https://github.com/frouriojs/frourio/compare/v0.18.2...v0.19.0) (2020-10-27)
613

714

__test__/index.spec.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
/* eslint-disable jest/no-done-callback */
22
import fs from 'fs'
3+
import rimraf from 'rimraf'
34
import fastify, { FastifyInstance } from 'fastify'
45
import FormData from 'form-data'
56
import axios from 'axios'
@@ -19,7 +20,7 @@ beforeEach(cb => {
1920
})
2021

2122
afterEach(cb => {
22-
fs.rmdirSync('packages/frourio/servers/all/.upload', { recursive: true })
23+
rimraf.sync('packages/frourio/servers/all/.upload')
2324
server.close(cb)
2425
})
2526

__test__/unit.spec.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import fs from 'fs'
2+
import rimraf from 'rimraf'
23
import createDefaultFilesIfNotExists from '../src/createDefaultFilesIfNotExists'
34

45
test('createDefaultFilesIfNotExists', () => {
@@ -38,5 +39,5 @@ export default defineHooks(() => ({
3839
`
3940
)
4041

41-
fs.rmdirSync(dir, { recursive: true })
42+
rimraf.sync(dir)
4243
})

package.json

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "frourio",
3-
"version": "0.19.0",
3+
"version": "0.19.1",
44
"description": "Fast and type-safe full stack framework, for TypeScript",
55
"author": "Solufa <solufa2020@gmail.com>",
66
"license": "MIT",
@@ -83,20 +83,21 @@
8383
]
8484
},
8585
"dependencies": {
86-
"aspida": "^0.22.1",
86+
"aspida": "^0.22.2",
8787
"velona": "^0.5.1"
8888
},
8989
"devDependencies": {
90-
"@aspida/axios": "^0.12.1",
90+
"@aspida/axios": "^0.12.2",
9191
"@types/busboy": "^0.2.3",
9292
"@types/jest": "^26.0.15",
93-
"@typescript-eslint/eslint-plugin": "^4.6.0",
94-
"@typescript-eslint/parser": "^4.6.0",
93+
"@types/rimraf": "^3.0.0",
94+
"@typescript-eslint/eslint-plugin": "^4.6.1",
95+
"@typescript-eslint/parser": "^4.6.1",
9596
"axios": "^0.21.0",
9697
"class-validator": "^0.12.2",
9798
"eslint": "^7.12.1",
9899
"eslint-config-prettier": "^6.15.0",
99-
"eslint-config-standard": "^15.0.0",
100+
"eslint-config-standard": "^16.0.1",
100101
"eslint-plugin-import": "^2.22.1",
101102
"eslint-plugin-jest": "^24.1.0",
102103
"eslint-plugin-node": "^11.1.0",
@@ -106,8 +107,9 @@
106107
"fastify": "^3.7.0",
107108
"fastify-multipart": "^3.3.0",
108109
"form-data": "^3.0.0",
109-
"jest": "^26.6.1",
110+
"jest": "^26.6.3",
110111
"prettier": "^2.1.2",
112+
"rimraf": "^3.0.2",
111113
"standard-version": "^9.0.0",
112114
"ts-jest": "^26.4.3",
113115
"typescript": "^4.0.5"

src/createControllersText.ts

Lines changed: 17 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,16 @@ type Param = [string, string]
1010
const findRootFiles = (dir: string): string[] =>
1111
fs
1212
.readdirSync(dir, { withFileTypes: true })
13-
.flatMap(d =>
14-
d.isDirectory()
15-
? findRootFiles(`${dir}/${d.name}`)
16-
: d.name === 'hooks.ts' || d.name === 'controller.ts'
17-
? [`${dir}/${d.name}`]
18-
: []
13+
.reduce<string[]>(
14+
(prev, d) => [
15+
...prev,
16+
...(d.isDirectory()
17+
? findRootFiles(`${dir}/${d.name}`)
18+
: d.name === 'hooks.ts' || d.name === 'controller.ts'
19+
? [`${dir}/${d.name}`]
20+
: [])
21+
],
22+
[]
1923
)
2024

2125
const initTSC = (appDir: string, project: string) => {
@@ -340,10 +344,10 @@ export default (appDir: string, project: string) => {
340344
})
341345

342346
const genHookTexts = (event: HooksEvent) => [
343-
...hooks.flatMap(h => {
347+
...hooks.reduce<string[]>((prev, h) => {
344348
const ev = h.events.find(e => e.type === event)
345-
return ev ? [`${ev.isArray ? '...' : ''}${h.name}.${event}`] : []
346-
}),
349+
return ev ? [...prev, `${ev.isArray ? '...' : ''}${h.name}.${event}`] : prev
350+
}, []),
347351
...(ctrlHooksEvents?.map(e =>
348352
e.type === event
349353
? `${e.isArray ? '...' : ''}ctrlHooks${controllers.filter(c => c[1]).length}.${event}`
@@ -524,7 +528,10 @@ ${validateInfo
524528
results.push(
525529
...childrenDirs
526530
.filter(d => !d.name.startsWith('_'))
527-
.flatMap(d => createText(path.posix.join(dirPath, d.name), hooks))
531+
.reduce<string[]>(
532+
(prev, d) => [...prev, ...createText(path.posix.join(dirPath, d.name), hooks)],
533+
[]
534+
)
528535
)
529536

530537
const value = childrenDirs.find(d => d.name.startsWith('_'))

0 commit comments

Comments
 (0)