Skip to content

Commit

Permalink
feat: add typescript compiler for build script (#53)
Browse files Browse the repository at this point in the history
Use tsc instead of babel for generating the package for npm
  • Loading branch information
amalv authored Nov 13, 2019
1 parent b1e26c3 commit aaee730
Show file tree
Hide file tree
Showing 11 changed files with 39 additions and 32 deletions.
14 changes: 8 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,15 +27,17 @@
"typescript": "3.7.2"
},
"scripts": {
"prettier:check": "prettier --check 'src/**/*.{ts,tsx}'",
"build": "build-storybook -o build && npm run build:lib",
"build:lib": "tsc --jsx react --skipLibCheck",
"build:watch": "tsc -w --jsx react --skipLibCheck",
"build:babel": "BABEL_ENV=production babel src -d dist2 --extensions .ts,.tsx",
"build-storybook": "build-storybook -s public",
"eject": "react-scripts eject",
"eslint": "eslint './src/**/*' --ext .ts,.tsx --fix",
"prettier:check": "prettier --check 'src/**/*.{ts,tsx}'",
"start": "react-scripts start",
"build": "build-storybook -o build && npm run build-package",
"build-package": "BABEL_ENV=production babel src -d dist --extensions .ts,.tsx",
"test": "react-scripts test",
"eject": "react-scripts eject",
"storybook": "start-storybook -p 9009 -s public",
"build-storybook": "build-storybook -s public"
"test": "react-scripts test"
},
"eslintConfig": {
"extends": "react-app"
Expand Down
6 changes: 1 addition & 5 deletions src/components/Icon.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
import React from "react";
import * as React from "react";
import styled from "styled-components";
import { icons } from "./shared/icons";

interface MyType {
[key: string]: string;
}

interface IconProps {
icon: string;
block?: boolean;
Expand Down
2 changes: 1 addition & 1 deletion src/components/Input.stories.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React from "react";
import * as React from "react";
import { Input } from "./Input";

export default {
Expand Down
2 changes: 1 addition & 1 deletion src/components/Input.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React from "react";
import * as React from "react";
import { StylesProvider, useTheme } from "@material-ui/core/styles";
import { InputStyled } from "./Input.styles";

Expand Down
2 changes: 1 addition & 1 deletion src/components/Post.stories.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React from "react";
import * as React from "react";
import { Post } from "./Post";

export default {
Expand Down
2 changes: 1 addition & 1 deletion src/components/Post.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React from "react";
import * as React from "react";
import { StylesProvider, useTheme } from "@material-ui/core/styles";
import CardContent from "@material-ui/core/CardContent";
import Grid from "@material-ui/core/Grid";
Expand Down
2 changes: 1 addition & 1 deletion src/components/RoundedButton.stories.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React from "react";
import * as React from "react";
import { action } from "@storybook/addon-actions";
import { RoundedButton } from "./RoundedButton";

Expand Down
2 changes: 1 addition & 1 deletion src/components/RoundedButton.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React from "react";
import * as React from "react";
import { ColorProperty } from "csstype";

export interface RoundedButtonProps {
Expand Down
2 changes: 1 addition & 1 deletion src/components/SignInButton.stories.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React from "react";
import * as React from "react";
import { SignInButton } from "./SignInButton";

export default {
Expand Down
2 changes: 1 addition & 1 deletion src/components/SignInButton.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React from "react";
import * as React from "react";
import Grid from "@material-ui/core/Grid";
import { StylesProvider } from "@material-ui/core/styles";
import { TextGridItem, BaseButton } from "./SignIn.styles";
Expand Down
35 changes: 22 additions & 13 deletions tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,20 +1,29 @@
{
"compilerOptions": {
"target": "es5",
"lib": ["dom", "dom.iterable", "esnext"],
"allowJs": true,
"skipLibCheck": true,
"esModuleInterop": true,
"allowSyntheticDefaultImports": true,
"strict": true,
"forceConsistentCasingInFileNames": true,
"module": "esnext",
"outDir": "dist",
"module": "commonjs",
"target": "es5",
"lib": ["es5", "es6", "es7", "es2017", "dom"],
"sourceMap": true,
"allowJs": false,
"jsx": "react",
"moduleResolution": "node",
"resolveJsonModule": true,
"isolatedModules": true,
"noEmit": true,
"jsx": "react"
"rootDirs": ["src", "stories"],
"baseUrl": "src",
"forceConsistentCasingInFileNames": true,
"noImplicitReturns": true,
"noImplicitThis": true,
"noImplicitAny": true,
"strictNullChecks": true,
"suppressImplicitAnyIndexErrors": true,
"noUnusedLocals": true,
"declaration": true,
"allowSyntheticDefaultImports": true,
"experimentalDecorators": true,
"emitDecoratorMetadata": true
},
"include": ["src"],
"include": ["src/**/*"],
"exclude": ["node_modules"],
"files": ["custom.d.ts"]
}

1 comment on commit aaee730

@vercel
Copy link

@vercel vercel bot commented on aaee730 Nov 13, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.