Skip to content

Commit

Permalink
Ensure package contents is namespaced to use govuk
Browse files Browse the repository at this point in the history
Before:

package
├── assets
├── components
├── core
├── helpers
├── objects
├── overrides
├── settings
├── tools
├── utilities
├── vendor
├── README.md
├── all-ie8.scss
├── all.js
├── all.scss
├── common.js
├── govuk-prototype-kit.config.json
├── package.json
└── template.njk

After:

package
├── govuk
│   ├── assets
│   ├── components
│   ├── core
│   ├── helpers
│   ├── objects
│   ├── overrides
│   ├── settings
│   ├── tools
│   ├── utilities
│   ├── vendor
│   ├── all-ie8.scss
│   ├── all.js
│   ├── all.scss
│   ├── common.js
│   └── template.njk
├── README.md
├── govuk-prototype-kit.config.json
└── package.json

See proposal for more detail
https://github.com/alphagov/govuk-design-system-architecture/blob/master/proposals/005-namespace-govuk-frontend-nunjucks-sass-using-a-nested-folder-structure.md
  • Loading branch information
aliuk2012 committed Jun 19, 2019
1 parent 271a0cf commit bed88d5
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 6 deletions.
10 changes: 6 additions & 4 deletions tasks/gulp/__tests__/after-build-package.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,13 +39,15 @@ describe('package/', () => {
'.DS_Store',
'*.test.js',
'*.yaml',
'*.snap'
'*.snap',
'*/govuk/README.md'
]

const additionalFilesNotInSrc = [
'package.json',
'govuk-prototype-kit.config.json',
'**/macro-options.json'
'**/macro-options.json',
'README.md'
]

return recursive(configPaths.src, filesToIgnore).then(
Expand Down Expand Up @@ -92,7 +94,7 @@ describe('package/', () => {

describe('all.scss', () => {
it('should compile without throwing an exception', async () => {
const allScssFile = path.join(configPaths.package, 'all.scss')
const allScssFile = path.join(configPaths.package, 'govuk', 'all.scss')
await renderSass({ file: allScssFile })
})
})
Expand All @@ -101,7 +103,7 @@ describe('package/', () => {
const componentNames = lib.allComponents.slice()

it.each(componentNames)(`'%s' should have macro-options.json that contains JSON`, (name) => {
const filePath = path.join(configPaths.package, 'components', name, 'macro-options.json')
const filePath = path.join(configPaths.package, 'govuk', 'components', name, 'macro-options.json')
return readFile(filePath, 'utf8')
.then((data) => {
var parsedData = JSON.parse(data)
Expand Down
4 changes: 3 additions & 1 deletion tasks/gulp/compile-assets.js
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,8 @@ gulp.task('scss:compile', () => {
gulp.task('js:compile', () => {
// for dist/ folder we only want compiled 'all.js' file
let srcFiles = isDist ? configPaths.src + 'all.js' : configPaths.src + '**/*.js'
let destination = isDist ? taskArguments.destination : taskArguments.destination + '/govuk/'

return gulp.src([
srcFiles,
'!' + configPaths.src + '**/*.test.js'
Expand All @@ -164,5 +166,5 @@ gulp.task('js:compile', () => {
})
))
.pipe(eol())
.pipe(gulp.dest(taskArguments.destination + '/'))
.pipe(gulp.dest(destination))
})
2 changes: 1 addition & 1 deletion tasks/gulp/copy-to-destination.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,5 +60,5 @@ gulp.task('copy-files', () => {
path.extname = '.json'
}))
.pipe(yamlFiles.restore)
.pipe(gulp.dest(taskArguments.destination + '/'))
.pipe(gulp.dest(taskArguments.destination + '/govuk/'))
})

0 comments on commit bed88d5

Please sign in to comment.