From 688fc52dcbc56eff5f49f65af2304028427d1776 Mon Sep 17 00:00:00 2001 From: Mathias Biilmann Christensen Date: Wed, 23 Nov 2016 12:23:45 -0800 Subject: [PATCH 1/4] Make sure we have a valid main file when using import netlify-cms --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 71872382..eba936b7 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "name": "netlify-cms", "version": "0.1.5", "description": "Netlify CMS lets content editors work on structured content stored in git", - "main": "index.js", + "main": "dist/cms.js", "scripts": { "start": "webpack-dev-server --config webpack.dev.js", "test": "jest", From d7d17df79a8f2176bd1a71423f0e3912a3cfaf90 Mon Sep 17 00:00:00 2001 From: Mathias Biilmann Christensen Date: Wed, 23 Nov 2016 12:24:07 -0800 Subject: [PATCH 2/4] Get rid of css linting in precommit --- package.json | 5 ----- 1 file changed, 5 deletions(-) diff --git a/package.json b/package.json index eba936b7..adf458f9 100644 --- a/package.json +++ b/package.json @@ -25,11 +25,6 @@ "eslint --fix", "jest --findRelatedTests", "git add" - ], - "*.css": [ - "stylefmt", - "stylelint", - "git add" ] }, "files": [ From 3f13435ff0039c427b09e0cdd91211a26fd3a49e Mon Sep 17 00:00:00 2001 From: Mathias Biilmann Christensen Date: Wed, 23 Nov 2016 12:26:15 -0800 Subject: [PATCH 3/4] Make sure we export the CMS for npm use --- src/index.js | 26 +++++++++++++++----------- 1 file changed, 15 insertions(+), 11 deletions(-) diff --git a/src/index.js b/src/index.js index 62ec89eb..4efcd6c6 100644 --- a/src/index.js +++ b/src/index.js @@ -24,7 +24,7 @@ render(( if (process.env.NODE_ENV !== 'production' && module.hot) { module.hot.accept('./root', () => { - const NextRoot = require('./root').default; + const NextRoot = require('./root').default; // eslint-disable-line render(( @@ -33,13 +33,6 @@ if (process.env.NODE_ENV !== 'production' && module.hot) { }); } -window.CMS = {}; -for (const method in registry) { - window.CMS[method] = registry[method]; -} -window.createClass = React.createClass; -window.h = React.createElement; - const buildtInPlugins = [{ label: 'Image', id: 'image', @@ -48,9 +41,7 @@ const buildtInPlugins = [{ alt: match[1], }, toBlock: data => `![${ data.alt }](${ data.image })`, - toPreview: (data) => { - return {data.alt}; - }, + toPreview: data => {data.alt}, pattern: /^!\[([^\]]+)\]\(([^\)]+)\)$/, fields: [{ label: 'Image', @@ -62,3 +53,16 @@ const buildtInPlugins = [{ }], }]; buildtInPlugins.forEach(plugin => registry.registerEditorComponent(plugin)); + +const CMS = {}; +for (const method in registry) { // eslint-disable-line + CMS[method] = registry[method]; +} + +if (typeof window !== 'undefined') { + window.CMS = CMS; + window.createClass = window.createClass || React.createClass; + window.h = window.h || React.createElement; +} + +export default CMS; From 58eb38438623460d58b40d6700430b3f4ed1018b Mon Sep 17 00:00:00 2001 From: Mathias Biilmann Christensen Date: Wed, 23 Nov 2016 12:28:03 -0800 Subject: [PATCH 4/4] Bump version --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index adf458f9..3a0115f8 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "netlify-cms", - "version": "0.1.5", + "version": "0.1.6", "description": "Netlify CMS lets content editors work on structured content stored in git", "main": "dist/cms.js", "scripts": {