1.2.7 ā€¢ Published 10 months ago

@backpackjs/cms-env v1.2.7

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

šŸŒŽ Backpackjs CMS-ENV

Backpack's Content Management System Environment module (CMS-ENV) is the first (1) command executed during the backpack storefront initialization lifecycle. It is executed in both development and production modes (i.e in both backpack dev & build).

Backpackjs CMS-ENV is primarily responsible for:

  • Detecting the current CMS environment branch (production or feature)
  • Managing the creation, update and deletion of CMS environment branches (via a cli prompt), and
  • Providing the default CMS environment branch context to the storefront (via the CMS_ENV env var)

CMS Environment

A CMS environment is the content management instance of a storefront. The instance's default schema includes a set of pre-defined content types that allow end-users to store and manage both meta and front-end content entry for all common e-commerce content endpoints.

CMS Environment Content Types

TYPEFIELDSDESCRIPTION
šŸ“ƒ Pageā€¢ handle ā€¢ seo title, description and image ā€¢ content local, global sectionsA page is a route representing a single page i.e /pages/about-us
šŸ—‚ Blogā€¢ handle ā€¢ seo title, description and image ā€¢ content local, global sectionsA blog is a route representing a collection of articles i.e /blogs/news
šŸ“ Articleā€¢ handle ā€¢ seo title, description and image ā€¢ article author, blog, excerpt, category, tags ā€¢ content local, global sectionsAn article represents a single blog post CMS entry i.e /blogs/news/we-are-live
šŸ› Collectionā€¢ handle ā€¢ seo title, description and image ā€¢ content local, global sectionsA collection is a route representing a collection of products i.e /collection/new-arrivals
šŸ‘œ Productā€¢ handle ā€¢ seo title, description and image ā€¢ content local, global sectionsA product content type is a route a single product content entry i.e /products/crew-neck-tee

CMS Environment Branches

An important feature of backpack CMS environments is the concept of content branches. A content branch, is an isolated clone of the full CMS instance for a given storefront.

There are two types of content branches:

TYPEDEFAULT# BRANCHESCONFIGURABLEDESCRIPTION
šŸŒŽ productionbranch"main"1noThe "main" branch is your live/production content branch
šŸš§ featurebranchesany git branch name i.e "staging"1-7 maxBranchesyesAny git branch such as "staging", "new-hero", "new-landing-page" etc..

Content isolation enables full separation of content management concerns between production and development content branches and between development branches themselves.

This means that developers can develop, configure, deploy and preview new complex features without worrying on it's impact on the production content branch or any other concurrent development branches.

Backpack feature branches provide similar but much improved functionality to Shopify themes development workflows via duplicated theme instances.

CMS feature branches (content) vs. Git branches (codebase)

All CMS content branches have a 1-to-1 relationship with storefront git branches. This ensures a correct association between code and content branches `. i.e A deployed "staging" git branch using the "staging" CMS content branch as data source.

  • Production Branch: By default backpack CMS creates its production branch under the name main which means that the storefront's git repository must have main as it's primary/master branch.
  • Feature Branch(es): Each feature branch i.e "new-homepage-hero" starts a clone of the main production branch (at the time of creation).

Feature branches

Feature content branches (can be) very dynamic by nature - just like git branches. That is, you can easily create , delete or update (soon) any feature branch.

Depending on your storefront cms-env configuration's maxBranches you will have up to 7 isolated and fully previewable feature branches to work with at any given time.

Although you may be limited to 7 concurrent feature branches, this does not mean that you can't have multiple developers collaborating within individual feature branch at the same time.

Since most features branches are likely to come and go, we provide you with a prompt-based cli interface that guides you throughout the feature management lifecycle.

Feature branch lifecycle

When a storefront is first created, it will have only the "main/production" content branch. This is because your storefront git repository will have no other branches.

As you start working on new features, you may want to develop these in separate git branches.

Creating content branches is closely tied with creating regular git branches.

1. Creating your first feature branch

  1. Create and new git branch
  2. Switch to your newly created branch
  3. Run yarn dev
  4. Because this is the first time you are running yarn dev on this new git branch, backpack CMS doesn't have yet have a matching content branch for it. The cli will prompt you wether you want to create a new content branch
  • Choose "yes" to create a new branch and then press enter

Any subsequent calls to yarn dev or yarn build on this branch won't require this step.

You must always create a new content branch via the cli, before a feature build preview can be successfully deployed. This is because a build will fail if there is no matching content branch for a given git branch.

2. Creating additional branches

To create any additional branches simply follow the previous steps. When you have reached your allocated number of feature branches, the cli may prompt you wether you want to delete an existing content branch in order to create a new one.

3. Creating a new content branch by replacing an existing content branch

Replacing an existing branch with a new one, is also managed via the cli. To replace an existing branch simply: 1. Create and new git branch 2. Switch to your newly created branch 3. Run yarn dev - You should see: šŸŒŽ Initializing Backpack environments... 4. Choose the old branch you want to delete 5. Confirm the deletion 6. Confirm the creation of the new content branch

Any subsequent calls to yarn dev or yarn build on this branch won't trigger the cli. Instead you should see:

šŸŒŽ Setting [configs-doc] as active environment [CMS_ENV]

4. Updating a feature branch (TODO)

This is the use case were I like working on say a jp branch. The branch gets out of sync with main.. Need to build the branch update prompt / feature.

Content branching workflow and caveats

Recommended workflow

  • Talk about the ideal workflow. Don't re-use all branches whose content may be stale.

Caveats

  • Currently content changes created on a feature branch can't be merged back into other branches. This includes the production branch. Although this may sound limiting at first, it doesn't have to be. This is because storefront content sections provide powerful default settings which should be used to easily transport new content section data into the production content branch. This is also a good practice, because the end users will be able to preview new content sections with any set of text, image and video defaults.

Forcing a given content branch

Although not recommended, a storefront can be forced to initialize with a "non-matching"/"detected" feature content branch. This can be achieved by configuring the forceEnv option on backpack.init.js

1.2.7

10 months ago

1.2.6

2 years ago

1.2.4

2 years ago

1.2.3

2 years ago

1.2.2

2 years ago

1.2.1

2 years ago

1.1.4

2 years ago

1.1.3

2 years ago

1.0.0

2 years ago

1.1.1

2 years ago

1.1.0

2 years ago

1.1.2

2 years ago

0.1.20

2 years ago

0.1.22

2 years ago

0.1.23

2 years ago

0.2.0

2 years ago

0.1.12

2 years ago

0.1.13

2 years ago

0.1.14

2 years ago

0.1.15

2 years ago

0.1.16

2 years ago

0.1.17

2 years ago

0.1.18

2 years ago

0.1.19

2 years ago

0.1.10

2 years ago

0.1.11

2 years ago

0.1.8

2 years ago

0.1.7

2 years ago

0.1.9

2 years ago

0.1.6

2 years ago

0.1.5

3 years ago

0.1.4

3 years ago

0.1.2

3 years ago

0.1.1

3 years ago

0.1.3

3 years ago

0.0.130

3 years ago

0.0.129

3 years ago

0.0.128

3 years ago

0.0.127

3 years ago

0.0.126

3 years ago

0.0.125

3 years ago

0.0.124

3 years ago

0.0.123

3 years ago

0.0.122

3 years ago

0.0.121

3 years ago

0.0.120

3 years ago

0.0.119

3 years ago

0.0.118

3 years ago

0.0.117

3 years ago

0.0.116

3 years ago

0.0.115

3 years ago

0.0.114

3 years ago

0.0.113

3 years ago

0.0.112

3 years ago

0.0.111

3 years ago

0.0.110

3 years ago

0.0.109

3 years ago

0.0.108

3 years ago

0.0.107

3 years ago

0.0.106

3 years ago

0.0.105

3 years ago

0.0.104

3 years ago

0.0.103

3 years ago

0.0.102

3 years ago

0.0.101

3 years ago

0.0.100

3 years ago

0.0.35

3 years ago

0.0.34

3 years ago

0.0.33

3 years ago

0.0.27

3 years ago

0.0.26

3 years ago

0.0.25

3 years ago

0.0.24

3 years ago

0.0.23

3 years ago

0.0.22

3 years ago

0.0.21

3 years ago

0.0.20

3 years ago

0.0.19

3 years ago

0.0.18

3 years ago

0.0.17

3 years ago

0.0.16

3 years ago

0.0.15

3 years ago

0.0.14

3 years ago

0.0.13

3 years ago

0.0.12

3 years ago

0.0.11

3 years ago

0.0.10

3 years ago

0.0.9

3 years ago

0.0.8

3 years ago

0.0.7

3 years ago

0.0.6

3 years ago

0.0.5

3 years ago

0.0.4

3 years ago

0.0.3

3 years ago

0.0.2

3 years ago