Skip to content

Commit

Permalink
Merge pull request #329 from nhsuk/error-logging
Browse files Browse the repository at this point in the history
Enable nodemon error logging
  • Loading branch information
Fenwick17 committed Jul 12, 2024
2 parents 6b2e16f + 2316585 commit 5b65647
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 37 deletions.
8 changes: 7 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# NHS.UK prototype kit Changelog

## 4.12.0 - Unreleased

:wrench:

- Enable console logging for nodemon

## 4.11.0 - 27 June 2024

:wrench: **Fixes**
Expand All @@ -21,7 +27,7 @@

- Add aria-labels to coronavirus hub page and mental health pagenavigation links
- Removed the duplicate selector in '\_related-nav.scss'
- Removed Covid banner from 'Social care and support guide' and 'NHS Services' templates
- Removed Covid banner from 'Social care and support guide' and 'NHS Services' templates
- Use 'String#startsWith' method instead of getting the index of a substring in utils.js
- Change unexpected var for const in gulpfile.js
- Update 'Social care and support guide' template to use primary cards with chevrons
Expand Down
74 changes: 38 additions & 36 deletions gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,54 +16,50 @@ const port = process.env.PORT || config.port;

// Delete all the files in /public build directory
function cleanPublic() {
return gulp.src('public', { allowEmpty: true})
.pipe(clean());
return gulp.src('public', { allowEmpty: true }).pipe(clean());
}

sass.compiler = require('sass');

// Compile SASS to CSS
function compileStyles() {
return gulp.src([
'app/assets/sass/**/*.scss',
'docs/assets/sass/**/*.scss'
])
return gulp
.src(['app/assets/sass/**/*.scss', 'docs/assets/sass/**/*.scss'])
.pipe(sass())
.pipe(gulp.dest('public/css'))
.on('error', (err) => {
console.log(err)
process.exit(1)
console.log(err);
process.exit(1);
});
}

// Compile JavaScript (with ES6 support)
function compileScripts() {
return gulp.src([
'app/assets/javascript/**/*.js',
'docs/assets/javascript/**/*.js'
])
.pipe(babel())
.pipe(gulp.dest('public/js'));
return gulp
.src(['app/assets/javascript/**/*.js', 'docs/assets/javascript/**/*.js'])
.pipe(babel())
.pipe(gulp.dest('public/js'));
}

// Compile assets
function compileAssets() {
return gulp.src([
'app/assets/**/**/*.*',
'docs/assets/**/**/*.*',
'!**/assets/**/**/*.js', // Don't copy JS files
'!**/assets/**/**/*.scss', // Don't copy SCSS files
])
.pipe(gulp.dest('public'));
return gulp
.src([
'app/assets/**/**/*.*',
'docs/assets/**/**/*.*',
'!**/assets/**/**/*.js', // Don't copy JS files
'!**/assets/**/**/*.scss', // Don't copy SCSS files
])
.pipe(gulp.dest('public'));
}

// Start nodemon
function startNodemon(done) {
const server = nodemon({
script: 'app.js',
stdout: false,
stdout: true,
ext: 'js',
quiet: true,
quiet: false,
});
let starting = false;

Expand All @@ -90,18 +86,21 @@ function reload() {
}

// Start browsersync
function startBrowserSync(done){
browserSync.init({
proxy: 'localhost:' + port,
port: port + 1000,
ui: false,
files: ['app/views/**/*.*', 'docs/views/**/*.*'],
ghostmode: false,
open: false,
notify: true,
watch: true,
}, done);
gulp.watch("public/**/*.*").on("change", reload);
function startBrowserSync(done) {
browserSync.init(
{
proxy: 'localhost:' + port,
port: port + 1000,
ui: false,
files: ['app/views/**/*.*', 'docs/views/**/*.*'],
ghostmode: false,
open: false,
notify: true,
watch: true,
},
done
);
gulp.watch('public/**/*.*').on('change', reload);
}

// Watch for changes within assets/
Expand All @@ -119,5 +118,8 @@ exports.compileStyles = compileStyles;
exports.compileScripts = compileScripts;
exports.cleanPublic = cleanPublic;

gulp.task('build', gulp.series(cleanPublic, compileStyles, compileScripts, compileAssets));
gulp.task(
'build',
gulp.series(cleanPublic, compileStyles, compileScripts, compileAssets)
);
gulp.task('default', gulp.series(startNodemon, startBrowserSync, watch));

0 comments on commit 5b65647

Please sign in to comment.