@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 +6 -0
- package/package.json +2 -2
- package/src/generate/templates/component/src/{[Component.stories.mdx].js → [Component.doc.mdx].js} +5 -4
- package/src/generate/templates/component/src/[Component.stories.tsx].js +10 -5
- package/src/generate/templates/component/src/[Component.tsx].js +4 -4
- package/test/spark-generate.test.ts +1 -1
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.
|
|
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": "
|
|
31
|
+
"gitHead": "0980f5c892af17c497dd2b363d81a577af43f820"
|
|
32
32
|
}
|
package/src/generate/templates/component/src/{[Component.stories.mdx].js → [Component.doc.mdx].js}
RENAMED
|
@@ -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
|
|
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
|
-
<
|
|
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 {
|
|
6
|
+
return `import { Meta, StoryFn } from '@storybook/react'
|
|
7
7
|
|
|
8
8
|
import { ${componentName} } from '.'
|
|
9
9
|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
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
|
|
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
|
}
|