Skip to content
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

Add instructions if you run npm start #411

Merged
merged 4 commits into from
Dec 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions app.js
Original file line number Diff line number Diff line change
Expand Up @@ -211,4 +211,16 @@ app.use((err, req, res) => {
// Run the application
app.listen(port);

if (
process.env.WATCH !== 'true' // If the user isn’t running watch
&& process.env.NODE_ENV !== 'production' // and it’s not in production mode
) {
/* eslint-disable no-console */
console.info(`Running at http://localhost:${port}/`);
console.info('');
console.warn('Warning: It looks like you may have run the command `npm start` locally.');
console.warn('Press `Ctrl+C` and then run `npm run watch` instead');
/* eslint-enable no-console */
}

module.exports = app;
8 changes: 7 additions & 1 deletion gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -109,13 +109,19 @@ function watch() {
gulp.watch('app/assets/**/**/*.*', compileAssets);
}

function setWatchEnv(done) {
process.env.WATCH = 'true';
done();
}

exports.watch = watch;
exports.compileStyles = compileStyles;
exports.compileScripts = compileScripts;
exports.cleanPublic = cleanPublic;
exports.setWatchEnv = setWatchEnv;

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