@spark-ui/cli-utils 2.11.12 → 2.11.14
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 +10 -0
- package/package.json +2 -2
- package/src/generate/generators/TemplateGenerator.mjs +0 -2
- package/src/generate/templates/component/src/[Component.stories.tsx].js +13 -13
- package/src/generate/templates/component/src/[Component.styles.ts].js +1 -0
- package/src/generate/validators/NameValidator.mjs +0 -1
- package/test/spark-generate.test.ts +4 -3
- package/test/utils/cmd.js +2 -2
- package/src/generate/templates/component/src/[Component.styles.tsx].js +0 -8
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,16 @@
|
|
|
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.11.14](https://github.com/adevinta/spark/compare/@spark-ui/cli-utils@2.11.13...@spark-ui/cli-utils@2.11.14) (2023-08-23)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @spark-ui/cli-utils
|
|
9
|
+
|
|
10
|
+
## [2.11.13](https://github.com/adevinta/spark/compare/@spark-ui/cli-utils@2.11.12...@spark-ui/cli-utils@2.11.13) (2023-07-28)
|
|
11
|
+
|
|
12
|
+
### Bug Fixes
|
|
13
|
+
|
|
14
|
+
- fix errors after eslint update ([3dae947](https://github.com/adevinta/spark/commit/3dae947dc169d9db3c7252f54a6224ded335980e))
|
|
15
|
+
|
|
6
16
|
## [2.11.12](https://github.com/adevinta/spark/compare/@spark-ui/cli-utils@2.11.11...@spark-ui/cli-utils@2.11.12) (2023-07-17)
|
|
7
17
|
|
|
8
18
|
**Note:** Version bump only for package @spark-ui/cli-utils
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@spark-ui/cli-utils",
|
|
3
|
-
"version": "2.11.
|
|
3
|
+
"version": "2.11.14",
|
|
4
4
|
"description": "Spark CLI utils",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
@@ -33,5 +33,5 @@
|
|
|
33
33
|
"devDependencies": {
|
|
34
34
|
"@types/fs-extra": "11.0.1"
|
|
35
35
|
},
|
|
36
|
-
"gitHead": "
|
|
36
|
+
"gitHead": "b3cb5019cadc8baac0c94c6e980a772bc2cdf633"
|
|
37
37
|
}
|
|
@@ -1,11 +1,9 @@
|
|
|
1
|
-
import { join } from 'node:path'
|
|
2
1
|
import { fileURLToPath } from 'node:url'
|
|
3
2
|
|
|
4
3
|
import { camelCase } from 'camel-case'
|
|
5
4
|
import glob from 'glob'
|
|
6
5
|
import { pascalCase } from 'pascal-case'
|
|
7
6
|
|
|
8
|
-
import { System } from '../../core/index.mjs'
|
|
9
7
|
import { Generator } from './Generator.mjs'
|
|
10
8
|
|
|
11
9
|
export class TemplateGenerator extends Generator {
|
|
@@ -1,21 +1,21 @@
|
|
|
1
1
|
import { pascalCase } from 'pascal-case'
|
|
2
2
|
|
|
3
|
-
export default ({ name
|
|
3
|
+
export default ({ name }) => {
|
|
4
4
|
const componentName = pascalCase(name)
|
|
5
5
|
|
|
6
|
-
return `
|
|
6
|
+
return `
|
|
7
|
+
import { Meta, StoryFn } from '@storybook/react'
|
|
8
|
+
import { ${componentName} } from '.'
|
|
7
9
|
|
|
8
|
-
|
|
10
|
+
const meta: Meta<typeof ${componentName}> = {
|
|
11
|
+
title: 'Components/${componentName}',
|
|
12
|
+
component: ${componentName},
|
|
13
|
+
}
|
|
9
14
|
|
|
10
|
-
|
|
11
|
-
title: 'Components/${componentName}',
|
|
12
|
-
component: ${componentName},
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
export default meta
|
|
15
|
+
export default meta
|
|
16
16
|
|
|
17
|
-
export const Default: StoryFn = _args => (
|
|
18
|
-
|
|
19
|
-
)
|
|
20
|
-
`
|
|
17
|
+
export const Default: StoryFn = _args => (
|
|
18
|
+
<${componentName}>Hello World!</${componentName}>
|
|
19
|
+
)
|
|
20
|
+
`
|
|
21
21
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default () => ''
|
|
@@ -20,7 +20,7 @@ describe('CLI `spark generate` (component package)', () => {
|
|
|
20
20
|
// WHEN we execute the `spark generate` command
|
|
21
21
|
const response = await cliProcess.execute(
|
|
22
22
|
['generate'],
|
|
23
|
-
[packageName, ENTER, packageType, ENTER, 'This is my foo component', ENTER]
|
|
23
|
+
[packageName, ENTER, packageType, ENTER, 'This is my foo component', ENTER],
|
|
24
24
|
)
|
|
25
25
|
const contextPath = TemplateGenerator.CONTEXTS[packageType] as string
|
|
26
26
|
const packagePath = path.join(process.cwd(), 'packages', contextPath, packageName)
|
|
@@ -30,7 +30,7 @@ describe('CLI `spark generate` (component package)', () => {
|
|
|
30
30
|
'/.npmignore',
|
|
31
31
|
'/package.json',
|
|
32
32
|
'/src/index.ts',
|
|
33
|
-
'/src/Bar.styles.
|
|
33
|
+
'/src/Bar.styles.ts',
|
|
34
34
|
'/src/Bar.tsx',
|
|
35
35
|
'/vite.config.ts',
|
|
36
36
|
'/src/Bar.doc.mdx',
|
|
@@ -38,6 +38,7 @@ describe('CLI `spark generate` (component package)', () => {
|
|
|
38
38
|
'/src/Bar.stories.tsx',
|
|
39
39
|
'/tsconfig.json',
|
|
40
40
|
]
|
|
41
|
+
|
|
41
42
|
const assertExpectedFiles = (filePath: string) => {
|
|
42
43
|
expect(response).toContain(`Created ${packagePath}${filePath}`)
|
|
43
44
|
expect(fse.pathExistsSync(`${packagePath}${filePath}`)).toBe(true)
|
|
@@ -61,7 +62,7 @@ describe('CLI `spark generate` (component package)', () => {
|
|
|
61
62
|
|
|
62
63
|
// THEN it throws an error and fails to create files for this package
|
|
63
64
|
expect(response).toContain(
|
|
64
|
-
'Name name must contain letters and dash symbols only (ex: "my-package")'
|
|
65
|
+
'Name name must contain letters and dash symbols only (ex: "my-package")',
|
|
65
66
|
)
|
|
66
67
|
expect(fse.pathExistsSync(packagePath)).toBe(false)
|
|
67
68
|
})
|
package/test/utils/cmd.js
CHANGED
|
@@ -34,7 +34,7 @@ function createProcess(processPath, args = [], env = null) {
|
|
|
34
34
|
preventAutoStart: false,
|
|
35
35
|
PATH, // This is needed in order to get all the binaries in your current terminal
|
|
36
36
|
},
|
|
37
|
-
env
|
|
37
|
+
env,
|
|
38
38
|
),
|
|
39
39
|
stdio: [null, null, null, 'ipc'], // This enables interprocess communication (IPC)
|
|
40
40
|
})
|
|
@@ -131,7 +131,7 @@ function executeWithInput(processPath, args, inputs, opts = {}) {
|
|
|
131
131
|
}
|
|
132
132
|
|
|
133
133
|
resolve(result.toString())
|
|
134
|
-
})
|
|
134
|
+
}),
|
|
135
135
|
)
|
|
136
136
|
})
|
|
137
137
|
|