-
Notifications
You must be signed in to change notification settings - Fork 331
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
7191c8f
commit 1822d0f
Showing
9 changed files
with
182 additions
and
139 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,53 @@ | ||
import { join } from 'path' | ||
|
||
import gulp from 'gulp' | ||
|
||
import { paths, pkg } from '../../config/index.js' | ||
import { clean } from '../clean.mjs' | ||
import { compileJavaScripts } from '../compile-javascripts.mjs' | ||
import { compileStylesheets } from '../compile-stylesheets.mjs' | ||
import { version } from '../file.mjs' | ||
import { copyAssets } from '../gulp/copy-to-destination.mjs' | ||
|
||
/** | ||
* Build dist task | ||
* Prepare dist folder for release | ||
* | ||
* @returns {() => import('gulp').TaskFunction} Task function | ||
*/ | ||
export default () => gulp.series( | ||
clean('**/*', { | ||
destPath: paths.dist | ||
}), | ||
|
||
// Copy GOV.UK Frontend static assets | ||
copyAssets('*/**', { | ||
srcPath: join(paths.src, 'govuk/assets'), | ||
destPath: join(paths.dist, 'assets') | ||
}), | ||
|
||
// Compile GOV.UK Frontend JavaScript | ||
compileJavaScripts('all.mjs', { | ||
srcPath: join(paths.src, 'govuk'), | ||
destPath: paths.dist, | ||
|
||
filePath (file) { | ||
return join(file.dir, `${file.name.replace(/^all/, pkg.name)}-${pkg.version}.min.js`) | ||
} | ||
}), | ||
|
||
// Compile GOV.UK Frontend Sass | ||
compileStylesheets('[!_]*.scss', { | ||
srcPath: join(paths.src, 'govuk'), | ||
destPath: paths.dist, | ||
|
||
filePath (file) { | ||
return join(file.dir, `${file.name.replace(/^all/, pkg.name)}-${pkg.version}.min.css`) | ||
} | ||
}), | ||
|
||
// Update GOV.UK Frontend version | ||
version('VERSION.txt', { | ||
destPath: paths.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
/** | ||
* Build target tasks | ||
*/ | ||
export { default as public } from './public.mjs' | ||
export { default as package } from './package.mjs' | ||
export { default as dist } from './dist.mjs' |
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,78 @@ | ||
import { join } from 'path' | ||
|
||
import gulp from 'gulp' | ||
|
||
import { paths } from '../../config/index.js' | ||
import { clean } from '../clean.mjs' | ||
import { compileConfig } from '../compile-configs.mjs' | ||
import { compileJavaScripts } from '../compile-javascripts.mjs' | ||
import { compileStylesheets } from '../compile-stylesheets.mjs' | ||
import { copyAssets, copyFiles } from '../gulp/copy-to-destination.mjs' | ||
|
||
/** | ||
* Build package task | ||
* Prepare package folder for publishing | ||
* | ||
* @returns {() => import('gulp').TaskFunction} Task function | ||
*/ | ||
export default () => gulp.series( | ||
clean('**/*', { | ||
destPath: paths.package, | ||
ignore: [ | ||
'**/package.json', | ||
'**/README.md' | ||
] | ||
}), | ||
|
||
// Copy GOV.UK Frontend files | ||
copyFiles({ | ||
srcPath: paths.src, | ||
destPath: paths.package | ||
}), | ||
|
||
// Copy GOV.UK Frontend JavaScript (ES modules) | ||
copyAssets('**/!(*.test).mjs', { | ||
srcPath: join(paths.src, 'govuk'), | ||
destPath: join(paths.package, 'govuk-esm') | ||
}), | ||
|
||
// Compile GOV.UK Frontend JavaScript (AMD modules) | ||
compileJavaScripts('**/!(*.test).mjs', { | ||
srcPath: join(paths.src, 'govuk'), | ||
destPath: join(paths.package, 'govuk'), | ||
|
||
filePath (file) { | ||
return join(file.dir, `${file.name}.js`) | ||
} | ||
}), | ||
|
||
// Apply CSS prefixes to GOV.UK Frontend Sass | ||
compileStylesheets('**/*.scss', { | ||
srcPath: join(paths.src, 'govuk'), | ||
destPath: join(paths.package, 'govuk'), | ||
|
||
filePath (file) { | ||
return join(file.dir, `${file.name}.scss`) | ||
} | ||
}), | ||
|
||
// Apply CSS prefixes to GOV.UK Prototype Kit Sass | ||
compileStylesheets('init.scss', { | ||
srcPath: join(paths.src, 'govuk-prototype-kit'), | ||
destPath: join(paths.package, 'govuk-prototype-kit'), | ||
|
||
filePath (file) { | ||
return join(file.dir, `${file.name}.scss`) | ||
} | ||
}), | ||
|
||
// Compile GOV.UK Prototype Kit config | ||
compileConfig('govuk-prototype-kit.config.mjs', { | ||
srcPath: join(paths.src, 'govuk-prototype-kit'), | ||
destPath: paths.package, | ||
|
||
filePath (file) { | ||
return join(file.dir, `${file.name}.json`) | ||
} | ||
}) | ||
) |
8 changes: 4 additions & 4 deletions
8
...lp/__tests__/after-build-package.test.mjs → tasks/build/package.test.mjs
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,28 @@ | ||
import { join } from 'path' | ||
|
||
import gulp from 'gulp' | ||
|
||
import { paths } from '../../config/index.js' | ||
import { clean } from '../clean.mjs' | ||
import { copyAssets } from '../gulp/copy-to-destination.mjs' | ||
|
||
/** | ||
* Build public task | ||
* Prepare public folder for review app | ||
* | ||
* @returns {() => import('gulp').TaskFunction} Task function | ||
*/ | ||
export default () => gulp.series( | ||
clean('**/*', { | ||
destPath: paths.public | ||
}), | ||
|
||
// Copy GOV.UK Frontend static assets | ||
copyAssets('**/*', { | ||
srcPath: join(paths.src, 'govuk/assets'), | ||
destPath: join(paths.public, 'assets') | ||
}), | ||
|
||
'scripts', | ||
'styles' | ||
) |