diff --git a/CHANGELOG.md b/CHANGELOG.md index eae9d05932..d338a61c57 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,7 +2,7 @@ Changelogs are separated by release type for better overview. -## ✅ [Master Releases][log_master] +## ✅ [Stable Releases][log_release] These are the official, stable releases that you can use in your production environments. @@ -11,7 +11,7 @@ These are the official, stable releases that you can use in your production envi Details: - Stability: *stable* - NPM channel: `@latest` -- Branch: [master][branch_master] +- Branch: [release][branch_release] - Purpose: official release - Suitable environment: production @@ -30,7 +30,7 @@ Details: ## 🔥 [Alpha Releases][log_alpha] -> ### “Use if you love sudden breaking changes!” +> ### “If you are curious to see what's next!” These releases contain the latest development changes, but you should be prepared for anything, including sudden breaking changes or code refactoring. Use this branch to contribute to the project and open pull requests. @@ -42,9 +42,9 @@ Details: - Suitable environment: experimental -[log_master]: https://github.com/parse-community/parse-dashboard/blob/master/changelogs/CHANGELOG_master.md +[log_release]: https://github.com/parse-community/parse-dashboard/blob/release/changelogs/CHANGELOG_release.md [log_beta]: https://github.com/parse-community/parse-dashboard/blob/beta/changelogs/CHANGELOG_beta.md [log_alpha]: https://github.com/parse-community/parse-dashboard/blob/alpha/changelogs/CHANGELOG_alpha.md -[branch_master]: https://github.com/parse-community/parse-dashboard/tree/master +[branch_release]: https://github.com/parse-community/parse-dashboard/tree/release [branch_beta]: https://github.com/parse-community/parse-dashboard/tree/beta [branch_alpha]: https://github.com/parse-community/parse-dashboard/tree/alpha diff --git a/Parse-Dashboard/index.js b/Parse-Dashboard/index.js index d5ed2019fc..2363f685b9 100644 --- a/Parse-Dashboard/index.js +++ b/Parse-Dashboard/index.js @@ -8,7 +8,7 @@ // Command line tool for npm start 'use strict' const path = require('path'); -const jsonFile = require('json-file-plus'); +const fs = require('fs'); const express = require('express'); const parseDashboard = require('./app'); const CLIHelper = require('./CLIHelper.js'); @@ -126,74 +126,72 @@ if (!program.config && !process.env.PARSE_DASHBOARD_CONFIG) { } } -let p = null; +let config = null; let configFilePath = null; if (configFile) { - p = jsonFile(configFile); - configFilePath = path.dirname(configFile); + try { + config = { + data: JSON.parse(fs.readFileSync(configFile, 'utf8')) + }; + configFilePath = path.dirname(configFile); + } catch (error) { + if (error instanceof SyntaxError) { + console.log('Your config file contains invalid JSON. Exiting.'); + process.exit(1); + } else if (error.code === 'ENOENT') { + if (explicitConfigFileProvided) { + console.log('Your config file is missing. Exiting.'); + process.exit(2); + } else { + console.log('You must provide either a config file or required CLI options (app ID, Master Key, and server URL); not both.'); + process.exit(3); + } + } else { + console.log('There was a problem with your config. Exiting.'); + process.exit(-1); + } + } } else if (configFromCLI) { - p = Promise.resolve(configFromCLI); + config = configFromCLI; } else { //Failed to load default config file. console.log('You must provide either a config file or an app ID, Master Key, and server URL. See parse-dashboard --help for details.'); process.exit(4); } -p.then(config => { - config.data.apps.forEach(app => { - if (!app.appName) { - app.appName = app.appId; - } - }); - if (config.data.iconsFolder && configFilePath) { - config.data.iconsFolder = path.join(configFilePath, config.data.iconsFolder); +config.data.apps.forEach(app => { + if (!app.appName) { + app.appName = app.appId; } +}); - const app = express(); +if (config.data.iconsFolder && configFilePath) { + config.data.iconsFolder = path.join(configFilePath, config.data.iconsFolder); +} - if (allowInsecureHTTP || trustProxy || dev) app.enable('trust proxy'); +const app = express(); - config.data.trustProxy = trustProxy; - let dashboardOptions = { allowInsecureHTTP, cookieSessionSecret, dev }; - app.use(mountPath, parseDashboard(config.data, dashboardOptions)); - let server; - if(!configSSLKey || !configSSLCert){ - // Start the server. - server = app.listen(port, host, function () { - console.log(`The dashboard is now available at http://${server.address().address}:${server.address().port}${mountPath}`); - }); - } else { - // Start the server using SSL. - var fs = require('fs'); - var privateKey = fs.readFileSync(configSSLKey); - var certificate = fs.readFileSync(configSSLCert); +if (allowInsecureHTTP || trustProxy || dev) app.enable('trust proxy'); - server = require('https').createServer({ - key: privateKey, - cert: certificate - }, app).listen(port, host, function () { - console.log(`The dashboard is now available at https://${server.address().address}:${server.address().port}${mountPath}`); - }); - } - handleSIGs(server); -}, error => { - if (error instanceof SyntaxError) { - console.log('Your config file contains invalid JSON. Exiting.'); - process.exit(1); - } else if (error.code === 'ENOENT') { - if (explicitConfigFileProvided) { - console.log('Your config file is missing. Exiting.'); - process.exit(2); - } else { - console.log('You must provide either a config file or required CLI options (app ID, Master Key, and server URL); not both.'); - process.exit(3); - } - } else { - console.log('There was a problem with your config. Exiting.'); - process.exit(-1); - } -}) -.catch(error => { - console.log('There was a problem loading the dashboard. Exiting.', error); - process.exit(-1); -}); +config.data.trustProxy = trustProxy; +let dashboardOptions = { allowInsecureHTTP, cookieSessionSecret, dev }; +app.use(mountPath, parseDashboard(config.data, dashboardOptions)); +let server; +if(!configSSLKey || !configSSLCert){ + // Start the server. + server = app.listen(port, host, function () { + console.log(`The dashboard is now available at http://${server.address().address}:${server.address().port}${mountPath}`); + }); +} else { + // Start the server using SSL. + var privateKey = fs.readFileSync(configSSLKey); + var certificate = fs.readFileSync(configSSLCert); + + server = require('https').createServer({ + key: privateKey, + cert: certificate + }, app).listen(port, host, function () { + console.log(`The dashboard is now available at https://${server.address().address}:${server.address().port}${mountPath}`); + }); +} +handleSIGs(server); diff --git a/changelogs/CHANGELOG_master.md b/changelogs/CHANGELOG_release.md similarity index 100% rename from changelogs/CHANGELOG_master.md rename to changelogs/CHANGELOG_release.md diff --git a/package-lock.json b/package-lock.json index e7512980da..363306904e 100644 --- a/package-lock.json +++ b/package-lock.json @@ -6773,7 +6773,8 @@ "function-bind": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz", - "integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==" + "integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==", + "dev": true }, "functional-red-black-tree": { "version": "1.0.1", @@ -7449,6 +7450,7 @@ "version": "1.0.3", "resolved": "https://registry.npmjs.org/has/-/has-1.0.3.tgz", "integrity": "sha512-f2dvO0VU6Oej7RkWJGrehjbzMAjFp5/VKPp5tTpWIV4JHHZK1/BxbFRtf/siA2SWTe09caDmVtYYzWEIbBS4zw==", + "dev": true, "requires": { "function-bind": "^1.1.1" } @@ -7934,11 +7936,6 @@ "resolved": "https://registry.npmjs.org/ipaddr.js/-/ipaddr.js-1.9.1.tgz", "integrity": "sha512-0KI/607xoxSToH7GjN1FfSbLoU0+btTicjsQSWQlh/hZykN8KpmMf7uYwPW3R+akZ6R/w18ZlXSHBYXiYUPO3g==" }, - "is": { - "version": "3.3.0", - "resolved": "https://registry.npmjs.org/is/-/is-3.3.0.tgz", - "integrity": "sha512-nW24QBoPcFGGHJGUwnfpI7Yc5CdqWNdsyHQszVE/z2pKHXzh7FZ5GWhJqSyaQ9wMkQnsTx+kAI8bHlCX4tKdbg==" - }, "is-accessor-descriptor": { "version": "0.1.6", "resolved": "https://registry.npmjs.org/is-accessor-descriptor/-/is-accessor-descriptor-0.1.6.tgz", @@ -7993,7 +7990,8 @@ "is-callable": { "version": "1.2.4", "resolved": "https://registry.npmjs.org/is-callable/-/is-callable-1.2.4.tgz", - "integrity": "sha512-nsuwtxZfMX67Oryl9LCQ+upnC0Z0BgpwntpS89m1H/TLF0zNfzfLMV/9Wa/6MZsj0acpEjAO0KF1xT6ZdLl95w==" + "integrity": "sha512-nsuwtxZfMX67Oryl9LCQ+upnC0Z0BgpwntpS89m1H/TLF0zNfzfLMV/9Wa/6MZsj0acpEjAO0KF1xT6ZdLl95w==", + "dev": true }, "is-ci": { "version": "2.0.0", @@ -10319,16 +10317,6 @@ "integrity": "sha512-4bV5BfR2mqfQTJm+V5tPPdf+ZpuhiIvTuAB5g8kcrXOZpTT/QwwVRWBywX1ozr6lEuPdbHxwaJlm9G6mI2sfSQ==", "dev": true }, - "json-file-plus": { - "version": "3.2.0", - "resolved": "https://registry.npmjs.org/json-file-plus/-/json-file-plus-3.2.0.tgz", - "integrity": "sha1-QTYJ4kmoFHtombmVytwqGWdx3Xs=", - "requires": { - "is": "^3.1.0", - "node.extend": "^1.1.5", - "promiseback": "^2.0.2" - } - }, "json-parse-better-errors": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/json-parse-better-errors/-/json-parse-better-errors-1.0.2.tgz", @@ -11863,15 +11851,6 @@ "@babel/parser": "^7.0.0" } }, - "node.extend": { - "version": "1.1.8", - "resolved": "https://registry.npmjs.org/node.extend/-/node.extend-1.1.8.tgz", - "integrity": "sha512-L/dvEBwyg3UowwqOUTyDsGBU6kjBQOpOhshio9V3i3BMPv5YUb9+mWNN8MK0IbWqT0AqaTSONZf0aTuMMahWgA==", - "requires": { - "has": "^1.0.3", - "is": "^3.2.1" - } - }, "nopt": { "version": "5.0.0", "resolved": "https://registry.npmjs.org/nopt/-/nopt-5.0.0.tgz", @@ -15013,23 +14992,6 @@ "asap": "~2.0.3" } }, - "promise-deferred": { - "version": "2.0.3", - "resolved": "https://registry.npmjs.org/promise-deferred/-/promise-deferred-2.0.3.tgz", - "integrity": "sha512-n10XaoznCzLfyPFOlEE8iurezHpxrYzyjgq/1eW9Wk1gJwur/N7BdBmjJYJpqMeMcXK4wEbzo2EvZQcqjYcKUQ==", - "requires": { - "promise": "^7.3.1" - } - }, - "promiseback": { - "version": "2.0.3", - "resolved": "https://registry.npmjs.org/promiseback/-/promiseback-2.0.3.tgz", - "integrity": "sha512-VZXdCwS0ppVNTIRfNsCvVwJAaP2b+pxQF7lM8DMWfmpNWyTxB6O5YNbzs+8z0ki/KIBHKHk308NTIl4kJUem3w==", - "requires": { - "is-callable": "^1.1.5", - "promise-deferred": "^2.0.3" - } - }, "prompts": { "version": "2.4.1", "resolved": "https://registry.npmjs.org/prompts/-/prompts-2.4.1.tgz", diff --git a/package.json b/package.json index 575376af36..ad4bbdd1c7 100644 --- a/package.json +++ b/package.json @@ -51,7 +51,6 @@ "immutable-devtools": "0.1.5", "inquirer": "8.1.3", "js-beautify": "1.14.0", - "json-file-plus": "3.2.0", "otpauth": "7.0.6", "package-json": "6.5.0", "parse": "3.3.1",