Skip to content

Commit

Permalink
Merge pull request #101 from frouriojs/develop
Browse files Browse the repository at this point in the history
chore(release): 0.19.1
  • Loading branch information
solufa authored Nov 7, 2020
2 parents af88bb0 + 97d37f8 commit 4bb33a9
Show file tree
Hide file tree
Showing 7 changed files with 481 additions and 394 deletions.
7 changes: 5 additions & 2 deletions .github/workflows/nodejs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,11 @@ jobs:
runs-on: ${{ matrix.os }}
strategy:
matrix:
node-version: [12, 14]
os: [windows-latest, ubuntu-latest]
node-version: [10, 12, 14]
os: [ubuntu-latest]
include:
- os: windows-latest
node-version: 14
steps:
- uses: actions/checkout@v2
- name: setup Node.js ${{ matrix.node-version }}
Expand Down
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,13 @@

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.

### [0.19.1](https://github.com/frouriojs/frourio/compare/v0.19.0...v0.19.1) (2020-11-07)


### Bug Fixes

* remove flatMap for node v10 ([b1cb1aa](https://github.com/frouriojs/frourio/commit/b1cb1aa8e95b63898650f0d0976042d9b8169142))

## [0.19.0](https://github.com/frouriojs/frourio/compare/v0.18.2...v0.19.0) (2020-10-27)


Expand Down
3 changes: 2 additions & 1 deletion __test__/index.spec.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
/* eslint-disable jest/no-done-callback */
import fs from 'fs'
import rimraf from 'rimraf'
import fastify, { FastifyInstance } from 'fastify'
import FormData from 'form-data'
import axios from 'axios'
Expand All @@ -19,7 +20,7 @@ beforeEach(cb => {
})

afterEach(cb => {
fs.rmdirSync('packages/frourio/servers/all/.upload', { recursive: true })
rimraf.sync('packages/frourio/servers/all/.upload')
server.close(cb)
})

Expand Down
3 changes: 2 additions & 1 deletion __test__/unit.spec.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import fs from 'fs'
import rimraf from 'rimraf'
import createDefaultFilesIfNotExists from '../src/createDefaultFilesIfNotExists'

test('createDefaultFilesIfNotExists', () => {
Expand Down Expand Up @@ -38,5 +39,5 @@ export default defineHooks(() => ({
`
)

fs.rmdirSync(dir, { recursive: true })
rimraf.sync(dir)
})
16 changes: 9 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "frourio",
"version": "0.19.0",
"version": "0.19.1",
"description": "Fast and type-safe full stack framework, for TypeScript",
"author": "Solufa <[email protected]>",
"license": "MIT",
Expand Down Expand Up @@ -83,20 +83,21 @@
]
},
"dependencies": {
"aspida": "^0.22.1",
"aspida": "^0.22.2",
"velona": "^0.5.1"
},
"devDependencies": {
"@aspida/axios": "^0.12.1",
"@aspida/axios": "^0.12.2",
"@types/busboy": "^0.2.3",
"@types/jest": "^26.0.15",
"@typescript-eslint/eslint-plugin": "^4.6.0",
"@typescript-eslint/parser": "^4.6.0",
"@types/rimraf": "^3.0.0",
"@typescript-eslint/eslint-plugin": "^4.6.1",
"@typescript-eslint/parser": "^4.6.1",
"axios": "^0.21.0",
"class-validator": "^0.12.2",
"eslint": "^7.12.1",
"eslint-config-prettier": "^6.15.0",
"eslint-config-standard": "^15.0.0",
"eslint-config-standard": "^16.0.1",
"eslint-plugin-import": "^2.22.1",
"eslint-plugin-jest": "^24.1.0",
"eslint-plugin-node": "^11.1.0",
Expand All @@ -106,8 +107,9 @@
"fastify": "^3.7.0",
"fastify-multipart": "^3.3.0",
"form-data": "^3.0.0",
"jest": "^26.6.1",
"jest": "^26.6.3",
"prettier": "^2.1.2",
"rimraf": "^3.0.2",
"standard-version": "^9.0.0",
"ts-jest": "^26.4.3",
"typescript": "^4.0.5"
Expand Down
27 changes: 17 additions & 10 deletions src/createControllersText.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,16 @@ type Param = [string, string]
const findRootFiles = (dir: string): string[] =>
fs
.readdirSync(dir, { withFileTypes: true })
.flatMap(d =>
d.isDirectory()
? findRootFiles(`${dir}/${d.name}`)
: d.name === 'hooks.ts' || d.name === 'controller.ts'
? [`${dir}/${d.name}`]
: []
.reduce<string[]>(
(prev, d) => [
...prev,
...(d.isDirectory()
? findRootFiles(`${dir}/${d.name}`)
: d.name === 'hooks.ts' || d.name === 'controller.ts'
? [`${dir}/${d.name}`]
: [])
],
[]
)

const initTSC = (appDir: string, project: string) => {
Expand Down Expand Up @@ -340,10 +344,10 @@ export default (appDir: string, project: string) => {
})

const genHookTexts = (event: HooksEvent) => [
...hooks.flatMap(h => {
...hooks.reduce<string[]>((prev, h) => {
const ev = h.events.find(e => e.type === event)
return ev ? [`${ev.isArray ? '...' : ''}${h.name}.${event}`] : []
}),
return ev ? [...prev, `${ev.isArray ? '...' : ''}${h.name}.${event}`] : prev
}, []),
...(ctrlHooksEvents?.map(e =>
e.type === event
? `${e.isArray ? '...' : ''}ctrlHooks${controllers.filter(c => c[1]).length}.${event}`
Expand Down Expand Up @@ -524,7 +528,10 @@ ${validateInfo
results.push(
...childrenDirs
.filter(d => !d.name.startsWith('_'))
.flatMap(d => createText(path.posix.join(dirPath, d.name), hooks))
.reduce<string[]>(
(prev, d) => [...prev, ...createText(path.posix.join(dirPath, d.name), hooks)],
[]
)
)

const value = childrenDirs.find(d => d.name.startsWith('_'))
Expand Down
Loading

0 comments on commit 4bb33a9

Please sign in to comment.