@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.
Files changed (42) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/bin/spark-generate.mjs +3 -3
  3. package/bin/spark-setup-theme.mjs +5 -3
  4. package/package.json +3 -3
  5. package/{bin → src}/core/Logger.mjs +1 -0
  6. package/{bin → src}/core/System.mjs +1 -1
  7. package/{bin → src/generate}/generators/TemplateGenerator.mjs +5 -4
  8. package/{bin → src/generate}/validators/DescriptionValidator.mjs +0 -4
  9. package/{bin → src/generate}/validators/NameValidator.mjs +1 -1
  10. package/src/index.stories.mdx +9 -3
  11. package/{utils/setupTheme → src/setup-theme/utils}/createCSSTokenfile.js +1 -1
  12. package/{utils/setupTheme → src/setup-theme/utils}/createTailwindThemeConfigFile.js +1 -1
  13. /package/{bin → src}/core/index.mjs +0 -0
  14. /package/{bin → src/generate}/generators/Generator.mjs +0 -0
  15. /package/{bin → src/generate}/generators/index.mjs +0 -0
  16. /package/{templates → src/generate/templates}/component/[.npmignore].js +0 -0
  17. /package/{templates → src/generate/templates}/component/[package.json].js +0 -0
  18. /package/{templates → src/generate/templates}/component/[tsconfig.json].js +0 -0
  19. /package/{templates → src/generate/templates}/component/[vite.config.ts].js +0 -0
  20. /package/{templates → src/generate/templates}/component/src/[Component.stories.mdx].js +0 -0
  21. /package/{templates → src/generate/templates}/component/src/[Component.stories.tsx].js +0 -0
  22. /package/{templates → src/generate/templates}/component/src/[Component.test.tsx].js +0 -0
  23. /package/{templates → src/generate/templates}/component/src/[Component.tsx].js +0 -0
  24. /package/{templates → src/generate/templates}/component/src/[Component.variants.tsx].js +0 -0
  25. /package/{templates → src/generate/templates}/component/src/[index.ts].js +0 -0
  26. /package/{templates → src/generate/templates}/hook/[.npmignore].js +0 -0
  27. /package/{templates → src/generate/templates}/hook/[package.json].js +0 -0
  28. /package/{templates → src/generate/templates}/hook/[tsconfig.json].js +0 -0
  29. /package/{templates → src/generate/templates}/hook/[vite.config.ts].js +0 -0
  30. /package/{templates → src/generate/templates}/hook/src/[index.ts].js +0 -0
  31. /package/{templates → src/generate/templates}/hook/src/[name.stories.mdx].js +0 -0
  32. /package/{templates → src/generate/templates}/hook/src/[name.test.tsx].js +0 -0
  33. /package/{templates → src/generate/templates}/hook/src/[name.tsx].js +0 -0
  34. /package/{templates → src/generate/templates}/util/[.npmignore].js +0 -0
  35. /package/{templates → src/generate/templates}/util/[package.json].js +0 -0
  36. /package/{templates → src/generate/templates}/util/[tsconfig.json].js +0 -0
  37. /package/{templates → src/generate/templates}/util/[vite.config.ts].js +0 -0
  38. /package/{templates → src/generate/templates}/util/src/[index.ts].js +0 -0
  39. /package/{bin → src/generate}/validators/Validator.mjs +0 -0
  40. /package/{bin → src/generate}/validators/index.mjs +0 -0
  41. /package/{utils/setupTheme → src/setup-theme/utils}/index.js +0 -0
  42. /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
@@ -2,9 +2,9 @@
2
2
 
3
3
  import * as prompt from '@clack/prompts'
4
4
 
5
- import { TemplateGenerator } from './generators/index.mjs'
6
- import { Logger, System } from './core/index.mjs'
7
- import { DescriptionValidator, NameValidator } from './validators/index.mjs'
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 { Logger, System } from './core/index.mjs'
10
- import { createCSSTokensFile, createTailwindThemeConfigFile } from '../utils/setupTheme/index.js'
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",
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.0",
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": "920c415878ef0f07ac3409a4c24d5ee2b49423a4"
32
+ "gitHead": "ef9e9e64bcaf2c2527725d995c9329c5672ac82b"
33
33
  }
@@ -1,3 +1,4 @@
1
+ /* eslint-disable no-console */
1
2
  import chalk from 'chalk'
2
3
 
3
4
  export class Logger {
@@ -40,6 +40,6 @@ export class System {
40
40
  return fse
41
41
  .outputFile(path, content)
42
42
  .then(() => this.logger.info(`Created ${path}`))
43
- .catch(error => this.exit(`Failed creating ${path}`))
43
+ .catch(() => this.exit(`Failed creating ${path}`))
44
44
  }
45
45
  }
@@ -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 '../core/index.mjs'
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]: 'components',
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(`../../templates/${type}/**/*.js`, import.meta.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) => {
@@ -1,10 +1,6 @@
1
1
  import { Validator } from './Validator.mjs'
2
2
 
3
3
  export class DescriptionValidator extends Validator {
4
- constructor() {
5
- super()
6
- }
7
-
8
4
  validate(description) {
9
5
  if (!description) {
10
6
  return 'You package must have a description'
@@ -1,4 +1,4 @@
1
- import { System } from '../core/index.mjs'
1
+ import { System } from '../../core/index.mjs'
2
2
  import { Validator } from './Validator.mjs'
3
3
 
4
4
  export class NameValidator extends Validator {
@@ -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 a new theme: `$ spark setup-theme`.
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 a theme](#setting-up-a-theme)
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 a theme" as="h2" />
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 './utils.js'
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 './utils.js'
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