add netlify-cms (main) package

This commit is contained in:
Shawn Erquhart 2018-07-23 23:40:48 -04:00
parent 19f484eeda
commit 27d13a73b6
18 changed files with 115 additions and 70 deletions

View File

@ -1,29 +1,20 @@
{ {
"name": "netlify-cms-core", "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", "version": "2.0.0-alpha.0",
"main": "dist/netlify-cms-core.js", "main": "dist/netlify-cms-core.js",
"lint-staged": {
"*.js": [
"eslint --fix",
"jest --findRelatedTests",
"git add"
]
},
"files": [ "files": [
"src/", "src/",
"dist/" "dist/"
], ],
"scripts": { "scripts": {
"watch": "webpack-dev-server --hot --open", "watch": "webpack -w",
"build": "webpack" "build": "webpack"
}, },
"keywords": [ "keywords": [
"netlify", "netlify",
"cms", "cms",
"content editing", "core"
"static site generators",
"jamstack"
], ],
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
@ -105,10 +96,8 @@
}, },
"devDependencies": { "devDependencies": {
"css-loader": "^1.0.0", "css-loader": "^1.0.0",
"friendly-errors-webpack-plugin": "^1.7.0",
"to-string-loader": "^1.1.5", "to-string-loader": "^1.1.5",
"webpack": "^4.16.1", "webpack": "^4.16.1",
"webpack-cli": "^3.1.0", "webpack-cli": "^3.1.0"
"webpack-dev-server": "^3.1.5"
} }
} }

View File

@ -10,7 +10,6 @@ import { setStore } from 'ValueObjects/AssetProxy';
import { ErrorBoundary } from 'UI' import { ErrorBoundary } from 'UI'
import App from 'App/App'; import App from 'App/App';
import 'EditorWidgets'; import 'EditorWidgets';
import 'MarkdownPlugins';
import 'what-input'; import 'what-input';
const ROOT_ID = 'nc-root'; const ROOT_ID = 'nc-root';

View File

@ -1,8 +0,0 @@
import { registerEditorComponent } from 'Lib/registry';
import image from 'netlify-cms-editor-component-image';
const plugins = [
image,
];
plugins.forEach(registerEditorComponent);

View File

@ -1,9 +0,0 @@
/**
* Components
*/
@import "./components/EditorWidgets/EditorWidgets.css";
/**
* Backend auth pages
*/
@import "./backends/git-gateway/AuthenticationPage.css";

View File

@ -1,6 +1,5 @@
const path = require('path'); const path = require('path');
const FriendlyErrorsWebpackPlugin = require('friendly-errors-webpack-plugin'); const { getConfig, rules } = require('../../scripts/webpack.js');
const { getConfig, rules, plugins } = require('../../scripts/webpack.js');
module.exports = { module.exports = {
...getConfig(), ...getConfig(),
@ -27,22 +26,5 @@ module.exports = {
use: ['to-string-loader', 'css-loader'], 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,
},
}; };

View File

Before

Width:  |  Height:  |  Size: 808 KiB

After

Width:  |  Height:  |  Size: 808 KiB

View File

Before

Width:  |  Height:  |  Size: 310 KiB

After

Width:  |  Height:  |  Size: 310 KiB

View File

Before

Width:  |  Height:  |  Size: 4.3 KiB

After

Width:  |  Height:  |  Size: 4.3 KiB

View File

@ -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"
}
}

View File

@ -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);

View File

@ -0,0 +1,5 @@
import image from 'netlify-cms-editor-component-image';
const { registerEditorComponent } = cms;
registerEditorComponent(image);

View File

@ -0,0 +1,3 @@
import './backends';
import './widgets';
import './editor-components';

View File

@ -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);

View File

@ -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,
},
};

View File

@ -24,24 +24,9 @@ const rules = () => ({
}); });
const plugins = () => { const plugins = () => {
const defaultPlugins = { return {
friendlyErrors: () => new FriendlyErrorsWebpackPlugin() 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 = () => { const stats = () => {
@ -75,7 +60,7 @@ const getConfig = () => ({
rules: Object.values(rules()).map(rule => rule()), rules: Object.values(rules()).map(rule => rule()),
}, },
plugins: Object.values(plugins()).map(plugin => plugin), plugins: Object.values(plugins()).map(plugin => plugin),
devtool: !isProduction && 'source-map', devtool: 'source-map',
target: 'web', target: 'web',
/** /**