Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(cli): support json configuration for tokens create #2847

Merged
merged 3 commits into from
Jan 8, 2025

Conversation

unekinn
Copy link
Contributor

@unekinn unekinn commented Nov 28, 2024

Closes #2846

Some things to note:

  • Most CLI options are no longer required, although they must be set either in JSON or through CLI. This could be confusing. I tried to look in to building options conditionally, so that e.g. options could be required if --json was not used or default config was not found, but this doesn't seem to be possible
  • The complete config is validated, so users will still get an error if options are missing. We could probably work on making the errors more clear.
  • CLI options take priority over JSON config. This is usually how CLI tools work.
  • Because of this, we need to know whether an option was supplied or not. This means we have to check if the option is set through the CLI or is a default value, before we decide whether it should overwrite the JSON config. The function getExplicitOptionOnly() has been added for this purpose.

Copy link

changeset-bot bot commented Nov 28, 2024

🦋 Changeset detected

Latest commit: 9a91153

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 4 packages
Name Type
@digdir/designsystemet Patch
@digdir/designsystemet-css Patch
@digdir/designsystemet-theme Patch
@digdir/designsystemet-react Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

Copy link
Contributor

github-actions bot commented Nov 28, 2024

Preview deployments for this pull request:

Storybook - 8. Jan 2025 - 15:58

@unekinn unekinn force-pushed the feat/cli-tokens-create-json-config branch from 807abb5 to 7561391 Compare November 28, 2024 13:15
Copy link
Contributor

github-actions bot commented Nov 28, 2024

Coverage Report

Status Category Percentage Covered / Total
🔵 Lines 55.42% 3190 / 5756
🔵 Statements 55.42% 3190 / 5756
🔵 Functions 86.25% 182 / 211
🔵 Branches 77.25% 523 / 677
File CoverageNo changed files found.
Generated in workflow #1533 for commit 9a91153 by the Vitest Coverage Report Action

@unekinn unekinn force-pushed the feat/cli-tokens-create-json-config branch 2 times, most recently from 0489d12 to e745bf4 Compare December 16, 2024 12:46
@unekinn unekinn marked this pull request as ready for review December 16, 2024 13:02
@unekinn unekinn force-pushed the feat/cli-tokens-create-json-config branch 2 times, most recently from a776f8c to 1fd3e22 Compare January 7, 2025 11:53
@unekinn unekinn force-pushed the feat/cli-tokens-create-json-config branch from 1fd3e22 to afc6dc1 Compare January 7, 2025 12:41
Copy link
Collaborator

@mimarz mimarz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added missing changeset.

I think this is a good start. We don't need to promote this feature yet, but test it internally for now and fine tune it.

@mimarz mimarz merged commit 3109699 into next Jan 8, 2025
10 checks passed
@mimarz mimarz deleted the feat/cli-tokens-create-json-config branch January 8, 2025 15:05
mimarz pushed a commit that referenced this pull request Jan 14, 2025
This PR was opened by the [Changesets
release](https://github.com/changesets/action) GitHub action. When
you're ready to do a release, you can merge this and the packages will
be published to npm automatically. If you're not ready to do a release
yet, that's fine, whenever you add more changesets to next, this PR will
be updated.

⚠️⚠️⚠️⚠️⚠️⚠️

`next` is currently in **pre mode** so this branch has prereleases
rather than normal releases. If you want to exit prereleases, run
`changeset pre exit` on `next`.

⚠️⚠️⚠️⚠️⚠️⚠️

# Releases
## @digdir/[email protected]

### Minor Changes

- Add JSON schema for CLI config file, which enables editor hints. To
use it, do something like this:
([#2972](#2972))

    ```jsonc
    {
"$schema":
"node_modules/@digdir/designsystemet/dist/config.schema.json",
      // ...config options here...
    }
    ```

- cli: better error messages for wrong or missing options
([#2970](#2970))

### Patch Changes

- tokens: fix wrong reference for focus color.
([#2989](#2989))

- refactor: Changed border-radius token to dimension type
([#2990](#2990))

- Add json config file support for `tokens create`
([#2847](#2847))

- Changed focus color to use neutral instead of accent color
([#2989](#2989))

- tokens build: fix invalid values in --ds-size calculations
([#2975](#2975))

- outDir option was required, but it should have a default value
([#2969](#2969))

## @digdir/[email protected]

### Patch Changes

- Helptext: Remove component
([#2956](#2956))

- Field: Don't show as disabled when option is disabled
([#2980](#2980))

- Changed focus color to use neutral instead of accent color
([#2989](#2989))

- Tabs: Rework component CSS
([#2991](#2991))

## @digdir/[email protected]

### Patch Changes

- Input: Add whitelist for `type`
([#2974](#2974))

- Helptext: Remove component
([#2956](#2956))

- Textfield: Add whitelist for `type`
([#2974](#2974))

- Tabs: Content will get focus when it has no focusable elements
([#2991](#2991))

## @digdir/[email protected]

### Patch Changes

- Changed focus color to use neutral instead of accent color
([#2989](#2989))

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Configuration file for CLI
2 participants