add-cms
This commit is contained in:
1347
source/admin/packages/decap-cms/CHANGELOG.md
Normal file
1347
source/admin/packages/decap-cms/CHANGELOG.md
Normal file
File diff suppressed because it is too large
Load Diff
50
source/admin/packages/decap-cms/README.md
Normal file
50
source/admin/packages/decap-cms/README.md
Normal file
@@ -0,0 +1,50 @@
|
||||
# Decap CMS
|
||||
|
||||
A CMS for static site generators. Give users a simple way to edit
|
||||
and add content to any site built with a static site generator.
|
||||
|
||||
[decapcms.org](https://www.decapcms.org/)
|
||||
|
||||
## Community Chat
|
||||
|
||||
<a href="https://decapcms.org/chat">Join us on Discord</a>
|
||||
|
||||
## How It Works
|
||||
|
||||
Decap CMS is a single-page app that you pull into the `/admin` part of your site.
|
||||
|
||||
It presents a clean UI for editing content stored in a Git repository.
|
||||
|
||||
You setup a YAML config to describe the content model of your site, and typically
|
||||
tweak the main layout of the CMS a bit to fit your own site.
|
||||
|
||||
When a user navigates to `/admin/` they'll be prompted to log in, and once authenticated
|
||||
they'll be able to create new content or edit existing content.
|
||||
|
||||
Read more about Decap CMS [Core Concepts](https://www.decapcms.org/docs/intro/).
|
||||
|
||||
## Installation and Configuration
|
||||
|
||||
The Decap CMS can be used in two different ways.
|
||||
|
||||
* A Quick and easy install, that requires you to create a single HTML file and a configuration file. All the CMS JavaScript and CSS are loaded from a CDN.
|
||||
To learn more about this installation method, refer to the [Quick Start Guide](https://www.decapcms.org/docs/quick-start/)
|
||||
* A complete, more complex install, that gives you more flexibility but requires that you use a static site builder with a build system that supports npm packages.
|
||||
|
||||
## Contributing
|
||||
|
||||
New contributors are always welcome! Check out [CONTRIBUTING.md](https://github.com/decaporg/decap-cms/blob/main/CONTRIBUTING.md) to get involved.
|
||||
|
||||
## Change Log
|
||||
|
||||
This project adheres to [Semantic Versioning](http://semver.org/).
|
||||
Every release is documented on the GitHub [Releases](https://github.com/decaporg/decap-cms/releases) page.
|
||||
|
||||
## License
|
||||
|
||||
Decap CMS is released under the [MIT License](LICENSE).
|
||||
Please make sure you understand its [implications and guarantees](https://writing.kemitchell.com/2016/09/21/MIT-License-Line-by-Line.html).
|
||||
|
||||
## Maintainers
|
||||
|
||||
Maintained with care by <a href="https://techhub.p-m.si/">PM</a> & friends.
|
||||
34
source/admin/packages/decap-cms/package.json
Normal file
34
source/admin/packages/decap-cms/package.json
Normal file
@@ -0,0 +1,34 @@
|
||||
{
|
||||
"name": "decap-cms",
|
||||
"description": "An extensible, open source, Git-based, React CMS for static sites.",
|
||||
"version": "3.8.3",
|
||||
"homepage": "https://www.decapcms.org",
|
||||
"repository": "https://github.com/decaporg/decap-cms",
|
||||
"bugs": "https://github.com/decaporg/decap-cms/issues",
|
||||
"main": "dist/decap-cms.js",
|
||||
"scripts": {
|
||||
"webpack": "node --max_old_space_size=4096 ../../node_modules/webpack/bin/webpack.js",
|
||||
"build": "cross-env NODE_ENV=production run-s webpack",
|
||||
"build-preview": "cross-env NODE_ENV=production webpack serve --open",
|
||||
"develop": "webpack serve --hot"
|
||||
},
|
||||
"keywords": [
|
||||
"cms",
|
||||
"content editing",
|
||||
"static site generators",
|
||||
"jamstack"
|
||||
],
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"codemirror": "^5.46.0",
|
||||
"create-react-class": "^15.7.0",
|
||||
"decap-cms-app": "^3.8.3",
|
||||
"decap-cms-media-library-cloudinary": "^3.1.0",
|
||||
"decap-cms-media-library-uploadcare": "^3.0.2",
|
||||
"file-loader": "^6.2.0",
|
||||
"react": "^19.1.0",
|
||||
"react-dom": "^19.1.0",
|
||||
"svgo-loader": "^3.0.3"
|
||||
},
|
||||
"incrementToForceBump": 2
|
||||
}
|
||||
5
source/admin/packages/decap-cms/shims/cms.css
Normal file
5
source/admin/packages/decap-cms/shims/cms.css
Normal file
@@ -0,0 +1,5 @@
|
||||
/**
|
||||
* Decap CMS 2.0 moved from static CSS to CSS-in-JS. Some site builds are configured to look
|
||||
* for `cms.css`, and will break when it's missing, so we're putting out this blank file to help.
|
||||
* We'll eventually remove it, so please update your build to not require it.
|
||||
*/
|
||||
@@ -0,0 +1,3 @@
|
||||
console.warn(
|
||||
'You seem to be loading Decap CMS by fetching `dist/cms.js` from a CDN. That file is deprecated and will be removed in the next major release. Please use `dist/decap-cms.js` instead.',
|
||||
);
|
||||
7
source/admin/packages/decap-cms/src/extensions.js
Normal file
7
source/admin/packages/decap-cms/src/extensions.js
Normal file
@@ -0,0 +1,7 @@
|
||||
import { DecapCmsApp as CMS } from 'decap-cms-app';
|
||||
// Media libraries
|
||||
import uploadcare from 'decap-cms-media-library-uploadcare';
|
||||
import cloudinary from 'decap-cms-media-library-cloudinary';
|
||||
|
||||
CMS.registerMediaLibrary(uploadcare);
|
||||
CMS.registerMediaLibrary(cloudinary);
|
||||
34
source/admin/packages/decap-cms/src/index.js
Normal file
34
source/admin/packages/decap-cms/src/index.js
Normal file
@@ -0,0 +1,34 @@
|
||||
import createReactClass from 'create-react-class';
|
||||
import React from 'react';
|
||||
import { DecapCmsApp as CMS } from 'decap-cms-app';
|
||||
import './extensions';
|
||||
|
||||
/**
|
||||
* Load Decap CMS automatically if `window.CMS_MANUAL_INIT` is set.
|
||||
*/
|
||||
if (!window.CMS_MANUAL_INIT) {
|
||||
CMS.init();
|
||||
} else {
|
||||
console.log('`window.CMS_MANUAL_INIT` flag set, skipping automatic initialization.');
|
||||
}
|
||||
|
||||
/**
|
||||
* Add extension hooks to global scope.
|
||||
*/
|
||||
if (typeof window !== 'undefined') {
|
||||
window.CMS = CMS;
|
||||
window.initCMS = CMS.init;
|
||||
window.createClass = window.createClass || createReactClass;
|
||||
window.h = window.h || React.createElement;
|
||||
/**
|
||||
* Log the version number.
|
||||
*/
|
||||
if (typeof DECAP_CMS_VERSION === 'string') {
|
||||
console.log(`decap-cms ${DECAP_CMS_VERSION}`);
|
||||
}
|
||||
}
|
||||
|
||||
export const DecapCms = {
|
||||
...CMS,
|
||||
};
|
||||
export default CMS;
|
||||
64
source/admin/packages/decap-cms/webpack.config.js
Normal file
64
source/admin/packages/decap-cms/webpack.config.js
Normal file
@@ -0,0 +1,64 @@
|
||||
const path = require('path');
|
||||
require('dotenv').config({ path: path.join(__dirname, '..', '..', '.env') });
|
||||
const webpack = require('webpack');
|
||||
const FriendlyErrorsWebpackPlugin = require('@soda/friendly-errors-webpack-plugin');
|
||||
const CopyWebpackPlugin = require('copy-webpack-plugin');
|
||||
|
||||
const pkg = require('./package.json');
|
||||
const { getConfig, plugins } = require('../../scripts/webpack');
|
||||
const baseWebpackConfig = getConfig({ baseOnly: true });
|
||||
|
||||
const isProduction = process.env.NODE_ENV === 'production';
|
||||
console.log(`${pkg.version}${isProduction ? '' : '-dev'}`);
|
||||
|
||||
const devServerPort = parseInt(process.env.DECAP_CMS_DEV_SERVER_PORT || `${8080}`);
|
||||
|
||||
const baseConfig = {
|
||||
...baseWebpackConfig,
|
||||
plugins: [
|
||||
...Object.entries(plugins)
|
||||
.filter(([key]) => key !== 'friendlyErrors')
|
||||
.map(([, plugin]) => plugin()),
|
||||
new webpack.DefinePlugin({
|
||||
DECAP_CMS_VERSION: JSON.stringify(`${pkg.version}${isProduction ? '' : '-dev'}`),
|
||||
}),
|
||||
new FriendlyErrorsWebpackPlugin({
|
||||
compilationSuccessInfo: {
|
||||
messages: [`Decap CMS is now running at http://localhost:${devServerPort}`],
|
||||
},
|
||||
}),
|
||||
new CopyWebpackPlugin({ patterns: [{ from: './shims/cms.css', to: './' }] }),
|
||||
],
|
||||
devServer: {
|
||||
static: '../../dev-test',
|
||||
devMiddleware: {
|
||||
publicPath: '/dist/',
|
||||
},
|
||||
host: '0.0.0.0',
|
||||
port: devServerPort,
|
||||
client: {
|
||||
overlay: false,
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
if (isProduction) {
|
||||
module.exports = [
|
||||
baseConfig,
|
||||
|
||||
/**
|
||||
* Output the same script a second time, but named `cms.js`, and with a
|
||||
* deprecation notice.
|
||||
*/
|
||||
{
|
||||
...baseConfig,
|
||||
entry: ['./shims/deprecate-old-dist.js', baseConfig.entry],
|
||||
output: {
|
||||
...baseConfig.output,
|
||||
filename: 'cms.js',
|
||||
},
|
||||
},
|
||||
];
|
||||
} else {
|
||||
module.exports = baseConfig;
|
||||
}
|
||||
Reference in New Issue
Block a user