-
Notifications
You must be signed in to change notification settings - Fork 331
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Build tasks: Move review app tasks into app/tasks
#3384
Merged
Merged
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
75ff6a3
Always run project npm tasks using npm CLI
colinrotherham 4f755b9
Prevent nodemon restart on component `*.mjs`
colinrotherham 6fbf4d5
Add `task.name()` build function helper
colinrotherham 248db0a
Use `task.name()` instead of Gulp “wrapper” functions
colinrotherham 8b360c4
Move review app tasks into app/tasks
colinrotherham a1407f5
Split review app sub tasks in app/tasks
colinrotherham 924b7ba
Use review app start script for Heroku
colinrotherham a3a964e
Update tasks documentation for `postbuild:*` scripts
colinrotherham 69b3f08
Update tasks documentation for review app
colinrotherham File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
web: npm run heroku | ||
web: npm start --workspace app |
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,16 @@ | ||
import gulp from 'gulp' | ||
|
||
import * as build from './tasks/build/index.mjs' | ||
import { scripts, styles } from './tasks/index.mjs' | ||
|
||
/** | ||
* Build target tasks | ||
*/ | ||
gulp.task('build', build.dist) | ||
gulp.task('dev', build.dev) | ||
|
||
/** | ||
* Utility tasks | ||
*/ | ||
gulp.task('scripts', scripts) | ||
gulp.task('styles', styles) |
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,14 @@ | ||
import { join } from 'path' | ||
|
||
import { paths } from '../../config/index.js' | ||
import { files } from '../../tasks/index.mjs' | ||
|
||
/** | ||
* Copy GOV.UK Frontend static assets | ||
*/ | ||
export async function assets () { | ||
await files.copy('**/*', { | ||
srcPath: join(paths.src, 'govuk/assets'), | ||
destPath: join(paths.app, 'dist/assets') | ||
}) | ||
} |
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,17 @@ | ||
import gulp from 'gulp' | ||
|
||
import { paths } from '../../../config/index.js' | ||
import { npm } from '../../../tasks/index.mjs' | ||
import { watch } from '../index.mjs' | ||
|
||
import dist from './dist.mjs' | ||
|
||
/** | ||
* Dev task | ||
* Runs a sequence of tasks on start | ||
*/ | ||
export default gulp.series( | ||
dist, | ||
watch, | ||
npm.script('serve', paths.app) | ||
) |
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,16 @@ | ||
import gulp from 'gulp' | ||
|
||
import { assets, clean, scripts, styles } from '../index.mjs' | ||
|
||
/** | ||
* Build review app task | ||
* Prepare dist folder for review app | ||
*/ | ||
export default gulp.series( | ||
clean, | ||
gulp.parallel( | ||
assets, | ||
scripts, | ||
styles | ||
) | ||
) |
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,5 @@ | ||
/** | ||
* Build target tasks | ||
*/ | ||
export { default as dev } from './dev.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,13 @@ | ||
import { join } from 'path' | ||
|
||
import { paths } from '../../config/index.js' | ||
import { files } from '../../tasks/index.mjs' | ||
|
||
/** | ||
* Clean task | ||
*/ | ||
export async function clean () { | ||
await files.clean('**/*', { | ||
destPath: join(paths.app, '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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
/** | ||
* Build tasks | ||
*/ | ||
export { assets } from './assets.mjs' | ||
export { clean } from './clean.mjs' | ||
export { compile as scripts } from './scripts.mjs' | ||
export { compile as styles } from './styles.mjs' | ||
export { watch } from './watch.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,26 @@ | ||
import { join } from 'path' | ||
|
||
import gulp from 'gulp' | ||
|
||
import { paths } from '../../config/index.js' | ||
import { npm, scripts, task } from '../../tasks/index.mjs' | ||
|
||
/** | ||
* JavaScripts task (for watch) | ||
* Compilation, documentation | ||
*/ | ||
export const compile = gulp.series( | ||
task.name('compile:js', () => | ||
scripts.compile('all.mjs', { | ||
srcPath: join(paths.src, 'govuk'), | ||
destPath: join(paths.app, 'dist/javascripts'), | ||
|
||
filePath (file) { | ||
return join(file.dir, `${file.name}.min.js`) | ||
} | ||
}) | ||
), | ||
|
||
// Build JSDoc for /docs/javascript | ||
npm.script('build:jsdoc') | ||
) |
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,26 @@ | ||
import { join } from 'path' | ||
|
||
import gulp from 'gulp' | ||
|
||
import { paths } from '../../config/index.js' | ||
import { npm, styles, task } from '../../tasks/index.mjs' | ||
|
||
/** | ||
* Stylesheets task (for watch) | ||
* Compilation, documentation | ||
*/ | ||
export const compile = gulp.series( | ||
task.name('compile:scss', () => | ||
styles.compile('**/[!_]*.scss', { | ||
srcPath: join(paths.app, 'src/stylesheets'), | ||
destPath: join(paths.app, 'dist/stylesheets'), | ||
|
||
filePath (file) { | ||
return join(file.dir, `${file.name}.min.css`) | ||
} | ||
}) | ||
), | ||
|
||
// Build SassDoc for /docs/sass | ||
npm.script('build:sassdoc') | ||
) |
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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nitpick As we're looking at reducing the complexity of our build, I think I'd be keen to avoid that
prestart
step that magically links the build to all ourstart
calls. It also allows to keep the build and the start of the app separate without having to know that you need to reach for--ignore-scripts
(which is a bit arcane).I think it'll only be used on heroku so could we maybe make things explicit in the Procfile with something like
(cd app && run build && npm start)
(or with two--workspace app
on each command).There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would you mind if we kept
npm start
?Keeps things simple
Although perhaps in future should align
start
/dev
?Server start
Development
But for now we have a necessary mismatch with
npm start
at project-level running this:npm run dev --workspace app