Skip to content

Commit

Permalink
Bookshop 3.0 🎉
Browse files Browse the repository at this point in the history
  • Loading branch information
bglw authored Apr 6, 2022
2 parents c727af0 + 7c8673b commit abaecdd
Show file tree
Hide file tree
Showing 236 changed files with 11,870 additions and 4,144 deletions.
9 changes: 0 additions & 9 deletions .github/workflows/test-ruby.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,15 +32,6 @@ jobs:
ruby-version: ${{ matrix.ruby-version }}
bundler-cache: true
working-directory: ./generator-plugins/jekyll/jekyll-bookshop
- name: Set up cloudcannon-jekyll-bookshop Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby-version }}
bundler-cache: true
working-directory: ./generator-plugins/jekyll/cloudcannon-jekyll-bookshop
- name: Run jekyll-bookshop tests
run: bundle exec rake test
working-directory: ./generator-plugins/jekyll/jekyll-bookshop
- name: Run cloudcannon-jekyll-bookshop tests
run: bundle exec rake test
working-directory: ./generator-plugins/jekyll/cloudcannon-jekyll-bookshop
16 changes: 16 additions & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#!/bin/sh

CHANGES=$(git diff --cached --name-only)
CHANGED_GUIDE=$(echo $CHANGES | grep -c "guides/")

if [ $CHANGED_GUIDE != "0" ]; then
if [[
-z $(echo $CHANGES | grep "hugo.adoc")
|| -z $(echo $CHANGES | grep "eleventy.adoc")
|| -z $(echo $CHANGES | grep "jekyll.adoc")
]]; then
echo "One of the SSG guides was changed without updating the others."
echo "Run ./scripts/build-guides.sh before comitting."
exit 1
fi
fi
88 changes: 88 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,91 @@
# [3.0.0](https://github.com/CloudCannon/bookshop/compare/v2.6.1...v3.0.0) (2022-04-07)

### Features

* Bookshop has a new component configuration syntax. See the [Bookshop 3.0 migration guide](https://github.com/CloudCannon/bookshop/blob/main/guides/migration.adoc) for in-depth information
* The new configuration files allow for your inputs to be configured using CloudCannon's `_inputs` configuration

* Your component blueprint can now nest other components and structures ([c1dd5f2](https://github.com/CloudCannon/bookshop/commit/c1dd5f2120b3904a9e1ca83ee2c2f05e934ce850))
* By using `bookshop:<component>` or `bookshop:structure:<structure>` in your component blueprint, you can nest the blueprint of other components, rather than having to re-specify their fields.
* See the [Jekyll](https://github.com/CloudCannon/bookshop/blob/main/guides/jekyll.adoc), [Eleventy](https://github.com/CloudCannon/bookshop/blob/main/guides/eleventy.adoc), or [Hugo](https://github.com/CloudCannon/bookshop/blob/main/guides/hugo.adoc) guide for more examples.

* **eleventy:** Site data and collections are now available to your templates while live editing ([df009c4](https://github.com/CloudCannon/bookshop/commit/df009c49ba2b6c3a58123fe24092ee42965a24e6))
* For data to be accessible, you will need to expose each data set using `data_config` in your CloudCannon Global Configuration file.

* **hugo:** `site.Data` is now available to your templates while live editing ([cac0fd3](https://github.com/CloudCannon/bookshop/commit/cac0fd312b632217c1033c1311cdea08c0f342f9))
* For data to be accessible, you will need to set `data_config: true` in your CloudCannon Global Configuration file.

* **hugo:** Site string functions are now available to your templates while live editing ([a71e1ea](https://github.com/CloudCannon/bookshop/commit/a71e1ea3dec976cc4106689f3b809832d3facf8f))
* This encompasses the common configuration variables `site.Title`, `site.BaseURL`, and `site.Copyright`

* Embedding the Component Browser is now easier across all SSGs ([1226d01](https://github.com/CloudCannon/bookshop/commit/1226d01925f403b4c16e59bb80338dff0c103f9f))
* Using the `{% bookshop_component_browser %}` or `{{ partial "bookshop_component_browser" }}` is now all that is needed.
* This will handle both local browsing of the component library, and building a hosted component library.

* Bookshop will now set a CMS loading state while live editing is initializing ([5b65707](https://github.com/CloudCannon/bookshop/commit/5b657072e42614d34e2342f5eed8edb890527865))
* This is especially helpful for first loads on Hugo sites, while loading the live editing WebAssembly

* The bookshop/init command can now create new Bookshop projects ([824de51](https://github.com/CloudCannon/bookshop/commit/824de5160fc9a74a34ea3c3306b1ffb60caeeb53))
* Running `npx @bookshop/init --new <name>` will scaffold out a new Bookshop for you

* The new `npx @bookshop/up@latest` command can upgrade all Bookshop dependencies. ([6ffe599](https://github.com/CloudCannon/bookshop/commit/6ffe5992202f5d0f7ada03ee24aeb2a61bedd1b8))
* This will also migrate old config files to the new syntax, and can convert between different file formats.

* `npx @bookshop/init` can now generate all supported file formats ([4ab5276](https://github.com/CloudCannon/bookshop/commit/4ab52765c2c5c4264fe05a5ad060bd57d84ee136))

* **eleventy:** The `url` filter is now available to your templates while live editing ([bd44ae0](https://github.com/CloudCannon/bookshop/commit/bd44ae03da61796b60332d08d2e6574856b8f3ab))
* This requires that a `pathPrefix` is passed to `eleventy-bookshop` in your `.eleventy.js`.

* **jekyll:** The `relative_url` filter is now available to your templates while live editing ([79304cc](https://github.com/CloudCannon/bookshop/commit/79304cc0d6c3e49afe2e563fd5158beeb2f1091f))

* Bookshop will now log a console error when your live editing package versions don't match the Bookshop plugin version your site was built with ([798e7ed](https://github.com/CloudCannon/bookshop/commit/798e7ed2dd84c77a9b0de03ccbc2fb30178928c5))

### Bug Fixes

* **eleventy:** Bookshop live editing no longer crashes when passing recursive data structures to components ([98610b4](https://github.com/CloudCannon/bookshop/commit/98610b487f72553b207607cd0e462722652838bd))

* **jekyll/eleventy:** Variables using complex filters with arguments now render correctly ([d87797c](https://github.com/CloudCannon/bookshop/commit/d87797c24ef31a05f8771cba3d9ee36b9b6ce3c6))

* **jekyll/eleventy:** Variable assignments that span multiple lines now render correctly ([d87797c](https://github.com/CloudCannon/bookshop/commit/d87797c24ef31a05f8771cba3d9ee36b9b6ce3c6))

* **browser:** The component browser now loads in safari ([10eb05f](https://github.com/CloudCannon/bookshop/commit/10eb05f81f331ae467f6a6ff21103951a5335f96))

* **hugo:** Nested component paths (like `sections/hero`) are now correctly resolved when live editing ([5fab912](https://github.com/CloudCannon/bookshop/commit/5fab9121bc44e85af3316c7949e2439ed2f6c289))

* **hugo:** Ranging over a map now works correctly when live editing ([46a0d51](https://github.com/CloudCannon/bookshop/commit/46a0d5161663138bedec3196ce3e4448d52f1a2a))

* **hugo:** Loading a hosted Bookshop Component Library now loads the WebAssembly correctly ([0d8cc82](https://github.com/CloudCannon/bookshop/commit/0d8cc82c63b07504502f3627dbd7495d77fbd5f7))

* **hugo:** Live editing in Hugo now loads the WebAssembly from a cdn correctly ([e9b9aaf](https://github.com/CloudCannon/bookshop/commit/e9b9aaf537557e4e4c6a679c495247655164ac89))


### BREAKING CHANGES

* Bookshop config files now have a different structure.
See the [Bookshop 3.0 migration guide](https://github.com/CloudCannon/bookshop/blob/main/guides/migration.adoc) for more information.

* **eleventy/jekyll:** Eleventy and Jekyll sites will need to change from the
`{% bookshop_browser <PORT> %}` tag to the
`{% bookshop_component_browser %}` tag. The new tag requires
no arguments.

* **eleventy:** The `@bookshop/cloudcannon-eleventy-bookshop` plugin is now superseded by
the bookshop/generate npm package.
See the [Bookshop 3.0 migration guide](https://github.com/CloudCannon/bookshop/blob/main/guides/migration.adoc) for more information.

* **jekyll:** The `cloudcannon-jekyll-bookshop` plugin is now superseded by
the bookshop/generate npm package.
See the [Bookshop 3.0 migration guide](https://github.com/CloudCannon/bookshop/blob/main/guides/migration.adoc) for more information.

* **jekyll:** For data to be accessible when live editing, you will need to set
`data_config: true` in your `cloudcannon.config.*` file.

* **jekyll:** Some collection fields such as page.content
and page.excerpt are no longer available when live editing.

* **jekyll:** Data and collections are no longer accessible
from the component browser.

## [2.6.1](https://github.com/CloudCannon/bookshop/compare/v2.6.0...v2.6.1) (2022-03-03)


Expand Down
24 changes: 9 additions & 15 deletions README.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,17 @@ ifdef::env-github[]
:caution-caption: :fire:
:warning-caption: :warning:
endif::[]
:version: 2.6.1

https://github.com/CloudCannon/bookshop/actions/workflows/integration-test.yml[image:https://github.com/CloudCannon/bookshop/actions/workflows/integration-test.yml/badge.svg?branch=main&event=push[Integration Test Status]]
https://github.com/CloudCannon/bookshop/actions/workflows/test-node.yml[image:https://github.com/CloudCannon/bookshop/actions/workflows/test-node.yml/badge.svg?branch=main&event=push[Javascript Test Status]]
https://github.com/CloudCannon/bookshop/actions/workflows/test-ruby.yml[image:https://github.com/CloudCannon/bookshop/actions/workflows/test-ruby.yml/badge.svg?branch=main&event=push[Ruby Test Status]]

https://github.com/cloudcannon/bookshop/releases/[image:https://img.shields.io/static/v1?label=version&message={version}&style=flat&color=informational[Version {version}]]
image:https://img.shields.io/github/release-date/cloudcannon/bookshop?color=informational[GitHub Release Date]

[.lead]
Bookshop is a component development workflow for static websites. Bookshop currently supports Jekyll, Eleventy, and Hugo with support for React, Vue, and Svelte coming in the near future.
Bookshop is a component development workflow for static websites. Bookshop currently supports Jekyll, Eleventy, and Hugo with support for Next, Nuxt, and Svelte coming in the near future.

image::bookshop-hero.png[Iconography representing some components that might reside in a component library. There are lines connecting some of the components to wireframed areas of two example website pages.]

Expand All @@ -23,20 +27,10 @@ Bookshop defines a convention for building self-contained components in the temp
A good rundown of our motivations and the problems we are looking to solve can be found in our link:https://cloudcannon.com/blog/introducing-bookshop/[launch post on CloudCannon].

== Quick start
To jump right into using Bookshop on a site, check out the link:https://github.com/CloudCannon/jekyll-bookshop-starter[Jekyll Bookshop Starter] or link:https://github.com/CloudCannon/eleventy-bookshop-starter[Eleventy Bookshop Starter]. Then read through the guides below to get a feel for how everything plugs together.

== Guides

link:guides/conventions.adoc[Conventions Guide]:: Learn the Bookshop conventions, from how to write Bookshop TOML files to the component file structure.

link:guides/jekyll.adoc[Jekyll Guide]:: How to integrate your Bookshop project into a Jekyll website.

link:guides/eleventy.adoc[Eleventy Guide]:: How to integrate your Bookshop projects into an Eleventy website.

link:guides/hugo.adoc[Hugo Guide]:: How to integrate your Bookshop projects into a Hugo website.
To get started, head over to the guide for the SSG you would like to work with.

link:guides/browser.adoc[Browser Guide]:: How to setup and use the Bookshop component browser locally and on a hosted URL.
* link:guides/jekyll.adoc[Jekyll Bookshop Reference Guide]

link:guides/live-editing.adoc[Live Editing Guide]:: Information on how the experimental live editing works, and how to configure it.
* link:guides/eleventy.adoc[Eleventy Bookshop Reference Guide]

link:guides/visual-data-bindings.adoc[Visual Data Bindings Guide]:: Information on the Visual Data Bindings that Bookshop generates automatically.
* link:guides/hugo.adoc[Hugo Bookshop Reference Guide]
37 changes: 28 additions & 9 deletions bookshop-packages.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,32 +9,51 @@
]
}
},
"rubygems": {
"generator-plugins/jekyll/cloudcannon-jekyll-bookshop": {
"vendor_from_npm": [
"javascript-modules/cloudcannon-structures",
"javascript-modules/toml-narrator"
]
"versionStrings": {
"hugo/v3/core/bookshop_bindings.html": {
"regex": "version: \"[^\"]+\"",
"replacement": "version: \"NEW_VERSION\""
},
"generator-plugins/jekyll/jekyll-bookshop/lib/jekyll-bookshop/tags/bookshop-common-tag.rb": {
"regex": "version = \"[^\"]+\"",
"replacement": "version = \"NEW_VERSION\""
},
"README.adoc": {
"regex": ":version: .+",
"replacement": ":version: NEW_VERSION"
},
"guides/hugo.adoc": {
"regex": ":version: .+",
"replacement": ":version: NEW_VERSION"
},
"guides/eleventy.adoc": {
"regex": ":version: .+",
"replacement": ":version: NEW_VERSION"
},
"guides/jekyll.adoc": {
"regex": ":version: .+",
"replacement": ":version: NEW_VERSION"
}
},
"rubygems": {
"generator-plugins/jekyll/cloudcannon-jekyll-bookshop": {},
"generator-plugins/jekyll/jekyll-bookshop": {}
},
"npm": {
"javascript-modules/bookshop-sass": {},
"javascript-modules/browser": {},
"javascript-modules/builder": {},
"javascript-modules/cloudcannon-structures": {},
"javascript-modules/engines/jekyll-engine": {},
"javascript-modules/engines/eleventy-engine": {},
"javascript-modules/engines/svelte-engine": {},
"javascript-modules/engines/hugo-engine": {},
"javascript-modules/gen": {},
"javascript-modules/generate": {},
"javascript-modules/generator-plugins/eleventy/cloudcannon-eleventy-bookshop": {},
"javascript-modules/generator-plugins/eleventy/eleventy-bookshop": {},
"javascript-modules/helpers": {},
"javascript-modules/init": {},
"javascript-modules/live": {},
"javascript-modules/styles": {},
"javascript-modules/toml-narrator": {}
"javascript-modules/up": {}
}
}
27 changes: 0 additions & 27 deletions generator-plugins/jekyll/cloudcannon-jekyll-bookshop/.rubocop.yml

This file was deleted.

8 changes: 0 additions & 8 deletions generator-plugins/jekyll/cloudcannon-jekyll-bookshop/Gemfile
Original file line number Diff line number Diff line change
@@ -1,11 +1,3 @@
source 'https://rubygems.org'

gemspec

group :test do
gem "rubocop"
gem "hashdiff"
gem "rake"
gem "minitest"
gem 'minitest-reporters'
end
16 changes: 0 additions & 16 deletions generator-plugins/jekyll/cloudcannon-jekyll-bookshop/Rakefile

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ Gem::Specification.new do |spec|
spec.authors = ["Liam Bigelow"]
spec.email = ["liam@cloudcannon.com"]
spec.homepage = "https://github.com/cloudcannon/bookshop"
spec.summary = "A Jekyll plugin to configure the CloudCannon CMS using bookshop TOML files"
spec.summary = "REMOVED: See the https://github.com/cloudcannon/bookshop migration guides"

spec.required_ruby_version = Gem::Requirement.new(">= 2.3.0")

Expand All @@ -19,12 +19,4 @@ Gem::Specification.new do |spec|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
spec.require_paths = ["lib"]
spec.license = "MIT"

spec.add_dependency "jekyll", ">= 3.7", "< 5.0"
spec.add_dependency "toml-rb", ">= 2.0", "< 3.0"
spec.add_dependency "node-runner-temp-fix-windows", ">= 1.0", "< 2.0"
spec.add_dependency "dry-inflector", ">= 0.1", "< 1.0"
spec.add_development_dependency "cloudcannon-jekyll", ">= 2.0", "< 3.0"
spec.add_development_dependency "rubocop", "~> 0.80"
spec.add_development_dependency "rubocop-jekyll", "~> 0.11"
end
Original file line number Diff line number Diff line change
@@ -1,16 +1,7 @@
# frozen_string_literal: true

require "jekyll"
require_relative "./cloudcannon-jekyll-bookshop/output-site-data"
require_relative "./cloudcannon-jekyll-bookshop/structures"
require_relative "./cloudcannon-jekyll-bookshop/tags/live-tag"
warn "CloudCannon Jekyll Bookshop has been removed in Bookshop 3.0"
warn "This functionality is now provided by the npm package @bookshop/generate"
warn "See the migration guide at https://github.com/cloudcannon/bookshop"

Liquid::Template.register_tag("bookshop_live", CloudCannonJekyllBookshop::LiveTag)

Jekyll::Hooks.register :site, :after_init do |site|
CloudCannonJekyllBookshop::Structures.build_structures(site)
end

Jekyll::Hooks.register :site, :post_write do |site|
CloudCannonJekyllBookshop::SiteData.output(site)
end
exit 1

This file was deleted.

This file was deleted.

Loading

0 comments on commit abaecdd

Please sign in to comment.