Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/thonatos/imorph
[WIP] a morph lib
https://github.com/thonatos/imorph
analyzer eggjs generator ts-morph
Last synced: about 1 month ago
JSON representation
[WIP] a morph lib
- Host: GitHub
- URL: https://github.com/thonatos/imorph
- Owner: thonatos
- License: mit
- Created: 2019-08-04T08:43:02.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2019-12-26T08:54:18.000Z (almost 5 years ago)
- Last Synced: 2024-05-02T05:36:01.819Z (7 months ago)
- Topics: analyzer, eggjs, generator, ts-morph
- Language: TypeScript
- Homepage:
- Size: 37.1 KB
- Stars: 2
- Watchers: 3
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# iMorph · [![GitHub license][license-square]][license-url]
[![Egg.js][egg-square]][egg-url]
[![Semantic Release][semantic-release-square]][semantic-release-url]
[![NPM Version][npm-square]][npm-url]
[![Codecov][codecov-square]][codecov-url]
[![Github Actions][github-actions-square]][github-actions-url][license-square]: https://img.shields.io/badge/license-MIT-blue.svg
[license-url]: https://github.com/thonatos/imorph/blob/HEAD/LICENSE
[egg-square]: https://img.shields.io/badge/Awesome-Egg.js-ff69b4.svg
[egg-url]: https://eggjs.org/
[npm-square]: https://img.shields.io/npm/v/imorph.svg
[npm-url]: https://www.npmjs.com/package/imorph
[codecov-square]: https://img.shields.io/codecov/c/github/thonatos/imorph.svg
[codecov-url]: https://codecov.io/gh/thonatos/imorph
[semantic-release-square]: https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg
[semantic-release-url]: https://github.com/semantic-release/semantic-release
[github-actions-square]: https://github.com/thonatos/imorph/workflows/Actions%20Release/badge.svg
[github-actions-url]: https://github.com/thonatos/imorph> a morph lib.
## Features
### Code Analyzer
- [x] analysis project dependencies
### Egg generator
> Use the specific description file to generate an egg application.
#### TODO
- [x] egg controllers
- [x] egg services
- [ ] egg router
- [ ] egg configconfig file
```yml
# egg.ymlversion: '1.0.0'
models:
user:
- id: number
- name: string
- mail: string
- nickname: stringcontrollers:
user:
routes:
- route: /user/:id
method: GET
auth: 'BASIC_LOGIN'
description: get user detail by user idservices:
user:
methods:
- name: getUserById
description: get user detail by user id
request:
- name: id
type: number
required: true
description: user id
response:
type: any
description: user detail
- name: getUserByName
description: get user detail by user name
request:
- name: name
type: string
required: true
description: user name
- name: privateInfo
type: boolean
required: false
description: show private user info
response:
type: any
description: user detail
description: user serviceplugins:
- buc
- acl
```services code
```typescript
// services/user.tsimport { Service } from 'egg';
/**
* user service
*/
export default class UserService extends Service {
/**
* get user detail by user id
* @param {number} id - user id
* @return {any} user detail
*/
public async getUserById(id: number): Promise {
return this.ctx.proxy.user.getUserById(id);
}/**
* get user detail by user name
* @param {string} name - user name
* @param {boolean} privateInfo - show private user info
* @return {any} user detail
*/
public async getUserByName(name: string, privateInfo?: boolean): Promise {
return this.ctx.proxy.user.getUserByName(name, privateInfo || null);
}
}
```## Development
### prepare
```bash
yarn
```### test
```bash
yarn test
```> you can debug with Visual Studio Code (Jest).