1.0.21 • Published 9 months ago

@simpleview/cms-headless v1.0.21

Weekly downloads
-
License
MIT
Repository
github
Last release
9 months ago

cms-headless

npm install cms-headless

CMS-Headless is a core library for supporting React CMS headless clients. This library is required to run a CMS-Headless Client and provides core functionality and components.

It is built on top of React Material-UI and is it recommended that you pin to the same version that CMS-Headless is using.

Usage

  • Add cms-headless to your package.json and pin to a specific version.
  • cms-headless has a host of peerDependencies which are not bundled into the library in order to minimize the bundle size of those that are using the package. You will need to ensure all of the peerDependencies of the package are satisfied. See the package.json for the current peerDependencies.

All components are exported individually and should be imported via destructuring to ensure proper tree-shaking.

import { Section } from "@simpleview/cms-headless"

For faster import statements, import just the resource you want, exposed by package.json "exports" key.

import Section from "@simpleview/cms-headless/components/Section";

Installation

  • Ensure you have sv-kubernetes installed.
  • If you want your windows box to have TypeScript completions of npm packages. Install Node via https://nodejs.org/en/download/, easiest method is the Windows Install 64-bit. It may ask you to restart your box. In windows cmd
    		```
    		cd d:\PATH\TO\sv-kubernetes\containers\cms-headless
    		npm install
    		```
  • Putty/Shell into sv-kubernetes Install the container sudo sv install cms-headless --type=container --branch=develop * Run the container
    		```
    		cd /sv/containers/cms-headless
    		sudo npm run docker
    		yarn start
    		```

The service should now be accessible at http://kube.simpleview.io:6006/

Unit Testing

  • Unit tests are not yet implemented. Comming Soon!

Repo Structure

When external parties consume this project the assumption is that all exported components are "top-level" meaning that you can destructure all necessary imports. This is necessary to ensure optimal and easy tree shaking.

import { Section, Unknown } from "@simpleview/cms-headless";
  • /components/ - Each exported component have it's own sub-folder in this folder. Component - e.g. DataView, DataViewFilterDate index.ts This file File which should re-export the primary component as default. So if in the folder /Section/ then index.ts should re-export /Section/Section.tsx. This file should also export all entities in the Component.types.ts file. This makes the type definitions usable throughout the project and by external consumers. Component.tsx - The primary component file. Component.type.ts - If the component needs to declare it's own typescript Interfaces or Types throughout the folder, declare them here. Additional.tsx - For private sub-components needed by this component which are not logical to be consumed outside of the project or within the project, simply place them in this folder and do not re-export them in the index.ts. Component.stories.tsx - Definition of the component playground used to test and demonstrate this components capabilities. Component.stories.mdx - The text documentation that describes this component and how to use it. Component.test.js - Jest file for testing this component.
  • /theme/ - Definition of shared colors and theming that is used across the project. Exported globally as theme.
  • /utils/ - Folder for non-react javascript utilities. Some of these are re-exported by the root index.ts, and some are private to the project.
  • index.ts - The primary entrypoint for the project. It will re-export all entities from all public components.

Publishing

Publishing to NPM and storybook is automated. You do not need to run build, or publish.

  • Whenever a push to master changes the package.json, @simpleview/cms-headless will be published to NPM via the publish github action which runs scripts/conditional-publish
  • Whenever a push to master occurs the storybook is automatically built and pushed to the gh-pages branch via the storybook github action.

Running Locally

  1. Install to sv-kubernetes as a container via sudo sv install cms-headless --type=container
  2. Start local storybook by navigating to the container and running sudo npm run docker
  3. When the docker image is built and started, you can run storybook with the command yarn start

Publishing a new Version

To publish a new version, be

1.0.20-qa-3c79ed

10 months ago

1.0.21-qa-8bde86

9 months ago

1.0.21-qa-c31f6c

9 months ago

1.0.20-qa-90e5e9

9 months ago

1.0.20-qa-18ca25

9 months ago

1.0.21

9 months ago

1.0.21-qa-1594a0

9 months ago

1.0.20-qa-3f1dbd

9 months ago

1.0.20-qa-64a971

9 months ago

1.0.20-qa-0db6ed

10 months ago

1.0.20-qa-61d20c

10 months ago

1.0.20-qa-7b0203

9 months ago

1.0.20-qa-f6e154

10 months ago

1.0.20-qa-990a72

10 months ago

1.0.20-qa-5b5d88

9 months ago

1.0.20

11 months ago

1.0.19

12 months ago

1.0.18

12 months ago

1.0.19-qa-609215

11 months ago

1.0.18-qa-45d799

12 months ago

1.0.18-qa-c04b0d

12 months ago

1.0.18-qa-9e69de

12 months ago

1.0.18-qa-82380d

12 months ago

1.0.18-qa-c45d6c

12 months ago

1.0.18-qa-059b90

12 months ago

1.0.18-qa-0cd740

12 months ago

1.0.18-qa-9c049f

12 months ago

1.0.18-qa-aaed50

12 months ago

1.0.18-qa-dce0db

12 months ago

1.0.18-qa-f09a44

12 months ago

1.0.18-qa-c86fcf

12 months ago

1.0.18-qa-1493ce

12 months ago

1.0.18-qa-c44bb6

12 months ago

1.0.18-qa-bf8766

12 months ago

1.0.18-qa-60f3f1

12 months ago

1.0.17

1 year ago

1.0.16

1 year ago

1.0.15

1 year ago

1.0.14

1 year ago

1.0.13

1 year ago

1.0.11

1 year ago

1.0.10

1 year ago

1.0.9

1 year ago

1.0.8

1 year ago

1.0.7

1 year ago

1.0.6

1 year ago

1.0.5

1 year ago

1.0.4

1 year ago

1.0.3

1 year ago

1.0.2

1 year ago

1.0.1

1 year ago

1.0.0

1 year ago