Comparing version 1.0.0 to 1.1.0
1.1.0 / 2017-01-13 | ||
================== | ||
* feat: support read framework from package.json (#1) | ||
1.0.0 / 2016-06-20 | ||
@@ -3,0 +8,0 @@ ================== |
13
index.js
@@ -14,3 +14,3 @@ 'use strict'; | ||
*/ | ||
exports.getFrameworkOrEggPath = function(cwd, eggNames) { | ||
exports.getFrameworkOrEggPath = (cwd, eggNames) => { | ||
eggNames = eggNames || ['egg']; | ||
@@ -23,2 +23,13 @@ const moduleDir = path.join(cwd, 'node_modules'); | ||
// try to get framework | ||
// 1. try to read egg.framework property on package.json | ||
const pkgFile = path.join(cwd, 'package.json'); | ||
if (fs.existsSync(pkgFile)) { | ||
const pkg = require(pkgFile); | ||
if (pkg.egg && pkg.egg.framework) { | ||
return path.join(moduleDir, pkg.egg.framework); | ||
} | ||
} | ||
// 2. try the module dependencies includes eggNames | ||
const names = fs.readdirSync(moduleDir); | ||
@@ -25,0 +36,0 @@ for (const name of names) { |
{ | ||
"name": "egg-utils", | ||
"version": "1.0.0", | ||
"version": "1.1.0", | ||
"description": "Utils for all egg projects", | ||
@@ -36,3 +36,3 @@ "main": "index.js", | ||
"engine": { | ||
"node": ">=4.0.0" | ||
"node": ">=6.0.0" | ||
}, | ||
@@ -45,4 +45,4 @@ "ava": { | ||
"ci": { | ||
"version": "4, 6" | ||
"version": "6, 7" | ||
} | ||
} |
@@ -10,12 +10,12 @@ egg-utils | ||
[npm-image]: https://img.shields.io/npm/v/egg-ci.svg?style=flat-square | ||
[npm-url]: https://npmjs.org/package/egg-ci | ||
[travis-image]: https://img.shields.io/travis/eggjs/egg-ci.svg?style=flat-square | ||
[travis-url]: https://travis-ci.org/eggjs/egg-ci | ||
[codecov-image]: https://codecov.io/github/eggjs/egg-ci/coverage.svg?branch=master | ||
[codecov-url]: https://codecov.io/github/eggjs/egg-ci?branch=master | ||
[david-image]: https://img.shields.io/david/eggjs/egg-ci.svg?style=flat-square | ||
[david-url]: https://david-dm.org/eggjs/egg-ci | ||
[download-image]: https://img.shields.io/npm/dm/egg-ci.svg?style=flat-square | ||
[download-url]: https://npmjs.org/package/egg-ci | ||
[npm-image]: https://img.shields.io/npm/v/egg-utils.svg?style=flat-square | ||
[npm-url]: https://npmjs.org/package/egg-utils | ||
[travis-image]: https://img.shields.io/travis/eggjs/egg-utils.svg?style=flat-square | ||
[travis-url]: https://travis-ci.org/eggjs/egg-utils | ||
[codecov-image]: https://codecov.io/github/eggjs/egg-utils/coverage.svg?branch=master | ||
[codecov-url]: https://codecov.io/github/eggjs/egg-utils?branch=master | ||
[david-image]: https://img.shields.io/david/eggjs/egg-utils.svg?style=flat-square | ||
[david-url]: https://david-dm.org/eggjs/egg-utils | ||
[download-image]: https://img.shields.io/npm/dm/egg-utils.svg?style=flat-square | ||
[download-url]: https://npmjs.org/package/egg-utils | ||
@@ -22,0 +22,0 @@ Utils for all egg projects. |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
4831
51
3