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,126 +4,126 @@
* 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'
}
}
},
// Project configuration.
grunt.initConfig({
forever: {
app: {
options: {
index: "app.js"
}
}
},
execute: {
app: {
src: 'app.js'
}
},
execute: {
app: {
src: "app.js"
}
},
coffee: {
server: {
expand: true,
flatten: false,
cwd: 'app/coffee',
src: ['**/*.coffee'],
dest: 'app/js/',
ext: '.js'
},
coffee: {
server: {
expand: true,
flatten: false,
cwd: 'app/coffee',
src: ['**/*.coffee'],
dest: 'app/js/',
ext: '.js'
},
app_server: {
expand: true,
flatten: false,
src: ['app.coffee'],
dest: './',
ext: '.js'
},
app_server: {
expand: true,
flatten: false,
src: ['app.coffee'],
dest: './',
ext: '.js'
},
unit_tests: {
expand: true,
flatten: false,
cwd: 'test/unit/coffee',
src: ['**/*.coffee'],
dest: 'test/unit/js/',
ext: '.js'
},
unit_tests: {
expand: true,
flatten: false,
cwd: 'test/unit/coffee',
src: ['**/*.coffee'],
dest: 'test/unit/js/',
ext: '.js'
},
acceptance_tests: {
expand: true,
flatten: false,
cwd: 'test/acceptance/coffee',
src: ['**/*.coffee'],
dest: 'test/acceptance/js/',
ext: '.js'
}
},
acceptance_tests: {
expand: true,
flatten: false,
cwd: 'test/acceptance/coffee',
src: ['**/*.coffee'],
dest: 'test/acceptance/js/',
ext: '.js'
}
},
watch: {
server_coffee: {
files: ['app/**/*.coffee', 'test/unit/**/*.coffee'],
tasks: ['compile:server', 'compile:unit_tests', 'mochaTest']
}
},
watch: {
server_coffee: {
files: ['app/**/*.coffee', 'test/unit/**/*.coffee'],
tasks: ['compile:server', 'compile:unit_tests', 'mochaTest']
}
},
clean: ['app/js', 'test/unit/js'],
clean: ["app/js", "test/unit/js"],
nodemon: {
dev: {
options: {
file: 'app.js'
}
}
},
nodemon: {
dev: {
options: {
file: 'app.js'
}
}
},
concurrent: {
dev: {
tasks: ['nodemon', 'watch'],
options: {
logConcurrentOutput: true
}
}
},
concurrent: {
dev: {
tasks: ['nodemon', 'watch'],
options: {
logConcurrentOutput: true
}
}
},
mochaTest: {
unit: {
options: {
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')
},
src: ['test/acceptance/**/*.js']
}
},
mochaTest: {
unit: {
options: {
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")
},
src: ['test/acceptance/**/*.js']
}
},
plato: {
your_task: {
files: { plato: ['app/js/**/*.js'] }
}
}
})
plato: {
your_task: {
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";
Server.server.listen(port, host, function(error) {
if (error != null) { throw error; }
return logger.info(`Chat starting up, listening on ${host}:${port}`);
});
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}`)
})
}
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",
port: 3010
}
},
apis: {
web: {
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`
},
internal: {
chat: {
host: process.env['LISTEN_ADDRESS'] || 'localhost',
port: 3010
}
},
redis: {
web: {
host: process.env['REDIS_HOST'] || "localhost",
port: "6379",
password: ""
}
}
};
apis: {
web: {
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`
},
redis: {
web: {
host: process.env['REDIS_HOST'] || 'localhost',
port: '6379',
password: ''
}
}
}