Skip to content
This repository has been archived by the owner on Sep 9, 2024. It is now read-only.

Commit

Permalink
Merge branch 'main' into next
Browse files Browse the repository at this point in the history
  • Loading branch information
KaneFreeman committed Oct 31, 2023
2 parents ec75fcd + fb5fb68 commit 4ffd38c
Show file tree
Hide file tree
Showing 22 changed files with 108 additions and 20 deletions.
2 changes: 1 addition & 1 deletion lerna.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"$schema": "node_modules/lerna/schemas/lerna-schema.json",
"version": "3.4.2"
"version": "3.4.4"
}
3 changes: 3 additions & 0 deletions packages/app/.editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,6 @@ quote_type = single

[*.md]
trim_trailing_whitespace = false

[*.mdx]
trim_trailing_whitespace = false
2 changes: 1 addition & 1 deletion packages/app/.eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ module.exports = {
'cypress/globals': true,
},
globals: {
STATIC_CMS_CORE_VERSION: false,
STATIC_CMS_APP_VERSION: false,
CMS_ENV: false,
},
rules: {
Expand Down
4 changes: 2 additions & 2 deletions packages/app/babel.config.js
Original file line number Diff line number Diff line change
@@ -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';
Expand Down Expand Up @@ -53,7 +53,7 @@ function plugins() {
[
'transform-define',
{
STATIC_CMS_CORE_VERSION: `${coreVersion}`,
STATIC_CMS_APP_VERSION: `${appVersion}`,
},
],
[
Expand Down
4 changes: 2 additions & 2 deletions packages/app/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@staticcms/app",
"version": "3.4.2",
"version": "3.4.4",
"license": "MIT",
"description": "Static CMS application.",
"repository": "https://github.com/StaticJsCMS/static-cms",
Expand Down Expand Up @@ -39,7 +39,7 @@
"dependencies": {
"@babel/eslint-parser": "7.22.15",
"@babel/runtime": "7.23.1",
"@staticcms/core": "^3.4.2",
"@staticcms/core": "^3.4.4",
"buffer": "6.0.3",
"react": "18.2.0",
"react-dom": "18.2.0",
Expand Down
4 changes: 4 additions & 0 deletions packages/app/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -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}`);
Expand Down Expand Up @@ -89,6 +90,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'),
Expand Down
3 changes: 3 additions & 0 deletions packages/core/.editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,6 @@ quote_type = single

[*.md]
trim_trailing_whitespace = false

[*.mdx]
trim_trailing_whitespace = false
26 changes: 26 additions & 0 deletions packages/core/dev-test/backends/proxy/_data/navigation.mdx
Original file line number Diff line number Diff line change
@@ -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: '#'
---
39 changes: 39 additions & 0 deletions packages/core/dev-test/backends/proxy/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,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
Expand Down
2 changes: 1 addition & 1 deletion packages/core/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@staticcms/core",
"version": "3.4.2",
"version": "3.4.4",
"license": "MIT",
"description": "Static CMS core application.",
"repository": "https://github.com/StaticJsCMS/static-cms",
Expand Down
4 changes: 3 additions & 1 deletion packages/core/src/bootstrap.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,9 @@ function bootstrap<F extends BaseField = UnknownField>(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}`);
}

Expand Down
6 changes: 4 additions & 2 deletions packages/core/src/components/ErrorBoundary.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
1 change: 1 addition & 0 deletions packages/core/src/formats/formats.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ export const extensionFormatters: Record<string, FileFormatter> = {
toml: TomlFormatter,
json: JsonFormatter,
md: FrontmatterInfer,
mdx: FrontmatterInfer,
markdown: FrontmatterInfer,
html: FrontmatterInfer,
};
Expand Down
1 change: 1 addition & 0 deletions packages/core/src/lib/util/media.util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -254,6 +254,7 @@ export function selectMediaFolder<EF extends BaseField>(
: joinUrlPath(
collection && 'folder' in collection ? collection.folder : '',
DRAFT_MEDIA_FILES,
folder,
);
}
}
Expand Down
1 change: 1 addition & 0 deletions packages/core/src/types/constants.d.ts
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
declare const STATIC_CMS_CORE_VERSION: string;
declare const STATIC_CMS_APP_VERSION: string;
3 changes: 3 additions & 0 deletions packages/docs/.editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,6 @@ quote_type = single

[*.md]
trim_trailing_whitespace = false

[*.mdx]
trim_trailing_whitespace = false
1 change: 0 additions & 1 deletion packages/docs/.eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ module.exports = {
jest: true,
},
globals: {
STATIC_CMS_CORE_VERSION: false,
CMS_ENV: false,
},
rules: {
Expand Down
2 changes: 1 addition & 1 deletion packages/docs/content/docs/collection-overview.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,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.

Expand Down
2 changes: 1 addition & 1 deletion packages/docs/content/docs/configuration-options.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand Down
2 changes: 1 addition & 1 deletion packages/docs/content/docs/test-backend.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand Down
10 changes: 10 additions & 0 deletions packages/docs/content/releases.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down
6 changes: 0 additions & 6 deletions packages/tools/babel.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,12 +56,6 @@ function plugins() {
if (isESM) {
return [
...defaultPlugins,
[
'transform-define',
{
STATIC_CMS_CORE_VERSION: `${coreVersion}`,
},
],
[
'inline-react-svg',
{
Expand Down

0 comments on commit 4ffd38c

Please sign in to comment.