feat: add byo react package netlify-cms-app (#2252)

This commit is contained in:
Tony Alves 2019-03-28 11:37:23 -07:00 committed by Shawn Erquhart
parent b4041d3971
commit ff4ffd7a70
10 changed files with 137 additions and 35 deletions

View File

@ -0,0 +1,43 @@
# Netlify CMS App
[![](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/netlify/netlifycms)
_For a Netlify CMS overview, see the general [Netlify CMS project README](https://github.com/netlify/netlify-cms)._
## Purpose
This package is similar to the [`netlify-cms`](https://github.com/netlify/netlify-cms/tree/master/packages/netlify-cms/) package, but is designed for use with extensions. It serves that purpose in the following ways.
- It does not automatically initialize - you must run the CMS `init` method.
- It does not include `react` or `react-dom` - they are required as peer dependencies.
- It does not include the following extensions:
- [`netlify-cms-media-library-cloudinary`]
- [`netlify-cms-media-library-uploadcare`]
## Usage
Install via script tag:
```html
<!-- Excluding `doctype` and `head` but you should add them -->
<body>
<!-- Add these scripts to the bottom of the body -->
<script src="https://unpkg.com/react@^16/umd/react.production.min.js"></script>
<script src="https://unpkg.com/react-dom@^16/umd/react-dom.production.min.js"></script>
<script src="https://unpkg.com/netlify-cms-app/dist/netlify-cms-app.js"></script>
<!-- Initialize the CMS -->
<script>
NetlifyCmsApp.init();
</script>
</body>
```
Install via npm:
```
npm i react react-dom netlify-cms-app
```
```js
import CMS from 'netlify-cms-app';
CMS.init();
```

View File

@ -0,0 +1,56 @@
{
"name": "netlify-cms-app",
"description": "An extensible, open source, Git-based, React CMS for static sites. Reusable congiuration with React as peer.",
"version": "2.8.1-beta.1",
"homepage": "https://www.netlifycms.org",
"repository": "https://github.com/netlify/netlify-cms/tree/master/packages/netlify-cms-app",
"bugs": "https://github.com/netlify/netlify-cms/issues",
"main": "dist/netlify-cms-app.js",
"scripts": {
"develop": "yarn build:esm --watch",
"build": "cross-env NODE_ENV=production webpack",
"build:esm": "cross-env NODE_ENV=esm babel src --out-dir dist/esm --ignore src/**/__tests__/* --root-mode upward -s"
},
"keywords": [
"netlify",
"cms",
"content editing",
"static site generators",
"jamstack"
],
"license": "MIT",
"dependencies": {
"@emotion/core": "^10.0.9",
"@emotion/styled": "^10.0.9",
"immutable": "^3.7.6",
"lodash": "^4.17.11",
"moment": "^2.24.0",
"netlify-cms-backend-bitbucket": "^2.3.1-beta.1",
"netlify-cms-backend-git-gateway": "^2.4.1-beta.1",
"netlify-cms-backend-github": "^2.4.1-beta.1",
"netlify-cms-backend-gitlab": "^2.3.1-beta.1",
"netlify-cms-backend-test": "^2.2.1-beta.1",
"netlify-cms-core": "^2.10.1-beta.1",
"netlify-cms-editor-component-image": "^2.4.1-beta.1",
"netlify-cms-widget-boolean": "^2.2.1-beta.1",
"netlify-cms-widget-date": "^2.3.1-beta.1",
"netlify-cms-widget-datetime": "^2.2.1-beta.1",
"netlify-cms-widget-file": "^2.4.1-beta.1",
"netlify-cms-widget-image": "^2.3.1-beta.1",
"netlify-cms-widget-list": "^2.3.1-beta.1",
"netlify-cms-widget-map": "^1.3.1-beta.1",
"netlify-cms-widget-markdown": "^2.4.1-beta.1",
"netlify-cms-widget-number": "^2.3.1-beta.1",
"netlify-cms-widget-object": "^2.2.1-beta.1",
"netlify-cms-widget-relation": "^2.3.1-beta.1",
"netlify-cms-widget-select": "^2.4.1-beta.1",
"netlify-cms-widget-string": "^2.2.1-beta.1",
"netlify-cms-widget-text": "^2.2.1-beta.1",
"prop-types": "^15.7.2",
"react-immutable-proptypes": "^2.1.0"
},
"peerDependencies": {
"react": "^16.8.4",
"react-dom": "^16.8.4"
}
}

View File

@ -0,0 +1,9 @@
import { NetlifyCmsCore as CMS } from 'netlify-cms-core';
import './backends';
import './widgets';
import './editor-components';
export const NetlifyCmsApp = {
...CMS,
};
export default CMS;

View File

@ -0,0 +1,25 @@
const path = require('path');
const webpack = require('webpack');
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 baseConfig = {
...baseWebpackConfig,
context: path.join(__dirname, 'src'),
entry: './index.js',
plugins: [
...Object.entries(plugins)
.filter(([key]) => key !== 'friendlyErrors')
.map(([, plugin]) => plugin()),
new webpack.DefinePlugin({
NETLIFY_CMS_VERSION: JSON.stringify(`- app - ${pkg.version}${isProduction ? '' : '-dev'}`),
NETLIFY_CMS_CORE_VERSION: null,
}),
],
};
module.exports = baseConfig;

View File

@ -20,38 +20,10 @@
],
"license": "MIT",
"dependencies": {
"@emotion/core": "^10.0.9",
"@emotion/styled": "^10.0.9",
"create-react-class": "^15.6.0",
"immutable": "^3.7.6",
"lodash": "^4.17.11",
"moment": "^2.24.0",
"netlify-cms-backend-bitbucket": "^2.3.1-beta.1",
"netlify-cms-backend-git-gateway": "^2.4.1-beta.1",
"netlify-cms-backend-github": "^2.4.1-beta.1",
"netlify-cms-backend-gitlab": "^2.3.1-beta.1",
"netlify-cms-backend-test": "^2.2.1-beta.1",
"netlify-cms-core": "^2.10.1-beta.1",
"netlify-cms-editor-component-image": "^2.4.1-beta.1",
"netlify-cms-app": "^2.8.1-beta.1",
"netlify-cms-media-library-cloudinary": "^1.3.1-beta.1",
"netlify-cms-media-library-uploadcare": "^0.5.1-beta.1",
"netlify-cms-widget-boolean": "^2.2.1-beta.1",
"netlify-cms-widget-date": "^2.3.1-beta.1",
"netlify-cms-widget-datetime": "^2.2.1-beta.1",
"netlify-cms-widget-file": "^2.4.1-beta.1",
"netlify-cms-widget-image": "^2.3.1-beta.1",
"netlify-cms-widget-list": "^2.3.1-beta.1",
"netlify-cms-widget-map": "^1.3.1-beta.1",
"netlify-cms-widget-markdown": "^2.4.1-beta.1",
"netlify-cms-widget-number": "^2.3.1-beta.1",
"netlify-cms-widget-object": "^2.2.1-beta.1",
"netlify-cms-widget-relation": "^2.3.1-beta.1",
"netlify-cms-widget-select": "^2.4.1-beta.1",
"netlify-cms-widget-string": "^2.2.1-beta.1",
"netlify-cms-widget-text": "^2.2.1-beta.1",
"prop-types": "^15.7.2",
"react": "^16.8.4",
"react-dom": "^16.8.4",
"react-immutable-proptypes": "^2.1.0"
"react-dom": "^16.8.4"
}
}

View File

@ -1,9 +1,6 @@
import createReactClass from 'create-react-class';
import React from 'react';
import { NetlifyCmsCore as CMS } from 'netlify-cms-core';
import './backends';
import './widgets';
import './editor-components';
import { NetlifyCmsApp as CMS } from 'netlify-cms-app/dist/esm';
import './media-libraries';
/**

View File

@ -3940,7 +3940,7 @@ create-hmac@^1.1.0, create-hmac@^1.1.2, create-hmac@^1.1.4:
safe-buffer "^5.0.1"
sha.js "^2.4.8"
create-react-class@^15.5.1, create-react-class@^15.5.2, create-react-class@^15.6.0:
create-react-class@^15.5.1, create-react-class@^15.5.2:
version "15.6.3"
resolved "https://registry.yarnpkg.com/create-react-class/-/create-react-class-15.6.3.tgz#2d73237fb3f970ae6ebe011a9e66f46dbca80036"
integrity sha512-M+/3Q6E6DLO6Yx3OwrWjwHBnvfXXYA7W+dFjt/ZDBemHO1DDZhsalX/NUtnTYclN6GfnBDRh4qRHjcDHmlJBJg==