diff --git a/packages/netlify-cms-core/package.json b/packages/netlify-cms-core/package.json index a544b467..9e1a6df2 100644 --- a/packages/netlify-cms-core/package.json +++ b/packages/netlify-cms-core/package.json @@ -1,29 +1,20 @@ { "name": "netlify-cms-core", - "description": "Netlify CMS lets content editors work on structured content stored in git", + "description": "Netlify CMS core application, see netlify-cms package for the main distribution.", "version": "2.0.0-alpha.0", "main": "dist/netlify-cms-core.js", - "lint-staged": { - "*.js": [ - "eslint --fix", - "jest --findRelatedTests", - "git add" - ] - }, "files": [ "src/", "dist/" ], "scripts": { - "watch": "webpack-dev-server --hot --open", + "watch": "webpack -w", "build": "webpack" }, "keywords": [ "netlify", "cms", - "content editing", - "static site generators", - "jamstack" + "core" ], "license": "MIT", "dependencies": { @@ -105,10 +96,8 @@ }, "devDependencies": { "css-loader": "^1.0.0", - "friendly-errors-webpack-plugin": "^1.7.0", "to-string-loader": "^1.1.5", "webpack": "^4.16.1", - "webpack-cli": "^3.1.0", - "webpack-dev-server": "^3.1.5" + "webpack-cli": "^3.1.0" } } diff --git a/packages/netlify-cms-core/src/bootstrap.js b/packages/netlify-cms-core/src/bootstrap.js index f917a5b5..3c9c0ee4 100644 --- a/packages/netlify-cms-core/src/bootstrap.js +++ b/packages/netlify-cms-core/src/bootstrap.js @@ -10,7 +10,6 @@ import { setStore } from 'ValueObjects/AssetProxy'; import { ErrorBoundary } from 'UI' import App from 'App/App'; import 'EditorWidgets'; -import 'MarkdownPlugins'; import 'what-input'; const ROOT_ID = 'nc-root'; diff --git a/packages/netlify-cms-core/src/components/MarkdownPlugins/index.js b/packages/netlify-cms-core/src/components/MarkdownPlugins/index.js deleted file mode 100644 index a03a6ded..00000000 --- a/packages/netlify-cms-core/src/components/MarkdownPlugins/index.js +++ /dev/null @@ -1,8 +0,0 @@ -import { registerEditorComponent } from 'Lib/registry'; -import image from 'netlify-cms-editor-component-image'; - -const plugins = [ - image, -]; - -plugins.forEach(registerEditorComponent); diff --git a/packages/netlify-cms-core/src/index.css b/packages/netlify-cms-core/src/index.css deleted file mode 100644 index 1f37b104..00000000 --- a/packages/netlify-cms-core/src/index.css +++ /dev/null @@ -1,9 +0,0 @@ -/** - * Components - */ -@import "./components/EditorWidgets/EditorWidgets.css"; - -/** - * Backend auth pages - */ -@import "./backends/git-gateway/AuthenticationPage.css"; diff --git a/packages/netlify-cms-core/webpack.config.js b/packages/netlify-cms-core/webpack.config.js index c47451f2..eb1ff340 100644 --- a/packages/netlify-cms-core/webpack.config.js +++ b/packages/netlify-cms-core/webpack.config.js @@ -1,6 +1,5 @@ const path = require('path'); -const FriendlyErrorsWebpackPlugin = require('friendly-errors-webpack-plugin'); -const { getConfig, rules, plugins } = require('../../scripts/webpack.js'); +const { getConfig, rules } = require('../../scripts/webpack.js'); module.exports = { ...getConfig(), @@ -27,22 +26,5 @@ module.exports = { use: ['to-string-loader', 'css-loader'], }, ], - }, - plugins: [ - ...Object.entries(plugins) - .filter(([ key ]) => key !== 'friendlyErrors') - .map(([ _, plugin ]) => plugin()), - new FriendlyErrorsWebpackPlugin({ - compilationSuccessInfo: { - messages: ['Netlify CMS is now running at http://localhost:8080'], - }, - }), - ], - devServer: { - contentBase: './example', - watchContentBase: true, - quiet: true, - host: 'localhost', - port: 8080, - }, + } }; diff --git a/packages/netlify-cms-core/example/Photo 1-lobby_FS.jpg b/packages/netlify-cms/example/Photo 1-lobby_FS.jpg similarity index 100% rename from packages/netlify-cms-core/example/Photo 1-lobby_FS.jpg rename to packages/netlify-cms/example/Photo 1-lobby_FS.jpg diff --git a/packages/netlify-cms-core/example/config.yml b/packages/netlify-cms/example/config.yml similarity index 100% rename from packages/netlify-cms-core/example/config.yml rename to packages/netlify-cms/example/config.yml diff --git a/packages/netlify-cms-core/example/example.css b/packages/netlify-cms/example/example.css similarity index 100% rename from packages/netlify-cms-core/example/example.css rename to packages/netlify-cms/example/example.css diff --git a/packages/netlify-cms-core/example/index.html b/packages/netlify-cms/example/index.html similarity index 100% rename from packages/netlify-cms-core/example/index.html rename to packages/netlify-cms/example/index.html diff --git a/packages/netlify-cms-core/example/moby-dick.jpg b/packages/netlify-cms/example/moby-dick.jpg similarity index 100% rename from packages/netlify-cms-core/example/moby-dick.jpg rename to packages/netlify-cms/example/moby-dick.jpg diff --git a/packages/netlify-cms-core/example/nf-logo.png b/packages/netlify-cms/example/nf-logo.png similarity index 100% rename from packages/netlify-cms-core/example/nf-logo.png rename to packages/netlify-cms/example/nf-logo.png diff --git a/packages/netlify-cms/package.json b/packages/netlify-cms/package.json new file mode 100644 index 00000000..1c1adc10 --- /dev/null +++ b/packages/netlify-cms/package.json @@ -0,0 +1,34 @@ +{ + "name": "netlify-cms", + "description": "An extensible, open source, Git-based, React CMS for static sites.", + "version": "2.0.0-alpha.0", + "main": "dist/netlify-cms.js", + "scripts": { + "watch": "webpack-dev-server --open", + "build": "webpack" + }, + "keywords": [ + "netlify", + "cms", + "content editing", + "static site generators", + "jamstack" + ], + "license": "MIT", + "dependencies": { + }, + "peerDependencies": { + "netlify-cms-core": "2.0.0-alpha.0", + "netlify-cms-backend-github": "2.0.0-alpha.0", + "netlify-cms-backend-gitlab": "2.0.0-alpha.0", + "netlify-cms-backend-git-gateway": "2.0.0-alpha.0", + "netlify-cms-backend-test": "2.0.0-alpha.0", + "netlify-cms-editor-component-image": "2.0.0-alpha.0" + }, + "devDependencies": { + "friendly-errors-webpack-plugin": "^1.7.0", + "webpack": "^4.16.1", + "webpack-cli": "^3.1.0", + "webpack-dev-server": "^3.1.5" + } +} diff --git a/packages/netlify-cms/src/backends.js b/packages/netlify-cms/src/backends.js new file mode 100644 index 00000000..cfe96d99 --- /dev/null +++ b/packages/netlify-cms/src/backends.js @@ -0,0 +1,12 @@ +import cms from 'netlify-cms-core'; +import { GitHubBackend } from 'netlify-cms-backend-github'; +import { GitLabBackend } from 'netlify-cms-backend-gitlab'; +import { GitGatewayBackend } from 'netlify-cms-backend-git-gateway'; +import { TestBackend } from 'netlify-cms-backend-test'; + +const { registerBackend } = cms; + +registerBackend('git-gateway', GitGatewayBackend); +registerBackend('github', GitHubBackend); +registerBackend('gitlab', GitLabBackend); +registerBackend('test-repo', TestBackend); diff --git a/packages/netlify-cms/src/editor-components.js b/packages/netlify-cms/src/editor-components.js new file mode 100644 index 00000000..194644b0 --- /dev/null +++ b/packages/netlify-cms/src/editor-components.js @@ -0,0 +1,5 @@ +import image from 'netlify-cms-editor-component-image'; + +const { registerEditorComponent } = cms; + +registerEditorComponent(image); diff --git a/packages/netlify-cms/src/index.js b/packages/netlify-cms/src/index.js new file mode 100644 index 00000000..ccf0cf51 --- /dev/null +++ b/packages/netlify-cms/src/index.js @@ -0,0 +1,3 @@ +import './backends'; +import './widgets'; +import './editor-components'; diff --git a/packages/netlify-cms/src/widgets.js b/packages/netlify-cms/src/widgets.js new file mode 100644 index 00000000..6f9b88ea --- /dev/null +++ b/packages/netlify-cms/src/widgets.js @@ -0,0 +1,30 @@ +import cms from 'netlify-cms-core'; +// import { StringControl, StringPreview } from 'netlify-cms-widget-string'; +// import { NumberControl, NumberPreview } from 'netlify-cms-widget-number'; +// import { TextControl, TextPreview } from 'netlify-cms-widget-text'; +// import { ImageControl, ImagePreview } from 'netlify-cms-widget-image'; +// import { FileControl, FilePreview } from 'netlify-cms-widget-file'; +// import { DateControl, DatePreview } from 'netlify-cms-widget-date'; +// import { DateTimeControl, DateTimePreview } from 'netlify-cms-widget-datetime'; +// import { SelectControl, SelectPreview } from 'netlify-cms-widget-select'; +// import { MarkdownControl, MarkdownPreview } from 'netlify-cms-widget-markdown'; +// import { ListControl, ListPreview } from 'netlify-cms-widget-list'; +// import { ObjectControl, ObjectPreview } from 'netlify-cms-widget-object'; +// import { RelationControl, RelationPreview } from 'netlify-cms-widget-relation'; +// import { BooleanControl } from 'netlify-cms-widget-boolean'; + +const { registerWidget } = cms; + +// registerWidget('string', StringControl, StringPreview); +// registerWidget('text', TextControl, TextPreview); +// registerWidget('number', NumberControl, NumberPreview); +// registerWidget('list', ListControl, ListPreview); +// registerWidget('markdown', MarkdownControl, MarkdownPreview); +// registerWidget('image', ImageControl, ImagePreview); +// registerWidget('file', FileControl, FilePreview); +// registerWidget('date', DateControl, DatePreview); +// registerWidget('datetime', DateTimeControl, DateTimePreview); +// registerWidget('select', SelectControl, SelectPreview); +// registerWidget('object', ObjectControl, ObjectPreview); +// registerWidget('relation', RelationControl, RelationPreview); +// registerWidget('boolean', BooleanControl); diff --git a/packages/netlify-cms/webpack.config.js b/packages/netlify-cms/webpack.config.js new file mode 100644 index 00000000..05acb312 --- /dev/null +++ b/packages/netlify-cms/webpack.config.js @@ -0,0 +1,23 @@ +const FriendlyErrorsWebpackPlugin = require('friendly-errors-webpack-plugin'); +const { getConfig, plugins } = require('../../scripts/webpack.js'); + +module.exports = { + ...getConfig(), + plugins: [ + ...Object.entries(plugins) + .filter(([ key ]) => key !== 'friendlyErrors') + .map(([ _, plugin ]) => plugin()), + new FriendlyErrorsWebpackPlugin({ + compilationSuccessInfo: { + messages: ['Netlify CMS is now running at http://localhost:8080'], + }, + }), + ], + devServer: { + contentBase: './example', + watchContentBase: true, + quiet: true, + host: 'localhost', + port: 8080, + }, +}; diff --git a/scripts/webpack.js b/scripts/webpack.js index 2182499d..af184082 100644 --- a/scripts/webpack.js +++ b/scripts/webpack.js @@ -24,24 +24,9 @@ const rules = () => ({ }); const plugins = () => { - const defaultPlugins = { + return { friendlyErrors: () => new FriendlyErrorsWebpackPlugin() }; - - if (isProduction) { - return { - ...defaultPlugins, - sourcemap: (config = {}) => new webpack.SourceMapDevToolPlugin({ - filename: '[file].map', - moduleFilenameTemplate: info => path.posix.normalize(`../src/${info.resourcePath}`), - noSources: true, - }), - }; - } - - return { - ...defaultPlugins, - } }; const stats = () => { @@ -75,7 +60,7 @@ const getConfig = () => ({ rules: Object.values(rules()).map(rule => rule()), }, plugins: Object.values(plugins()).map(plugin => plugin), - devtool: !isProduction && 'source-map', + devtool: 'source-map', target: 'web', /**