Skip to content
Closed
Show file tree
Hide file tree
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
8 changes: 7 additions & 1 deletion known-plugins.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,12 @@
"@govuk-prototype-kit/step-by-step",
"hmrc-frontend",
"jquery"
]
],
"interned": {
"jquery": {
"scripts": ["/dist/jquery.js"],
"assets": ["/dist"]
}
}
}
}
13 changes: 6 additions & 7 deletions lib/extensions/extensions.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,16 @@ const path = require('path')

// Local dependencies
const appConfig = require('../config')
const { projectDir } = require('../path-utils')
const { packageDir, projectDir } = require('../path-utils')
const pkgPath = path.join(projectDir, 'package.json')
const chokidar = require('chokidar')
const fse = require('fs-extra')
const { shadowNunjucks } = require('../build/config.json').paths

const knownPlugins = fse.readJsonSync(
path.join(packageDir, 'known-plugins.json')
)

// Generic utilities
const removeDuplicates = arr => [...new Set(arr)]
const filterOutParentAndEmpty = part => part && part !== '..'
Expand All @@ -57,12 +61,7 @@ const objectMap = (object, mapFn) => Object.keys(object).reduce((result, key) =>
// File utilities
const getPathFromProjectRoot = (...all) => path.join(...[projectDir].concat(all))
const pathToPackageConfigFile = packageName => getPathFromProjectRoot('node_modules', packageName, 'govuk-prototype-kit.config.json')
const moduleToExtensionConversion = {
jquery: {
scripts: ['/dist/jquery.js'],
assets: ['/dist']
}
}
const moduleToExtensionConversion = knownPlugins.plugins.interned

const readJsonFile = (filePath) => {
return JSON.parse(fs.readFileSync(filePath, 'utf8'))
Expand Down