Socket
Socket
Sign inDemoInstall

@netlify/framework-info

Package Overview
Dependencies
8
Maintainers
16
Versions
93
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 6.1.0 to 7.0.0-rc

11

package.json
{
"name": "@netlify/framework-info",
"version": "6.1.0",
"version": "7.0.0-rc",
"description": "Framework detection utility",
"type": "module",
"exports": "./src/main.js",
"main": "./src/main.js",

@@ -74,4 +76,4 @@ "browser": "./dist/index.js",

"config": {
"eslint": "--ignore-path .gitignore --cache --format=codeframe --max-warnings=0 \"{src,site,scripts,test,cypress}/**/*.{js,jsx,html}\" --ignore-pattern \"test/fixtures/**/*\"",
"prettier": "--ignore-path .gitignore --loglevel warn \"{src,site,scripts,test,cypress}/**/*.js\" \"*.{js,md,yml,json}\" \"!package-lock.json\" \"!CHANGELOG.md\""
"eslint": "--ignore-path .gitignore --cache --format=codeframe --max-warnings=0 \"{src,site,scripts,test,cypress}/**/*.{cjs,mjs,js,jsx,html}\" --ignore-pattern \"test/fixtures/**/*\"",
"prettier": "--ignore-path .gitignore --loglevel warn \"{src,site,scripts,test,cypress}/**/*.{cjs,mjs,js}\" \"*.{cjs,mjs,js,md,yml,json}\" \"!package-lock.json\" \"!CHANGELOG.md\""
},

@@ -129,3 +131,6 @@ "dependencies": {

"node": "^12.20.0 || ^14.14.0 || >=16.0.0"
},
"ava": {
"verbose": true
}
}

@@ -26,3 +26,3 @@ [![npm version](https://img.shields.io/npm/v/@netlify/framework-info.svg)](https://npmjs.org/package/@netlify/framework-info)

```js
const { listFrameworks, hasFramework, getFramework } = require('@netlify/framework-info')
import { listFrameworks, hasFramework, getFramework } from '@netlify/framework-info'

@@ -29,0 +29,0 @@ console.log(await listFrameworks({ projectDir: './path/to/gatsby/website' }))

@@ -1,6 +0,6 @@

const { cwd, version } = require('process')
import { cwd, version } from 'process'
const isPlainObj = require('is-plain-obj')
const locatePath = require('locate-path')
const readPkgUp = require('read-pkg-up')
import isPlainObj from 'is-plain-obj'
import locatePath from 'locate-path'
import readPkgUp from 'read-pkg-up'

@@ -26,3 +26,3 @@ const getPackageJson = async (projectDir) => {

const getContext = async ({ projectDir = cwd(), nodeVersion = version } = {}) => {
export const getContext = async ({ projectDir = cwd(), nodeVersion = version } = {}) => {
const { packageJson, packageJsonPath = projectDir } = await getPackageJson(projectDir)

@@ -36,3 +36,1 @@ return {

}
module.exports = { getContext }

@@ -1,14 +0,13 @@

const pFilter = require('p-filter')
import pFilter from 'p-filter'
const { FRAMEWORKS } = require('../build/frameworks')
import { FRAMEWORKS } from '../build/frameworks.js'
const { usesFramework } = require('./detect')
const { getDevCommands } = require('./dev')
const { getPackageJsonContent } = require('./package')
const { getPlugins } = require('./plugins')
const { getRunScriptCommand } = require('./run_script')
import { usesFramework } from './detect.js'
import { getDevCommands } from './dev.js'
import { getPackageJsonContent } from './package.js'
import { getPlugins } from './plugins.js'
import { getRunScriptCommand } from './run_script.js'
const getContext = (context) => {
const { pathExists, packageJson, packageJsonPath = '.', nodeVersion } = context
return { pathExists, packageJson, packageJsonPath, nodeVersion }

@@ -69,3 +68,3 @@ }

*/
const listFrameworks = async function (context) {
export const listFrameworks = async function (context) {
const { pathExists, packageJson, packageJsonPath, nodeVersion } = getContext(context)

@@ -92,3 +91,3 @@ const { npmDependencies, scripts, runScriptCommand } = await getProjectInfo({

*/
const hasFramework = async function (frameworkId, context) {
export const hasFramework = async function (frameworkId, context) {
const framework = getFrameworkById(frameworkId)

@@ -109,3 +108,3 @@ const { pathExists, packageJson, packageJsonPath } = getContext(context)

*/
const getFramework = async function (frameworkId, context) {
export const getFramework = async function (frameworkId, context) {
const framework = getFrameworkById(frameworkId)

@@ -171,3 +170,1 @@ const { pathExists, packageJson, packageJsonPath, nodeVersion } = getContext(context)

}
module.exports = { listFrameworks, hasFramework, getFramework }

@@ -1,2 +0,2 @@

const pLocate = require('p-locate')
import pLocate from 'p-locate'

@@ -9,3 +9,3 @@ // Checks if the project is using a specific framework:

// - if `framework.configFiles` is set, one of the files must exist
const usesFramework = async function (
export const usesFramework = async function (
{

@@ -48,3 +48,1 @@ detect: {

}
module.exports = { usesFramework }

@@ -6,3 +6,3 @@ // Retrieve framework's dev commands.

// - `framework.dev.command`
const getDevCommands = function ({ frameworkDevCommand, scripts, runScriptCommand }) {
export const getDevCommands = function ({ frameworkDevCommand, scripts, runScriptCommand }) {
if (frameworkDevCommand === undefined) {

@@ -70,3 +70,1 @@ return []

const EXCLUDED_SCRIPTS = ['netlify dev']
module.exports = { getDevCommands }
// We purposely order the following array to ensure the most relevant framework
// is always first, if several frameworks are detected at once.
// Therefore, we cannot use `fs.readdir()`.
module.exports.FRAMEWORK_NAMES = [
export const FRAMEWORK_NAMES = [
// Static site generators

@@ -6,0 +6,0 @@ 'astro',

@@ -1,3 +0,3 @@

const { getContext } = require('./context')
const { listFrameworks: list, hasFramework: has, getFramework: get } = require('./core')
import { getContext } from './context.js'
import { listFrameworks as list, hasFramework as has, getFramework as get } from './core.js'

@@ -39,3 +39,3 @@ /**

*/
const listFrameworks = async function (opts) {
export const listFrameworks = async function (opts) {
const context = await getContext(opts)

@@ -53,3 +53,3 @@ return await list(context)

*/
const hasFramework = async function (frameworkId, options) {
export const hasFramework = async function (frameworkId, options) {
const context = await getContext(options)

@@ -67,7 +67,5 @@ return await has(frameworkId, context)

*/
const getFramework = async function (frameworkId, options) {
export const getFramework = async function (frameworkId, options) {
const context = await getContext(options)
return await get(frameworkId, context)
}
module.exports = { listFrameworks, hasFramework, getFramework }

@@ -1,5 +0,5 @@

const filterObj = require('filter-obj')
const isPlainObj = require('is-plain-obj')
import filterObj from 'filter-obj'
import isPlainObj from 'is-plain-obj'
const getPackageJsonContent = function ({ packageJson }) {
export const getPackageJsonContent = function ({ packageJson }) {
if (packageJson === undefined) {

@@ -40,3 +40,1 @@ return { npmDependencies: [], scripts: {} }

}
module.exports = { getPackageJsonContent }

@@ -1,3 +0,3 @@

const Ajv = require('ajv').default
const semver = require('semver')
import Ajv from 'ajv'
import semver from 'semver'

@@ -13,3 +13,3 @@ const MIN_NODE_VERSION_KEYWORD = {

const getPlugins = function (plugins, { nodeVersion }) {
export const getPlugins = function (plugins, { nodeVersion }) {
return plugins

@@ -19,3 +19,1 @@ .filter(({ condition }) => ajv.validate(condition, { nodeVersion }))

}
module.exports = { getPlugins }

@@ -1,5 +0,5 @@

const { dirname } = require('path')
import { dirname } from 'path'
// Retrieve the command to run `package.json` `scripts` commands
const getRunScriptCommand = async function ({ pathExists, packageJsonPath }) {
export const getRunScriptCommand = async function ({ pathExists, packageJsonPath }) {
const yarnExists = await pathExists(`${dirname(packageJsonPath)}/yarn.lock`)

@@ -12,3 +12,1 @@ if (yarnExists) {

}
module.exports = { getRunScriptCommand }
SocketSocket SOC 2 Logo

Product

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

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc