Skip to content

Commit c23f767

Browse files
authored
Merge pull request #62 from back4app/parse-sdk-back4app
Parse sdk back4app
2 parents dd7b577 + f50d496 commit c23f767

File tree

8 files changed

+44
-10
lines changed

8 files changed

+44
-10
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
11
.DS_Store
22
node_modules/
33
bundles/
4+
PIG/index.html
45
PIG/bundles/
6+
production/
7+
Parse-Dashboard/public/index.html
58
Parse-Dashboard/public/bundles/
69
npm-debug.log
710
.eslintcache

PIG/index.html renamed to PIG/index.template.html

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,5 @@
33
<title>PIG Component Explorer</title>
44
<body>
55
<div id="browser_mount"></div>
6-
<script src="/bundles/PIG.bundle.js"></script>
76
</body>
87
</html>

Parse-Dashboard/app.js

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,15 @@ module.exports = function(config, options) {
6060
// wait for app to mount in order to get mountpath
6161
app.on('mount', function() {
6262
const mountPath = getMount(app.mountpath);
63+
let dashboardUrl = '';
64+
let loginUrl = '';
65+
66+
// Reads files from public/bundles folder, looking for dashboard.<hash>.js and login.<hash>.js
67+
fs.readdir(path.join(__dirname, 'public', 'bundles'), function(err, items) {
68+
dashboardUrl = items.filter(file => file.indexOf('dashboard.') === 0)[0] || 'dashboard.bundle.js';
69+
loginUrl = items.filter(file => file.indexOf('login.') === 0)[0] || 'login.bundle.js';
70+
});
71+
6372
const users = config.users;
6473
const useEncryptedPasswords = config.useEncryptedPasswords ? true : false;
6574
const authInstance = new Authentication(users, useEncryptedPasswords, mountPath);
@@ -180,7 +189,6 @@ module.exports = function(config, options) {
180189
res.send(`<!DOCTYPE html>
181190
<head>
182191
<link rel="shortcut icon" type="image/x-icon" href="${mountPath}favicon.ico" />
183-
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-alpha.6/css/bootstrap.min.css" integrity="sha384-rwoIResjU2yc3z8GV/NPeZWAv56rSmLldC3R/AZzGRnGxQQKnKkoFVhFQhNUwEyJ" crossorigin="anonymous">
184192
<base href="${mountPath}"/>
185193
<script>
186194
PARSE_DASHBOARD_PATH = "${mountPath}";
@@ -192,7 +200,7 @@ module.exports = function(config, options) {
192200
<div id="login_mount"></div>
193201
${errors}
194202
<script id="csrf" type="application/json">"${req.csrfToken()}"</script>
195-
<script src="${mountPath}bundles/login.bundle.js"></script>
203+
<script src="${mountPath}bundles/${loginUrl}"></script>
196204
</body>
197205
</html>
198206
`);
@@ -206,7 +214,6 @@ module.exports = function(config, options) {
206214
res.send(`<!DOCTYPE html>
207215
<head>
208216
<link rel="shortcut icon" type="image/x-icon" href="${mountPath}favicon.ico" />
209-
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-alpha.6/css/bootstrap.min.css" integrity="sha384-rwoIResjU2yc3z8GV/NPeZWAv56rSmLldC3R/AZzGRnGxQQKnKkoFVhFQhNUwEyJ" crossorigin="anonymous">
210217
<base href="${mountPath}"/>
211218
<script>
212219
PARSE_DASHBOARD_PATH = "${mountPath}";
@@ -216,7 +223,7 @@ module.exports = function(config, options) {
216223
<title>Parse Dashboard</title>
217224
<body>
218225
<div id="browser_mount"></div>
219-
<script src="${mountPath}bundles/dashboard.bundle.js"></script>
226+
<script src="${mountPath}bundles/${dashboardUrl}"></script>
220227
<script src="https://static.back4app.com/back4app-navigation.bundle.js"></script>
221228
</body>
222229
</html>

Parse-Dashboard/index.html renamed to Parse-Dashboard/index.template.html

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,13 @@
44
<base href="/"/>
55
<script>
66
PARSE_DASHBOARD_PATH = "/";
7-
console.log('hello')
87
</script>
98
<script src="https://static.back4app.com/back4app-navigation.bundle.js"></script>
10-
<!--<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-alpha.6/css/bootstrap.min.css" integrity="sha384-rwoIResjU2yc3z8GV/NPeZWAv56rSmLldC3R/AZzGRnGxQQKnKkoFVhFQhNUwEyJ" crossorigin="anonymous">-->
119
</head>
1210
<html>
1311
<title>Parse Dashboard</title>
1412
<body>
1513
<div id="browser_mount"></div>
16-
<script src="/bundles/dashboard.bundle.js"></script>
1714
<script type="text/javascript">
1815
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
1916
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@
4141
"cookie-session": "^2.0.0-alpha.1",
4242
"csurf": "^1.9.0",
4343
"express": "^4.13.4",
44+
"html-webpack-plugin": "^3.2.0",
4445
"jquery": "^3.2.1",
4546
"json-file-plus": "^3.2.0",
4647
"material-design-iconic-font": "^2.2.0",
@@ -75,7 +76,7 @@
7576
"js-beautify": "~1.6.14",
7677
"marked": "^0.3.5",
7778
"node-sass": "^4.5.3",
78-
"parse": "1.9.2",
79+
"parse": "git+https://github.com/back4app/Parse-SDK-JS.git",
7980
"prismjs": "~1.6.0",
8081
"react": "^15.0.1",
8182
"react-addons-test-utils": "^15.0.1",

webpack/PIG.config.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,18 @@
66
* the root directory of this source tree.
77
*/
88
var configuration = require('./base.config.js');
9+
var HtmlWebpackPlugin = require('html-webpack-plugin');
10+
var path = require('path');
911

1012
configuration.entry = {PIG: './parse-interface-guide/index.js'};
1113
configuration.output.path = require('path').resolve('./PIG/bundles');
14+
configuration.output.filename = "[name].[chunkhash].js";
15+
16+
configuration.plugins.push(
17+
new HtmlWebpackPlugin({
18+
template: '../PIG/index.template.html',
19+
filename: path.resolve('./PIG/index.html')
20+
}),
21+
);
1222

1323
module.exports = configuration;

webpack/build.config.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,21 @@
66
* the root directory of this source tree.
77
*/
88
var configuration = require('./base.config.js');
9+
var HtmlWebpackPlugin = require('html-webpack-plugin');
10+
var path = require('path');
911

1012
configuration.entry = {
1113
dashboard: './dashboard/index.js',
1214
login: './login/index.js'
1315
};
1416
configuration.output.path = require('path').resolve('./Parse-Dashboard/public/bundles');
17+
configuration.output.filename = "[name].[chunkhash].js";
18+
19+
configuration.plugins.push(
20+
new HtmlWebpackPlugin({
21+
template: '../Parse-Dashboard/index.template.html',
22+
filename: path.resolve('./Parse-Dashboard/public/index.html')
23+
})
24+
);
1525

1626
module.exports = configuration;

webpack/publish.config.js

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,15 @@
66
* the root directory of this source tree.
77
*/
88
var configuration = require('./base.config.js');
9+
var HtmlWebpackPlugin = require('html-webpack-plugin');
10+
var path = require('path');
911

1012
configuration.entry = {
1113
dashboard: './dashboard/index.js',
1214
login: './login/index.js'
1315
};
14-
configuration.output.path = require('path').resolve('./Parse-Dashboard/public/bundles');
16+
configuration.output.path = path.resolve('./Parse-Dashboard/public/bundles');
17+
configuration.output.filename = "[name].[chunkhash].js";
1518

1619
var webpack = require('webpack');
1720

@@ -28,6 +31,10 @@ configuration.plugins.push(
2831
}
2932
}),
3033
new webpack.optimize.OccurrenceOrderPlugin(),
34+
new HtmlWebpackPlugin({
35+
template: '../Parse-Dashboard/index.template.html',
36+
filename: path.resolve('./Parse-Dashboard/public/index.html')
37+
}),
3138
function() {
3239
this.plugin('done', function(stats) {
3340
if (stats.compilation.errors && stats.compilation.errors.length) {

0 commit comments

Comments
 (0)