Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

egg-leaf

Package Overview
Dependencies
Maintainers
3
Versions
13
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

egg-leaf - npm Package Compare versions

Comparing version 1.6.1 to 1.6.3

33

app/middleware/leaf.js

@@ -11,3 +11,9 @@ 'use strict';

const { apiDir = '', enable } = appConfig || {};
const mockPathList = getAllMockPathList(apiDir);
let mockPathList = [];
if (enable) {
mockPathList = getAllMockPathList(apiDir);
}
return function* leafMiddleware(next) {

@@ -114,12 +120,17 @@ if (!enable) return yield next;

let results = [];
const fileNameOrDirName = fs.readdirSync(dir);
fileNameOrDirName.forEach(function(file) {
const fileDir = dir + '/' + file;
const stat = fs.statSync(fileDir);
if (stat && stat.isDirectory()) {
results = results.concat(getMockPath(fileDir));
} else {
results.push(fileDir.replace(mockFilePath, '').replace(/\..+\..+$/, ''));
}
});
try {
const fileNameOrDirName = fs.readdirSync(dir);
fileNameOrDirName.forEach(function(file) {
const fileDir = dir + '/' + file;
const stat = fs.statSync(fileDir);
if (stat && stat.isDirectory()) {
results = results.concat(getMockPath(fileDir));
} else {
results.push(fileDir.replace(mockFilePath, '').replace(/\..+\..+$/, ''));
}
});
} catch (e) {
console.error(chalk.red(`==========目录不存在===========\n${dir}`));
}
return results;

@@ -126,0 +137,0 @@ }(mockFilePath));

@@ -5,2 +5,17 @@ # Change Log

<a name="1.6.3"></a>
## [1.6.3](https://github.com/forsigner/egg-leaf/compare/v1.6.2...v1.6.3) (2018-04-13)
<a name="1.6.2"></a>
## [1.6.2](https://github.com/forsigner/egg-leaf/compare/v1.6.1...v1.6.2) (2018-04-13)
### Bug Fixes
* 修复当配置文件为配置目录时,或者配置目录错误时,应用报错的bug ([8f86ed0](https://github.com/forsigner/egg-leaf/commit/8f86ed0))
<a name="1.6.1"></a>

@@ -7,0 +22,0 @@ ## [1.6.1](https://github.com/forsigner/egg-leaf/compare/v1.6.0...v1.6.1) (2018-04-11)

{
"name": "egg-leaf",
"version": "1.6.1",
"version": "1.6.3",
"description": "Mock server for egg",

@@ -5,0 +5,0 @@ "eggPlugin": {

@@ -22,3 +22,3 @@ # egg-leaf

exports.leaf = {
apiDir: 'config/api-docs', // 接口文档目录
apiDir: api-docs1, // 接口文档目录
enable: true, // 是否开启 mock 服务

@@ -25,0 +25,0 @@ };

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc