Socket
Socket
Sign inDemoInstall

@netlify/framework-info

Package Overview
Dependencies
Maintainers
14
Versions
93
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@netlify/framework-info - npm Package Compare versions

Comparing version 2.0.0 to 2.1.0

src/plugins.js

7

CHANGELOG.md

@@ -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 @@

7

package.json
{
"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

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