Skip to content

Commit 0d6e575

Browse files
sethiddenlukasborawskifilrakbloodflsliwaradioluz
authored
chore(IN-4062): consolidate storyblok (#7118)
* chore: initial structure * docs: update README * docs: update README * docs: update README * fix: namespace * docs: update README * docs: update README * fix: un char * Update README.md * chore: depts update * chore: versions bump * chore: add repository page * chore: add vsf core middlware handling * docs: readme update * chore: ignores update * revert: lib * chore: editable value handling * chore: building image object * chore: version bump * chore: build clean script * chore: content items check is array * chore: version bump * fix(#7): conditional chaning removed for sb bridge, version bump * chore: npmignore update * docs: update README * chore: version bump * docs: update README * chore: added #TechForUkraine * Update README.md * Update README.md * chore(in-3875): storyblok package upgrade (#26) * chore: swap storyblok packages * chore: upgrade storyblok package * chore: update dev dependencies * chore: update husky * chore: deactivate sonar cloud check * chore: install engineering toolkit dependencies * fix: linting errors * chore: storyblok bridge file improvements * chore: changeset * chore: enable releases from master * chore: node-version file (#27) * ci: release (rc) (#28) Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> * chore: exit pre mode (#29) * ci: release (#30) Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> * alokai rebranding (#31) Co-authored-by: krystian wlodarski <kwlodarski@vuestorefront.io> * Add storyblok to root * conventional pr name is not necessary if we have changesets * remove labeler on legacy * run old ci on legacy branch * Run on all Node versions - don't die if Node 14 fails * eslint --fix * manual eslint fixes * remove labeler * simplify storyblok devdeps --------- Co-authored-by: lukasborawski <lukas.borawski@gmail.com> Co-authored-by: Filip Rakowski <f.rakowskI@hotmail.com> Co-authored-by: Heitor Ramon Ribeiro <heitor.ramon@gmail.com> Co-authored-by: Łukasz Śliwa <39009379+lsliwaradioluz@users.noreply.github.com> Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> Co-authored-by: Krystian Wlodarski <kryswlo95@gmail.com> Co-authored-by: krystian wlodarski <kwlodarski@vuestorefront.io>
1 parent 32fd7a4 commit 0d6e575

30 files changed

+602
-1529
lines changed

.eslintignore

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,6 @@
44
packages/cache/nuxt/plugin.js
55
packages/nuxt-module/plugins/i18n-cookies.js
66
packages/nuxt-module/plugins/logger.js
7-
packages/cli/dist
7+
packages/cli/dist
8+
packages/*/server
9+
packages/*/nuxt/plugin.js

.github/labeler.yml

Lines changed: 0 additions & 27 deletions
This file was deleted.

.github/workflows/conventional-pr-name.yml

Lines changed: 0 additions & 23 deletions
This file was deleted.

.github/workflows/label.yml

Lines changed: 0 additions & 21 deletions
This file was deleted.

.github/workflows/test.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,14 @@ on:
1111
- main
1212
- develop
1313
- release-**
14+
- legacy
1415

1516
jobs:
1617
test_repository:
1718
name: Run linter, build and test all packages
1819
runs-on: ubuntu-latest
1920
strategy:
21+
fail-fast: false
2022
matrix:
2123
node-version: [14, 16, 18]
2224
steps:

packages/middleware/nuxt/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ module.exports = async function VueStorefrontMiddleware(moduleOptions) {
4141
);
4242
}
4343
});
44-
44+
// eslint-disable-next-line global-require
4545
const config = require(`${this.nuxt.options.rootDir}/middleware.config.js`);
4646
const handler = await createServer(config);
4747
const serverMiddleware = { path: `/${apiPath}`, handler };

packages/middleware/src/createServer.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,16 +79,18 @@ async function createServer(config: MiddlewareConfig): Promise<Express> {
7979
const status = getAgnosticStatusCode(error);
8080
res.status(status);
8181
if (status < 500) {
82+
8283
/**
8384
* For all 4xx error codes or client error codes we wanted to send the error message
8485
*/
8586
res.send(error);
8687
} else {
88+
8789
/**
8890
* For all other error codes we wanted to send a generic error message
8991
*/
9092
res.send(
91-
"ServerError: Something went wrong. Please, check the logs for more details."
93+
'ServerError: Something went wrong. Please, check the logs for more details.'
9294
);
9395
}
9496
}

packages/storyblok/.gitignore

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
.idea
2+
3+
lib
4+
server
5+
coverage
6+
node_modules
7+
package-lock.json

packages/storyblok/.npmignore

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
node_modules
2+
coverage
3+
src
4+
demo
5+
__tests__
6+
.husky
7+
.github
8+
9+
.idea
10+
.editorconfig
11+
.eslintrc.js
12+
.prettierrc
13+
babel.config.js
14+
commitlint.config.js
15+
package-lock.json
16+
jest.config.ts
17+
rollup.config.js
18+
tsconfig.json
19+
yarn.lock

packages/storyblok/CHANGELOG.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# @vue-storefront/storyblok
2+
3+
## 0.4.0
4+
5+
### Minor Changes
6+
7+
- ed72567: Replaced `storyblok-vue` with `@storyblok/vue-2`.
8+
9+
## 0.4.0-rc.0
10+
11+
### Minor Changes
12+
13+
- ed72567: Replaced `storyblok-vue` with `@storyblok/vue-2`.

packages/storyblok/README.md

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
# Storyblok Integration
2+
3+
### Stay connected
4+
5+
[![GitHub Repo stars](https://img.shields.io/github/stars/vuestorefront/vue-storefront?style=social)](https://github.com/vuestorefront/vue-storefront)
6+
[![Twitter Follow](https://img.shields.io/twitter/follow/vuestorefront?style=social)](https://twitter.com/vuestorefront)
7+
[![YouTube Channel Subscribers](https://img.shields.io/youtube/channel/subscribers/UCkm1F3Cglty3CE1QwKQUhhg?style=social)](https://www.youtube.com/c/VueStorefront)
8+
[![Discord](https://img.shields.io/discord/770285988244750366?label=join%20discord&logo=Discord&logoColor=white)](https://discord.vuestorefront.io)
9+
10+
Here you can find a quick installation guide for [Storyblok](https://www.storyblok.com/) CMS integration with Alokai.
11+
12+
Full documentation can be found [here](https://docs.vuestorefront.io/storyblok).
13+
14+
### Installation
15+
16+
---
17+
18+
Install the module in your app.
19+
20+
```bash
21+
npm install @vue-storefront/storyblok @storyblok/vue-2 --save
22+
```
23+
24+
or
25+
26+
```bash
27+
yarn add @vue-storefront/storyblok -D @storyblok/vue-2
28+
```
29+
30+
Check the [documentation](https://docs.vuestorefront.io/storyblok) for all the instructions and guidelines.
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
<template>
2+
<div v-editable="content || ''">
3+
<component
4+
v-for="(component, index) in components"
5+
v-editable="content[index] ? content[index] : ''"
6+
:is="component.componentName"
7+
:key="index"
8+
v-bind="component.props"
9+
/>
10+
</div>
11+
</template>
12+
13+
<script lang="ts">
14+
import Vue from 'vue';
15+
import { extractComponents } from '@vue-storefront/storyblok';
16+
17+
interface RenderContent {
18+
componentName: string
19+
// eslint-disable-next-line @typescript-eslint/ban-types
20+
props?: {}
21+
}
22+
23+
export default Vue.extend({
24+
name: 'RenderContent',
25+
props: {
26+
content: {
27+
type: Array
28+
}
29+
},
30+
computed: {
31+
components(): RenderContent[] {
32+
return extractComponents(this.content);
33+
}
34+
}
35+
});
36+
</script>

packages/storyblok/jest.config.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
module.exports = {
2+
moduleNameMapper: {
3+
'^@/(.*)$': '<rootDir>/$1',
4+
'^~/(.*)$': '<rootDir>/$1'
5+
},
6+
moduleFileExtensions: ['js', 'ts', 'json'],
7+
transform: {
8+
'^.+\\.js$': 'babel-jest',
9+
'^.+\\.ts$': 'ts-jest'
10+
},
11+
testMatch: ['<rootDir>/**/__tests__/**/*spec.[jt]s?(x)']
12+
};

packages/storyblok/nuxt/index.js

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
import path from 'path';
2+
3+
// eslint-disable-next-line
4+
export default function storyblok(moduleOptions) {
5+
const { storyblok, head } = this.options;
6+
const options = {
7+
...storyblok,
8+
...moduleOptions
9+
};
10+
if (options.jsBridge && head) {
11+
const scripts = head.script;
12+
scripts.push({
13+
src: `${options.jsBridge}`
14+
});
15+
}
16+
this.addPlugin({
17+
src: path.resolve(__dirname, 'plugin.js'),
18+
options
19+
});
20+
}

packages/storyblok/nuxt/plugin.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
import Vue from 'vue'
2+
import {StoryblokVue} from '@storyblok/vue-2'
3+
import { integrationPlugin } from '@vue-storefront/core'
4+
5+
Vue.use(StoryblokVue)
6+
7+
export default integrationPlugin(({ integration }) => {
8+
integration.configure('sb', { ...<%= serialize(options) %> })
9+
})

packages/storyblok/package.json

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
{
2+
"name": "@vue-storefront/storyblok",
3+
"version": "0.4.0",
4+
"description": "Storyblok CMS integration with Vue Storefront",
5+
"main": "lib/index.cjs.js",
6+
"module": "lib/index.es.js",
7+
"server": "server/index.js",
8+
"scripts": {
9+
"build": "rollup -c && rm -r -- ./server/*/",
10+
"build:clean": "rollup -c && rm -r -- ./lib/*/ && rm -r -- ./server/*/",
11+
"dev": "rollup -c -w",
12+
"test": "jest --passWithNoTests",
13+
"lint": "eslint --ext .js,.ts --ignore-path .eslintignore .",
14+
"prepublish": "yarn build",
15+
"changesets:version": "yarn changeset version && YARN_ENABLE_IMMUTABLE_INSTALLS=false yarn install",
16+
"changesets:publish": "yarn build && yarn changeset publish"
17+
},
18+
"author": "Vue Storefront",
19+
"license": "MIT",
20+
"dependencies": {
21+
"@vue-storefront/core": "^2.4.3",
22+
"axios": "^0.23.0",
23+
"nanoid": "^3.1.30",
24+
"storyblok-js-client": "^4.1.5",
25+
"tslib": "^2.3.1"
26+
},
27+
"devDependencies": {
28+
"@vue-storefront/integrations-tsconfig": "^0.0.4",
29+
"@jest/globals": "^27.2.5"
30+
},
31+
"peerDependencies": {
32+
"@storyblok/vue-2": "^3.0.17"
33+
},
34+
"publishConfig": {
35+
"access": "public"
36+
},
37+
"keywords": [
38+
"vuestorefront",
39+
"vue-storefront",
40+
"storyblok",
41+
"cms",
42+
"integration",
43+
"vue",
44+
"vuejs"
45+
],
46+
"homepage": "https://github.com/vuestorefront/storyblok"
47+
}

packages/storyblok/rollup.config.js

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
import typescript from 'rollup-plugin-typescript2';
2+
import pkg from './package.json';
3+
4+
const config = {
5+
input: 'src/index.ts',
6+
output: [
7+
{
8+
file: pkg.main,
9+
format: 'cjs',
10+
sourcemap: true
11+
},
12+
{
13+
file: pkg.module,
14+
format: 'es',
15+
sourcemap: true
16+
}
17+
],
18+
external: [...Object.keys(pkg.dependencies || {})],
19+
plugins: [
20+
typescript()
21+
]
22+
};
23+
const server = {
24+
input: 'src/index.server.ts',
25+
output: [
26+
{
27+
file: pkg.server,
28+
format: 'cjs',
29+
sourcemap: true
30+
}
31+
],
32+
external: [
33+
...Object.keys(pkg.dependencies || {}),
34+
...Object.keys(pkg.peerDependencies || {})
35+
],
36+
plugins: [
37+
typescript()
38+
]
39+
};
40+
41+
export default [config, server];

0 commit comments

Comments
 (0)