From c85761180fa331317d7580379c0fc32f5a88cd2a Mon Sep 17 00:00:00 2001 From: Durran Jordan Date: Wed, 6 Jul 2016 12:22:26 +0200 Subject: [PATCH 1/4] INT-1616: Use compile cache with markdown --- .nvmrc | 1 + src/help/help-entry-collection.js | 25 ++++++++----------------- src/help/index.js | 4 +--- 3 files changed, 10 insertions(+), 20 deletions(-) create mode 100644 .nvmrc diff --git a/.nvmrc b/.nvmrc new file mode 100644 index 00000000000..95ee81a4117 --- /dev/null +++ b/.nvmrc @@ -0,0 +1 @@ +5.9 diff --git a/src/help/help-entry-collection.js b/src/help/help-entry-collection.js index 689cf216694..ebb8dd1d3b1 100644 --- a/src/help/help-entry-collection.js +++ b/src/help/help-entry-collection.js @@ -5,10 +5,9 @@ var selectableMixin = require('../app/models/selectable-collection-mixin'); var filterableMixin = require('ampersand-collection-filterable'); var withSync = require('../app/models/with-sync'); var debug = require('debug')('mongodb-compass:help:help-entry-collection'); -var mm = require('marky-mark'); var path = require('path'); var _ = require('lodash'); -var highlight = require('highlight.js'); +var fs = require('fs'); var HelpEntryCollection = Collection.extend( selectableMixin, lodashMixin, filterableMixin, { @@ -29,25 +28,17 @@ var HelpEntryCollection = Collection.extend( } var dir = path.join(__dirname, 'entries'); - debug('parsing entries with marky-mark from `%s`', dir); - - // add syntax highlighting options, pass through to `marked` module - var parserOptions = { - marked: { - highlight: function(code) { - var result = highlight.highlightAuto(code).value; - return result; - } - } - }; - - mm.parseDirectory(dir, parserOptions, function(err, entries) { + fs.readdir(dir, function(err, files) { if (err) { - debug('error parsing entries', err); + debug('error reading entries', err); done(err); return; } - debug('successfully parsed!', entries); + + var entries = _.map(files, function(file) { + return require(path.join(dir, file)); + }); + // in production don't return the dev-only entries if (process.env.NODE_ENV === 'production') { entries = _.filter(entries, function(entry) { diff --git a/src/help/index.js b/src/help/index.js index b1524f4b674..0b83bbf3e86 100644 --- a/src/help/index.js +++ b/src/help/index.js @@ -128,9 +128,7 @@ var HelpPage = View.extend({ if (!entry) { debug('Unknown help entry', entryId); this.viewSwitcher.clear(); - app.statusbar.showMessage({ - message: 'Help entry not found.' - }); + app.statusbar.showMessage('Help entry not found.'); return; } From e2e1046d162f863d41a8e4a96daba2d67dc6134d Mon Sep 17 00:00:00 2001 From: Durran Jordan Date: Wed, 6 Jul 2016 12:26:17 +0200 Subject: [PATCH 2/4] INT-1616: Update to latest compile cache --- package.json | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/package.json b/package.json index 96be0a1e83e..02897cc20b1 100644 --- a/package.json +++ b/package.json @@ -102,7 +102,7 @@ "get-object-path": "azer/get-object-path#74eb42de0cfd02c14ffdd18552f295aba723d394", "hadron-action": "^0.0.4", "hadron-auto-update-manager": "^0.0.12", - "hadron-compile-cache": "^0.2.0", + "hadron-compile-cache": "^0.3.0", "hadron-component-registry": "^0.4.0", "hadron-document": "^0.14.0", "hadron-ipc": "^0.0.7", @@ -119,7 +119,6 @@ "local-links": "^1.4.0", "lodash": "^3.10.1", "marked": "^0.3.5", - "marky-mark": "^1.2.1", "moment": "^2.10.6", "mongodb-collection-model": "^0.2.3", "mongodb-connection-model": "^4.3.0", From 4cbeab59513582aef006783decdfbd9cea1b8028 Mon Sep 17 00:00:00 2001 From: Durran Jordan Date: Wed, 6 Jul 2016 12:27:31 +0200 Subject: [PATCH 3/4] Remove the .nvmrc --- .nvmrc | 1 - 1 file changed, 1 deletion(-) delete mode 100644 .nvmrc diff --git a/.nvmrc b/.nvmrc deleted file mode 100644 index 95ee81a4117..00000000000 --- a/.nvmrc +++ /dev/null @@ -1 +0,0 @@ -5.9 From 125fb79dcfdda3df0abf98e52099cea0dfedea31 Mon Sep 17 00:00:00 2001 From: Durran Jordan Date: Wed, 6 Jul 2016 16:00:13 +0200 Subject: [PATCH 4/4] INT-1616: Bump hadron-build --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 02897cc20b1..8012ff16878 100644 --- a/package.json +++ b/package.json @@ -151,7 +151,7 @@ "devDependencies": { "eslint-config-mongodb-js": "^1.0.6", "eslint-plugin-react": "^4.1.0", - "hadron-build": "^0.6.3", + "hadron-build": "^0.6.5", "hadron-test-utils": "^0.0.8", "xvfb-maybe": "^0.1.3" },