Remove coffeescript dependency from website

This commit is contained in:
Blade Barringer
2015-11-11 08:43:36 -06:00
parent 774a42d67e
commit 9408effb4e
6 changed files with 7 additions and 19 deletions

View File

@@ -1,5 +1,3 @@
/* @see ./routes.coffee for routing*/
var url = require('url');
var ipn = require('paypal-ipn');
var _ = require('lodash');
@@ -66,10 +64,6 @@ var findTask = function(req, res) {
---------------
*/
/**
This is called form deprecated.coffee's score function, and the req.headers are setup properly to handle the login
Export it also so we can call it from deprecated.coffee
*/
api.score = function(req, res, next) {
var id = req.params.id,
direction = req.params.direction,
@@ -546,7 +540,7 @@ api.sessionPartyInvite = function(req,res,next){
}
/**
* All other user.ops which can easily be mapped to habitrpg-shared/index.coffee, not requiring custom API-wrapping
* All other user.ops which can easily be mapped to common/script/index.js, not requiring custom API-wrapping
*/
_.each(shared.wrap({}).ops, function(op,k){
if (!api[k]) {

View File

@@ -1,4 +1,3 @@
/* @see ./routes.coffee for routing*/
var _ = require('lodash');
var shared = require('../../../../common');
var nconf = require('nconf');

View File

@@ -2,7 +2,6 @@
// payment plan definitions, instead you have to create it via their REST SDK and keep it updated the same way. So this
// file will be used once for initing your billing plan (then you get the resultant plan.id to store in config.json),
// and once for any time you need to edit the plan thereafter
require('coffee-script');
var path = require('path');
var nconf = require('nconf');
_ = require('lodash');
@@ -90,4 +89,4 @@ switch(OP) {
});
break;
case "remove": break;
}
}

View File

@@ -1,4 +1,3 @@
require('coffee-script');
require('./i18n');
var _ = require('lodash');

View File

@@ -2,13 +2,11 @@
---------- /api/v2 API ------------
see https://github.com/wordnik/swagger-node-express
Every url added to router is prefaced by /api/v2
Note: Many user-route ops exist in ../../common/script/index.coffee#user.ops, so that they can (1) be called both
Note: Many user-route ops exist in ../../common/script/index.js#user.ops, so that they can (1) be called both
client and server.
v1 user. Requires x-api-user (user id) and x-api-key (api key) headers, Test with:
$ mocha test/user.mocha.coffee
*/
require('coffee-script');
var user = require("../../controllers/api-v2/user");
var groups = require("../../controllers/api-v2/groups");
var members = require("../../controllers/api-v2/members");
@@ -295,7 +293,7 @@ module.exports = function(swagger, v2) {
spec: {
method: 'POST',
description: "Casts a spell on a target.",
parameters: [path('spell', "The key of the spell to cast (see ../../common#content/index.coffee)", 'string'), query('targetType', "The type of object you're targeting", 'string', ['party', 'self', 'user', 'task']), query('targetId', "The ID of the object you're targeting", 'string')]
parameters: [path('spell', "The key of the spell to cast (see ../../common#content/index.js)", 'string'), query('targetType', "The type of object you're targeting", 'string', ['party', 'self', 'user', 'task']), query('targetId', "The ID of the object you're targeting", 'string')]
},
action: user.cast
},
@@ -772,6 +770,6 @@ module.exports = function(swagger, v2) {
swagger["add" + route.spec.method](route);
return true;
});
return swagger.configure((nconf.get('BASE_URL')) + "/api/v2", "2");
};

View File

@@ -20,7 +20,6 @@ if (cores!==0 && cluster.isMaster && (isDev || isProd)) {
});
} else {
require('coffee-script'); // remove this once we've fully converted over
var express = require("express");
var http = require("http");
var path = require("path");
@@ -100,7 +99,7 @@ if (cores!==0 && cluster.isMaster && (isDev || isProd)) {
// Route requests to the right app
app.use(app.router);
// Matches all request except the ones going to /api/v3/**
app.all(/^(?!\/api\/v3).+/i, oldApp);
app.all(/^(?!\/api\/v3).+/i, oldApp);
// Matches all requests going to /api/v3
app.all('/api/v3', newApp);
@@ -159,4 +158,4 @@ if (cores!==0 && cluster.isMaster && (isDev || isProd)) {
});
module.exports = server;
}
}