Prettier: convert individual decaffeinated files to Prettier format

This commit is contained in:
Nate Stemen 2018-12-20 14:14:14 -05:00
parent ee4d9766fd
commit 9f65be5771
3 changed files with 164 additions and 149 deletions

View file

@ -4,20 +4,19 @@
* Full docs: https://github.com/decaffeinate/decaffeinate/blob/master/docs/suggestions.md
*/
module.exports = function(grunt) {
// Project configuration.
grunt.initConfig({
forever: {
app: {
options: {
index: "app.js"
index: 'app.js'
}
}
},
execute: {
app: {
src: "app.js"
src: 'app.js'
}
},
@ -65,7 +64,7 @@ module.exports = function(grunt) {
}
},
clean: ["app/js", "test/unit/js"],
clean: ['app/js', 'test/unit/js'],
nodemon: {
dev: {
@ -87,15 +86,15 @@ module.exports = function(grunt) {
mochaTest: {
unit: {
options: {
reporter: process.env.MOCHA_RUNNER || "spec",
grep: grunt.option("grep")
reporter: process.env.MOCHA_RUNNER || 'spec',
grep: grunt.option('grep')
},
src: ['test/unit/**/*.js']
},
acceptance: {
options: {
reporter: process.env.MOCHA_RUNNER || "spec",
grep: grunt.option("grep")
reporter: process.env.MOCHA_RUNNER || 'spec',
grep: grunt.option('grep')
},
src: ['test/acceptance/**/*.js']
}
@ -103,27 +102,28 @@ module.exports = function(grunt) {
plato: {
your_task: {
files: {'plato': ['app/js/**/*.js']}
files: { plato: ['app/js/**/*.js'] }
}
}
});
})
grunt.loadNpmTasks('grunt-contrib-coffee');
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-nodemon');
grunt.loadNpmTasks('grunt-contrib-clean');
grunt.loadNpmTasks('grunt-concurrent');
grunt.loadNpmTasks('grunt-mocha-test');
grunt.loadNpmTasks('grunt-plato');
grunt.loadNpmTasks('grunt-execute');
grunt.loadNpmTasks('grunt-bunyan');
grunt.loadNpmTasks('grunt-forever');
grunt.registerTask('compile', ['clean', 'coffee']);
grunt.registerTask('install', ['compile']);
grunt.registerTask('default', ['compile', 'bunyan', 'execute']);
grunt.registerTask('test:unit', ['compile', 'mochaTest:unit']);
return grunt.registerTask('test:acceptance', ['compile:acceptance_tests', 'mochaTest:acceptance']);
};
grunt.loadNpmTasks('grunt-contrib-coffee')
grunt.loadNpmTasks('grunt-contrib-watch')
grunt.loadNpmTasks('grunt-nodemon')
grunt.loadNpmTasks('grunt-contrib-clean')
grunt.loadNpmTasks('grunt-concurrent')
grunt.loadNpmTasks('grunt-mocha-test')
grunt.loadNpmTasks('grunt-plato')
grunt.loadNpmTasks('grunt-execute')
grunt.loadNpmTasks('grunt-bunyan')
grunt.loadNpmTasks('grunt-forever')
grunt.registerTask('compile', ['clean', 'coffee'])
grunt.registerTask('install', ['compile'])
grunt.registerTask('default', ['compile', 'bunyan', 'execute'])
grunt.registerTask('test:unit', ['compile', 'mochaTest:unit'])
return grunt.registerTask('test:acceptance', [
'compile:acceptance_tests',
'mochaTest:acceptance'
])
}

View file

@ -5,22 +5,35 @@
* DS207: Consider shorter variations of null checks
* Full docs: https://github.com/decaffeinate/decaffeinate/blob/master/docs/suggestions.md
*/
const logger = require('logger-sharelatex');
const settings = require('settings-sharelatex');
const logger = require('logger-sharelatex')
const settings = require('settings-sharelatex')
const Server = require("./app/js/server");
const Server = require('./app/js/server')
if (!module.parent) { // Called directly
const port = __guard__(settings.internal != null ? settings.internal.chat : undefined, x => x.port) || 3010;
const host = __guard__(settings.internal != null ? settings.internal.chat : undefined, x1 => x1.host) || "localhost";
if (!module.parent) {
// Called directly
const port =
__guard__(
settings.internal != null ? settings.internal.chat : undefined,
x => x.port
) || 3010
const host =
__guard__(
settings.internal != null ? settings.internal.chat : undefined,
x1 => x1.host
) || 'localhost'
Server.server.listen(port, host, function(error) {
if (error != null) { throw error; }
return logger.info(`Chat starting up, listening on ${host}:${port}`);
});
if (error != null) {
throw error
}
return logger.info(`Chat starting up, listening on ${host}:${port}`)
})
}
module.exports = Server.server;
module.exports = Server.server
function __guard__(value, transform) {
return (typeof value !== 'undefined' && value !== null) ? transform(value) : undefined;
return typeof value !== 'undefined' && value !== null
? transform(value)
: undefined
}

View file

@ -1,28 +1,30 @@
module.exports = {
internal: {
chat: {
host: process.env['LISTEN_ADDRESS'] || "localhost",
host: process.env['LISTEN_ADDRESS'] || 'localhost',
port: 3010
}
},
apis: {
web: {
url: `http://${process.env['WEB_HOST'] || "localhost"}:${process.env['WEB_PORT'] || 3000}`,
user: "sharelatex",
pass: "password"
url: `http://${process.env['WEB_HOST'] || 'localhost'}:${process.env[
'WEB_PORT'
] || 3000}`,
user: 'sharelatex',
pass: 'password'
}
},
mongo: {
url : `mongodb://${process.env['MONGO_HOST'] || "localhost"}/sharelatex`
url: `mongodb://${process.env['MONGO_HOST'] || 'localhost'}/sharelatex`
},
redis: {
web: {
host: process.env['REDIS_HOST'] || "localhost",
port: "6379",
password: ""
host: process.env['REDIS_HOST'] || 'localhost',
port: '6379',
password: ''
}
}
}
};