Skip to content

Commit

Permalink
chore: upgrade cms to DECAP
Browse files Browse the repository at this point in the history
  • Loading branch information
smarcet committed May 7, 2024
1 parent 8446c57 commit ec33ece
Show file tree
Hide file tree
Showing 5 changed files with 905 additions and 851 deletions.
37 changes: 16 additions & 21 deletions gatsby-config.js
Original file line number Diff line number Diff line change
Expand Up @@ -122,29 +122,29 @@ module.exports = {
},
},
{
resolve: 'gatsby-plugin-netlify-cms',
resolve: "gatsby-plugin-decap-cms",
options: {
modulePath: `${__dirname}/src/cms/cms.js`,
publicPath: 'netlify/admin',
manualInit: true,
customizeWebpackConfig: (config, { stage, plugins }) => {
enableIdentityWidget: true,
htmlTitle: `Kata Containers | Content Manager`,
includeRobots: false,
customizeWebpackConfig: (config) => {
/**
* Fixes Module not found: Error: Can"t resolve "path" bug.
* Webpack 5 doesn"t include browser polyfills for node APIs by default anymore,
* so we need to provide them ourselves.
* @see https://github.com/postcss/postcss/issues/1509#issuecomment-772097567
* @see https://github.com/gatsbyjs/gatsby/issues/31475
* @see https://github.com/gatsbyjs/gatsby/issues/31179#issuecomment-844588682
*/
config.resolve = {
...config.resolve,
alias: {
...config.resolve.alias,
path: require.resolve("path-browserify")
},
fallback: {
...config.resolve.fallback,
fs: false,
path: false,
}
path: require.resolve("path-browserify"),
},
};
if (stage === "build-javascript" || stage === "develop") {
config.plugins.push(plugins.provide({ process: "process/browser" }));
}
config.plugins.push(plugins.provide({ Buffer: ["buffer", "Buffer"] }));
}
},
},
},
{
Expand All @@ -156,11 +156,6 @@ module.exports = {
}, // must be after other CSS plugins
{
resolve: 'gatsby-plugin-netlify', // make sure to keep it last in the array,
options: {
enableIdentityWidget: true,
htmlTitle: `Kata Containers | Content Manager`,
includeRobots: false,
}
}
],
}
8 changes: 5 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,16 @@
"@ncwidgets/id": "^0.9.0",
"axios": "^0.21.2",
"bulma": "^0.8.0",
"events": "^3.3.0",
"gatsby": "^5.8.1",
"gatsby-cli": "^5.8.0",
"gatsby-plugin-google-analytics": "^5.12.0",
"gatsby-plugin-google-gtag": "^5.12.3",
"gatsby-plugin-image": "^3.12.3",
"gatsby-plugin-manifest": "^5.12.3",
"gatsby-plugin-netlify": "^5.1.1",
"gatsby-plugin-netlify-cms": "^7.12.0",
"decap-cms-app": "^3.0.12",
"gatsby-plugin-decap-cms": "^4.0.3",
"gatsby-plugin-offline": "^6.12.3",
"gatsby-plugin-purgecss": "^6.2.1",
"gatsby-plugin-react-helmet": "^6.12.0",
Expand All @@ -33,7 +35,6 @@
"lodash-webpack-plugin": "^0.11.4",
"moment": "^2.29.2",
"navigation-widget": "^1.0.16",
"netlify-cms-app": "2.15.72",
"path-browserify": "^1.0.1",
"prop-types": "^15.6.0",
"react": "^18.2.0",
Expand All @@ -50,8 +51,9 @@
"scripts": {
"clean": "gatsby clean",
"start": "yarn clean develop",
"gatsby-clean": "gatsby clean",
"build": "yarn clean && gatsby build",
"develop": "yarn clean && gatsby develop",
"develop": "NODE_ENV=development NODE_OPTIONS=--max-old-space-size=8192 npm run gatsby-clean && node --trace-warnings node_modules/.bin/gatsby develop --S -H 0.0.0.0",
"format": "prettier --trailing-comma es5 --no-semi --single-quote --write \"{gatsby-*.js,src/**/*.js}\"",
"test": "echo \"Error: no test specified\" && exit 1"
},
Expand Down
2 changes: 1 addition & 1 deletion src/cms/cms.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import CMS from 'netlify-cms-app'
import CMS from 'decap-cms-app'

import CommunityPagePreview from './preview-templates/CommunityPagePreview'
import DocsPagePreview from './preview-templates/DocsPagePreview'
Expand Down
2 changes: 1 addition & 1 deletion static/admin/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ collections:
]}
- {label: "Title", name: title, widget: string}
- {label: "Sub Title", name: subTitle, widget: string}
- {label: "Intro", name: intro, widget: object, fields:[
- {label: "Intro", name: intro, widget: object, fields: [
{label: Text, name: text, widget: text},
{label: "Buttons", name: buttons, widget: list, fields: [
{label: Text, name: text, widget: string},
Expand Down
Loading

0 comments on commit ec33ece

Please sign in to comment.