Skip to content

Commit c506ba1

Browse files
committed
Merge pull request #76 from ParsePlatform/flovilmart.npmDist
Adds distribution with built package
2 parents b7efb40 + e60052f commit c506ba1

File tree

6 files changed

+66
-6
lines changed

6 files changed

+66
-6
lines changed

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@ node_modules/
33
bundles/
44
PIG/bundles/
55
Parse-Dashboard/public/bundles/
6-
6+
Parse-Dashboard/parse-dashboard-config.json
7+
dist/
78
npm-debug.log
89

910
// vim .swp

Parse-Dashboard/index.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,11 @@ app.use(express.static(path.join(__dirname,'public')));
3333
app.get('/parse-dashboard-config.json', function(req, res) {
3434
jsonFile(configFile)
3535
.then(config => {
36+
config.data.apps.forEach((app) => {
37+
if (!app.appName) {
38+
return res.send({ success: false, error: 'An application is misconfigured, appName is required' });
39+
}
40+
});
3641
var response = {apps: config.data.apps};
3742
var users = config.data.users;
3843
//If they provide auth when their config has no users, ignore the auth

README.md

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,16 @@ If you are not familiar with Docker, ``--port 8080`` with be passed in as argume
104104

105105
## Deploying in production
106106

107+
For production deployments, it's recommended to use the npm package
108+
109+
1. Create a folder for your project
110+
2. run `$ npm init`
111+
3. Create your dashboard.json in the root ot your project
112+
4. run `$ npm install --save parse-dashboard`
113+
5. add a start script in your package.json `"start": "parse-dashboard --config ./dahsboard.json"` 
114+
6. run `$ npm start`
115+
116+
107117
If you're deploying to a provider like Heroku, or Google App Engine, the SSL endpoint is terminated early and handled by the provider and you may encounter this error `Parse Dashboard can only be remotely accessed via HTTPS`.
108118

109119
:warning: :warning: Before going further, make sure your server **cannot** be reachable via **HTTP**. See the provider documentation for force HTTPS connections to your deployment.
@@ -114,11 +124,12 @@ To start your server use:
114124

115125
`$ npm start`
116126

117-
118127
Optionally you can use the command line arguments:
119128

120129
`$ npm start -- --config path/to/config.json --port 8080 --allowInsecureHTTP=1`
121130

131+
Or update you start script with the accoring configuration.
132+
122133
All paramters are optional and their default values are:
123134

124135

bin/parse-dashboard

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
#!/usr/bin/env node
2+
require('../dist/Parse-Dashboard');

gulpfile.js

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
var gulp = require('gulp');
2+
var webpack = require('webpack');
3+
var webpackConfig = require("./webpack/production.config");
4+
5+
var dist = './dist/Parse-Dashboard';
6+
var bundlesDir = './production/bundles';
7+
8+
gulp.task('webpack', function(callback) {
9+
// run webpack
10+
webpack(webpackConfig, function(err, stats) {
11+
if(err) throw new gutil.PluginError('webpack', err);
12+
callback();
13+
});
14+
});
15+
16+
gulp.task('bundles', ['webpack'], function(){
17+
gulp.src([bundlesDir + '/dashboard.bundle.js', bundlesDir + '/sprites.svg'])
18+
.pipe(gulp.dest(dist + '/public/bundles/'));
19+
})
20+
21+
gulp.task('static', ['bundles'], function() {
22+
gulp.src(['./Parse-Dashboard/**/*', // all files
23+
'!./Parse-Dashboard/*.json', // but the config
24+
'!./Parse-Dashboard/public/bundles/*']) // but the bundles
25+
.pipe(gulp.dest(dist));
26+
});
27+
28+
gulp.task('default', ['static', 'bundles']);

package.json

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,15 @@
11
{
2-
"private": true,
2+
"name": "parse-dashboard",
3+
"description": "The parse dashboard",
4+
"version": "2.0.0",
5+
"repository": {
6+
"type": "git",
7+
"url": "https://github.com/ParsePlatform/parse-dashboard"
8+
},
9+
"license": "LicenseRef-LICENSE",
10+
"files": [
11+
"dist"
12+
],
313
"dependencies": {
414
"babel-runtime": "~5.8.25",
515
"basic-auth": "^1.0.3",
@@ -22,6 +32,7 @@
2232
"babel-loader": "~5.3.0",
2333
"babel-plugin-remove-proptypes": "~1.0.0",
2434
"css-loader": "~0.18.0",
35+
"gulp": "^3.9.1",
2536
"http-server": "~0.8.5",
2637
"immutable-devtools": "~0.0.4",
2738
"jest-cli": "^0.7.1",
@@ -40,9 +51,11 @@
4051
"build": "NODE_ENV=production webpack --config webpack/production.config.js && webpack --config webpack/PIG.config.js",
4152
"test": "NODE_PATH=./node_modules jest",
4253
"generate": "node scripts/generate.js",
43-
"preinstall": "git update-index --skip-worktree Parse-Dashboard/parse-dashboard-config.json",
44-
"prestart": "webpack --config webpack/build.config.js --progress",
45-
"start": "node ./Parse-Dashboard/index.js"
54+
"prepublish": "gulp",
55+
"start": "node ./dist/Parse-Dashboard/index.js"
56+
},
57+
"bin": {
58+
"parse-dashboard": "./bin/parse-dashboard"
4659
},
4760
"engines": {
4861
"node": ">=4.3"

0 commit comments

Comments
 (0)