-
Notifications
You must be signed in to change notification settings - Fork 333
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Resolve
govuk-frontend
at workspace level by default
Node.js `require.resolve()` paths are optionally provided, for example: 1. Review app uses local `node_modules` before project level 2. Package stats uses local `node_modules` before project level This is necessary for workspace `govuk-frontend@4` installs to be found
- Loading branch information
1 parent
5343240
commit 5eb1e82
Showing
9 changed files
with
112 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
const { dirname, join } = require('path') | ||
|
||
// Repository root directory | ||
const paths = require('./paths') | ||
|
||
/** | ||
* Default lookup resolver paths | ||
* | ||
* @param {string} basePath - Base directory, for example `/path/to/package` | ||
* @returns {{ modules: string[], stylesheets: string[], views: string[] }} Resolver paths | ||
*/ | ||
module.exports = (basePath) => { | ||
const requirePaths = [ | ||
join(basePath, 'node_modules'), | ||
join(paths.root, 'node_modules') | ||
] | ||
|
||
// Locate GOV.UK Frontend | ||
const packagePath = dirname( | ||
require.resolve('govuk-frontend/package.json', { | ||
paths: requirePaths | ||
}) | ||
) | ||
|
||
return { | ||
/** | ||
* Node.js module paths | ||
*/ | ||
modules: [ | ||
join(packagePath, 'node_modules'), | ||
...requirePaths | ||
], | ||
|
||
/** | ||
* Sass stylesheets | ||
*/ | ||
stylesheets: [ | ||
join(packagePath, 'dist'), | ||
...requirePaths | ||
], | ||
|
||
/** | ||
* Nunjucks view paths | ||
*/ | ||
views: [ | ||
join(basePath, 'src/views'), | ||
join(packagePath, 'dist') | ||
] | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters