Skip to content

Commit

Permalink
Typescript support in icons package (#514)
Browse files Browse the repository at this point in the history
* Fix tsconfig for tokens package. Didn't realise that this was missing...

* Add typescript and typescript config

* Rename index.js -> index.ts

* Rename file endings for icons in figma broker
  • Loading branch information
wenche authored and vnys committed Nov 13, 2020
1 parent ca8b367 commit f9f566f
Show file tree
Hide file tree
Showing 10 changed files with 326 additions and 6 deletions.
2 changes: 1 addition & 1 deletion apps/figma-broker/actions/createAssets.js
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ export const ${name} = {
R.head,
)(assets)

writeFile(PATHS.ICON_FILES, 'index', 'js', jsFile)
writeFile(PATHS.ICON_FILES, 'index', 'ts', jsFile)
}

const writeJsonAssets = (assets) => {
Expand Down
File renamed without changes.
4 changes: 3 additions & 1 deletion libraries/icons/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,9 @@
],
"devDependencies": {
"@rollup/plugin-node-resolve": "^8.0.1",
"rollup": "^2.15.0"
"rollup": "^2.15.0",
"rollup-plugin-typescript2": "^0.27.2",
"typescript": "^4.0.2"
},
"engines": {
"pnpm": ">=4",
Expand Down
136 changes: 136 additions & 0 deletions libraries/icons/pnpm-lock.yaml

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

13 changes: 11 additions & 2 deletions libraries/icons/rollup.config.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,24 @@
import resolve from '@rollup/plugin-node-resolve'
import pkg from './package.json'
import typescript from 'rollup-plugin-typescript2'
import commonjsPkg from './commonjs/package.json'

// eslint-disable-next-line import/no-default-export
export default [
{
input: 'index.js',
input: 'index.ts',
watch: {
clearScreen: true,
},
plugins: [resolve()],
plugins: [
resolve(),
typescript({
tsconfig: 'tsconfig.json',
typescript: require('typescript'),
include: ['*.ts+(|x)', '**/*.ts+(|x)', '*.js+(|x)', '**/*.js+(|x)'],
exclude: ['node_modules/**'],
}),
],
output: [
{
file: pkg.module,
Expand Down
18 changes: 18 additions & 0 deletions libraries/icons/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"compilerOptions": {
"target": "es5",
"module": "esnext",
"lib": ["dom", "es2015"],
"moduleResolution": "node",
"resolveJsonModule": true,
"allowSyntheticDefaultImports": true,
"esModuleInterop": true,
"sourceMap": false,
"allowJs": true,
"checkJs": true,
"noEmit": true,
"jsx": "react"
},
"include": ["index.ts"],
"exclude": ["node_modules"]
}
1 change: 1 addition & 0 deletions libraries/tokens/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
"devDependencies": {
"@rollup/plugin-node-resolve": "^8.0.1",
"rollup": "^2.15.0",
"rollup-plugin-typescript2": "^0.27.2",
"typescript": "^4.0.2"
},
"engines": {
Expand Down
Loading

0 comments on commit f9f566f

Please sign in to comment.