Add babel task and move to src directory

This commit is contained in:
Blade Barringer
2015-09-17 17:40:59 -05:00
parent 993b568ad8
commit 85a16b62e5
13 changed files with 31 additions and 10 deletions

2
.gitignore vendored
View File

@@ -26,6 +26,6 @@ website/public/docs
*.sublime-workspace
coverage
coverage.html
common/dist/scripts/habitrpg-shared.js
common/dist/scripts/*
test/spec/mocks/translations.js

View File

@@ -2,7 +2,11 @@ api = module.exports
_ = require 'lodash'
moment = require 'moment'
t = require './helpers/translator'
DIST_LOCATION = '../../dist/scripts/content'
t = require "#{DIST_LOCATION}/helpers/translator"
require('babel/register')
@@ -16,9 +20,9 @@ require('babel/register')
classes = ['warrior', 'rogue', 'healer', 'wizard']
gearTypes = [ 'weapon', 'armor', 'head', 'shield', 'body', 'back', 'headAccessory', 'eyewear']
events = require('./events')
events = require("#{DIST_LOCATION}/events")
api.mystery = require('./mystery-sets')
api.mystery = require("#{DIST_LOCATION}/mystery-sets")
api.itemList =
'weapon': {localeKey: 'weapon', isEquipment: true}
@@ -547,9 +551,9 @@ api.classes = classes
api.gearTypes = gearTypes
api.spells = require('./spells/index')
api.spells = require("#{DIST_LOCATION}/spells/index")
api.cardTypes = require('./card-types')
api.cardTypes = require("#{DIST_LOCATION}/card-types")
# Intercept all spells to reduce user.stats.mp after casting the spell
_.each api.spells, (spellClass) ->
@@ -569,7 +573,7 @@ api.special = api.spells.special
---------------------------------------------------------------
###
eggs = require('./eggs/index')
eggs = require("#{DIST_LOCATION}/eggs/index")
api.dropEggs = eggs.dropEggs
@@ -628,7 +632,7 @@ api.specialMounts =
'Orca-Base': 'orca'
'Gryphon-RoyalPurple': 'royalPurpleGryphon'
api.timeTravelStable = require('./time-traveler-stable')
api.timeTravelStable = require("#{DIST_LOCATION}/time-traveler-stable")
api.hatchingPotions =
Base: value: 2, text: t('hatchingPotionBase')
@@ -1794,4 +1798,4 @@ api.userDefaults =
{name: t('defaultTag3')}
]
api.faq = require './faq'
api.faq = require "#{DIST_LOCATION}/faq"

View File

@@ -1,7 +1,7 @@
'use strict';
require('coffee-script');
var i18n = require('../../i18n.coffee');
var i18n = require(__dirname + '/../../../../script/i18n.coffee');
var t = function(string, vars) {
var func = function(lang) {

View File

@@ -100,6 +100,7 @@
"deep-diff": "~0.1.4",
"event-stream": "^3.2.2",
"expect.js": "~0.2.0",
"gulp-babel": "^5.2.1",
"istanbul": "^0.3.14",
"karma": "~0.10.2",
"karma-chai-plugins": "~0.1.0",

16
tasks/gulp-babelify.js Normal file
View File

@@ -0,0 +1,16 @@
import gulp from 'gulp';
import babel from 'gulp-babel';
const ES2015_SOURCE = 'common/script/src/**/*.js';
const ES2015_DIST = 'common/dist/scripts/';
gulp.task('babel:common', () => {
return gulp.src(ES2015_SOURCE)
.pipe(babel())
.pipe(gulp.dest(ES2015_DIST));
});
gulp.task('babel:common:watch', () => {
gulp.watch([ES2015_SOURCE], ['babel:common']);
});