Skip to content

Commit

Permalink
Types for tokens library (#507)
Browse files Browse the repository at this point in the history
* Install typescript and types for react and react-dom

* Add support for typescript by using .ts extensions for js files

* Change file extensions to .ts in figma-broker
  • Loading branch information
wenche authored and vnys committed Nov 13, 2020
1 parent 46965c8 commit ca8b367
Show file tree
Hide file tree
Showing 11 changed files with 13 additions and 3 deletions.
4 changes: 2 additions & 2 deletions apps/figma-broker/actions/createTokens.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ const PATHS_ = {
}

const writeJSTokens = (tokens) => {
writeResults(tokens, PATHS_.BASE_TOKENS_JS, 'js')
writeResults(tokens, PATHS_.BASE_TOKENS_JS, 'ts')

const baseIndexContent = `${tokens
.map((token) => `import { ${token.name} } from './${token.name}'`)
Expand All @@ -32,7 +32,7 @@ const writeJSTokens = (tokens) => {
}
`

writeFile(PATHS_.BASE_TOKENS_JS, 'index', 'js', baseIndexContent)
writeFile(PATHS_.BASE_TOKENS_JS, 'index', 'ts', baseIndexContent)

// Disabled – shouldn’t really be done here…
// writeFile(`${TOKENS_DIR}`, 'index', 'js', `export { tokens } from './base'`)
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
3 changes: 2 additions & 1 deletion libraries/tokens/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,8 @@
],
"devDependencies": {
"@rollup/plugin-node-resolve": "^8.0.1",
"rollup": "^2.15.0"
"rollup": "^2.15.0",
"typescript": "^4.0.2"
},
"engines": {
"pnpm": ">=4",
Expand Down
9 changes: 9 additions & 0 deletions libraries/tokens/pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit ca8b367

Please sign in to comment.