@spark-ui/cli-utils 2.0.3 → 2.0.5
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 +8 -0
- package/bin/spark-generate.mjs +3 -3
- package/bin/spark-setup-theme.mjs +5 -3
- package/package.json +3 -3
- package/{bin → src}/core/Logger.mjs +1 -0
- package/{bin → src}/core/System.mjs +1 -1
- package/{bin → src/generate}/generators/TemplateGenerator.mjs +5 -4
- package/{bin → src/generate}/validators/DescriptionValidator.mjs +0 -4
- package/{bin → src/generate}/validators/NameValidator.mjs +1 -1
- package/src/index.stories.mdx +9 -3
- package/{utils/setupTheme → src/setup-theme/utils}/createCSSTokenfile.js +1 -1
- package/{utils/setupTheme → src/setup-theme/utils}/createTailwindThemeConfigFile.js +1 -1
- /package/{bin → src}/core/index.mjs +0 -0
- /package/{bin → src/generate}/generators/Generator.mjs +0 -0
- /package/{bin → src/generate}/generators/index.mjs +0 -0
- /package/{templates → src/generate/templates}/component/[.npmignore].js +0 -0
- /package/{templates → src/generate/templates}/component/[package.json].js +0 -0
- /package/{templates → src/generate/templates}/component/[tsconfig.json].js +0 -0
- /package/{templates → src/generate/templates}/component/[vite.config.ts].js +0 -0
- /package/{templates → src/generate/templates}/component/src/[Component.stories.mdx].js +0 -0
- /package/{templates → src/generate/templates}/component/src/[Component.stories.tsx].js +0 -0
- /package/{templates → src/generate/templates}/component/src/[Component.test.tsx].js +0 -0
- /package/{templates → src/generate/templates}/component/src/[Component.tsx].js +0 -0
- /package/{templates → src/generate/templates}/component/src/[Component.variants.tsx].js +0 -0
- /package/{templates → src/generate/templates}/component/src/[index.ts].js +0 -0
- /package/{templates → src/generate/templates}/hook/[.npmignore].js +0 -0
- /package/{templates → src/generate/templates}/hook/[package.json].js +0 -0
- /package/{templates → src/generate/templates}/hook/[tsconfig.json].js +0 -0
- /package/{templates → src/generate/templates}/hook/[vite.config.ts].js +0 -0
- /package/{templates → src/generate/templates}/hook/src/[index.ts].js +0 -0
- /package/{templates → src/generate/templates}/hook/src/[name.stories.mdx].js +0 -0
- /package/{templates → src/generate/templates}/hook/src/[name.test.tsx].js +0 -0
- /package/{templates → src/generate/templates}/hook/src/[name.tsx].js +0 -0
- /package/{templates → src/generate/templates}/util/[.npmignore].js +0 -0
- /package/{templates → src/generate/templates}/util/[package.json].js +0 -0
- /package/{templates → src/generate/templates}/util/[tsconfig.json].js +0 -0
- /package/{templates → src/generate/templates}/util/[vite.config.ts].js +0 -0
- /package/{templates → src/generate/templates}/util/src/[index.ts].js +0 -0
- /package/{bin → src/generate}/validators/Validator.mjs +0 -0
- /package/{bin → src/generate}/validators/index.mjs +0 -0
- /package/{utils/setupTheme → src/setup-theme/utils}/index.js +0 -0
- /package/{utils/setupTheme → src}/utils.js +0 -0
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,14 @@
|
|
|
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.0.5](https://github.com/adevinta/spark/compare/@spark-ui/cli-utils@2.0.4...@spark-ui/cli-utils@2.0.5) (2023-02-24)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @spark-ui/cli-utils
|
|
9
|
+
|
|
10
|
+
## [2.0.4](https://github.com/adevinta/spark/compare/@spark-ui/cli-utils@2.0.3...@spark-ui/cli-utils@2.0.4) (2023-02-24)
|
|
11
|
+
|
|
12
|
+
**Note:** Version bump only for package @spark-ui/cli-utils
|
|
13
|
+
|
|
6
14
|
## [2.0.3](https://github.com/adevinta/spark/compare/@spark-ui/cli-utils@2.0.2...@spark-ui/cli-utils@2.0.3) (2023-02-23)
|
|
7
15
|
|
|
8
16
|
**Note:** Version bump only for package @spark-ui/cli-utils
|
package/bin/spark-generate.mjs
CHANGED
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
|
|
3
3
|
import * as prompt from '@clack/prompts'
|
|
4
4
|
|
|
5
|
-
import { TemplateGenerator } from '
|
|
6
|
-
import { Logger, System } from '
|
|
7
|
-
import { DescriptionValidator, NameValidator } from '
|
|
5
|
+
import { TemplateGenerator } from '../src/generate/generators/index.mjs'
|
|
6
|
+
import { Logger, System } from '../src/core/index.mjs'
|
|
7
|
+
import { DescriptionValidator, NameValidator } from '../src/generate/validators/index.mjs'
|
|
8
8
|
|
|
9
9
|
const logger = new Logger()
|
|
10
10
|
const system = new System({ logger })
|
|
@@ -5,9 +5,11 @@ import { join, extname } from 'node:path'
|
|
|
5
5
|
import { readFileSync, readdirSync, writeFileSync, unlinkSync } from 'node:fs'
|
|
6
6
|
import { transformSync } from 'esbuild'
|
|
7
7
|
import { createRequire } from 'node:module'
|
|
8
|
-
|
|
9
|
-
import {
|
|
10
|
-
|
|
8
|
+
import { Logger, System } from '../src/core/index.mjs'
|
|
9
|
+
import {
|
|
10
|
+
createCSSTokensFile,
|
|
11
|
+
createTailwindThemeConfigFile,
|
|
12
|
+
} from '../src/setup-theme/utils/index.js'
|
|
11
13
|
|
|
12
14
|
const logger = new Logger()
|
|
13
15
|
const system = new System({ logger })
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@spark-ui/cli-utils",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.5",
|
|
4
4
|
"description": "Spark CLI utils",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
"type": "module",
|
|
14
14
|
"dependencies": {
|
|
15
15
|
"@clack/prompts": "0.2.2",
|
|
16
|
-
"@spark-ui/theme-utils": "^2.3.
|
|
16
|
+
"@spark-ui/theme-utils": "^2.3.1",
|
|
17
17
|
"camel-case": "4.1.2",
|
|
18
18
|
"chalk": "5.2.0",
|
|
19
19
|
"commander": "10.0.0",
|
|
@@ -29,5 +29,5 @@
|
|
|
29
29
|
"url": "git@github.com:adevinta/spark.git",
|
|
30
30
|
"directory": "packages/utils/cli"
|
|
31
31
|
},
|
|
32
|
-
"gitHead": "
|
|
32
|
+
"gitHead": "ef9e9e64bcaf2c2527725d995c9329c5672ac82b"
|
|
33
33
|
}
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { join } from 'node:path'
|
|
2
2
|
import { fileURLToPath } from 'node:url'
|
|
3
|
+
|
|
4
|
+
import { camelCase } from 'camel-case'
|
|
3
5
|
import glob from 'glob'
|
|
4
6
|
import { pascalCase } from 'pascal-case'
|
|
5
|
-
import { camelCase } from 'camel-case'
|
|
6
7
|
|
|
7
|
-
import { System } from '
|
|
8
|
+
import { System } from '../../core/index.mjs'
|
|
8
9
|
import { Generator } from './Generator.mjs'
|
|
9
10
|
|
|
10
11
|
export class TemplateGenerator extends Generator {
|
|
@@ -16,7 +17,7 @@ export class TemplateGenerator extends Generator {
|
|
|
16
17
|
|
|
17
18
|
static CONTEXTS = {
|
|
18
19
|
[TemplateGenerator.TYPES.COMPONENT]: 'components',
|
|
19
|
-
[TemplateGenerator.TYPES.HOOK]: '
|
|
20
|
+
[TemplateGenerator.TYPES.HOOK]: 'hooks',
|
|
20
21
|
[TemplateGenerator.TYPES.UTIL]: 'utils',
|
|
21
22
|
}
|
|
22
23
|
|
|
@@ -33,7 +34,7 @@ export class TemplateGenerator extends Generator {
|
|
|
33
34
|
}
|
|
34
35
|
|
|
35
36
|
getTemplatePaths({ type }) {
|
|
36
|
-
const pattern = fileURLToPath(new URL(
|
|
37
|
+
const pattern = fileURLToPath(new URL(`../templates/${type}/**/*.js`, import.meta.url))
|
|
37
38
|
|
|
38
39
|
return new Promise((resolve, reject) => {
|
|
39
40
|
glob(pattern, async (error, paths) => {
|
package/src/index.stories.mdx
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { Meta } from '@storybook/blocks'
|
|
2
2
|
import { StoryHeading } from '@docs/helpers/StoryHeading'
|
|
3
|
+
import { Alert } from '@docs/helpers/Alert'
|
|
3
4
|
|
|
4
5
|
<Meta title="utils/CLI" />
|
|
5
6
|
|
|
@@ -8,13 +9,13 @@ import { StoryHeading } from '@docs/helpers/StoryHeading'
|
|
|
8
9
|
This package provides some CLI commands to improve the development experience when building the Spark design system. Right now there are some different commands available:
|
|
9
10
|
|
|
10
11
|
- A command for generating new components: `$ spark generate`.
|
|
11
|
-
- A command for doing the initial setup for
|
|
12
|
+
- A command for doing the initial setup for one or more themes: `$ spark setup-themes`.
|
|
12
13
|
|
|
13
14
|
## Contents
|
|
14
15
|
|
|
15
16
|
- [Installation](#installation)
|
|
16
17
|
- [Generating a new package](#generating-a-new-package)
|
|
17
|
-
- [Setting up
|
|
18
|
+
- [Setting up your themes](#setting-up-your-themes)
|
|
18
19
|
|
|
19
20
|
<StoryHeading label="Installation" as="h2" />
|
|
20
21
|
|
|
@@ -44,7 +45,12 @@ Then, a command prompt will guide you through the process by asking you for:
|
|
|
44
45
|
- the template used (required, only `Component` template available right now)
|
|
45
46
|
- and the package description (optional).
|
|
46
47
|
|
|
47
|
-
<StoryHeading label="Setting up
|
|
48
|
+
<StoryHeading label="Setting up your themes" as="h2" />
|
|
49
|
+
|
|
50
|
+
<Alert kind="info">
|
|
51
|
+
[Step-by-step guide to integrating Spark into your current
|
|
52
|
+
project](?path=/docs/getting-started--docs#getting-started)
|
|
53
|
+
</Alert>
|
|
48
54
|
|
|
49
55
|
```bash
|
|
50
56
|
$ spark setup-theme
|
|
@@ -3,7 +3,7 @@ import { join } from 'node:path'
|
|
|
3
3
|
|
|
4
4
|
import hexRgb from 'hex-rgb'
|
|
5
5
|
|
|
6
|
-
import { isHex, isStringOrNumber, toKebabCase } from '
|
|
6
|
+
import { isHex, isStringOrNumber, toKebabCase } from '../../utils.js'
|
|
7
7
|
|
|
8
8
|
function flattenTheme(theme, className) {
|
|
9
9
|
const flattenedTheme = {}
|
|
@@ -3,7 +3,7 @@ import { join } from 'node:path'
|
|
|
3
3
|
|
|
4
4
|
import { defaultTheme } from '@spark-ui/theme-utils'
|
|
5
5
|
|
|
6
|
-
import { isHex, isStringOrNumber, toKebabCase, toKebabCaseKeys } from '
|
|
6
|
+
import { isHex, isStringOrNumber, toKebabCase, toKebabCaseKeys } from '../../utils.js'
|
|
7
7
|
|
|
8
8
|
function toTailwindConfig(theme) {
|
|
9
9
|
const themeCpy = JSON.parse(JSON.stringify(theme))
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|