Skip to content
Open
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
7 changes: 7 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@dipankarmaikap I would keep this out of the scope of this PR - we have a ticket to revisit formatting using OXC

"bracketSpacing": true,
"printWidth": 80,
"semi": true,
"singleQuote": true,
"trailingComma": "all"
}
5 changes: 0 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,6 @@
"resolutions": {
"cypress": "^14.3.3"
},
"pnpm": {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(non-blocking): same here - it's not related to the PR. No issue keeping it as it's low risk, but better to tackle it in its own PR moving forward. Will give better visibility, for example, in cases where a regression is introduced

"overrides": {
"happy-dom": "^20.8.8"
}
},
"dependencies": {
"cypress": "^14.3.3"
}
Expand Down
15 changes: 10 additions & 5 deletions packages/angular/src/lib/richtext/rich-text.component.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,11 @@ describe('SbRichTextComponent', () => {
});
describe('custom renderers', () => {
it('overrides node rendering with custom component', async () => {
const node: SbRichTextNode = { type: 'paragraph', content: [text('Hello')] };
const node: SbRichTextNode = {
type: 'paragraph',
attrs: { textAlign: null },
content: [text('Hello')],
};
TestBed.resetTestingModule();
await TestBed.configureTestingModule({
imports: [SbRichTextComponent],
Expand Down Expand Up @@ -198,6 +202,7 @@ describe('SbRichTextComponent', () => {

const node: SbRichTextNode = {
type: 'paragraph',
attrs: { textAlign: null },
content: [text('Bold Link', [{ type: 'bold' }, linkMark('https://example.com')])],
};
fixture.componentRef.setInput('sbDocument', node);
Expand Down Expand Up @@ -314,9 +319,9 @@ describe('SbRichTextComponent', () => {
const content: SbRichTextDoc = {
type: 'doc',
content: [
{ type: 'paragraph', content: [text('Before')] },
{ type: 'paragraph', attrs: { textAlign: null }, content: [text('Before')] },
{ type: 'blok', attrs: { id: 'x', body: [{ _uid: '1', component: 'test' }] } },
{ type: 'paragraph', content: [text('After')] },
{ type: 'paragraph', attrs: { textAlign: null }, content: [text('After')] },
],
};
fixture.componentRef.setInput('sbDocument', content);
Expand Down Expand Up @@ -431,9 +436,9 @@ describe('SbRichTextComponent', () => {
const doc: SbRichTextDoc = {
type: 'doc',
content: [
{ type: 'paragraph', content: [text('Before image')] },
{ type: 'paragraph', attrs: { textAlign: null }, content: [text('Before image')] },
imageNode,
{ type: 'paragraph', content: [text('After image')] },
{ type: 'paragraph', attrs: { textAlign: null }, content: [text('After image')] },
],
};
fixture.componentRef.setInput('sbDocument', doc);
Expand Down
27 changes: 27 additions & 0 deletions packages/cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
"dist/**"
],
"scripts": {
"generate:openapi": "node --experimental-strip-types --no-warnings=ExperimentalWarning scripts/generate.ts",
"build": "unbuild",
"release": "release-it",
"dev": "pnpm run build && node dist/index.mjs",
Expand All @@ -47,6 +48,31 @@
"test:ui": "vitest --ui",
"coverage": "vitest run --coverage"
},
"nx": {
"targets": {
"generate:openapi": {
"inputs": [
"{projectRoot}/scripts/generate.ts",
"openapiCodegen"
],
"outputs": [
"{projectRoot}/src/generated"
],
"cache": true,
"dependsOn": [
"@storyblok/openapi-codegen:build"
]
},
"build": {
"dependsOn": [
"^build"
],
"outputs": [
"{projectRoot}/dist/**"
]
}
}
},
"dependencies": {
"@inquirer/prompts": "^7.5.1",
"@storyblok/js": "workspace:*",
Expand All @@ -72,6 +98,7 @@
"devDependencies": {
"@release-it/conventional-changelog": "10.0.0",
"@storyblok/eslint-config": "workspace:*",
"@storyblok/openapi-codegen": "workspace:*",
"@types/cli-progress": "^3.11.6",
"@types/inquirer": "^9.0.8",
"@types/node": "^24.11.0",
Expand Down
25 changes: 25 additions & 0 deletions packages/cli/scripts/generate.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#!/usr/bin/env -S node --experimental-strip-types --no-warnings=ExperimentalWarning
/**
* Generates `storyblok` CLI's OpenAPI-derived richtext types from the pinned
* overlay spec cache. Produces `RichtextDoc`, `RichTextNode`, and
* `RichTextMark` in `src/generated/` — the types for the richtext document
* format consumed by story content.
*
* Re-run after `pnpm --filter @storyblok/openapi-codegen pull[:update]`.
*/

import { resolve } from 'node:path';
import { fileURLToPath } from 'node:url';
import { generate } from '@storyblok/openapi-codegen';
import { execSync } from 'node:child_process';

const PKG_ROOT = resolve(fileURLToPath(import.meta.url), '../..');

await generate({
outDir: resolve(PKG_ROOT, 'src/generated'),
include: ['RichtextDoc', 'RichTextNode', 'RichTextMark'],
});
const GENERATED_PATH = resolve(PKG_ROOT, 'src/generated');
execSync(`pnpm eslint ${GENERATED_PATH} --fix`, {
stdio: 'inherit',
});
Loading
Loading