From e7dd7bdb2a1f8f0b35954248d788518e5cbd1c4f Mon Sep 17 00:00:00 2001 From: PTrottier <31802216+PTrottier@users.noreply.github.com> Date: Mon, 30 Oct 2023 22:58:48 +0000 Subject: [PATCH 1/7] docs: fix url to demo instance (#961) --- packages/docs/content/docs/configuration-options.mdx | 2 +- packages/docs/content/docs/test-backend.mdx | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/docs/content/docs/configuration-options.mdx b/packages/docs/content/docs/configuration-options.mdx index 185a3f2bf..9fb2ef3c3 100644 --- a/packages/docs/content/docs/configuration-options.mdx +++ b/packages/docs/content/docs/configuration-options.mdx @@ -15,7 +15,7 @@ Alternatively, you can specify a custom config file using a link tag: If you prefer, you can use a javascript file (`admin/config.js`) instead of a yaml file. Simply import the javascript config and pass it into your `CMS.init({ config })` call. -To see working configuration examples, you can [start from a template](/docs/start-with-a-template) or check out the [CMS demo site](https://demo-staticcms.org/). (No login required: click the login button and Static CMS will open.) You can refer to the demo [configuration code](https://github.com/StaticJsCMS/static-cms/blob/main/core/dev-test/config.yml) to see how each option was configured. +To see working configuration examples, you can [start from a template](/docs/start-with-a-template) or check out the [CMS demo site](https://demo.staticcms.org/). (No login required: click the login button and Static CMS will open.) You can refer to the demo [configuration code](https://github.com/StaticJsCMS/static-cms/blob/main/core/dev-test/config.yml) to see how each option was configured. You can find details about all configuration options below. Note that [YAML syntax](https://en.wikipedia.org/wiki/YAML#Basic_components) allows lists and objects to be written in block or inline style, and the code samples below include a mix of both. diff --git a/packages/docs/content/docs/test-backend.mdx b/packages/docs/content/docs/test-backend.mdx index 103139a55..a131b2d33 100644 --- a/packages/docs/content/docs/test-backend.mdx +++ b/packages/docs/content/docs/test-backend.mdx @@ -6,7 +6,7 @@ weight: 60 - **Name**: `gitlab` -You can use the `test-repo` backend to try out Static CMS without connecting to a Git repo. With this backend, you can write and publish content normally, but any changes will disappear when you reload the page. This backend powers the Static CMS [demo site](https://demo-staticcms.org/). +You can use the `test-repo` backend to try out Static CMS without connecting to a Git repo. With this backend, you can write and publish content normally, but any changes will disappear when you reload the page. This backend powers the Static CMS [demo site](https://demo.staticcms.org/). **Note:** The `test-repo` backend can't access your local file system, nor does it connect to a Git repo, thus you won't see any existing files while using it. From bf0c5b69712f7ae217b76d99011935af05ae846e Mon Sep 17 00:00:00 2001 From: Daniel Lautzenheiser Date: Tue, 31 Oct 2023 09:12:26 -0400 Subject: [PATCH 2/7] fix: output app version number just like core (#962) --- packages/app/.eslintrc.js | 2 +- packages/app/babel.config.js | 4 ++-- packages/app/webpack.config.js | 4 ++++ packages/core/src/bootstrap.tsx | 4 +++- packages/core/src/components/ErrorBoundary.tsx | 6 ++++-- packages/core/src/types/constants.d.ts | 1 + packages/docs/.eslintrc.js | 1 - packages/tools/babel.config.js | 6 ------ 8 files changed, 15 insertions(+), 13 deletions(-) diff --git a/packages/app/.eslintrc.js b/packages/app/.eslintrc.js index 91bfc7211..90bd58f4d 100644 --- a/packages/app/.eslintrc.js +++ b/packages/app/.eslintrc.js @@ -15,7 +15,7 @@ module.exports = { 'cypress/globals': true, }, globals: { - STATIC_CMS_CORE_VERSION: false, + STATIC_CMS_APP_VERSION: false, CMS_ENV: false, }, rules: { diff --git a/packages/app/babel.config.js b/packages/app/babel.config.js index 40a4d8b86..913730138 100644 --- a/packages/app/babel.config.js +++ b/packages/app/babel.config.js @@ -1,6 +1,6 @@ const path = require('path'); -const coreVersion = require('./package.json').version; +const appVersion = require('./package.json').version; const isProduction = process.env.NODE_ENV === 'production'; const isTest = process.env.NODE_ENV === 'test'; const isESM = process.env.NODE_ENV === 'esm'; @@ -59,7 +59,7 @@ function plugins() { [ 'transform-define', { - STATIC_CMS_CORE_VERSION: `${coreVersion}`, + STATIC_CMS_APP_VERSION: `${appVersion}`, }, ], [ diff --git a/packages/app/webpack.config.js b/packages/app/webpack.config.js index fc525d6f5..3e1c17287 100644 --- a/packages/app/webpack.config.js +++ b/packages/app/webpack.config.js @@ -3,6 +3,7 @@ const webpack = require('webpack'); const ReactRefreshWebpackPlugin = require('@pmmmwh/react-refresh-webpack-plugin'); const TsconfigPathsPlugin = require('tsconfig-paths-webpack-plugin'); const MiniCssExtractPlugin = require('mini-css-extract-plugin'); +const pkg = require('./package.json'); const isProduction = process.env.NODE_ENV === 'production'; const devServerPort = parseInt(process.env.STATIC_CMS_DEV_SERVER_PORT || `${8080}`); @@ -90,6 +91,9 @@ module.exports = { process: 'process/browser', Buffer: ['buffer', 'Buffer'], }), + new webpack.DefinePlugin({ + STATIC_CMS_APP_VERSION: JSON.stringify(`${pkg.version}${isProduction ? '' : '-dev'}`), + }), ].filter(Boolean), output: { path: path.resolve(__dirname, 'dist'), diff --git a/packages/core/src/bootstrap.tsx b/packages/core/src/bootstrap.tsx index 6148ba6d2..54a7bab83 100644 --- a/packages/core/src/bootstrap.tsx +++ b/packages/core/src/bootstrap.tsx @@ -81,7 +81,9 @@ function bootstrap(opts?: { /** * Log the version number. */ - if (typeof STATIC_CMS_CORE_VERSION === 'string') { + if (typeof STATIC_CMS_APP_VERSION === 'string') { + console.info(`[StaticCMS] Using @staticcms/app ${STATIC_CMS_APP_VERSION}`); + } else if (typeof STATIC_CMS_CORE_VERSION === 'string') { console.info(`[StaticCMS] Using @staticcms/core ${STATIC_CMS_CORE_VERSION}`); } diff --git a/packages/core/src/components/ErrorBoundary.tsx b/packages/core/src/components/ErrorBoundary.tsx index 1d54d6349..95e3d9c03 100644 --- a/packages/core/src/components/ErrorBoundary.tsx +++ b/packages/core/src/components/ErrorBoundary.tsx @@ -51,8 +51,10 @@ ${config} function buildIssueTemplate(config?: Config) { let version = ''; - if (typeof STATIC_CMS_CORE_VERSION === 'string') { - version = `static-cms@${STATIC_CMS_CORE_VERSION}`; + if (typeof STATIC_CMS_APP_VERSION === 'string') { + version = `@staticcms/app@${STATIC_CMS_APP_VERSION}`; + } else if (typeof STATIC_CMS_CORE_VERSION === 'string') { + version = `@staticcms/core@${STATIC_CMS_CORE_VERSION}`; } const template = getIssueTemplate( version, diff --git a/packages/core/src/types/constants.d.ts b/packages/core/src/types/constants.d.ts index a94128ec9..40a4ad217 100644 --- a/packages/core/src/types/constants.d.ts +++ b/packages/core/src/types/constants.d.ts @@ -1 +1,2 @@ declare const STATIC_CMS_CORE_VERSION: string; +declare const STATIC_CMS_APP_VERSION: string; diff --git a/packages/docs/.eslintrc.js b/packages/docs/.eslintrc.js index 6ae5ddb50..d2ced921a 100644 --- a/packages/docs/.eslintrc.js +++ b/packages/docs/.eslintrc.js @@ -15,7 +15,6 @@ module.exports = { jest: true, }, globals: { - STATIC_CMS_CORE_VERSION: false, CMS_ENV: false, }, rules: { diff --git a/packages/tools/babel.config.js b/packages/tools/babel.config.js index 40a4d8b86..3dc431bd8 100644 --- a/packages/tools/babel.config.js +++ b/packages/tools/babel.config.js @@ -56,12 +56,6 @@ function plugins() { if (isESM) { return [ ...defaultPlugins, - [ - 'transform-define', - { - STATIC_CMS_CORE_VERSION: `${coreVersion}`, - }, - ], [ 'inline-react-svg', { From 597d135ff7e557471086a422da627cb457454405 Mon Sep 17 00:00:00 2001 From: Daniel Lautzenheiser Date: Tue, 31 Oct 2023 09:13:06 -0400 Subject: [PATCH 3/7] v3.4.3 --- lerna.json | 2 +- packages/app/package.json | 4 ++-- packages/core/package.json | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lerna.json b/lerna.json index 1c3478f5a..e26e32367 100644 --- a/lerna.json +++ b/lerna.json @@ -1,5 +1,5 @@ { "$schema": "node_modules/lerna/schemas/lerna-schema.json", "useWorkspaces": true, - "version": "3.4.2" + "version": "3.4.3" } diff --git a/packages/app/package.json b/packages/app/package.json index 4cd5131fe..7b093480c 100644 --- a/packages/app/package.json +++ b/packages/app/package.json @@ -1,6 +1,6 @@ { "name": "@staticcms/app", - "version": "3.4.2", + "version": "3.4.3", "license": "MIT", "description": "Static CMS application.", "repository": "https://github.com/StaticJsCMS/static-cms", @@ -40,7 +40,7 @@ "@babel/eslint-parser": "7.21.3", "@babel/runtime": "7.21.0", "@emotion/babel-preset-css-prop": "11.10.0", - "@staticcms/core": "^3.4.2", + "@staticcms/core": "^3.4.3", "buffer": "6.0.3", "react": "18.2.0", "react-dom": "18.2.0", diff --git a/packages/core/package.json b/packages/core/package.json index cd7057957..85bd2eae4 100644 --- a/packages/core/package.json +++ b/packages/core/package.json @@ -1,6 +1,6 @@ { "name": "@staticcms/core", - "version": "3.4.2", + "version": "3.4.3", "license": "MIT", "description": "Static CMS core application.", "repository": "https://github.com/StaticJsCMS/static-cms", From 215cb21e892bfb4682f154406c61980690455eaf Mon Sep 17 00:00:00 2001 From: Daniel Lautzenheiser Date: Tue, 31 Oct 2023 11:31:04 -0400 Subject: [PATCH 4/7] feat: basic support for mdx file extension (#964) --- packages/app/.editorconfig | 3 ++ packages/core/.editorconfig | 3 ++ .../backends/proxy/_data/navigation.mdx | 26 +++++++++++++ .../core/dev-test/backends/proxy/config.yml | 39 +++++++++++++++++++ packages/core/src/formats/formats.ts | 1 + packages/docs/.editorconfig | 3 ++ .../docs/content/docs/collection-overview.mdx | 2 +- 7 files changed, 76 insertions(+), 1 deletion(-) create mode 100644 packages/core/dev-test/backends/proxy/_data/navigation.mdx diff --git a/packages/app/.editorconfig b/packages/app/.editorconfig index 5fe0621b4..e2e9c4478 100644 --- a/packages/app/.editorconfig +++ b/packages/app/.editorconfig @@ -17,3 +17,6 @@ quote_type = single [*.md] trim_trailing_whitespace = false + +[*.mdx] +trim_trailing_whitespace = false diff --git a/packages/core/.editorconfig b/packages/core/.editorconfig index 5fe0621b4..e2e9c4478 100644 --- a/packages/core/.editorconfig +++ b/packages/core/.editorconfig @@ -17,3 +17,6 @@ quote_type = single [*.md] trim_trailing_whitespace = false + +[*.mdx] +trim_trailing_whitespace = false diff --git a/packages/core/dev-test/backends/proxy/_data/navigation.mdx b/packages/core/dev-test/backends/proxy/_data/navigation.mdx new file mode 100644 index 000000000..89d86efcd --- /dev/null +++ b/packages/core/dev-test/backends/proxy/_data/navigation.mdx @@ -0,0 +1,26 @@ +--- +main_menu: + - label: News + href: /news + - label: Features + href: '#features' + - label: About + href: '#about' + - label: Contact + href: '#contact' +footer_menus: + - label: Company + links: + - label: Home + href: / + - label: 'Privacy Policy ' + href: '#' + - label: About us + href: '#' + - label: Documentation + links: + - label: Docs + href: '#' + - label: Blog + href: '#' +--- diff --git a/packages/core/dev-test/backends/proxy/config.yml b/packages/core/dev-test/backends/proxy/config.yml index 77021776d..2cbeb28ff 100644 --- a/packages/core/dev-test/backends/proxy/config.yml +++ b/packages/core/dev-test/backends/proxy/config.yml @@ -176,6 +176,45 @@ collections: - label: Description name: description widget: text + + - name: navigation + label: Navigation + file: packages/core/dev-test/backends/proxy/_data/navigation.mdx + extension: mdx + format: yaml-frontmatter + fields: + - name: main_menu + label: Main Menu + widget: list + collapsed: true + fields: + - name: label + label: Label + widget: string + - name: href + label: Href + widget: string + - name: footer_menus + label: Footer Menus + widget: list + collapsed: true + reuired: false + fields: + - name: label + label: Label + widget: string + - name: links + label: Links + widget: list + collapsed: true + fields: + - name: label + label: Label + widget: string + - name: href + label: Href + widget: string + - name: kitchenSink label: Kitchen Sink folder: packages/core/dev-test/backends/proxy/_sink diff --git a/packages/core/src/formats/formats.ts b/packages/core/src/formats/formats.ts index cb7282115..0de5de4be 100644 --- a/packages/core/src/formats/formats.ts +++ b/packages/core/src/formats/formats.ts @@ -26,6 +26,7 @@ export const extensionFormatters: Record = { toml: TomlFormatter, json: JsonFormatter, md: FrontmatterInfer, + mdx: FrontmatterInfer, markdown: FrontmatterInfer, html: FrontmatterInfer, }; diff --git a/packages/docs/.editorconfig b/packages/docs/.editorconfig index 5fe0621b4..e2e9c4478 100644 --- a/packages/docs/.editorconfig +++ b/packages/docs/.editorconfig @@ -17,3 +17,6 @@ quote_type = single [*.md] trim_trailing_whitespace = false + +[*.mdx] +trim_trailing_whitespace = false diff --git a/packages/docs/content/docs/collection-overview.mdx b/packages/docs/content/docs/collection-overview.mdx index 7c09e0d96..fbf35cccc 100644 --- a/packages/docs/content/docs/collection-overview.mdx +++ b/packages/docs/content/docs/collection-overview.mdx @@ -57,7 +57,7 @@ collections: [ These settings determine how collection files are parsed and saved. Both are optional—Static CMS will attempt to infer your settings based on existing items in the collection. If your collection is empty, or you'd like more control, you can set these fields explicitly. -`extension` determines the file extension searched for when finding existing entries in a folder collection and it determines the file extension used to save new collection items. It accepts the following values: `yml`, `yaml`, `json`, `md`, `markdown`, `html`. +`extension` determines the file extension searched for when finding existing entries in a folder collection and it determines the file extension used to save new collection items. It accepts the following values: `yml`, `yaml`, `json`, `md`, `markdown`, `mdx`, `html`. You may also specify a custom `extension` not included in the list above, as long as the collection files can be parsed and saved in one of the supported formats below. From d25281e3573bc4b1c8718412fb61a9196adb5afc Mon Sep 17 00:00:00 2001 From: Daniel Lautzenheiser Date: Tue, 31 Oct 2023 12:01:12 -0400 Subject: [PATCH 5/7] fix: respect relative media folder on field (#965) --- packages/core/src/lib/util/media.util.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/core/src/lib/util/media.util.ts b/packages/core/src/lib/util/media.util.ts index 98b2c2524..d6fa915c5 100644 --- a/packages/core/src/lib/util/media.util.ts +++ b/packages/core/src/lib/util/media.util.ts @@ -254,6 +254,7 @@ export function selectMediaFolder( : joinUrlPath( collection && 'folder' in collection ? collection.folder : '', DRAFT_MEDIA_FILES, + folder, ); } } From 5a8bba94958763bf1c320e94a5d5e4bb5a25244d Mon Sep 17 00:00:00 2001 From: Daniel Lautzenheiser Date: Tue, 31 Oct 2023 12:02:21 -0400 Subject: [PATCH 6/7] Update releases.json --- packages/docs/content/releases.json | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/packages/docs/content/releases.json b/packages/docs/content/releases.json index b3f2ea95f..01afb2c95 100644 --- a/packages/docs/content/releases.json +++ b/packages/docs/content/releases.json @@ -1,5 +1,15 @@ { "releases": [ + { + "date": "2023-10-31T11:00:00.000Z", + "version": "v3.4.4", + "type": "patch" + }, + { + "date": "2023-10-31T10:00:00.000Z", + "version": "v3.4.3", + "type": "patch" + }, { "date": "2023-10-27T10:00:00.000Z", "version": "v3.4.2", From fb5fb68eccbbccf09a889cee0270317249dc1597 Mon Sep 17 00:00:00 2001 From: Daniel Lautzenheiser Date: Tue, 31 Oct 2023 12:02:36 -0400 Subject: [PATCH 7/7] v3.4.4 --- lerna.json | 2 +- packages/app/package.json | 4 ++-- packages/core/package.json | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lerna.json b/lerna.json index e26e32367..1188cd4d1 100644 --- a/lerna.json +++ b/lerna.json @@ -1,5 +1,5 @@ { "$schema": "node_modules/lerna/schemas/lerna-schema.json", "useWorkspaces": true, - "version": "3.4.3" + "version": "3.4.4" } diff --git a/packages/app/package.json b/packages/app/package.json index 7b093480c..2e3f8a60d 100644 --- a/packages/app/package.json +++ b/packages/app/package.json @@ -1,6 +1,6 @@ { "name": "@staticcms/app", - "version": "3.4.3", + "version": "3.4.4", "license": "MIT", "description": "Static CMS application.", "repository": "https://github.com/StaticJsCMS/static-cms", @@ -40,7 +40,7 @@ "@babel/eslint-parser": "7.21.3", "@babel/runtime": "7.21.0", "@emotion/babel-preset-css-prop": "11.10.0", - "@staticcms/core": "^3.4.3", + "@staticcms/core": "^3.4.4", "buffer": "6.0.3", "react": "18.2.0", "react-dom": "18.2.0", diff --git a/packages/core/package.json b/packages/core/package.json index 85bd2eae4..733314e74 100644 --- a/packages/core/package.json +++ b/packages/core/package.json @@ -1,6 +1,6 @@ { "name": "@staticcms/core", - "version": "3.4.3", + "version": "3.4.4", "license": "MIT", "description": "Static CMS core application.", "repository": "https://github.com/StaticJsCMS/static-cms",