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 2 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
8 changes: 8 additions & 0 deletions app.js
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,14 @@ app.use((err, req, res) => {
res.send(err.message);
});

if (
process.env.WATCH !== 'true' // If the user isn’t running watch
&& process.env.NODE_ENV !== 'production' // and it’s not in production mode
) {
console.info(`Running at http://localhost:${port}/`); // eslint-disable-line no-console
console.warn('\x1b[36m \nIf you are working on this prototype now, press Control-c to stop the server and \ntype \x1b[34mnpm run watch\x1b[36m instead to run the prototype in development mode.\x1b[0m'); // eslint-disable-line no-console
}

// Run the application
app.listen(port);

Expand Down
8 changes: 7 additions & 1 deletion gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -113,13 +113,19 @@ function watch() {
gulp.watch('docs/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));