Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(IN-4062): consolidate storyblok #7118

Merged
merged 51 commits into from
Apr 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
51 commits
Select commit Hold shift + click to select a range
e830875
chore: initial structure
lukasborawski Jan 27, 2021
3028c12
docs: update README
lukasborawski Jan 27, 2021
a5b48df
docs: update README
lukasborawski Jan 27, 2021
2bbbe51
docs: update README
lukasborawski Jan 27, 2021
bb8432a
fix: namespace
lukasborawski Jan 27, 2021
7b29a72
docs: update README
lukasborawski Jan 27, 2021
aa773f8
docs: update README
lukasborawski Jan 27, 2021
262c011
fix: un char
lukasborawski Jan 28, 2021
f9795d3
Update README.md
filrak Jan 28, 2021
8c22d19
chore: depts update
lukasborawski Feb 1, 2021
e202803
Merge branch 'master' of github.com:vuestorefront/storyblok
lukasborawski Feb 1, 2021
9827077
chore: versions bump
lukasborawski Feb 1, 2021
5ee4b63
chore: add repository page
lukasborawski Feb 1, 2021
9e5f3a6
chore: add vsf core middlware handling
lukasborawski Mar 15, 2021
1840937
docs: readme update
lukasborawski Mar 15, 2021
8c58ef8
chore: ignores update
lukasborawski Mar 17, 2021
4999bcd
revert: lib
lukasborawski Mar 17, 2021
a6d6b19
Merge pull request #3 from vuestorefront/issue-1-update-of-core-middl…
lukasborawski Mar 17, 2021
4c0e5c6
chore: editable value handling
lukasborawski Mar 17, 2021
02797c0
chore: building image object
lukasborawski Apr 1, 2021
9cdc97f
chore: version bump
lukasborawski Apr 1, 2021
cc0eba2
chore: build clean script
lukasborawski Apr 1, 2021
641cad7
Merge pull request #6 from vuestorefront/issue-5-image-object
lukasborawski Apr 1, 2021
17a3595
chore: content items check is array
lukasborawski Apr 1, 2021
6689cab
chore: version bump
lukasborawski May 5, 2021
24661f9
fix(#7): conditional chaning removed for sb bridge, version bump
lukasborawski May 5, 2021
48a9eb1
feat(global): cache, custom search, filters, locale, version, bridge,…
lukasborawski Oct 19, 2021
4a78113
chore: npmignore update
lukasborawski Oct 19, 2021
49d765e
Merge pull request #4 from vuestorefront/issue-2-editable-mode-handling
lukasborawski Oct 19, 2021
c96351a
docs: update README
lukasborawski Oct 19, 2021
6fb393a
chore: version bump
lukasborawski Oct 19, 2021
29e8c8f
docs: update README
lukasborawski Oct 19, 2021
501a685
chore: added #TechForUkraine
bloodf Feb 26, 2022
4ba6c35
Update README.md
bloodf Feb 27, 2022
153569a
Update README.md
bloodf Apr 22, 2022
f780120
chore(in-3875): storyblok package upgrade (#26)
lsliwaradioluz Dec 19, 2023
e96744e
chore: node-version file (#27)
lsliwaradioluz Dec 19, 2023
48befd4
ci: release (rc) (#28)
github-actions[bot] Dec 19, 2023
1d1c223
chore: exit pre mode (#29)
lsliwaradioluz Dec 19, 2023
ee25d17
ci: release (#30)
github-actions[bot] Dec 19, 2023
e22e60d
alokai rebranding (#31)
Olbix Mar 19, 2024
9f01e73
Merge branch 'master' of ../storyblok into IN-4062-storyblok
sethidden Apr 18, 2024
fef0cd5
Add storyblok to root
sethidden Apr 18, 2024
1994355
conventional pr name is not necessary if we have changesets
sethidden Apr 18, 2024
4a0b4c4
remove labeler on legacy
sethidden Apr 18, 2024
93452ff
run old ci on legacy branch
sethidden Apr 18, 2024
9d50ec4
Run on all Node versions - don't die if Node 14 fails
sethidden Apr 18, 2024
be7b767
eslint --fix
sethidden Apr 18, 2024
7270491
manual eslint fixes
sethidden Apr 18, 2024
adb80af
remove labeler
sethidden Apr 18, 2024
70ab561
simplify storyblok devdeps
sethidden Apr 18, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion .eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,6 @@
packages/cache/nuxt/plugin.js
packages/nuxt-module/plugins/i18n-cookies.js
packages/nuxt-module/plugins/logger.js
packages/cli/dist
packages/cli/dist
packages/*/server
packages/*/nuxt/plugin.js
27 changes: 0 additions & 27 deletions .github/labeler.yml

This file was deleted.

23 changes: 0 additions & 23 deletions .github/workflows/conventional-pr-name.yml

This file was deleted.

21 changes: 0 additions & 21 deletions .github/workflows/label.yml

This file was deleted.

2 changes: 2 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,14 @@ on:
- main
- develop
- release-**
- legacy

jobs:
test_repository:
name: Run linter, build and test all packages
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
node-version: [14, 16, 18]
steps:
Expand Down
2 changes: 1 addition & 1 deletion packages/middleware/nuxt/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ module.exports = async function VueStorefrontMiddleware(moduleOptions) {
);
}
});

// eslint-disable-next-line global-require
const config = require(`${this.nuxt.options.rootDir}/middleware.config.js`);
const handler = await createServer(config);
const serverMiddleware = { path: `/${apiPath}`, handler };
Expand Down
4 changes: 3 additions & 1 deletion packages/middleware/src/createServer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,16 +79,18 @@ async function createServer(config: MiddlewareConfig): Promise<Express> {
const status = getAgnosticStatusCode(error);
res.status(status);
if (status < 500) {

/**
* For all 4xx error codes or client error codes we wanted to send the error message
*/
res.send(error);
} else {

/**
* For all other error codes we wanted to send a generic error message
*/
res.send(
"ServerError: Something went wrong. Please, check the logs for more details."
'ServerError: Something went wrong. Please, check the logs for more details.'
);
}
}
Expand Down
7 changes: 7 additions & 0 deletions packages/storyblok/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
.idea

lib
server
coverage
node_modules
package-lock.json
19 changes: 19 additions & 0 deletions packages/storyblok/.npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
node_modules
coverage
src
demo
__tests__
.husky
.github

.idea
.editorconfig
.eslintrc.js
.prettierrc
babel.config.js
commitlint.config.js
package-lock.json
jest.config.ts
rollup.config.js
tsconfig.json
yarn.lock
13 changes: 13 additions & 0 deletions packages/storyblok/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# @vue-storefront/storyblok

## 0.4.0

### Minor Changes

- ed72567: Replaced `storyblok-vue` with `@storyblok/vue-2`.

## 0.4.0-rc.0

### Minor Changes

- ed72567: Replaced `storyblok-vue` with `@storyblok/vue-2`.
30 changes: 30 additions & 0 deletions packages/storyblok/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# Storyblok Integration

### Stay connected

[![GitHub Repo stars](https://img.shields.io/github/stars/vuestorefront/vue-storefront?style=social)](https://github.com/vuestorefront/vue-storefront)
[![Twitter Follow](https://img.shields.io/twitter/follow/vuestorefront?style=social)](https://twitter.com/vuestorefront)
[![YouTube Channel Subscribers](https://img.shields.io/youtube/channel/subscribers/UCkm1F3Cglty3CE1QwKQUhhg?style=social)](https://www.youtube.com/c/VueStorefront)
[![Discord](https://img.shields.io/discord/770285988244750366?label=join%20discord&logo=Discord&logoColor=white)](https://discord.vuestorefront.io)

Here you can find a quick installation guide for [Storyblok](https://www.storyblok.com/) CMS integration with Alokai.

Full documentation can be found [here](https://docs.vuestorefront.io/storyblok).

### Installation

---

Install the module in your app.

```bash
npm install @vue-storefront/storyblok @storyblok/vue-2 --save
```

or

```bash
yarn add @vue-storefront/storyblok -D @storyblok/vue-2
```

Check the [documentation](https://docs.vuestorefront.io/storyblok) for all the instructions and guidelines.
36 changes: 36 additions & 0 deletions packages/storyblok/components/RenderContent.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
<template>
<div v-editable="content || ''">
<component
v-for="(component, index) in components"
v-editable="content[index] ? content[index] : ''"
:is="component.componentName"
:key="index"
v-bind="component.props"
/>
</div>
</template>

<script lang="ts">
import Vue from 'vue';
import { extractComponents } from '@vue-storefront/storyblok';

interface RenderContent {
componentName: string
// eslint-disable-next-line @typescript-eslint/ban-types
props?: {}
}

export default Vue.extend({
name: 'RenderContent',
props: {
content: {
type: Array
}
},
computed: {
components(): RenderContent[] {
return extractComponents(this.content);
}
}
});
</script>
12 changes: 12 additions & 0 deletions packages/storyblok/jest.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
module.exports = {
moduleNameMapper: {
'^@/(.*)$': '<rootDir>/$1',
'^~/(.*)$': '<rootDir>/$1'
},
moduleFileExtensions: ['js', 'ts', 'json'],
transform: {
'^.+\\.js$': 'babel-jest',
'^.+\\.ts$': 'ts-jest'
},
testMatch: ['<rootDir>/**/__tests__/**/*spec.[jt]s?(x)']
};
20 changes: 20 additions & 0 deletions packages/storyblok/nuxt/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import path from 'path';

// eslint-disable-next-line
export default function storyblok(moduleOptions) {
const { storyblok, head } = this.options;
const options = {
...storyblok,
...moduleOptions
};
if (options.jsBridge && head) {
const scripts = head.script;
scripts.push({
src: `${options.jsBridge}`
});
}
this.addPlugin({
src: path.resolve(__dirname, 'plugin.js'),
options
});
}
9 changes: 9 additions & 0 deletions packages/storyblok/nuxt/plugin.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import Vue from 'vue'
import {StoryblokVue} from '@storyblok/vue-2'
import { integrationPlugin } from '@vue-storefront/core'

Vue.use(StoryblokVue)

export default integrationPlugin(({ integration }) => {
integration.configure('sb', { ...<%= serialize(options) %> })
})
47 changes: 47 additions & 0 deletions packages/storyblok/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
{
"name": "@vue-storefront/storyblok",
"version": "0.4.0",
"description": "Storyblok CMS integration with Vue Storefront",
"main": "lib/index.cjs.js",
"module": "lib/index.es.js",
"server": "server/index.js",
"scripts": {
"build": "rollup -c && rm -r -- ./server/*/",
"build:clean": "rollup -c && rm -r -- ./lib/*/ && rm -r -- ./server/*/",
"dev": "rollup -c -w",
"test": "jest --passWithNoTests",
"lint": "eslint --ext .js,.ts --ignore-path .eslintignore .",
"prepublish": "yarn build",
"changesets:version": "yarn changeset version && YARN_ENABLE_IMMUTABLE_INSTALLS=false yarn install",
"changesets:publish": "yarn build && yarn changeset publish"
},
"author": "Vue Storefront",
"license": "MIT",
"dependencies": {
"@vue-storefront/core": "^2.4.3",
"axios": "^0.23.0",
"nanoid": "^3.1.30",
"storyblok-js-client": "^4.1.5",
"tslib": "^2.3.1"
},
"devDependencies": {
"@vue-storefront/integrations-tsconfig": "^0.0.4",
"@jest/globals": "^27.2.5"
},
"peerDependencies": {
"@storyblok/vue-2": "^3.0.17"
},
"publishConfig": {
"access": "public"
},
"keywords": [
"vuestorefront",
"vue-storefront",
"storyblok",
"cms",
"integration",
"vue",
"vuejs"
],
"homepage": "https://github.com/vuestorefront/storyblok"
}
41 changes: 41 additions & 0 deletions packages/storyblok/rollup.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
import typescript from 'rollup-plugin-typescript2';
import pkg from './package.json';

const config = {
input: 'src/index.ts',
output: [
{
file: pkg.main,
format: 'cjs',
sourcemap: true
},
{
file: pkg.module,
format: 'es',
sourcemap: true
}
],
external: [...Object.keys(pkg.dependencies || {})],
plugins: [
typescript()
]
};
const server = {
input: 'src/index.server.ts',
output: [
{
file: pkg.server,
format: 'cjs',
sourcemap: true
}
],
external: [
...Object.keys(pkg.dependencies || {}),
...Object.keys(pkg.peerDependencies || {})
],
plugins: [
typescript()
]
};

export default [config, server];
Loading
Loading