Skip to content

Commit

Permalink
group and alphabetise requires in server.js
Browse files Browse the repository at this point in the history
  • Loading branch information
joelanman committed Oct 18, 2017
1 parent 535fcee commit bbe15e8
Show file tree
Hide file tree
Showing 12 changed files with 74 additions and 54 deletions.
4 changes: 2 additions & 2 deletions app/routes.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
var express = require('express')
var router = express.Router()
const express = require('express')
const router = express.Router()

// Route index page
router.get('/', function (req, res) {
Expand Down
17 changes: 11 additions & 6 deletions docs/documentation_routes.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,14 @@
var express = require('express')
var fs = require('fs')
var marked = require('marked')
var path = require('path')
var router = express.Router()
var utils = require('../lib/utils.js')
// built in modules
const fs = require('fs')
const path = require('path')

// other modules
const express = require('express')
const marked = require('marked')
const router = express.Router()

// prototype kit code
const utils = require('../lib/utils.js')

// Page routes

Expand Down
7 changes: 4 additions & 3 deletions gulp/clean.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,11 @@
- public
- govuk_modules
*/
var config = require('./config.json')

var gulp = require('gulp')
var clean = require('gulp-clean')
const gulp = require('gulp')
const clean = require('gulp-clean')

const config = require('./config.json')

gulp.task('clean', function () {
return gulp.src([config.paths.public + '/*',
Expand Down
4 changes: 2 additions & 2 deletions gulp/copy-assets.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
copies images and javascript folders to public
*/

var gulp = require('gulp')
var config = require('./config.json')
const gulp = require('gulp')
const config = require('./config.json')

gulp.task('copy-assets', function () {
return gulp.src(['!' + config.paths.assets + 'sass{,/**/*}',
Expand Down
4 changes: 2 additions & 2 deletions gulp/copy-modules.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
copies files for node_modules into govuk_modules
*/

var gulp = require('gulp')
var config = require('./config.json')
const gulp = require('gulp')
const config = require('./config.json')

gulp.task('copy-toolkit', function () {
return gulp.src(['node_modules/govuk_frontend_toolkit/**'])
Expand Down
12 changes: 7 additions & 5 deletions gulp/nodemon.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,13 @@
uses nodemon to run a server, watches for javascript and json changes
*/

var fs = require('fs')
var path = require('path')
var gulp = require('gulp')
var nodemon = require('gulp-nodemon')
var config = require('./config.json')
const fs = require('fs')
const path = require('path')

const gulp = require('gulp')
const nodemon = require('gulp-nodemon')

const config = require('./config.json')

gulp.task('server', function () {
nodemon({
Expand Down
8 changes: 4 additions & 4 deletions gulp/sass.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@
also includes sourcemaps
*/

var gulp = require('gulp')
var sass = require('gulp-sass')
var sourcemaps = require('gulp-sourcemaps')
const gulp = require('gulp')
const sass = require('gulp-sass')
const sourcemaps = require('gulp-sourcemaps')

var config = require('./config.json')
const config = require('./config.json')

gulp.task('sass', function () {
return gulp.src(config.paths.assets + '/sass/*.scss')
Expand Down
6 changes: 3 additions & 3 deletions gulp/tasks.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
defaults wraps generate-assets, watch and server
*/

var gulp = require('gulp')
var mocha = require('gulp-mocha')
var runSequence = require('run-sequence')
const gulp = require('gulp')
const mocha = require('gulp-mocha')
const runSequence = require('run-sequence')

gulp.task('default', function (done) {
runSequence('generate-assets',
Expand Down
4 changes: 2 additions & 2 deletions gulp/watch.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
watches sass/js/images
*/

var gulp = require('gulp')
var config = require('./config.json')
const gulp = require('gulp')
const config = require('./config.json')

gulp.task('watch-sass', function () {
return gulp.watch(config.paths.assets + 'sass/**', {cwd: './'}, ['sass'])
Expand Down
2 changes: 1 addition & 1 deletion gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
tasks to run when you run `gulp`.
*/

var requireDir = require('require-dir')
const requireDir = require('require-dir')

// Require all tasks in gulp/tasks, including subfolders
requireDir('./gulp', {recurse: true})
21 changes: 13 additions & 8 deletions lib/utils.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,16 @@
var basicAuth = require('basic-auth')
var config = require('../app/config.js')
var fs = require('fs')
var marked = require('marked')
var path = require('path')
var portScanner = require('portscanner')
var prompt = require('prompt')
var request = require('sync-request')
// built in modules
const fs = require('fs')

// other modules
const basicAuth = require('basic-auth')
const marked = require('marked')
const path = require('path')
const portScanner = require('portscanner')
const prompt = require('prompt')
const request = require('sync-request')

// prototype kit code
const config = require('../app/config.js')

// Variables
var releaseUrl = null
Expand Down
39 changes: 23 additions & 16 deletions server.js
Original file line number Diff line number Diff line change
@@ -1,19 +1,26 @@
require('dotenv').config()
var crypto = require('crypto')
var path = require('path')
var express = require('express')
var session = require('express-session')
var nunjucks = require('nunjucks')
var routes = require('./app/routes.js')
var documentationRoutes = require('./docs/documentation_routes.js')
var favicon = require('serve-favicon')
var app = express()
var documentationApp = express()
var bodyParser = require('body-parser')
var browserSync = require('browser-sync')
var config = require('./app/config.js')
var utils = require('./lib/utils.js')
var packageJson = require('./package.json')
// built in modules
const crypto = require('crypto')
const path = require('path')

// other modules
const bodyParser = require('body-parser')
const browserSync = require('browser-sync')
const dotenv = require('dotenv')
const express = require('express')
const favicon = require('serve-favicon')
const nunjucks = require('nunjucks')
const session = require('express-session')

// prototype kit code
const config = require('./app/config.js')
const documentationRoutes = require('./docs/documentation_routes.js')
const packageJson = require('./package.json')
const routes = require('./app/routes.js')
const utils = require('./lib/utils.js')

const app = express()
const documentationApp = express()
dotenv.config()

// Grab environment variables specified in Procfile or as Heroku config vars
var releaseVersion = packageJson.version
Expand Down

0 comments on commit bbe15e8

Please sign in to comment.