chore: move local dev env to netlify-cms (#1538)
Before Width: | Height: | Size: 808 KiB After Width: | Height: | Size: 808 KiB |
@ -4,6 +4,8 @@ backend:
|
||||
display_url: https://example.com
|
||||
media_folder: "assets/uploads"
|
||||
|
||||
publish_mode: editorial_workflow
|
||||
|
||||
collections: # A list of collections the CMS should be able to edit
|
||||
- name: "posts" # Used in routes, ie.: /admin/collections/:slug/edit
|
||||
label: "Posts" # Used in the UI
|
@ -79,7 +79,7 @@
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<script src="netlify-cms.js"></script>
|
||||
<script src="dist/netlify-cms.js"></script>
|
||||
<script>
|
||||
var PostPreview = createClass({
|
||||
render: function() {
|
Before Width: | Height: | Size: 310 KiB After Width: | Height: | Size: 310 KiB |
Before Width: | Height: | Size: 4.3 KiB After Width: | Height: | Size: 4.3 KiB |
@ -10,7 +10,6 @@
|
||||
"dist/"
|
||||
],
|
||||
"scripts": {
|
||||
"watch": "webpack-dev-server --hot --open",
|
||||
"build": "cross-env NODE_ENV=production webpack"
|
||||
},
|
||||
"keywords": [
|
||||
@ -70,10 +69,8 @@
|
||||
"devDependencies": {
|
||||
"cross-env": "^5.2.0",
|
||||
"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"
|
||||
}
|
||||
}
|
||||
|
@ -1,40 +0,0 @@
|
||||
import { registerBackend, registerWidget, registerEditorComponent } from 'Lib/registry';
|
||||
import { GitHubBackend } from 'netlify-cms-backend-github';
|
||||
import { GitLabBackend } from 'netlify-cms-backend-gitlab';
|
||||
import { GitGatewayBackend } from 'netlify-cms-backend-git-gateway';
|
||||
import { BitbucketBackend } from 'netlify-cms-backend-bitbucket';
|
||||
import { TestBackend } from 'netlify-cms-backend-test';
|
||||
import { BooleanControl } from 'netlify-cms-widget-boolean';
|
||||
import { DateControl, DatePreview } from 'netlify-cms-widget-date';
|
||||
import { DateTimeControl, DateTimePreview } from 'netlify-cms-widget-datetime';
|
||||
import { FileControl, FilePreview } from 'netlify-cms-widget-file';
|
||||
import { ImageControl, ImagePreview } from 'netlify-cms-widget-image';
|
||||
import { ListControl, ListPreview } from 'netlify-cms-widget-list';
|
||||
import { ObjectControl, ObjectPreview } from 'netlify-cms-widget-object';
|
||||
import { MarkdownControl, MarkdownPreview } from 'netlify-cms-widget-markdown';
|
||||
import { NumberControl, NumberPreview } from 'netlify-cms-widget-number';
|
||||
import { RelationControl, RelationPreview } from 'netlify-cms-widget-relation';
|
||||
import { StringControl, StringPreview } from 'netlify-cms-widget-string';
|
||||
import { SelectControl, SelectPreview } from 'netlify-cms-widget-select';
|
||||
import { TextControl, TextPreview } from 'netlify-cms-widget-text';
|
||||
import image from 'netlify-cms-editor-component-image';
|
||||
|
||||
registerBackend('git-gateway', GitGatewayBackend);
|
||||
registerBackend('github', GitHubBackend);
|
||||
registerBackend('gitlab', GitLabBackend);
|
||||
registerBackend('test-repo', TestBackend);
|
||||
registerBackend('bitbucket', BitbucketBackend);
|
||||
registerWidget('boolean', BooleanControl);
|
||||
registerWidget('date', DateControl, DatePreview);
|
||||
registerWidget('datetime', DateTimeControl, DateTimePreview);
|
||||
registerWidget('file', FileControl, FilePreview);
|
||||
registerWidget('image', ImageControl, ImagePreview);
|
||||
registerWidget('list', ListControl, ListPreview);
|
||||
registerWidget('markdown', MarkdownControl, MarkdownPreview);
|
||||
registerWidget('number', NumberControl, NumberPreview);
|
||||
registerWidget('object', ObjectControl, ObjectPreview);
|
||||
registerWidget('relation', RelationControl, RelationPreview);
|
||||
registerWidget('string', StringControl, StringPreview);
|
||||
registerWidget('text', TextControl, TextPreview);
|
||||
registerWidget('select', SelectControl, SelectPreview);
|
||||
registerEditorComponent(image);
|
@ -6,23 +6,12 @@ const { getConfig, rules, plugins } = require('../../scripts/webpack.js');
|
||||
|
||||
const isProduction = process.env.NODE_ENV === 'production';
|
||||
|
||||
const entry = () => {
|
||||
const defaultEntry = ['./index.js'];
|
||||
|
||||
if (isProduction) {
|
||||
return defaultEntry;
|
||||
}
|
||||
|
||||
return [
|
||||
...defaultEntry,
|
||||
'../scripts/load-extensions.js',
|
||||
];
|
||||
};
|
||||
const baseConfig = getConfig();
|
||||
|
||||
module.exports = {
|
||||
...getConfig(),
|
||||
...baseConfig,
|
||||
context: path.join(__dirname, 'src'),
|
||||
entry: entry(),
|
||||
entry: ['./index.js'],
|
||||
module: {
|
||||
rules: [
|
||||
...Object.entries(rules)
|
||||
@ -46,24 +35,10 @@ module.exports = {
|
||||
],
|
||||
},
|
||||
plugins: [
|
||||
...Object.entries(plugins)
|
||||
.filter(([ key ]) => key !== 'friendlyErrors')
|
||||
.map(([ _, plugin ]) => plugin()),
|
||||
...baseConfig.plugins,
|
||||
new webpack.DefinePlugin({
|
||||
NETLIFY_CMS_VERSION: null,
|
||||
NETLIFY_CMS_CORE_VERSION: JSON.stringify(`${pkg.version}${isProduction ? '' : '-dev'}`),
|
||||
}),
|
||||
new FriendlyErrorsWebpackPlugin({
|
||||
compilationSuccessInfo: {
|
||||
messages: ['Netlify CMS is now running at http://localhost:8080'],
|
||||
},
|
||||
}),
|
||||
],
|
||||
devServer: {
|
||||
contentBase: './example',
|
||||
watchContentBase: true,
|
||||
quiet: true,
|
||||
host: 'localhost',
|
||||
port: 8080,
|
||||
},
|
||||
};
|
||||
|
Before Width: | Height: | Size: 808 KiB |
@ -1,171 +0,0 @@
|
||||
backend:
|
||||
name: test-repo
|
||||
|
||||
display_url: https://example.com
|
||||
media_folder: "assets/uploads"
|
||||
|
||||
collections: # A list of collections the CMS should be able to edit
|
||||
- name: "posts" # Used in routes, ie.: /admin/collections/:slug/edit
|
||||
label: "Posts" # Used in the UI
|
||||
label_singular: "Post" # Used in the UI, ie: "New Post"
|
||||
description: >
|
||||
The description is a great place for tone setting, high level information, and editing
|
||||
guidelines that are specific to a collection.
|
||||
folder: "_posts"
|
||||
slug: "{{year}}-{{month}}-{{day}}-{{slug}}"
|
||||
create: true # Allow users to create new documents in this collection
|
||||
fields: # The fields each document in this collection have
|
||||
- {label: "Title", name: "title", widget: "string", tagname: "h1"}
|
||||
- {label: "Publish Date", name: "date", widget: "datetime", format: "YYYY-MM-DD hh:mma"}
|
||||
- {label: "Cover Image", name: "image", widget: "image", required: false, tagname: ""}
|
||||
- {label: "Body", name: "body", widget: "markdown"}
|
||||
meta:
|
||||
- {label: "SEO Description", name: "description", widget: "text"}
|
||||
|
||||
- name: "faq" # Used in routes, ie.: /admin/collections/:slug/edit
|
||||
label: "FAQ" # Used in the UI
|
||||
folder: "_faqs"
|
||||
create: true # Allow users to create new documents in this collection
|
||||
fields: # The fields each document in this collection have
|
||||
- {label: "Question", name: "title", widget: "string", tagname: "h1"}
|
||||
- {label: "Answer", name: "body", widget: "markdown"}
|
||||
|
||||
- name: "settings"
|
||||
label: "Settings"
|
||||
delete: false # Prevent users from deleting documents in this collection
|
||||
editor:
|
||||
preview: false
|
||||
files:
|
||||
- name: "general"
|
||||
label: "Site Settings"
|
||||
file: "_data/settings.json"
|
||||
description: "General Site Settings"
|
||||
fields:
|
||||
- {label: "Global title", name: "site_title", widget: "string"}
|
||||
- label: "Post Settings"
|
||||
name: posts
|
||||
widget: "object"
|
||||
fields:
|
||||
- {label: "Number of posts on frontpage", name: front_limit, widget: number}
|
||||
- {label: "Default Author", name: author, widget: string}
|
||||
- {label: "Default Thumbnail", name: thumb, widget: image, class: "thumb"}
|
||||
|
||||
- name: "authors"
|
||||
label: "Authors"
|
||||
file: "_data/authors.yml"
|
||||
description: "Author descriptions"
|
||||
fields:
|
||||
- name: authors
|
||||
label: Authors
|
||||
label_singular: "Author"
|
||||
widget: list
|
||||
fields:
|
||||
- {label: "Name", name: "name", widget: "string"}
|
||||
- {label: "Description", name: "description", widget: "markdown"}
|
||||
|
||||
- name: "kitchenSink" # all the things in one entry, for documentation and quick testing
|
||||
label: "Kitchen Sink"
|
||||
folder: "_sink"
|
||||
create: true
|
||||
fields:
|
||||
- label: "Related Post"
|
||||
name: "post"
|
||||
widget: "relationKitchenSinkPost"
|
||||
collection: "posts"
|
||||
displayFields: ["title", "date"]
|
||||
searchFields: ["title", "body"]
|
||||
valueField: "title"
|
||||
- {label: "Title", name: "title", widget: "string"}
|
||||
- {label: "Boolean", name: "boolean", widget: "boolean", default: true}
|
||||
- {label: "Text", name: "text", widget: "text"}
|
||||
- {label: "Number", name: "number", widget: "number"}
|
||||
- {label: "Markdown", name: "markdown", widget: "markdown"}
|
||||
- {label: "Datetime", name: "datetime", widget: "datetime"}
|
||||
- {label: "Date", name: "date", widget: "date"}
|
||||
- {label: "Image", name: "image", widget: "image"}
|
||||
- {label: "File", name: "file", widget: "file"}
|
||||
- {label: "Select", name: "select", widget: "select", options: ["a", "b", "c"]}
|
||||
- {label: "Hidden", name: "hidden", widget: "hidden", default: "hidden"}
|
||||
- label: "Object"
|
||||
name: "object"
|
||||
widget: "object"
|
||||
fields:
|
||||
- label: "Related Post"
|
||||
name: "post"
|
||||
widget: "relationKitchenSinkPost"
|
||||
collection: "posts"
|
||||
searchFields: ["title", "body"]
|
||||
valueField: "title"
|
||||
- {label: "String", name: "string", widget: "string"}
|
||||
- {label: "Boolean", name: "boolean", widget: "boolean", default: false}
|
||||
- {label: "Text", name: "text", widget: "text"}
|
||||
- {label: "Number", name: "number", widget: "number"}
|
||||
- {label: "Markdown", name: "markdown", widget: "markdown"}
|
||||
- {label: "Datetime", name: "datetime", widget: "datetime"}
|
||||
- {label: "Date", name: "date", widget: "date"}
|
||||
- {label: "Image", name: "image", widget: "image"}
|
||||
- {label: "File", name: "file", widget: "file"}
|
||||
- {label: "Select", name: "select", widget: "select", options: ["a", "b", "c"]}
|
||||
- label: "List"
|
||||
name: "list"
|
||||
widget: "list"
|
||||
fields:
|
||||
- {label: "String", name: "string", widget: "string"}
|
||||
- {label: "Boolean", name: "boolean", widget: "boolean"}
|
||||
- {label: "Text", name: "text", widget: "text"}
|
||||
- {label: "Number", name: "number", widget: "number"}
|
||||
- {label: "Markdown", name: "markdown", widget: "markdown"}
|
||||
- {label: "Datetime", name: "datetime", widget: "datetime"}
|
||||
- {label: "Date", name: "date", widget: "date"}
|
||||
- {label: "Image", name: "image", widget: "image"}
|
||||
- {label: "File", name: "file", widget: "file"}
|
||||
- {label: "Select", name: "select", widget: "select", options: ["a", "b", "c"]}
|
||||
- label: "Object"
|
||||
name: "object"
|
||||
widget: "object"
|
||||
fields:
|
||||
- {label: "String", name: "string", widget: "string"}
|
||||
- {label: "Boolean", name: "boolean", widget: "boolean"}
|
||||
- {label: "Text", name: "text", widget: "text"}
|
||||
- {label: "Number", name: "number", widget: "number"}
|
||||
- {label: "Markdown", name: "markdown", widget: "markdown"}
|
||||
- {label: "Datetime", name: "datetime", widget: "datetime"}
|
||||
- {label: "Date", name: "date", widget: "date"}
|
||||
- {label: "Image", name: "image", widget: "image"}
|
||||
- {label: "File", name: "file", widget: "file"}
|
||||
- {label: "Select", name: "select", widget: "select", options: ["a", "b", "c"]}
|
||||
- label: "List"
|
||||
name: "list"
|
||||
widget: "list"
|
||||
fields:
|
||||
- label: "Related Post"
|
||||
name: "post"
|
||||
widget: "relationKitchenSinkPost"
|
||||
collection: "posts"
|
||||
searchFields: ["title", "body"]
|
||||
valueField: "title"
|
||||
- {label: "String", name: "string", widget: "string"}
|
||||
- {label: "Boolean", name: "boolean", widget: "boolean"}
|
||||
- {label: "Text", name: "text", widget: "text"}
|
||||
- {label: "Number", name: "number", widget: "number"}
|
||||
- {label: "Markdown", name: "markdown", widget: "markdown"}
|
||||
- {label: "Datetime", name: "datetime", widget: "datetime"}
|
||||
- {label: "Date", name: "date", widget: "date"}
|
||||
- {label: "Image", name: "image", widget: "image"}
|
||||
- {label: "File", name: "file", widget: "file"}
|
||||
- {label: "Select", name: "select", widget: "select", options: ["a", "b", "c"]}
|
||||
- {label: "Hidden", name: "hidden", widget: "hidden", default: "hidden"}
|
||||
- label: "Object"
|
||||
name: "object"
|
||||
widget: "object"
|
||||
fields:
|
||||
- {label: "String", name: "string", widget: "string"}
|
||||
- {label: "Boolean", name: "boolean", widget: "boolean"}
|
||||
- {label: "Text", name: "text", widget: "text"}
|
||||
- {label: "Number", name: "number", widget: "number"}
|
||||
- {label: "Markdown", name: "markdown", widget: "markdown"}
|
||||
- {label: "Datetime", name: "datetime", widget: "datetime"}
|
||||
- {label: "Date", name: "date", widget: "date"}
|
||||
- {label: "Image", name: "image", widget: "image"}
|
||||
- {label: "File", name: "file", widget: "file"}
|
||||
- {label: "Select", name: "select", widget: "select", options: ["a", "b", "c"]}
|
@ -1,21 +0,0 @@
|
||||
html,
|
||||
body {
|
||||
color: #444;
|
||||
font-size: 14px;
|
||||
font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
|
||||
}
|
||||
|
||||
body {
|
||||
padding: 20px;
|
||||
}
|
||||
|
||||
h1 {
|
||||
margin-top: 20px;
|
||||
color: #666;
|
||||
font-weight: bold;
|
||||
font-size: 32px;
|
||||
}
|
||||
|
||||
img {
|
||||
max-width: 100%;
|
||||
}
|
Before Width: | Height: | Size: 310 KiB |
Before Width: | Height: | Size: 4.3 KiB |
@ -7,6 +7,7 @@
|
||||
"bugs": "https://github.com/netlify/netlify-cms/issues",
|
||||
"main": "dist/netlify-cms.js",
|
||||
"scripts": {
|
||||
"watch": "webpack-dev-server --hot --open",
|
||||
"build": "cross-env NODE_ENV=production webpack"
|
||||
},
|
||||
"keywords": [
|
||||
@ -42,7 +43,9 @@
|
||||
},
|
||||
"devDependencies": {
|
||||
"cross-env": "^5.2.0",
|
||||
"friendly-errors-webpack-plugin": "^1.7.0",
|
||||
"webpack": "^4.16.1",
|
||||
"webpack-cli": "^3.1.0"
|
||||
"webpack-cli": "^3.1.0",
|
||||
"webpack-dev-server": "^3.1.5"
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,8 @@
|
||||
const path = require('path');
|
||||
const webpack = require('webpack');
|
||||
const FriendlyErrorsWebpackPlugin = require('friendly-errors-webpack-plugin');
|
||||
const pkg = require('./package.json');
|
||||
const { plugins } = require('../../scripts/webpack');
|
||||
const coreWebpackConfig = require('../netlify-cms-core/webpack.config.js');
|
||||
|
||||
const isProduction = process.env.NODE_ENV === 'production';
|
||||
@ -10,14 +12,29 @@ const baseConfig = {
|
||||
context: path.join(__dirname, 'src'),
|
||||
entry: './index.js',
|
||||
plugins: [
|
||||
...coreWebpackConfig.plugins.filter(plugin => !(plugin instanceof webpack.DefinePlugin)),
|
||||
...Object.entries(plugins)
|
||||
.filter(([ key ]) => key !== 'friendlyErrors')
|
||||
.map(([ _, plugin ]) => plugin()),
|
||||
new webpack.DefinePlugin({
|
||||
NETLIFY_CMS_VERSION: JSON.stringify(`${pkg.version}${isProduction ? '' : '-dev'}`),
|
||||
NETLIFY_CMS_CORE_VERSION: null,
|
||||
}),
|
||||
new FriendlyErrorsWebpackPlugin({
|
||||
compilationSuccessInfo: {
|
||||
messages: ['Netlify CMS is now running at http://localhost:8080'],
|
||||
},
|
||||
}),
|
||||
],
|
||||
devServer: {
|
||||
contentBase: '../../dev-test',
|
||||
watchContentBase: true,
|
||||
quiet: true,
|
||||
host: 'localhost',
|
||||
port: 8080,
|
||||
},
|
||||
};
|
||||
|
||||
if (isProduction) {
|
||||
module.exports = [
|
||||
baseConfig,
|
||||
|
||||
@ -37,3 +54,6 @@ module.exports = [
|
||||
},
|
||||
},
|
||||
];
|
||||
} else {
|
||||
module.exports = baseConfig;
|
||||
}
|
||||
|