Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix plugin config schema comment #2376

Merged
merged 2 commits into from
Nov 20, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 21 additions & 12 deletions lib/plugins/plugins.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
/**
* plugins.js (Use with caution)
*
* Experimental feature which is likely to change.
* This file returns helper methods to enable services to include
* their own departmental frontend(Styles, Scripts, nunjucks etc)
*
Expand All @@ -15,21 +13,32 @@
*
* // govuk-prototype-kit.config.json
* {
* "assets": path | path[],
* "importNunjucksMacrosInto": path | path[],
* "nunjucksPaths": path | path[],
* "nunjucksFilters": path | path[],
* "sass": path | path[],
* "scripts": path | path[],
* "stylesheets": path | path[],
* "assets": string | string[],
* "importNunjucksMacrosInto": string | string[],
* "meta": {
* "description": string,
* "urls": {
* "documentation": string,
* "versionHistory": string,
* "releaseNotes": string
* }
* },
* "nunjucksMacros": {"importFrom": string, "macroName": string} | {"importFrom": string, "macroName": string}[],
* "nunjucksPaths": string | string[],
* "nunjucksFilters": string | string[],
* "nunjucksFunctions": string | string[],
* "pluginDependencies": [{"packageName": string, "minVersion": string, "maxVersion": string}],
* "sass": string | string[],
* "scripts": string | string[] | {"path": string, "type": string} | {"path": string, "type": string}[],
* "stylesheets": string | string[],
* "templates": {
* "name": string,
* "path": path,
* "path": string,
* "type": string
* }[]
* }
*
* Note that all of the top-level keys are optional.
* Note that all the top-level keys are optional.
*
*/

Expand Down Expand Up @@ -83,7 +92,7 @@ function getPluginConfig (packageName) {
/**
* Handle errors to do with plugin paths
* @param {{ packageName: string, item: string }} subject - For example { packageName: 'govuk-frontend', item: '/all.js' }
* @throws if path in item is badly formatted
* @throws when path in item is badly formatted
*/
function throwIfBadFilepath (subject) {
if (('' + subject.item).indexOf('\\') > -1) {
Expand Down