Skip to content
This repository was archived by the owner on Dec 5, 2022. It is now read-only.

Commit e9cf6c1

Browse files
committedOct 13, 2017
refactor(misc): add misc updates
* restore orange logo text color * use externals also for lunr dep as we do with jquery * rename main.js to doc.js to be consistent with doc.css * use babel-loader to compile jsx and es6 to es5
1 parent 74a0123 commit e9cf6c1

File tree

10 files changed

+1579
-1182
lines changed

10 files changed

+1579
-1182
lines changed
 

‎LICENSE

+1-1
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ SOFTWARE.
113113
--------------------------------------------------------------------------------
114114

115115
NOTICE for:
116-
- source/scripts/main.js contains the following third-party libraries:
116+
- source/scripts/doc.js contains the following third-party libraries:
117117
- react
118118
- react-dom
119119
- url-join

‎banner.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ const banner = ` /*!
1212

1313
const files = [
1414
'source/style/doc.css',
15-
'source/script/main.js'
15+
'source/script/doc.js',
1616
];
1717

1818
files.forEach(writeBanner(banner));

‎layout/layout.ejs

+1-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
<script src="//cdnjs.cloudflare.com/ajax/libs/lunr.js/2.1.0/lunr.min.js"></script>
3232

3333
<!-- js source -->
34-
<script src="<%- url_for('script/main.js') %>"></script>
34+
<script src="<%- url_for('script/doc.js') %>"></script>
3535

3636
</body>
3737
</html>

‎lib/browser/search/__tests__/load.test.js

+8-6
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,14 @@ const mockSearcher = () => {
99

1010
jest.mock('../../../nodejs/search/searcher', () => mockSearcher);
1111

12+
const mockLunr = {
13+
Index: {
14+
load: (index) => index
15+
}
16+
};
17+
18+
jest.mock('lunr', () => mockLunr);
19+
1220
const mockResponse = () => {
1321
return {
1422
json: () => Promise.resolve({
@@ -22,12 +30,6 @@ const mockFetch = jest.fn().mockReturnValue(Promise.resolve(mockResponse()));
2230

2331
global.fetch = mockFetch;
2432

25-
global.lunr = {
26-
Index: {
27-
load: (index) => index
28-
}
29-
};
30-
3133
describe('browser.search.load', () => {
3234
const load = require('../load');
3335

‎lib/browser/search/load.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* global lunr */
1+
const lunr = require('lunr');
22
const searcher = require('../../nodejs/search/searcher');
33

44
module.exports = function load (url) {

‎package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@
5959
"url-join": "^2.0.2"
6060
},
6161
"devDependencies": {
62+
"babel-loader": "^7.1.2",
6263
"conventional-changelog-cli": "^1.3.3",
6364
"dress-code": "2.1.1",
6465
"enzyme": "2.8.0",
@@ -69,7 +70,6 @@
6970
"hexo-renderer-ejs": "^0.3.0",
7071
"jest": "^20.0.4",
7172
"jest-junit": "^2.1.0",
72-
"jsx-loader": "^0.13.2",
7373
"node-sass": "^4.5.3",
7474
"react-addons-test-utils": "15.4.2",
7575
"webpack": "^3.0.0"

‎source/script/main.js ‎source/script/doc.js

+1,549-1,163
Large diffs are not rendered by default.

‎source/style/_doc/vars.scss

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ $doc-color-darkest: #333;
2121
$doc-navbar-height: 50px;
2222
$doc-navbar-background-color: $doc-color-lightest;
2323
$doc-navbar-border-color: #e1e1e1;
24-
$doc-navbar-logo-text-color: $doc-color-primary;
24+
$doc-navbar-logo-text-color: #ff5d00;
2525
$doc-navbar-width-collapsed: $doc-navbar-height;
2626

2727
// sidebar

‎source/style/doc.css

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎webpack.config.js

+15-6
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,28 @@
11
'use strict';
2-
32
const path = require('path');
43

54
module.exports = {
6-
entry: './lib/browser/index.js',
75
externals: {
8-
jquery: '$'
6+
jquery: '$',
7+
lunr: true,
8+
},
9+
entry: {
10+
'doc': './lib/browser/index.js',
911
},
1012
output: {
11-
path: path.resolve('source/script'),
12-
filename: 'main.js'
13+
path: path.resolve(__dirname, 'source/script'),
14+
filename: '[name].js'
1315
},
1416
module: {
1517
loaders: [
16-
{ test: /\.jsx$/, exclude: /node_modules/, loader: 'jsx-loader' }
18+
{
19+
test: /.jsx?$/,
20+
loader: 'babel-loader',
21+
exclude: /node_modules/,
22+
query: {
23+
presets: ['es2015', 'react']
24+
}
25+
}
1726
]
1827
}
1928
};

0 commit comments

Comments
 (0)
This repository has been archived.