From 368b1e4607aa6ae31a233e8fc6a7e1fb31477d7a Mon Sep 17 00:00:00 2001 From: Ben Surgison Date: Fri, 17 Nov 2023 14:49:16 +0000 Subject: [PATCH 1/2] Fix plugin config schema comment --- lib/plugins/plugins.js | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/lib/plugins/plugins.js b/lib/plugins/plugins.js index 900468ed1b..96d23b00fd 100644 --- a/lib/plugins/plugins.js +++ b/lib/plugins/plugins.js @@ -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) * @@ -17,10 +15,21 @@ * { * "assets": path | path[], * "importNunjucksMacrosInto": path | path[], + * "meta": { + * "description": string, + * "urls": { + * "documentation": url, + * "versionHistory": url, + * "releaseNotes": url + * } + * }, + * "nunjucksMacros": {"importFrom": path, "macroName": string} | {"importFrom": path, "macroName": string}[], * "nunjucksPaths": path | path[], * "nunjucksFilters": path | path[], + * "nunjucksFunctions": path | path[], + * "pluginDependencies": [{"packageName": packageName, "minVersion": semVer, "maxVersion": semVer}], * "sass": path | path[], - * "scripts": path | path[], + * "scripts": path | path[] | {"path": path, "type": string} | {"path": path, "type": string}[], * "stylesheets": path | path[], * "templates": { * "name": string, @@ -29,7 +38,7 @@ * }[] * } * - * Note that all of the top-level keys are optional. + * Note that all the top-level keys are optional. * */ @@ -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) { From 5b3058bf0261ae7a5634b3afec769e0c6e412a67 Mon Sep 17 00:00:00 2001 From: Ben Surgison Date: Fri, 17 Nov 2023 16:47:01 +0000 Subject: [PATCH 2/2] Fix plugin config schema comment as requested in review --- lib/plugins/plugins.js | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/lib/plugins/plugins.js b/lib/plugins/plugins.js index 96d23b00fd..eb3c088512 100644 --- a/lib/plugins/plugins.js +++ b/lib/plugins/plugins.js @@ -13,27 +13,27 @@ * * // govuk-prototype-kit.config.json * { - * "assets": path | path[], - * "importNunjucksMacrosInto": path | path[], + * "assets": string | string[], + * "importNunjucksMacrosInto": string | string[], * "meta": { * "description": string, * "urls": { - * "documentation": url, - * "versionHistory": url, - * "releaseNotes": url + * "documentation": string, + * "versionHistory": string, + * "releaseNotes": string * } * }, - * "nunjucksMacros": {"importFrom": path, "macroName": string} | {"importFrom": path, "macroName": string}[], - * "nunjucksPaths": path | path[], - * "nunjucksFilters": path | path[], - * "nunjucksFunctions": path | path[], - * "pluginDependencies": [{"packageName": packageName, "minVersion": semVer, "maxVersion": semVer}], - * "sass": path | path[], - * "scripts": path | path[] | {"path": path, "type": string} | {"path": path, "type": string}[], - * "stylesheets": path | path[], + * "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 * }[] * }