Skip to content
This repository was archived by the owner on Jan 11, 2023. It is now read-only.

Commit db4e8f5

Browse files
authored
feat: add plugins detection (#111)
1 parent 6d4c004 commit db4e8f5

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

50 files changed

+315
-71
lines changed

README.md

Lines changed: 36 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,8 @@ console.log(await listFrameworks({ projectDir: './path/to/gatsby/website' }))
3535
// commands: ['gatsby build'],
3636
// directory: 'public'
3737
// },
38-
// env: { GATSBY_LOGGER: 'yurnalist' }
38+
// env: { GATSBY_LOGGER: 'yurnalist' },
39+
// plugins: []
3940
// }
4041
// ]
4142

@@ -52,7 +53,8 @@ console.log(await listFrameworks({ projectDir: './path/to/vue/website' }))
5253
// commands: ['vue-cli-service build'],
5354
// directory: 'dist'
5455
// },
55-
// env: {}
56+
// env: {},
57+
// plugins: []
5658
// }
5759
// ]
5860

@@ -71,7 +73,8 @@ console.log(await getFramework('vue', { projectDir: './path/to/vue/website' }))
7173
// commands: ['vue-cli-service build'],
7274
// directory: 'dist'
7375
// },
74-
// env: {}
76+
// env: {},
77+
// plugins: []
7578
// }
7679
```
7780

@@ -94,7 +97,8 @@ $ framework-info --long ./path/to/vue/website
9497
"commands": ["vue-cli-service build"],
9598
"directory": "dist"
9699
},
97-
"env": {}
100+
"env": {},
101+
"plugins": []
98102
}
99103
]
100104
```
@@ -182,6 +186,12 @@ _Type_: `object`
182186

183187
Environment variables that should be set when calling the dev command.
184188

189+
#### plugins
190+
191+
_Type_: `string[]`
192+
193+
A list of recommend Netlify build plugins to install for the framework.
194+
185195
## hasFramework(frameworkName, options?)
186196

187197
`options`: `object?`\
@@ -232,7 +242,8 @@ Each framework is a JSON file in the `/src/frameworks/` directory. For example:
232242
"command": "gatsby build",
233243
"directory": "public"
234244
},
235-
"env": { "GATSBY_LOGGER": "yurnalist" }
245+
"env": { "GATSBY_LOGGER": "yurnalist" },
246+
"plugins": []
236247
}
237248
```
238249

@@ -324,3 +335,23 @@ Directory where built files are written to.
324335
_Type_: `object`
325336

326337
Environment variables that should be set when running the dev command.
338+
339+
## plugins
340+
341+
_Type_: `object[]`
342+
343+
A list of Netlify build plugins package names and conditions. If a condition is met for a plugin it will be returned in
344+
the framework's plugin's list.
345+
346+
For example
347+
348+
```json
349+
{
350+
"plugins": [
351+
{
352+
"packageName": "@netlify/plugin-nextjs",
353+
"condition": { "minNodeVersion": "10.13.0" }
354+
}
355+
]
356+
}
357+
```

package-lock.json

Lines changed: 109 additions & 17 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,20 +73,21 @@
7373
"prettier": "--ignore-path .gitignore --loglevel warn \"{src,site,scripts,test}/**/*.js\" \"*.{js,md,yml,json}\" \"!package-lock.json\" \"!CHANGELOG.md\""
7474
},
7575
"dependencies": {
76+
"ajv": "^7.0.0",
7677
"filter-obj": "^2.0.1",
7778
"is-plain-obj": "^2.1.0",
7879
"locate-path": "^5.0.0",
7980
"p-filter": "^2.1.0",
8081
"p-locate": "^4.1.0",
8182
"read-pkg-up": "^7.0.1",
83+
"semver": "^7.3.4",
8284
"yargs": "^15.4.1"
8385
},
8486
"devDependencies": {
8587
"@babel/core": "^7.12.10",
8688
"@babel/preset-env": "^7.12.10",
8789
"@babel/preset-react": "^7.12.10",
8890
"@netlify/eslint-config-node": "^2.2.2",
89-
"ajv": "^7.0.0",
9091
"ava": "^2.4.0",
9192
"babel-loader": "^8.2.2",
9293
"cpy": "^8.1.0",

0 commit comments

Comments
 (0)