diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 0000000..c8c9c28 --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,28 @@ +version: 2 +updates: + - package-ecosystem: "pnpm" + directory: "/" + schedule: + interval: "daily" + commit-message: + prefix: fix + prefix-development: chore + include: scope + groups: + linting-dx-tools: + patterns: + - "*lint*" # eslint, eslint-*, vue-eslint-parser, lint-staged, @commitlint/*, @typescript-eslint/* + - "prettier" + - "husky" + - "@vue/tsconfig" + - "*babel*" # babel-*, @vue/babel-preset-app, @babel/* + update-types: + - "minor" + - "patch" + testing-tools: + patterns: + - "@vue/test-utils" + - "vitest" + update-types: + - "minor" + - "patch" \ No newline at end of file diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..55e287f --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,41 @@ +name: Release CI + +on: + push: + branches: [main, next, beta] + pull_request: + branches: [main, next, beta] + +env: + PNPM_CACHE_FOLDER: .pnpm-store + HUSKY: 0 # Bypass husky commit hook for CI + +jobs: + release: + runs-on: ubuntu-latest + strategy: + matrix: + node-version: [20] + steps: + - name: Checkout + uses: actions/checkout@v4 + - name: Setup pnpm + uses: pnpm/action-setup@v2 + with: + version: 8 + - name: Use Node.js ${{ matrix.node-version }} + uses: actions/setup-node@v4 + with: + node-version: ${{ matrix.node-version }} + cache: pnpm + - name: Install dependencies + run: pnpm install + - name: Build lib + run: pnpm run build + - name: Test run + run: pnpm run test + - name: Release + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + NPM_TOKEN: ${{ secrets.NPM_TOKEN }} + run: npx semantic-release@latest \ No newline at end of file diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 0000000..24683f2 --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,30 @@ +name: Run Tests +on: [push] + +env: + PNPM_CACHE_FOLDER: .pnpm-store + HUSKY: 0 # Bypass husky commit hook for CI + +jobs: + test: + name: Unit Test + runs-on: ubuntu-latest + strategy: + matrix: + node-version: [20] + steps: + - name: Checkout + uses: actions/checkout@v4 + - name: Setup pnpm + uses: pnpm/action-setup@v2 + with: + version: 8 + - name: Use Node.js ${{ matrix.node-version }} + uses: actions/setup-node@v4 + with: + node-version: ${{ matrix.node-version }} + cache: pnpm + - name: Install dependencies + run: pnpm install + - name: Run Unit Tests + run: pnpm run test diff --git a/README.md b/README.md index 3c961d5..0e080bd 100644 --- a/README.md +++ b/README.md @@ -10,7 +10,7 @@ This is a proof of concept for a custom resolver for the Storyblok Richtext fiel ### Basic ```ts -import { RichTextResolver } from '@storyblok/richtext-resolver' +import { RichTextResolver } from '@storyblok/richtext' const { render } = RichTextResolver() @@ -28,7 +28,7 @@ document.querySelector('#app')!.innerHTML = ` To overwrite an existing resolver, you can pass a property called resolvers available on the `RichTextResolver` options. ```ts -import { MarkTypes, RichTextResolver } from '@storyblok/richtext-resolver' +import { MarkTypes, RichTextResolver } from '@storyblok/richtext' const html = RichTextResolver({ resolvers: { @@ -47,7 +47,7 @@ It is possible to ensure correct typing support in a framework-agnostic way by u - Vue `VNode` - React `React.ReactElement` -This way the `@storyblok/richtext-resolver` is ignorant of framework specific types, avoiding having to import them and having `vue` `react` etc as dependencies. +This way the `@storyblok/richtext` is ignorant of framework specific types, avoiding having to import them and having `vue` `react` etc as dependencies. ```ts // Vanilla diff --git a/package.json b/package.json index eaba34d..a58ccc7 100644 --- a/package.json +++ b/package.json @@ -1,5 +1,5 @@ { - "name": "@storyblok/richtext-resolver", + "name": "@storyblok/richtext", "type": "module", "version": "0.0.0", "packageManager": "pnpm@8.10.2", @@ -109,6 +109,19 @@ "semi": true, "singleQuote": false }, + "release": { + "branches": [ + "main", + { + "name": "next", + "prerelease": true + }, + { + "name": "beta", + "prerelease": true + } + ] + }, "dependencies": { "consola": "^3.2.3" } diff --git a/packages/react/package.json b/packages/react/package.json index 8e32d25..06ebadf 100644 --- a/packages/react/package.json +++ b/packages/react/package.json @@ -35,7 +35,7 @@ }, "dependencies": { "@storyblok/react": "^3.0.9", - "@storyblok/richtext-resolver": "workspace:^", + "@storyblok/richtext": "workspace:^", "@vitejs/plugin-react": "^4.2.1", "react": "^18.2.0", "react-dom": "^18.2.0" diff --git a/packages/react/src/index.ts b/packages/react/src/index.ts index 332bc73..ac8bbc2 100644 --- a/packages/react/src/index.ts +++ b/packages/react/src/index.ts @@ -1,7 +1,7 @@ import React from 'react' import { StoryblokComponent } from '@storyblok/react' -import type { Node, SbRichtextOptions } from '@storyblok/richtext-resolver' -import { BlockTypes, RichTextResolver } from '@storyblok/richtext-resolver' +import type { Node, SbRichtextOptions } from '@storyblok/richtext' +import { BlockTypes, RichTextResolver } from '@storyblok/richtext' import SbRichText from './SbRichText' function componentResolver(node: Node) { diff --git a/packages/vue/package.json b/packages/vue/package.json index af84af8..10e2d86 100644 --- a/packages/vue/package.json +++ b/packages/vue/package.json @@ -34,7 +34,7 @@ "lint:fix": "eslint . --fix" }, "dependencies": { - "@storyblok/richtext-resolver": "workspace:^", + "@storyblok/richtext": "workspace:^", "@storyblok/vue": "^8.0.7", "vue": "^3.4.21", "vue-router": "^4.3.0" diff --git a/packages/vue/src/index.ts b/packages/vue/src/index.ts index f96d16a..fc8e588 100644 --- a/packages/vue/src/index.ts +++ b/packages/vue/src/index.ts @@ -2,8 +2,8 @@ import type { VNode } from 'vue' import { createTextVNode, h } from 'vue' import { RouterLink } from 'vue-router' -import type { Node, NodeResolver, SbRichtextOptions } from '@storyblok/richtext-resolver' -import { BlockTypes, MarkTypes, RichTextResolver } from '@storyblok/richtext-resolver' +import type { Node, NodeResolver, SbRichtextOptions } from '@storyblok/richtext' +import { BlockTypes, MarkTypes, RichTextResolver } from '@storyblok/richtext' import { StoryblokComponent } from '@storyblok/vue' import SbRichText from './components/SbRichText.vue' diff --git a/playground/react/src/App.tsx b/playground/react/src/App.tsx index 62f2b6e..c62af98 100644 --- a/playground/react/src/App.tsx +++ b/playground/react/src/App.tsx @@ -1,4 +1,4 @@ -import { RichTextResolver } from '@storyblok/richtext-resolver' +import { RichTextResolver } from '@storyblok/richtext' import { StoryblokComponent, useStoryblok } from '@storyblok/react' import { SbRichText } from '@storyblok/react-richtext' import './App.css' diff --git a/playground/react/vite.config.ts b/playground/react/vite.config.ts index 4b9db57..6de920e 100644 --- a/playground/react/vite.config.ts +++ b/playground/react/vite.config.ts @@ -11,7 +11,7 @@ export default defineConfig({ ], resolve: { alias: { - '@storyblok/richtext-resolver': resolve(__dirname, '../../src/index.ts'), + '@storyblok/richtext': resolve(__dirname, '../../src/index.ts'), '@storyblok/react-richtext': resolve(__dirname, '../../packages/react/src/index.ts'), }, }, diff --git a/playground/vanilla/package.json b/playground/vanilla/package.json index 70b4a72..698d812 100644 --- a/playground/vanilla/package.json +++ b/playground/vanilla/package.json @@ -14,7 +14,7 @@ "vite-plugin-qrcode": "^0.2.3" }, "dependencies": { - "@storyblok/richtext-resolver": "workspace:^", + "@storyblok/richtext": "workspace:^", "storyblok-js-client": "^6.7.1" } } diff --git a/playground/vanilla/src/main.ts b/playground/vanilla/src/main.ts index aa8dba7..190e7e8 100644 --- a/playground/vanilla/src/main.ts +++ b/playground/vanilla/src/main.ts @@ -1,5 +1,5 @@ import './style.css' -import { MarkTypes, type Node, RichTextResolver, type SbRichtextOptions } from '@storyblok/richtext-resolver' +import { MarkTypes, type Node, RichTextResolver, type SbRichtextOptions } from '@storyblok/richtext' import StoryblokClient from 'storyblok-js-client' /* const doc: Node = { diff --git a/playground/vanilla/vite.config.ts b/playground/vanilla/vite.config.ts index e06e8cd..a6e31dd 100644 --- a/playground/vanilla/vite.config.ts +++ b/playground/vanilla/vite.config.ts @@ -16,7 +16,7 @@ export default defineConfig({ }, resolve: { alias: { - '@storyblok/richtext-resolver': resolve(__dirname, '../../src/index.ts'), + '@storyblok/richtext': resolve(__dirname, '../../src/index.ts'), }, }, }) diff --git a/playground/vue/package.json b/playground/vue/package.json index 8f3cc3c..d553875 100644 --- a/playground/vue/package.json +++ b/playground/vue/package.json @@ -9,7 +9,7 @@ "preview": "vite preview" }, "dependencies": { - "@storyblok/richtext-resolver": "workspace:^", + "@storyblok/richtext": "workspace:^", "@storyblok/vue": "^8.0.7", "@storyblok/vue-richtext": "workspace:^", "vue": "^3.4.21", diff --git a/playground/vue/src/components/HomeView.vue b/playground/vue/src/components/HomeView.vue index 7989164..74b9580 100644 --- a/playground/vue/src/components/HomeView.vue +++ b/playground/vue/src/components/HomeView.vue @@ -1,6 +1,6 @@