@netlify/framework-info
Advanced tools
Comparing version 2.0.0 to 2.1.0
@@ -10,2 +10,9 @@ # Changelog | ||
## [2.1.0](https://www.github.com/netlify/framework-info/compare/v2.0.0...v2.1.0) (2021-01-25) | ||
### Features | ||
* add plugins detection ([#111](https://www.github.com/netlify/framework-info/issues/111)) ([db4e8f5](https://www.github.com/netlify/framework-info/commit/db4e8f5eaeb3f7f05f7f2c82ec94fdc8312322d2)) | ||
## [2.0.0](https://www.github.com/netlify/framework-info/compare/v1.1.2...v2.0.0) (2021-01-07) | ||
@@ -12,0 +19,0 @@ |
{ | ||
"name": "@netlify/framework-info", | ||
"version": "2.0.0", | ||
"version": "2.1.0", | ||
"description": "Framework detection utility", | ||
@@ -17,3 +17,3 @@ "main": "./src/main.js", | ||
"scripts": { | ||
"prepublishOnly": "run-s build:core", | ||
"prepublishOnly": "npm ci && run-s test build:core", | ||
"build": "run-s build:*", | ||
@@ -77,2 +77,3 @@ "build:core": "webpack --config scripts/webpack.config.core.js", | ||
"dependencies": { | ||
"ajv": "^7.0.0", | ||
"filter-obj": "^2.0.1", | ||
@@ -84,2 +85,3 @@ "is-plain-obj": "^2.1.0", | ||
"read-pkg-up": "^7.0.1", | ||
"semver": "^7.3.4", | ||
"yargs": "^15.4.1" | ||
@@ -92,3 +94,2 @@ }, | ||
"@netlify/eslint-config-node": "^2.2.2", | ||
"ajv": "^7.0.0", | ||
"ava": "^2.4.0", | ||
@@ -95,0 +96,0 @@ "babel-loader": "^8.2.2", |
@@ -38,3 +38,4 @@ [![npm version](https://img.shields.io/npm/v/@netlify/framework-info.svg)](https://npmjs.org/package/@netlify/framework-info) | ||
// }, | ||
// env: { GATSBY_LOGGER: 'yurnalist' } | ||
// env: { GATSBY_LOGGER: 'yurnalist' }, | ||
// plugins: [] | ||
// } | ||
@@ -56,3 +57,4 @@ // ] | ||
// }, | ||
// env: {} | ||
// env: {}, | ||
// plugins: [] | ||
// } | ||
@@ -76,3 +78,4 @@ // ] | ||
// }, | ||
// env: {} | ||
// env: {}, | ||
// plugins: [] | ||
// } | ||
@@ -100,3 +103,4 @@ ``` | ||
}, | ||
"env": {} | ||
"env": {}, | ||
"plugins": [] | ||
} | ||
@@ -189,2 +193,8 @@ ] | ||
#### plugins | ||
_Type_: `string[]` | ||
A list of recommend Netlify build plugins to install for the framework. | ||
## hasFramework(frameworkName, options?) | ||
@@ -240,3 +250,4 @@ | ||
}, | ||
"env": { "GATSBY_LOGGER": "yurnalist" } | ||
"env": { "GATSBY_LOGGER": "yurnalist" }, | ||
"plugins": [] | ||
} | ||
@@ -333,1 +344,21 @@ ``` | ||
Environment variables that should be set when running the dev command. | ||
## plugins | ||
_Type_: `object[]` | ||
A list of Netlify build plugins package names and conditions. If a condition is met for a plugin it will be returned in | ||
the framework's plugin's list. | ||
For example | ||
```json | ||
{ | ||
"plugins": [ | ||
{ | ||
"packageName": "@netlify/plugin-nextjs", | ||
"condition": { "minNodeVersion": "10.13.0" } | ||
} | ||
] | ||
} | ||
``` |
@@ -1,2 +0,2 @@ | ||
const { cwd } = require('process') | ||
const { cwd, version } = require('process') | ||
@@ -32,2 +32,3 @@ const isPlainObj = require('is-plain-obj') | ||
packageJsonPath, | ||
nodeVersion: version, | ||
} | ||
@@ -34,0 +35,0 @@ } |
@@ -7,8 +7,9 @@ const pFilter = require('p-filter') | ||
const { getPackageJsonContent } = require('./package.js') | ||
const { getPlugins } = require('./plugins') | ||
const { getRunScriptCommand } = require('./run_script.js') | ||
const getContext = (context) => { | ||
const { pathExists, packageJson, packageJsonPath = '.' } = context | ||
const { pathExists, packageJson, packageJsonPath = '.', nodeVersion } = context | ||
return { pathExists, packageJson, packageJsonPath } | ||
return { pathExists, packageJson, packageJsonPath, nodeVersion } | ||
} | ||
@@ -28,2 +29,3 @@ | ||
* @property {string} [packageJsonPath='.'] - Path of package.json | ||
* @property {nodeVersion} [nodeVersion] - Node.js version of the runtime environment. Used to recommend Netlify build plugins | ||
*/ | ||
@@ -50,2 +52,3 @@ | ||
* @property {object} env - Environment variables that should be set when calling the dev command | ||
* @property {string[]} plugins - A list of recommend Netlify build plugins to install for the framework | ||
*/ | ||
@@ -61,3 +64,3 @@ | ||
const listFrameworks = async function (context) { | ||
const { pathExists, packageJson, packageJsonPath } = getContext(context) | ||
const { pathExists, packageJson, packageJsonPath, nodeVersion } = getContext(context) | ||
const { npmDependencies, scripts, runScriptCommand } = await getProjectInfo({ | ||
@@ -69,3 +72,5 @@ pathExists, | ||
const frameworks = await pFilter(FRAMEWORKS, (framework) => usesFramework(framework, { pathExists, npmDependencies })) | ||
const frameworkInfos = frameworks.map((framework) => getFrameworkInfo(framework, { scripts, runScriptCommand })) | ||
const frameworkInfos = frameworks.map((framework) => | ||
getFrameworkInfo(framework, { scripts, runScriptCommand, nodeVersion }), | ||
) | ||
return frameworkInfos | ||
@@ -100,3 +105,3 @@ } | ||
const framework = getFrameworkByName(frameworkName) | ||
const { pathExists, packageJson, packageJsonPath } = getContext(context) | ||
const { pathExists, packageJson, packageJsonPath, nodeVersion } = getContext(context) | ||
const { scripts, runScriptCommand } = await getProjectInfo({ | ||
@@ -107,3 +112,3 @@ pathExists, | ||
}) | ||
const frameworkInfo = getFrameworkInfo(framework, { scripts, runScriptCommand }) | ||
const frameworkInfo = getFrameworkInfo(framework, { scripts, runScriptCommand, nodeVersion }) | ||
return frameworkInfo | ||
@@ -140,6 +145,8 @@ } | ||
env, | ||
plugins, | ||
}, | ||
{ scripts, runScriptCommand }, | ||
{ scripts, runScriptCommand, nodeVersion }, | ||
) { | ||
const devCommands = getDevCommands({ frameworkDevCommand, scripts, runScriptCommand }) | ||
const recommendedPlugins = getPlugins(plugins, { nodeVersion }) | ||
return { | ||
@@ -151,2 +158,3 @@ name, | ||
env, | ||
plugins: recommendedPlugins, | ||
} | ||
@@ -153,0 +161,0 @@ } |
@@ -17,3 +17,4 @@ { | ||
}, | ||
"env": {} | ||
"env": {}, | ||
"plugins": [] | ||
} |
@@ -14,3 +14,4 @@ { | ||
}, | ||
"env": {} | ||
"env": {}, | ||
"plugins": [] | ||
} |
@@ -17,3 +17,4 @@ { | ||
}, | ||
"env": {} | ||
"env": {}, | ||
"plugins": [] | ||
} |
@@ -17,3 +17,4 @@ { | ||
}, | ||
"env": { "BROWSER": "none", "PORT": "3000" } | ||
"env": { "BROWSER": "none", "PORT": "3000" }, | ||
"plugins": [] | ||
} |
@@ -17,3 +17,4 @@ { | ||
}, | ||
"env": {} | ||
"env": {}, | ||
"plugins": [] | ||
} |
@@ -17,3 +17,4 @@ { | ||
}, | ||
"env": { "BROWSER": "none" } | ||
"env": { "BROWSER": "none" }, | ||
"plugins": [] | ||
} |
@@ -17,3 +17,4 @@ { | ||
}, | ||
"env": { "BROWSER": "none" } | ||
"env": { "BROWSER": "none" }, | ||
"plugins": [] | ||
} |
@@ -17,3 +17,4 @@ { | ||
}, | ||
"env": {} | ||
"env": {}, | ||
"plugins": [] | ||
} |
@@ -17,3 +17,4 @@ { | ||
}, | ||
"env": {} | ||
"env": {}, | ||
"plugins": [] | ||
} |
@@ -17,3 +17,4 @@ { | ||
}, | ||
"env": {} | ||
"env": {}, | ||
"plugins": [] | ||
} |
@@ -17,3 +17,4 @@ { | ||
}, | ||
"env": { "GATSBY_LOGGER": "yurnalist" } | ||
"env": { "GATSBY_LOGGER": "yurnalist" }, | ||
"plugins": [] | ||
} |
@@ -17,3 +17,4 @@ { | ||
}, | ||
"env": {} | ||
"env": {}, | ||
"plugins": [] | ||
} |
@@ -14,3 +14,5 @@ { | ||
}, | ||
"env": {} | ||
"env": {}, | ||
"plugins": [], | ||
"plugins": [] | ||
} |
@@ -14,3 +14,4 @@ { | ||
}, | ||
"env": {} | ||
"env": {}, | ||
"plugins": [] | ||
} |
@@ -17,3 +17,4 @@ { | ||
}, | ||
"env": {} | ||
"env": {}, | ||
"plugins": [] | ||
} |
@@ -17,3 +17,4 @@ { | ||
}, | ||
"env": {} | ||
"env": {}, | ||
"plugins": [] | ||
} |
@@ -17,3 +17,4 @@ { | ||
}, | ||
"env": {} | ||
"env": {}, | ||
"plugins": [] | ||
} |
@@ -17,3 +17,4 @@ { | ||
}, | ||
"env": {} | ||
"env": {}, | ||
"plugins": [] | ||
} |
@@ -14,3 +14,4 @@ { | ||
}, | ||
"env": {} | ||
"env": {}, | ||
"plugins": [] | ||
} |
@@ -17,3 +17,4 @@ { | ||
}, | ||
"env": {} | ||
"env": {}, | ||
"plugins": [] | ||
} |
@@ -17,3 +17,9 @@ { | ||
}, | ||
"env": {} | ||
"env": {}, | ||
"plugins": [ | ||
{ | ||
"packageName": "@netlify/plugin-nextjs", | ||
"condition": { "minNodeVersion": "10.13.0" } | ||
} | ||
] | ||
} |
@@ -17,3 +17,4 @@ { | ||
}, | ||
"env": {} | ||
"env": {}, | ||
"plugins": [] | ||
} |
@@ -17,3 +17,4 @@ { | ||
}, | ||
"env": {} | ||
"env": {}, | ||
"plugins": [] | ||
} |
@@ -17,3 +17,4 @@ { | ||
}, | ||
"env": {} | ||
"env": {}, | ||
"plugins": [] | ||
} |
@@ -17,3 +17,4 @@ { | ||
}, | ||
"env": {} | ||
"env": {}, | ||
"plugins": [] | ||
} |
@@ -17,3 +17,4 @@ { | ||
}, | ||
"env": {} | ||
"env": {}, | ||
"plugins": [] | ||
} |
@@ -17,3 +17,4 @@ { | ||
}, | ||
"env": {} | ||
"env": {}, | ||
"plugins": [] | ||
} |
@@ -17,3 +17,4 @@ { | ||
}, | ||
"env": {} | ||
"env": {}, | ||
"plugins": [] | ||
} |
@@ -17,3 +17,4 @@ { | ||
}, | ||
"env": {} | ||
"env": {}, | ||
"plugins": [] | ||
} |
@@ -17,3 +17,4 @@ { | ||
}, | ||
"env": { "BROWSER": "none", "PORT": "3000" } | ||
"env": { "BROWSER": "none", "PORT": "3000" }, | ||
"plugins": [] | ||
} |
@@ -17,3 +17,4 @@ { | ||
}, | ||
"env": {} | ||
"env": {}, | ||
"plugins": [] | ||
} |
@@ -17,3 +17,4 @@ { | ||
}, | ||
"env": {} | ||
"env": {}, | ||
"plugins": [] | ||
} |
@@ -17,3 +17,4 @@ { | ||
}, | ||
"env": {} | ||
"env": {}, | ||
"plugins": [] | ||
} |
@@ -17,3 +17,4 @@ { | ||
}, | ||
"env": {} | ||
"env": {}, | ||
"plugins": [] | ||
} |
@@ -28,2 +28,3 @@ const { getContext } = require('./context') | ||
* @property {object} env - Environment variables that should be set when calling the dev command | ||
* @property {string[]} plugins - A list of recommend Netlify build plugins to install for the framework | ||
*/ | ||
@@ -30,0 +31,0 @@ |
Sorry, the diff of this file is too big to display
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
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
216091
24
49
1741
358
9
+ Addedajv@^7.0.0
+ Addedsemver@^7.3.4
+ Addedajv@7.2.4(transitive)
+ Addedfast-deep-equal@3.1.3(transitive)
+ Addedjson-schema-traverse@1.0.0(transitive)
+ Addedpunycode@2.3.1(transitive)
+ Addedrequire-from-string@2.0.2(transitive)
+ Addedsemver@7.6.3(transitive)
+ Addeduri-js@4.4.1(transitive)