Skip to content
This repository has been archived by the owner on Apr 18, 2024. It is now read-only.

chore(in-3875): storyblok package upgrade #26

Merged
merged 10 commits into from
Dec 19, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
8 changes: 8 additions & 0 deletions .changeset/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Changesets

Hello and welcome! This folder has been automatically generated by `@changesets/cli`, a build tool that works
with multi-package repos, or single-package repos to help you version and publish your code. You can
find the full documentation for it [in our repository](https://github.com/changesets/changesets)

We have a quick list of common questions to get you started engaging with this project in
[our documentation](https://github.com/changesets/changesets/blob/main/docs/common-questions.md)
10 changes: 10 additions & 0 deletions .changeset/config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"$schema": "https://unpkg.com/@changesets/[email protected]/schema.json",
"commit": false,
"fixed": [],
"linked": [],
"access": "public",
"baseBranch": "master",
"updateInternalDependencies": "patch",
"ignore": []
}
8 changes: 8 additions & 0 deletions .changeset/pre.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"mode": "pre",
"tag": "rc",
"initialVersions": {
"@vue-storefront/storyblok": "0.3.0"
},
"changesets": []
}
5 changes: 5 additions & 0 deletions .changeset/twelve-pets-live.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@vue-storefront/storyblok': minor
---

Replaced `storyblok-vue` with `@storyblok/vue-2`.
52 changes: 3 additions & 49 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,50 +1,4 @@
module.exports = {
root: true,
env: {
browser: true,
node: true,
},
parserOptions: {
ecmaVersion: 2020,
sourceType: 'module',
parser: '@typescript-eslint/parser',
},
extends: [
'prettier',
'plugin:prettier/recommended',
'eslint:recommended',
'plugin:@typescript-eslint/recommended',
'plugin:vue/vue3-recommended',
'prettier/vue',
],
plugins: ['prettier', '@typescript-eslint'],
rules: {
camelcase: 'off',
'no-unused-vars': 'off',
'object-curly-spacing': ['error', 'always'],
'array-bracket-spacing': ['error', 'never'],
'space-before-function-paren': 'off',
'@typescript-eslint/ban-ts-comment': 'off',
'@typescript-eslint/camelcase': 'off',
'@typescript-eslint/no-explicit-any': 0,
'@typescript-eslint/no-extra-semi': 'off',
'@typescript-eslint/no-unused-vars': [
'error',
{
vars: 'all',
args: 'after-used',
ignoreRestSiblings: false,
},
],
'@typescript-eslint/ban-types': [
'error',
{
extendDefaults: true,
types: {
'{}': false,
},
},
],
'vue/no-setup-props-destructure': 'off',
},
}
extends: '@vue-storefront/eslint-config-integrations',
};

1 change: 1 addition & 0 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* @vuestorefront/integrations-team
15 changes: 15 additions & 0 deletions .github/workflows/continuous-delivery.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
name: VSF Continuous Delivery

on:
workflow_dispatch:
push:
branches:
- master

jobs:
release-packages:
name: "Release NPM Packages"
uses: vuestorefront/integrations-github-workflows/.github/workflows/continuous-delivery.yml@main
secrets: inherit
with:
enterprise: false
30 changes: 30 additions & 0 deletions .github/workflows/continuous-integration.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: VSF Continuous Integration

on:
pull_request:
types: ['opened', 'edited', 'reopened', 'synchronize']

concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true

jobs:
continous-integration:
name: 'Continuous Integration'
uses: vuestorefront/integrations-github-workflows/.github/workflows/continuous-integration.yml@main
secrets: inherit
with:
enterprise: false

# This integration has 0 tests, thus the following sonarcloud check will fail

# sonarcloud:
# name: 'SonarCloud'
# needs: [continous-integration]
# uses: vuestorefront/integrations-github-workflows/.github/workflows/sonarcloud.yml@main
# secrets:
# SONARCLOUD_TOKEN: ${{ secrets.SONARCLOUD_TOKEN }}
# with:
# project_key: 'vuestorefront_storyblok'
# package_name: 'storyblok'
# exclusions: '*.config.js,src/index.ts,src/api-extractor-data.ts,**/types/**'
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,24 +7,24 @@
[![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 quick installation guide for [Storyblok](https://www.storyblok.com/) CMS integration with Vue Storefront.
Here you can find a quick installation guide for [Storyblok](https://www.storyblok.com/) CMS integration with Vue Storefront.

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

### Installation

---

Install module into your app.
Install the module in your app.

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

or

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

Check the [documentation](https://docs.vuestorefront.io/storyblok) for all the instructions and guidelines.
2 changes: 1 addition & 1 deletion nuxt/plugin.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import Vue from 'vue'
import StoryblokVue from 'storyblok-vue'
import {StoryblokVue} from '@storyblok/vue-2'
import { integrationPlugin } from '@vue-storefront/core'

Vue.use(StoryblokVue)
Expand Down
25 changes: 12 additions & 13 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@
"dev": "rollup -c -w",
"test": "jest --passWithNoTests",
"lint": "eslint --ext .js,.ts --ignore-path .eslintignore .",
"prepublish": "yarn build"
"prepublish": "yarn build",
"changesets:version": "yarn changeset version && YARN_ENABLE_IMMUTABLE_INSTALLS=false yarn install",
"changesets:publish": "yarn build && yarn changeset publish"
},
"lint-staged": {
"*.{js,ts,vue}": "eslint --ext .js,.ts --ignore-path .eslintignore ."
Expand All @@ -32,26 +34,23 @@
"tslib": "^2.3.1"
},
"devDependencies": {
"@changesets/changelog-github": "^0.4.8",
"@changesets/cli": "^2.26.1",
"@commitlint/cli": "^13.2.1",
"@commitlint/config-conventional": "^13.2.0",
"@vue-storefront/eslint-config-integrations": "^0.0.19",
"@vue-storefront/integrations-tsconfig": "^0.0.4",
"@vue-storefront/rollup-config": "^0.0.6",
"@vue/eslint-config-typescript": "^7.0.0",
"@jest/globals": "^27.2.5",
"@typescript-eslint/eslint-plugin": "^4.33.0",
"@typescript-eslint/parser": "^4.33.0",
"eslint": "^7.32.0",
"eslint-config-prettier": "^7.2.0",
"eslint-plugin-prettier": "^4.0.0",
"eslint-plugin-vue": "^7.19.1",
"husky": "^5.1.3",
"husky": "^8.0.3",
"jest": "^27.2.5",
"lint-staged": "^11.2.3",
"prettier": "^2.4.1",
"rollup": "^2.58.0",
"rollup-plugin-typescript2": "^0.30.0",
"ts-jest": "^27.0.6",
"typescript": "^4.4.4"
"ts-jest": "^29.1.0"
},
"peerDependencies": {
"storyblok-vue": "^1.0.5"
"@storyblok/vue-2": "^3.0.17"
},
"publishConfig": {
"access": "public"
Expand Down
6 changes: 3 additions & 3 deletions src/api.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import { ApiContext, ApiResponse, ContentSearchParams } from './types'
import { Logger } from '@vue-storefront/core'
import { nanoid } from 'nanoid'
import { ApiContext, ApiResponse, ContentSearchParams } from './types'
import { errorMessage } from './helpers/constants'
import { extractNestedComponents } from './helpers'

export const getContent = async (
{ client, config }: ApiContext,
{ client: Client, config }: ApiContext,
{
id,
url,
Expand All @@ -20,7 +20,7 @@ export const getContent = async (
return Logger.warn(`${errorMessage.GENERAL} ${errorMessage.EMPTY_ID}`)
}
const { token, cacheProvider } = config
const Storyblok = new client({
const Storyblok = new Client({
accessToken: token,
cache: {
clear: 'auto',
Expand Down
2 changes: 1 addition & 1 deletion src/helpers/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
return items.map((item: { image }) => {
const { replace } = actions
if (item.image) {
const image = item.image
const { image } = item
const itemObject = replace
? { ...item, url: image }
: {
Expand All @@ -34,7 +34,7 @@
if (data.content) {
extractNestedComponents(data.content)
if (Array.isArray(data.content)) {
data.content = data.content.map((component) => {

Check warning on line 37 in src/helpers/index.ts

View workflow job for this annotation

GitHub Actions / Continuous Integration / Run CI (16)

Assignment to property of function parameter 'data'

Check warning on line 37 in src/helpers/index.ts

View workflow job for this annotation

GitHub Actions / Continuous Integration / Run CI (18)

Assignment to property of function parameter 'data'
extractNestedComponents(component)
if (component.content) {
return {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,12 @@
) => {
if (window) {
// eslint-disable-next-line
// @ts-ignore
const instance = new StoryblokBridge({

Check warning on line 9 in src/helpers/storyblokBridge.ts

View workflow job for this annotation

GitHub Actions / Continuous Integration / Run CI (16)

'StoryblokBridge' is not defined

Check warning on line 9 in src/helpers/storyblokBridge.ts

View workflow job for this annotation

GitHub Actions / Continuous Integration / Run CI (18)

'StoryblokBridge' is not defined
resolveRelations: relations,
})
instance.on(events, (payload) => {
content.content = {

Check warning on line 13 in src/helpers/storyblokBridge.ts

View workflow job for this annotation

GitHub Actions / Continuous Integration / Run CI (16)

Assignment to property of function parameter 'content'

Check warning on line 13 in src/helpers/storyblokBridge.ts

View workflow job for this annotation

GitHub Actions / Continuous Integration / Run CI (18)

Assignment to property of function parameter 'content'
...payload.story.content,
_meta: payload.story,
}
Expand Down
2 changes: 1 addition & 1 deletion src/index.server.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { apiClientFactory } from '@vue-storefront/core'
import { ApiContext, ContentSearchParams } from './types'
import StoryblokClient from 'storyblok-js-client'
import { ApiContext, ContentSearchParams } from './types'

import { getContent } from './api'

Expand Down
2 changes: 1 addition & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { storyblokBridge } from './helpers/storyblokBridge.js'
import { storyblokBridge } from './helpers/storyblokBridge'

export * from './composables'
export { storyblokBridge }
File renamed without changes.
7 changes: 1 addition & 6 deletions tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,20 +1,15 @@
{
"extends": "@vue-storefront/integrations-tsconfig/tsconfig",
"compilerOptions": {
"outDir": "./dist",
"esModuleInterop": true,
"target": "es5",
"module": "ES2015",
"moduleResolution": "node",
"importHelpers": true,
"noEmitHelpers": true,
"sourceMap": true,
"declaration": true,
"skipLibCheck": true,
"forceConsistentCasingInFileNames": true,
"baseUrl": "./src",
"lib": ["es6", "es7", "ES2017", "ES2018", "ES2019", "dom"],
"strict": false,
"preserveSymlinks": true
},
"exclude": ["node_modules", "**/*.spec.ts", "*.js", "server", "lib"]
}
Loading
Loading