@spark-ui/cli-utils 2.8.0 → 2.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -3,6 +3,12 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ # [2.9.0](https://github.com/adevinta/spark/compare/@spark-ui/cli-utils@2.8.0...@spark-ui/cli-utils@2.9.0) (2023-03-27)
7
+
8
+ ### Features
9
+
10
+ - **cli-utils:** component package template updated to match agreements ([10e7159](https://github.com/adevinta/spark/commit/10e71594f604f946e94c6f776f559ca0d0212860)), closes [#465](https://github.com/adevinta/spark/issues/465)
11
+
6
12
  # [2.8.0](https://github.com/adevinta/spark/compare/@spark-ui/cli-utils@2.7.3...@spark-ui/cli-utils@2.8.0) (2023-03-23)
7
13
 
8
14
  ### Features
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@spark-ui/cli-utils",
3
- "version": "2.8.0",
3
+ "version": "2.9.0",
4
4
  "description": "Spark CLI utils",
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -28,5 +28,5 @@
28
28
  "devDependencies": {
29
29
  "@types/fs-extra": "11.0.1"
30
30
  },
31
- "gitHead": "9b2398b8c58cf0359169bdde07e8e33ede075e16"
31
+ "gitHead": "0980f5c892af17c497dd2b363d81a577af43f820"
32
32
  }
@@ -3,15 +3,14 @@ import { pascalCase } from 'pascal-case'
3
3
  export default ({ name, description }) => {
4
4
  const componentName = pascalCase(name)
5
5
 
6
- return `import { ArgsTable, Meta, Story } from '@storybook/addon-docs'
7
- import { ReactLiveBlock } from '@docs/helpers/ReactLiveBlock'
6
+ return `import { ArgsTable, Meta, Story, Canvas } from '@storybook/addon-docs'
8
7
  import { StoryHeading } from '@docs/helpers/StoryHeading'
9
8
 
10
9
  import { ${componentName} } from '.'
11
10
 
12
11
  import * as stories from './${componentName}.stories'
13
12
 
14
- <Meta title="Components/Misc/${componentName}" component={${componentName}} />
13
+ <Meta of={stories} />
15
14
 
16
15
  # ${componentName}
17
16
 
@@ -35,6 +34,8 @@ import { ${componentName} } from "@spark-ui/${name}"
35
34
 
36
35
  <StoryHeading label="Variants" />
37
36
 
38
- <Story name="default" story={stories.Default} />
37
+ <Canvas>
38
+ <Story of={stories.Default} />
39
+ </Canvas>
39
40
  `
40
41
  }
@@ -3,14 +3,19 @@ import { pascalCase } from 'pascal-case'
3
3
  export default ({ name, description }) => {
4
4
  const componentName = pascalCase(name)
5
5
 
6
- return `import { ReactLiveBlock } from '@docs/helpers/ReactLiveBlock'
6
+ return `import { Meta, StoryFn } from '@storybook/react'
7
7
 
8
8
  import { ${componentName} } from '.'
9
9
 
10
- export const Default = () => (
11
- <ReactLiveBlock scope={{ ${componentName} }}>
12
- <${componentName}>Hello World!</${componentName}>
13
- </ReactLiveBlock>
10
+ const meta: Meta<typeof Portal> = {
11
+ title: 'Components/${componentName}',
12
+ component: ${componentName},
13
+ }
14
+
15
+ export default meta
16
+
17
+ export const Default: StoryFn = _args => (
18
+ <${componentName}>Hello World!</${componentName}>
14
19
  )
15
20
  `
16
21
  }
@@ -3,12 +3,12 @@ import { pascalCase } from 'pascal-case'
3
3
  export default ({ name }) => {
4
4
  const componentName = pascalCase(name)
5
5
 
6
- return `import { ComponentPropsWithoutRef, PropsWithChildren } from 'react'
6
+ return `import { forwardRef, ComponentPropsWithoutRef, PropsWithChildren } from 'react'
7
7
 
8
8
  export type ${componentName}Props = ComponentPropsWithoutRef<'div'>
9
9
 
10
- export function ${componentName}(props: PropsWithChildren<${componentName}Props>) {
11
- return <div {...props} />
12
- }
10
+ export const ${componentName} = forwardRef<HTMLDivElement, PropsWithChildren<${componentName}Props>>((props, ref) => {
11
+ return <div ref={ref} {...props} />
12
+ })
13
13
  `
14
14
  }
@@ -33,7 +33,7 @@ describe('CLI `spark generate` (component package)', () => {
33
33
  '/src/Bar.variants.tsx',
34
34
  '/src/Bar.tsx',
35
35
  '/vite.config.ts',
36
- '/src/Bar.stories.mdx',
36
+ '/src/Bar.doc.mdx',
37
37
  '/src/Bar.test.tsx',
38
38
  '/src/Bar.stories.tsx',
39
39
  '/tsconfig.json',