Skip to content

Commit

Permalink
Rewrite amd modules into es2015 modules
Browse files Browse the repository at this point in the history
Add babel as webpack loader with custom plugins:
  Presets aren't needed right now and plugins can be added on demand
  Newer NW.js versions run most es2015 stuff natively anyway

Keep indentation of all modules for better git diffs

TODO:

- Use named exports
- Rewrite more stuff into es2015
- Include babel-plugin-transform-runtime
  • Loading branch information
bastimeyer committed Aug 24, 2016
1 parent 681b4a0 commit fb60c22
Show file tree
Hide file tree
Showing 263 changed files with 1,742 additions and 3,033 deletions.
17 changes: 17 additions & 0 deletions build/tasks/configs/webpack.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
var PATH = require( "path" );
var OS = require( "os" );
var webpack = require( "webpack" );
var SplitByPathPlugin = require( "webpack-split-by-path" );
var HtmlWebpackPlugin = require( "html-webpack-plugin" );
Expand Down Expand Up @@ -96,6 +97,22 @@ module.exports = {

module: {
loaders: [
{
test: /\.js$/,
exclude: [
pModulesNpm,
pModulesBower
],
loader: "babel",
query: {
presets: [],
plugins: [
"babel-plugin-transform-es2015-modules-commonjs",
"babel-plugin-transform-es2015-shorthand-properties"
],
cacheDirectory: r( OS.tmpdir(), "babel-cache" )
}
},
{
test: /\.hbs$/,
loader: "hbs-loader"
Expand Down
4 changes: 4 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,10 @@
"html-webpack-plugin": "2.22.0",
"copy-webpack-plugin": "3.0.1",
"extract-text-webpack-plugin": "1.0.1",
"babel-loader": "6.2.5",
"babel-core": "6.13.2",
"babel-plugin-transform-es2015-modules-commonjs": "6.11.5",
"babel-plugin-transform-es2015-shorthand-properties": "6.8.0",
"json-loader": "0.5.4",
"raw-loader": "0.5.1",
"file-loader": "0.9.0",
Expand Down
1 change: 1 addition & 0 deletions src/.jshintrc
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
"browser" : true,
"node" : true,
"devel" : false,
"esnext" : true,

"curly" : true,
"eqeqeq" : true,
Expand Down
785 changes: 517 additions & 268 deletions src/app/app.js

Large diffs are not rendered by default.

27 changes: 7 additions & 20 deletions src/app/components/ApplicationComponent.js
Original file line number Diff line number Diff line change
@@ -1,20 +1,9 @@
define([
"Ember",
"config",
"nwjs/nwGui",
"nwjs/nwWindow",
"utils/node/platform",
"gui/selectable",
"gui/smoothscroll"
], function(
Ember,
config,
nwGui,
nwWindow,
platform,
guiSelectable,
guiSmoothscroll
) {
import Ember from "Ember";
import config from "config";
import platform from "utils/node/platform";
import guiSelectable from "gui/selectable";
import guiSmoothscroll from "gui/smoothscroll";


var get = Ember.get;
var getOwner = Ember.getOwner;
Expand All @@ -36,7 +25,7 @@ define([
}


return Ember.Component.extend({
export default Ember.Component.extend({
settings: Ember.inject.service(),

tagName: "body",
Expand Down Expand Up @@ -82,5 +71,3 @@ define([
setupRefresh( controller );
}
});

});
14 changes: 4 additions & 10 deletions src/app/components/FlagIconComponent.js
Original file line number Diff line number Diff line change
@@ -1,17 +1,13 @@
define([
"Ember",
"config"
], function(
Ember,
config
) {
import Ember from "Ember";
import config from "config";


var get = Ember.get;

var langs = config.langs;


return Ember.Component.extend({
export default Ember.Component.extend({
tagName: "i",
classNames: [ "flag-icon-component" ],
classNameBindings: [ "flag", "withCursor::no-cursor" ],
Expand Down Expand Up @@ -49,5 +45,3 @@ define([
}
}.property( "withTitle", "lang" )
});

});
14 changes: 4 additions & 10 deletions src/app/components/LangFilterComponent.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,11 @@
define([
"Ember",
"templates/components/LangFilterComponent.hbs"
], function(
Ember,
layout
) {
import Ember from "Ember";
import layout from "templates/components/LangFilterComponent.hbs";


var get = Ember.get;


return Ember.Component.extend({
export default Ember.Component.extend({
layout: layout,
tagName: "li",

Expand All @@ -23,5 +19,3 @@ define([
binding.connect( this );
}
});

});
14 changes: 4 additions & 10 deletions src/app/components/LoadingSpinnerComponent.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,8 @@
define([
"Ember",
"templates/components/LoadingSpinnerComponent.hbs"
], function(
Ember,
layout
) {
import Ember from "Ember";
import layout from "templates/components/LoadingSpinnerComponent.hbs";

return Ember.Component.extend({

export default Ember.Component.extend({
layout: layout,

tagName: "svg",
Expand All @@ -22,5 +18,3 @@ define([
circle.setAttribute( "r", radius + "%" );
}.on( "didInsertElement" )
});

});
14 changes: 4 additions & 10 deletions src/app/components/PreviewImageComponent.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,11 @@
define([
"Ember",
"templates/components/PreviewImageComponent.hbs"
], function(
Ember,
layout
) {
import Ember from "Ember";
import layout from "templates/components/PreviewImageComponent.hbs";


var set = Ember.set;


return Ember.Component.extend({
export default Ember.Component.extend({
layout: layout,

classNames: [],
Expand Down Expand Up @@ -37,5 +33,3 @@ define([
img.addEventListener( "load", onLoad, false );
}.on( "willInsertElement" )
});

});
20 changes: 6 additions & 14 deletions src/app/components/SearchBarComponent.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,8 @@
define([
"Ember",
"config",
"utils/getStreamFromUrl",
"templates/components/SearchBarComponent.hbs"
], function(
Ember,
config,
getStreamFromUrl,
layout
) {
import Ember from "Ember";
import config from "config";
import getStreamFromUrl from "utils/getStreamFromUrl";
import layout from "templates/components/SearchBarComponent.hbs" ;


var get = Ember.get;
var set = Ember.set;
Expand All @@ -17,7 +11,7 @@ define([
var searchHistorySize = config.vars[ "search-history-size" ];


return Ember.Component.extend({
export default Ember.Component.extend({
store : Ember.inject.service(),

layout: layout,
Expand Down Expand Up @@ -171,5 +165,3 @@ define([
}
}
});

});
19 changes: 6 additions & 13 deletions src/app/components/SelectableTextComponent.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,9 @@
define([
"Ember",
"nwjs/menu",
"nwjs/clipboard"
], function(
Ember,
Menu,
clipboard
) {

return Ember.Component.extend({
import Ember from "Ember";
import Menu from "nwjs/menu";
import clipboard from "nwjs/clipboard";


export default Ember.Component.extend({
tagName: "div",

classNameBindings: [ "class" ],
Expand Down Expand Up @@ -37,5 +32,3 @@ define([
menu.popup( event );
}
});

});
14 changes: 4 additions & 10 deletions src/app/components/SettingsRowComponent.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
define([
"Ember",
"templates/components/SettingsRowComponent.hbs"
], function(
Ember,
layout
) {
import Ember from "Ember";
import layout from "templates/components/SettingsRowComponent.hbs";


var get = Ember.get;

Expand All @@ -31,7 +27,7 @@ define([
}


return Ember.Component.extend({
export default Ember.Component.extend({
layout: layout,
classNames: [ "settings-row-component" ],

Expand All @@ -48,5 +44,3 @@ define([
}).reopenClass({
positionalParams: [ "title", "description" ]
});

});
14 changes: 4 additions & 10 deletions src/app/components/SettingsSubmitComponent.js
Original file line number Diff line number Diff line change
@@ -1,18 +1,14 @@
define([
"Ember",
"templates/components/SettingsSubmitComponent.hbs"
], function(
Ember,
layout
) {
import Ember from "Ember";
import layout from "templates/components/SettingsSubmitComponent.hbs";


var get = Ember.get;
var set = Ember.set;
var cancel = Ember.run.cancel;
var later = Ember.run.later;


return Ember.Component.extend({
export default Ember.Component.extend({
layout: layout,

classNames: [ "settings-submit-component" ],
Expand Down Expand Up @@ -63,5 +59,3 @@ define([
}
}.on( "willDestroyElement" )
});

});
17 changes: 5 additions & 12 deletions src/app/components/button/FollowChannelComponent.js
Original file line number Diff line number Diff line change
@@ -1,17 +1,12 @@
define([
"Ember",
"components/button/FormButtonComponent",
"mixins/FollowButtonMixin"
], function(
Ember,
FormButtonComponent,
FollowButtonMixin
) {
import Ember from "Ember";
import FormButtonComponent from "components/button/FormButtonComponent";
import FollowButtonMixin from "mixins/FollowButtonMixin";


var alias = Ember.computed.alias;


return FormButtonComponent.extend( FollowButtonMixin, {
export default FormButtonComponent.extend( FollowButtonMixin, {
modelName: "twitchUserFollowsChannel",

// model alias (component attribute)
Expand All @@ -21,5 +16,3 @@ define([
// use the channel's display_name
name : alias( "channel.display_name" )
});

});
17 changes: 5 additions & 12 deletions src/app/components/button/FollowGameComponent.js
Original file line number Diff line number Diff line change
@@ -1,23 +1,16 @@
define([
"Ember",
"components/button/FormButtonComponent",
"mixins/FollowButtonMixin"
], function(
Ember,
FormButtonComponent,
FollowButtonMixin
) {
import Ember from "Ember";
import FormButtonComponent from "components/button/FormButtonComponent";
import FollowButtonMixin from "mixins/FollowButtonMixin";


var alias = Ember.computed.alias;


return FormButtonComponent.extend( FollowButtonMixin, {
export default FormButtonComponent.extend( FollowButtonMixin, {
modelName: "twitchUserFollowsGame",

// model alias (component attribute)
model : alias( "game" ),
// model is a string, no game record (just use the game name as ID)
id : alias( "model" )
});

});
14 changes: 4 additions & 10 deletions src/app/components/button/FormButtonComponent.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
define([
"Ember",
"templates/components/button/FormButtonComponent.hbs"
], function(
Ember,
layout
) {
import Ember from "Ember";
import layout from "templates/components/button/FormButtonComponent.hbs";


var get = Ember.get;
var set = Ember.set;
Expand All @@ -29,7 +25,7 @@ define([
}


return Ember.Component.extend({
export default Ember.Component.extend({
layout: layout,

tagName: "",
Expand Down Expand Up @@ -99,5 +95,3 @@ define([
}
}
});

});
Loading

0 comments on commit fb60c22

Please sign in to comment.