Skip to content

Commit

Permalink
chore: add tsconfig file within component package to generate the TS …
Browse files Browse the repository at this point in the history
…declaration files (#344)

* chore: add tsconfig to generate d.ts files

* docs: adjust stackblitz link position in mdx docs

* chore: set utilities to canary
  • Loading branch information
annawen1 authored Dec 30, 2024
1 parent 1225d25 commit d31d8d6
Show file tree
Hide file tree
Showing 6 changed files with 30 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,17 @@ import * as ExampleButtonStories from './ExampleButton.stories';

<Meta isTemplate />

# ExampleButton

{/* <!-- START doctoc generated TOC please keep comment here to allow auto update --> */}
{/* <!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE --> */}

> 💡 Check our
> [Stackblitz](https://stackblitz.com/github/carbon-design-system/carbon-labs/tree/main/examples/react/example-button)
> example implementation.
[![Edit carbon-labs](https://developer.stackblitz.com/img/open_in_stackblitz.svg)](https://stackblitz.com/github/carbon-design-system/carbon-labs/tree/main/examples/react/example-button)

# ExampleButton

{/* <!-- START doctoc generated TOC please keep comment here to allow auto update --> */}
{/* <!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE --> */}

## Table of Contents

- [Overview](#overview)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
*/
import React from 'react';
import { Button, ButtonProps } from '@carbon/react';
import { usePrefix } from '../../../internal/usePrefix';
import { usePrefix } from '@carbon-labs/utilities/es/index.js';

/** Primary UI component for user interaction */

Expand Down
3 changes: 3 additions & 0 deletions packages/react/src/components/ExampleButton/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,8 @@
"scripts": {
"build": "node ../../../tasks/build.js",
"clean": "rm -rf {es,lib,scss}"
},
"devDependencies": {
"@carbon-labs/utilities": "canary"
}
}
8 changes: 8 additions & 0 deletions packages/react/src/components/ExampleButton/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"extends": "typescript-config-carbon/tsconfig.base.json",
"compilerOptions": {
// TODO: Turn back on once stricter typings for internal utitlies are complete
"noImplicitAny": false
},
"exclude": ["**/__stories__/*.stories.js", "**/__tests__/*"]
}
2 changes: 1 addition & 1 deletion packages/react/tasks/build.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ const packageJSON = JSON.parse(
async function build() {
const reactEntrypoint = {
filepath: path.resolve(process.cwd(), 'index.ts'),
rootDir: 'src',
rootDir: path.resolve(process.cwd()),
outputDirectory: path.resolve(process.cwd()),
};

Expand Down
12 changes: 12 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2585,6 +2585,8 @@ __metadata:
"@carbon-labs/react-example-button@workspace:packages/react/src/components/ExampleButton":
version: 0.0.0-use.local
resolution: "@carbon-labs/react-example-button@workspace:packages/react/src/components/ExampleButton"
dependencies:
"@carbon-labs/utilities": "npm:canary"
languageName: unknown
linkType: soft

Expand All @@ -2606,6 +2608,16 @@ __metadata:
languageName: node
linkType: hard

"@carbon-labs/utilities@npm:canary":
version: 0.14.1-canary.387
resolution: "@carbon-labs/utilities@npm:0.14.1-canary.387"
dependencies:
react: "npm:^18.3.1"
react-dom: "npm:^18.3.1"
checksum: 10c0/17f791a40f4f55689924b355fdecbfb254abd99325e1aee86ef96b7adb95e57d5be0b0eb928083137a6bad8a667d1bdfe33af2946502fa48434a133fb43756a3
languageName: node
linkType: hard

"@carbon-labs/web-components-example-button@workspace:packages/web-components/src/components/example-button":
version: 0.0.0-use.local
resolution: "@carbon-labs/web-components-example-button@workspace:packages/web-components/src/components/example-button"
Expand Down

0 comments on commit d31d8d6

Please sign in to comment.