From c3a0765c5c32bf90757d7300e1fdd1fb87918b59 Mon Sep 17 00:00:00 2001 From: Une Sofie Kinn Ekroll Date: Thu, 7 Nov 2024 15:09:28 +0100 Subject: [PATCH] fix(cli): limit the exports from ./tokens and export a barrel file at root (#2745) --- apps/theme/components/TokenModal/TokenModal.tsx | 2 +- packages/cli/package.json | 9 ++++++--- packages/cli/src/index.ts | 2 ++ packages/cli/src/tokens/index.ts | 1 + 4 files changed, 10 insertions(+), 4 deletions(-) create mode 100644 packages/cli/src/index.ts create mode 100644 packages/cli/src/tokens/index.ts diff --git a/apps/theme/components/TokenModal/TokenModal.tsx b/apps/theme/components/TokenModal/TokenModal.tsx index b8423e9512..9e81134690 100644 --- a/apps/theme/components/TokenModal/TokenModal.tsx +++ b/apps/theme/components/TokenModal/TokenModal.tsx @@ -8,7 +8,7 @@ import { Paragraph, Textfield, } from '@digdir/designsystemet-react'; -import { createTokens } from '@digdir/designsystemet/tokens/create.js'; +import { createTokens } from '@digdir/designsystemet/tokens'; import { CodeIcon, InformationSquareIcon } from '@navikt/aksel-icons'; import { CodeSnippet } from '@repo/components'; import { useEffect, useRef, useState } from 'react'; diff --git a/packages/cli/package.json b/packages/cli/package.json index e6cb557ccf..95c0f81e20 100644 --- a/packages/cli/package.json +++ b/packages/cli/package.json @@ -10,17 +10,20 @@ "homepage": "https://github.com/digdir/designsystemet/tree/main/scripts/cli", "license": "MIT", "type": "module", - "types": "./dist/types", + "main": "./dist/src/index.js", "files": [ "./dist/**" ], "bin": "dist/bin/designsystemet.js", "exports": { + ".": { + "import": "./dist/src/index.js" + }, "./color": { "import": "./dist/src/colors/index.js" }, - "./tokens/*": { - "import": "./dist/src/tokens/*" + "./tokens": { + "import": "./dist/src/tokens/index.js" } }, "publishConfig": { diff --git a/packages/cli/src/index.ts b/packages/cli/src/index.ts new file mode 100644 index 0000000000..f2a3412868 --- /dev/null +++ b/packages/cli/src/index.ts @@ -0,0 +1,2 @@ +export * from './colors'; +export * from './tokens'; diff --git a/packages/cli/src/tokens/index.ts b/packages/cli/src/tokens/index.ts new file mode 100644 index 0000000000..de12b5aa43 --- /dev/null +++ b/packages/cli/src/tokens/index.ts @@ -0,0 +1 @@ +export { type CreateTokensOptions, createTokens } from './create';