@kong/design-tokens 2.0.0-pr.91.e870166.0 → 2.0.0

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/README.md CHANGED
@@ -1,8 +1,6 @@
1
- # Kong UI Design Tokens
1
+ # @kong/design-tokens
2
2
 
3
- Kong Design Tokens, via [Style Dictionary](https://github.com/amzn/style-dictionary).
4
-
5
- > **Note**: Repository and documentation is a work in progress. This package is currently for Kong internal-use only, but is published publicly in order to consume in our OSS projects.
3
+ Kong Design Tokens for Konnect, via [Style Dictionary](https://github.com/amzn/style-dictionary).
6
4
 
7
5
  - [Tokens](#tokens)
8
6
  - [Token Formats](#token-formats)
@@ -12,22 +10,21 @@ Kong Design Tokens, via [Style Dictionary](https://github.com/amzn/style-diction
12
10
  - [JavaScript](#javascript)
13
11
  - [Usage](#usage)
14
12
  - [Installation](#installation)
15
- - [Stylelint Plugin](#stylelint-plugin)
16
- - [Recommended VS Code extension](#recommended-vs-code-extension)
17
13
  - [Standalone components](#standalone-components)
18
14
  - [Host applications](#host-applications)
19
- - [Updating Tokens \& Local Development](#updating-tokens--local-development)
15
+ - [Updating Tokens & Local Development](#updating-tokens--local-development)
20
16
  - [Token Requirements](#token-requirements)
21
17
  - [Development Sandbox](#development-sandbox)
22
18
  - [Lint and fix](#lint-and-fix)
23
19
  - [Build for production](#build-for-production)
24
20
  - [Token Update Workflow](#token-update-workflow)
25
21
  - [Committing Changes](#committing-changes)
22
+ - [Approvals](#approvals)
26
23
  - [Package Publishing](#package-publishing)
27
24
 
28
25
  ## Tokens
29
26
 
30
- All design tokens **must** be placed inside of the `/tokens` directory in one of two sub-directories.
27
+ All design tokens **must** be placed inside of the `packages/design-tokens/tokens/` directory in one of two sub-directories.
31
28
 
32
29
  [View the lists of available tokens here](TOKENS.md), or keep reading for more information.
33
30
 
@@ -40,7 +37,7 @@ The `@kong/design-tokens` package exports tokens in multiple formats:
40
37
  - [CSS Custom Properties](#css-custom-properties)
41
38
  - [JavaScript](#javascript) (ESM, CJS, and JSON), along with corresponding TypeScript types
42
39
 
43
- Exports are available from the package root, meaning you do not need to include the `dist/` directory in your imports:
40
+ Exports are available from the package root meaning you do not need to include the `dist/` directory in your imports:
44
41
 
45
42
  ```ts
46
43
  // Notice that for JavaScript/TypeScript, we can just import from the root
@@ -160,7 +157,7 @@ The package also exports a JSON file of all tokens from `@kong/design-tokens/tok
160
157
  In your host project, install the package **only** as a `devDependency`:
161
158
 
162
159
  ```shell
163
- yarn add -D @kong/design-tokens
160
+ pnpm add -D @kong/design-tokens
164
161
  ```
165
162
 
166
163
  #### Why a `devDependency`?
@@ -171,25 +168,7 @@ This strategy alleviates the need for a consuming application to need to install
171
168
 
172
169
  ### Stylelint Plugin
173
170
 
174
- This package offers a [Stylelint](https://github.com/stylelint/stylelint) plugin for linting the usage of Kong Design Tokens.
175
-
176
- [View the Stylelint plugin docs for usage instructions](./stylelint-plugin/README.md)
177
-
178
- ### Recommended VS Code extension
179
-
180
- To get auto-completion of the SCSS variables in your project within VS Code, you can add the [SCSS IntelliSense extension](https://marketplace.visualstudio.com/items?itemName=mrmlnc.vscode-scss) to VS Code on your machine along with the corresponding settings object which will auto-import the variables for auto-completion. Notice that we are explicitly **not excluding** `node_modules`:
181
-
182
- ```jsonc
183
- // settings.json
184
- {
185
- "scss.scannerExclude": [
186
- "**/.git",
187
- "**/bower_components"
188
- ]
189
- }
190
- ```
191
-
192
- If you are installing the package as a `devDependency` in your project, you can add a `/.vscode/settings.json` file into your project that will enforce these settings in your project for all developers.
171
+ This package used to bundle a Stylelint plugin. It is now a standalone package. See [`@kong/stylelint-plugin-design-tokens`](../stylelint-plugin-design-tokens/README.md).
193
172
 
194
173
  ### Standalone components
195
174
 
@@ -283,7 +262,7 @@ export default defineConfig({
283
262
  // Explicitly alias the SCSS file since we are overriding the default import below
284
263
  '@kong/design-tokens/tokens/scss/variables': path.resolve(__dirname, '../node_modules/@kong/design-tokens/dist/tokens/scss/variables.scss'),
285
264
  // Alias `@kong/design-tokens` imports to specifically utilize the esm build
286
- '@kong/design-tokens': path.resolve(__dirname, '../node_modules/@kong/design-tokens/dist/tokens/js/'),
265
+ '@kong/design-tokens': path.resolve(__dirname, '../node_modules/@kong/design-tokens/dist/tokens/js/index.mjs'),
287
266
  },
288
267
  },
289
268
  })
@@ -291,15 +270,15 @@ export default defineConfig({
291
270
 
292
271
  ## Updating Tokens & Local Development
293
272
 
294
- To get started, install the package dependencies
273
+ To get started, install the package dependencies from the repo root:
295
274
 
296
275
  ```sh
297
- yarn install --frozen-lockfile
276
+ pnpm install
298
277
  ```
299
278
 
300
279
  ### Token Requirements
301
280
 
302
- - Tokens **must** be defined in the corresponding JSON files within the `/tokens` directory in one of two sub-directories:
281
+ - Tokens **must** be defined in the corresponding JSON files within the `packages/design-tokens/tokens/` directory in one of two sub-directories:
303
282
 
304
283
  Directory | Description
305
284
  ---------|----------
@@ -352,15 +331,21 @@ yarn install --frozen-lockfile
352
331
 
353
332
  ### Development Sandbox
354
333
 
355
- This repository includes a Vue sandbox (see the `/sandbox` directory) to allow you to experiment with consuming tokens.
334
+ This package includes a Vue sandbox (see the `sandbox/` directory) to allow you to experiment with consuming tokens.
356
335
 
357
- To start the sandbox:
336
+ To start the sandbox, run from the **repo root**:
358
337
 
359
338
  ```sh
360
- yarn sandbox
339
+ pnpm sandbox:design-tokens
361
340
  ```
362
341
 
363
- This command will simultaneously start the Vite dev server and initialize a watcher on the `/tokens` directory. If any files in the `/tokens` directory are modified, the sandbox will automatically run the build command to update the tokens and then restart the Vite dev server (simulating hot module reload).
342
+ Or from within this package directory:
343
+
344
+ ```sh
345
+ pnpm sandbox
346
+ ```
347
+
348
+ This command will simultaneously start the Vite dev server and initialize a watcher on the `tokens/` directory. If any files in the `tokens/` directory are modified, the sandbox will automatically run the build command to update the tokens and then restart the Vite dev server (simulating hot module reload).
364
349
 
365
350
  Updating any files within the sandbox itself will also trigger hot module reload as expected.
366
351
 
@@ -370,21 +355,35 @@ Lint package files, and optionally auto-fix detected issues.
370
355
 
371
356
  ```sh
372
357
  # Lint only
373
- yarn lint
358
+ pnpm lint
374
359
 
375
360
  # Lint and fix
376
- yarn lint:fix
361
+ pnpm lint:fix
377
362
  ```
378
363
 
364
+ ### Shared build utilities
365
+
366
+ Build-time utilities — Style Dictionary transforms, string helpers, and the file-header factory — live in this package's own `utilities/` directory and are exported from `utilities/index.mjs`.
367
+
368
+ **Package-specific** build utilities (e.g. transforms or formatters that only apply to `@kong/design-tokens`) should be added to `utilities/` and exported from `utilities/index.mjs`.
369
+
379
370
  ### Build for production
380
371
 
381
- Utilize the `style-dictionary` CLI to build the token assets for production based on the configuration in `/config.js`.
372
+ Utilize the `style-dictionary` CLI to build the token assets for production based on the configuration in `config.mjs`.
373
+
374
+ From this package directory:
382
375
 
383
376
  ```sh
384
- yarn build
377
+ pnpm build
385
378
  ```
386
379
 
387
- If additional sub-directories (other than `dist/tokens`) are added to the `dist/` directory in `/config.js`, you will also need to create a new corresponding entry in the `package.json > exports` section to allow for importing into the host project without `dist/` in the path.
380
+ Or from the repo root:
381
+
382
+ ```sh
383
+ pnpm --filter @kong/design-tokens build
384
+ ```
385
+
386
+ If additional sub-directories (other than `dist/tokens`) are added to the `dist/` directory in `config.mjs`, you will also need to create a new corresponding entry in the `package.json > exports` section to allow for importing into the host project without `dist/` in the path.
388
387
 
389
388
  For example, if I want to add a new `my-feature` folder, I'd update the `exports` entry as shown here:
390
389
 
@@ -399,10 +398,10 @@ For example, if I want to add a new `my-feature` folder, I'd update the `exports
399
398
  ### Token Update Workflow
400
399
 
401
400
  1. Ensure you are on the `main` branch, then pull down the latest code by running `git checkout main && git pull origin main`
402
- 2. Checkout a new branch for your changes with `git checkout -b {type}/{jira-ticket}-{description}` - as an example, `git checkout feat/khcp-1234-add-color-tokens`
403
- 3. Add/edit the tokens in the `/tokens` directory as needed, ensuring to adhere to the [Token Requirements](#token-requirements)
404
- 4. Before committing your changes, locally run `yarn lint` to ensure you do not have any linting errors. If you have errors, you can try running `yarn lint:fix` to resolve
405
- 5. Commit your changes, adhering to [Conventional Commits](#committing-changes). To make this easier, you're encouraged to run `yarn commit` to help build your commit message
401
+ 2. Checkout a new branch for your changes with `git checkout -b {type}/{jira-ticket}-{description}` as an example, `git checkout feat/khcp-1234-add-color-tokens`
402
+ 3. Add/edit the tokens in the `packages/design-tokens/tokens/` directory as needed, ensuring to adhere to the [Token Requirements](#token-requirements)
403
+ 4. Before committing your changes, locally run `pnpm lint` to ensure you do not have any linting errors. If you have errors, you can try running `pnpm lint:fix` to resolve
404
+ 5. Commit your changes, adhering to [Conventional Commits](#committing-changes). To make this easier, you're encouraged to run `pnpm commit` from the repo root to help build your commit message
406
405
  6. Push your branch up to the remote with `git push origin {branch-name}`
407
406
  7. Open a pull request and request a review
408
407
 
@@ -414,10 +413,10 @@ This repo uses [Conventional Commits](https://www.conventionalcommits.org/en/v1.
414
413
 
415
414
  [Commitizen](https://github.com/commitizen/cz-cli) and [Commitlint](https://github.com/conventional-changelog/commitlint) are used to help build and enforce commit messages.
416
415
 
417
- It is **highly recommended** to use the following command in order to create your commits:
416
+ It is **highly recommended** to use the following command from the repo root in order to create your commits:
418
417
 
419
418
  ```sh
420
- yarn commit
419
+ pnpm commit
421
420
  ```
422
421
 
423
422
  This will trigger the Commitizen interactive prompt for building your commit message.
@@ -426,11 +425,19 @@ This will trigger the Commitizen interactive prompt for building your commit mes
426
425
 
427
426
  [Lefthook](https://github.com/evilmartians/lefthook) is used to manage Git Hooks within the repo.
428
427
 
429
- - A `commit-msg` hook is automatically setup that enforces commit message stands with `commitlint`, see [`lefthook.yml`](./lefthook.yaml)
428
+ - A `commit-msg` hook is automatically setup that enforces commit message standards with `commitlint`
430
429
  - A `pre-push` hook is used that runs `eslint` before allowing you to push your changes to the repository
431
430
 
432
431
  Additionally, CI will use `commitlint` to validate the commits associated with a PR in the `Lint and Validate` job.
433
432
 
433
+ ### Approvals
434
+
435
+ - All pull requests require review and approval from authorized team members.
436
+ - Automated approvals through workflows are strictly prohibited.
437
+ - There is an exception for automated pull request approvals originating from generated dependency updates that satisfy status checks and other requirements.
438
+ - Protected branches require at least one approval from code owners.
439
+ - All status checks must pass before a pull request may be merged.
440
+
434
441
  ### Package Publishing
435
442
 
436
- This repository utilizes [Semantic Release](https://github.com/semantic-release/semantic-release) for automated package publishing and version updates.
443
+ This package is published automatically via [lerna-lite](https://github.com/lerna-lite/lerna-lite) in independent mode. Releases are triggered by conventional commits on `main`, `alpha`, and `beta` branches.