Skip to content

Commit 5e0e49d

Browse files
authored
Merge pull request binary-com#1480 from binary-hamedanchi/mohammad/webpack
Webpack
2 parents 3a16628 + 7a0794c commit 5e0e49d

File tree

176 files changed

+1709
-10944
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

176 files changed

+1709
-10944
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,5 @@ mojo/log/
88
.idea/
99
binary-static.iml
1010
scripts/local
11+
npm-debug.log
12+
*.swp

.jshintrc

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
"es5": true, // ECMAScript 5
33
"browser": true, // Standard browser globals e.g. `window`, `document`.
44
"sub": true, // Tolerate all forms of subscript notation besides dot notation e.g. `dict['key']` instead of `dict.key`.
5-
"bitwise": true, // true: Prohibit bitwise operators (&, |, ^, etc.)
6-
"immed": false, // true: Require immediate invocations to be wrapped in parens e.g.
5+
"bitwise": true, // true: Prohibit bitwise operators (&, |, ^, etc.)
6+
"immed": false, // true: Require immediate invocations to be wrapped in parens e.g.
77
"latedef": false, // true: Require variables/functions to be defined before being used
88
"newcap": false, // true: Require capitalization of all constructor functions e.g. `new F()`
99
"noarg": true, // true: Prohibit use of `arguments.caller` and `arguments.callee`
@@ -54,7 +54,22 @@
5454
"moment": true,
5555
"pjax_config_page": true,
5656
"page": true,
57-
"text": true
57+
"require": true,
58+
"module": true,
59+
"TUser": true,
60+
"PortfolioWS": true,
61+
"BinarySocket": true,
62+
"Portfolio": true,
63+
"PortfolioWS": true,
64+
"addComma": true,
65+
"addTooltip": true,
66+
"buildOauthApps": true,
67+
"console": true,
68+
"format_money": true,
69+
"japanese_client": true,
70+
"showLoadingImage": true,
71+
"showTooltip": true,
72+
"toJapanTimeIfNeeded": true
5873
}
5974

6075
// TODO: Options to enable later:

build/aliases.yaml

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,9 @@ css:
44
- 'cssmin'
55

66
js:
7+
- 'webpack'
78
- 'concat'
9+
- 'shell:remove_pack'
810
- 'uglify'
911

1012
test:
@@ -34,12 +36,7 @@ serve:
3436
- 'watch'
3537

3638
livereload:
37-
- 'clean'
38-
- 'css'
39-
- 'js'
40-
- 'fileindex'
41-
- 'copy'
42-
- 'shell:compile_dev'
39+
- 'default'
4340
- 'connect:livereload'
4441
- 'watch'
4542

build/concat.js

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -7,19 +7,8 @@ module.exports = {
77
{
88
dest: global.dist + '/js/binary.js',
99
src: [
10-
'src/javascript/lib/jquery.js',
11-
'src/javascript/lib/highstock/highstock.js',
12-
'src/javascript/lib/highstock/highstock-exporting.js',
13-
'src/javascript/lib/moment/moment.js',
14-
'src/javascript/lib/**/*.js',
15-
'src/javascript/autogenerated/idd_codes.js',
16-
'src/javascript/autogenerated/texts.js',
17-
'src/javascript/autogenerated/*.js',
18-
'src/javascript/config.js',
19-
'src/javascript/binary/base/*.js',
20-
'src/javascript/binary/**/*.js',
21-
'src/javascript/binary_japan/**/*.js',
22-
'!src/javascript/binary/**/__tests__/*.js'
10+
global.dist + '/js/binary_pack.js',
11+
'src/javascript/lib/guide.enjoyhint.js',
2312
]
2413
}
2514
]

build/copy.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ module.exports = {
1717
{ expand: true, cwd: 'src/download/', src: ['**'], dest: global.dist + '/download/' },
1818
{ expand: true, cwd: 'src/css/external/jquery-ui-custom-theme/images/', src: ['**'], dest: global.dist + '/css/images' },
1919
{ expand: true, cwd: 'src/css/external/jquery-ui-custom-theme/', src: ['*.css'], dest: global.dist + '/css/' },
20-
{ expand: true, cwd: 'src/javascript/', src: ['**'], dest: global.dist + '/dev/src/javascript/' },
2120
]
2221
}
2322
};

build/fileindex.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ module.exports = {
1212
'src/javascript/lib/highstock/highstock-exporting.js',
1313
'src/javascript/lib/moment/moment.js',
1414
'src/javascript/lib/**/*.js',
15-
'src/javascript/autogenerated/idd_codes.js',
1615
'src/javascript/autogenerated/texts.js',
1716
'src/javascript/autogenerated/*.js',
1817
'src/javascript/binary/base/*.js',
@@ -27,7 +26,6 @@ module.exports = {
2726
'src/javascript/lib/highstock/highstock.js',
2827
'src/javascript/lib/moment/moment.js',
2928
'src/javascript/lib/**/*.js',
30-
'src/javascript/autogenerated/idd_codes.js',
3129
'src/javascript/autogenerated/texts.js',
3230
'src/javascript/autogenerated/*.js',
3331
'src/javascript/binary/base/*.js',

build/mochaTest.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ module.exports = {
33
options: {
44
reporter: 'spec',
55
quiet: false, // Optionally suppress output to standard out (defaults to false)
6-
clearRequireCache: false // Optionally clear the require cache before running tests (defaults to false)
6+
clearRequireCache: false, // Optionally clear the require cache before running tests (defaults to false)
77
},
88
src: ['src/javascript/binary/**/__tests__/*.js']
99
}

build/shell.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
module.exports = function (grunt) {
22
return {
3+
remove_pack: {
4+
command: 'rm ' + global.dist + '/js/binary_pack.js',
5+
options: {
6+
stdout: true
7+
}
8+
},
39
compile_dev: {
410
command: global.compileCommand('-f -d'),
511
options: {
@@ -107,4 +113,4 @@ module.exports = function (grunt) {
107113
}
108114
}
109115
}
110-
};
116+
};

build/webpack.js

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
module.exports = function (grunt) {
2+
return {
3+
all: {
4+
devtool: 'source-map',
5+
entry: {
6+
app: './src/javascript/index.js',
7+
},
8+
output: {
9+
path: global.dist + '/js/',
10+
filename: 'binary_pack.js',
11+
},
12+
}
13+
}
14+
};

package.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
"connect-livereload": "^0.5.4",
3030
"connect-modrewrite": "^0.9.0",
3131
"deep-diff": "^0.3.4",
32+
"event-source-polyfill": "0.0.7",
3233
"grunt": "^0.4.5",
3334
"grunt-bump": "^0.0.16",
3435
"grunt-contrib-clean": "^0.5.0",
@@ -48,12 +49,16 @@
4849
"grunt-shell": "^0.7.0",
4950
"grunt-stylelint": "^0.4.0",
5051
"grunt-uncss": "^0.3.5",
52+
"grunt-webpack": "^1.0.14",
53+
"jquery": "^2.1.1",
5154
"load-grunt-config": "^0.13.1",
5255
"load-grunt-tasks": "^0.6.0",
5356
"mocha": "^2.5.3",
5457
"nightwatch": "^0.5.11",
5558
"postcss-scss": "^0.1.8",
5659
"time-grunt": "^1.0.0",
60+
"webpack": "^1.13.2",
61+
"webpack-dev-server": "^1.15.1",
5762
"ws": "^1.1.0"
5863
}
5964
}

scripts/bin/GenerateStaticData.pm

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,13 @@ sub generate_data_files {
1515

1616
_make_nobody_dir($js_path);
1717
print "\tGenerating $js_path/texts.js\n";
18-
File::Slurp::write_file("$js_path/texts.js", {binmode => ':utf8'}, _texts());
18+
my $exports = <<'END_EXPORTS';
19+
20+
module.exports = {
21+
texts_json: texts_json,
22+
};
23+
END_EXPORTS
24+
File::Slurp::write_file("$js_path/texts.js", {binmode => ':utf8'}, _texts() . $exports);
1925

2026
return;
2127
}

scripts/lib/BS.pm

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -165,26 +165,8 @@ sub js_config {
165165
push @libs, root_url . "js/binary.min.js?$static_hash";
166166
}
167167

168-
my %setting = (
169-
enable_relative_barrier => 'true',
170-
image_link => {
171-
hourglass => url_for('images/common/hourglass_1.gif')->to_string,
172-
up => url_for('images/javascript/up_arrow_1.gif')->to_string,
173-
down => url_for('images/javascript/down_arrow_1.gif')->to_string,
174-
calendar_icon => url_for('images/common/calendar_icon_1.png')->to_string,
175-
livechaticon => url_for('images/pages/contact/chat-icon.svg')->to_string,
176-
},
177-
broker => 'CR',
178-
valid_loginids => 'MX|MF|VRTC|MLT|CR|FOG|VRTJ|JP',
179-
streaming_server => 'www.binary.com',
180-
);
181-
182-
# hardcode, require a fix?
183-
$setting{arr_all_currencies} = ["USD", "EUR", "GBP", "AUD"];
184-
185168
return {
186169
libs => \@libs,
187-
settings => JSON::to_json(\%setting),
188170
};
189171
}
190172

src/javascript/autogenerated/idd_codes.js

Lines changed: 0 additions & 1 deletion
This file was deleted.

src/javascript/autogenerated/texts.js

Lines changed: 4 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)