Skip to content

Commit

Permalink
Merge pull request #512 from bemusic/replace-babel-with-tsc
Browse files Browse the repository at this point in the history
Replace Babel with TypeScript compiler
  • Loading branch information
dtinth authored Dec 6, 2018
2 parents 154f665 + b2dc544 commit cf2bd47
Show file tree
Hide file tree
Showing 12 changed files with 104 additions and 198 deletions.
29 changes: 0 additions & 29 deletions .babelrc

This file was deleted.

2 changes: 1 addition & 1 deletion .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ globals:
xit: false
sinon: false
BemuseLogger: false
parser: babel-eslint
parser: typescript-eslint-parser
plugins:
- react
rules:
Expand Down
27 changes: 23 additions & 4 deletions config/webpack.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,15 +57,31 @@ function generateBaseConfig () {
function generateLoadersConfig () {
return [
{
test: /\.jsx?$/,
test: /\.[jt]sx?$/,
include: [path('src'), path('spec')],
use: {
loader: 'babel-loader',
loader: 'ts-loader',
options: {
cacheDirectory: true
transpileOnly: true,
compilerOptions: {
module: 'es6'
}
}
}
},
...(Env.coverageEnabled()
? [
{
test: /\.[jt]sx?$/,
include: [path('src')],
use: {
loader: 'istanbul-instrumenter-loader',
options: { esModules: true }
},
enforce: 'post'
}
]
: []),
{
test: /\.js$/,
type: 'javascript/auto',
Expand Down Expand Up @@ -221,7 +237,10 @@ function applyTestBedConfig (config) {
return config
}

export const generateWebConfig = flowRight(applyWebConfig, generateBaseConfig)
export const generateWebConfig = flowRight(
applyWebConfig,
generateBaseConfig
)

export const generateKarmaConfig = flowRight(
applyKarmaConfig,
Expand Down
5 changes: 1 addition & 4 deletions node-environment.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
require('dotenv').load()
require('@babel/register')({
plugins: ['@babel/plugin-transform-modules-commonjs']
})
require('@babel/polyfill')
require('ts-node/register/transpile-only')
global.Promise = require('bluebird')
18 changes: 4 additions & 14 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -54,19 +54,7 @@
},
"homepage": "https://github.com/spacetme/bemuse",
"devDependencies": {
"@babel/core": "^7.1.2",
"@babel/plugin-proposal-class-properties": "^7.1.0",
"@babel/plugin-syntax-dynamic-import": "^7.0.0",
"@babel/plugin-transform-modules-commonjs": "^7.1.0",
"@babel/preset-env": "^7.1.0",
"@babel/preset-react": "^7.0.0",
"@babel/register": "^7.0.0",
"autoprefixer": "^9.1.5",
"babel-eslint": "^10.0.1",
"babel-loader": "^8.0.4",
"babel-plugin-emotion": "^9.2.11",
"babel-plugin-espower": "^3.0.0",
"babel-plugin-istanbul": "^5.1.0",
"body-parser": "^1.18.3",
"brfs": "^1.6.1",
"chai": "^4.2.0",
Expand Down Expand Up @@ -102,6 +90,7 @@
"gulp-util": "^3.0.8",
"hide-stack-frames-from": "^1.0.0",
"import-sort-style-renke": "^2.4.0",
"istanbul-instrumenter-loader": "^3.0.1",
"jade": "^1.9.2",
"jade-loader": "^0.8.0",
"js-yaml": "^3.12.0",
Expand Down Expand Up @@ -140,8 +129,10 @@
"style-loader": "^0.23.1",
"through2": "^2.0.3",
"transform-loader": "^0.2.4",
"ts-loader": "^5.3.1",
"ts-node": "^7.0.1",
"typescript": "^3.1.3",
"typescript": "^3.2.1",
"typescript-eslint-parser": "^21.0.1",
"url-loader": "^1.1.2",
"val-loader": "^1.1.1",
"web-audio-test-api": "^0.5.2",
Expand All @@ -152,7 +143,6 @@
"yn": "^1.3.0"
},
"dependencies": {
"@babel/polyfill": "^7.0.0",
"audio-context": "^1.0.3",
"auth0-js": "^9.8.0",
"axios": "^0.17.1",
Expand Down
6 changes: 3 additions & 3 deletions src/app/ui/AboutScene.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -109,9 +109,9 @@ class AboutScene extends React.Component {
libraries we use into standalone web packages.
</li>
<li>
We use <a href='https://babeljs.io/'>Babel</a> so that we can
write our code in future JavaScript dialect and have it
translate our code for today{"'"}s browsers.
We use <a href="https://www.typescriptlang.org/">TypeScript</a>{' '}
to statically check our code for type errors and compiles the
code down to JavaScript.
</li>
<li>
We use{' '}
Expand Down
4 changes: 0 additions & 4 deletions src/bootstrap/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,13 @@
// :doc:
// Bootstraps the environment with:
//
// - `babel-polyfill`_
// - `debug`_
// - `Bluebird`_ (with `extended Promise API`_)
//
// .. _ES6 Runtime: https://babeljs.io/docs/usage/polyfill/
// .. _Babel: https://babeljs.io/
// .. _debug: https://www.npmjs.com/package/debug
// .. _bluebird: https://github.com/petkaantonov/bluebird
// .. _Extended Promise API: https://github.com/petkaantonov/bluebird/blob/master/API.md

import '@babel/polyfill'
import 'whatwg-fetch'
import debug from 'debug'
import Bluebird from 'bluebird'
Expand Down
4 changes: 2 additions & 2 deletions src/ui/DialogContent.jsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import styled from 'react-emotion'

const DialogContent = styled.div`
const DialogContent = styled('div')`
padding: 1em;
> p {
margin: 0;
Expand All @@ -10,7 +10,7 @@ const DialogContent = styled.div`
}
`

DialogContent.Buttons = styled.p`
DialogContent.Buttons = styled('p')`
text-align: right;
`

Expand Down
5 changes: 3 additions & 2 deletions src/ui/FloatingMobileButton.jsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
import React from 'react'
import PropTypes from 'prop-types'
import { css } from 'emotion';

function FloatingMobileButton ({ children, buttonProps }) {
return (
<button
css={`
className={css(`
position: fixed;
z-index: 102;
top: 20px;
Expand All @@ -23,7 +24,7 @@ function FloatingMobileButton ({ children, buttonProps }) {
align-items: center;
justify-content: center;
cursor: pointer;
`}
`)}
{...buttonProps}
>
{children}
Expand Down
8 changes: 4 additions & 4 deletions src/ui/FloatingMobileMenu.jsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import React from 'react'
import PropTypes from 'prop-types'
import styled, { keyframes } from 'react-emotion'
import styled, { keyframes, css } from 'react-emotion'

function FloatingMobileMenu ({ children, visible }) {
return (
<nav
css={`
className={css(`
position: fixed;
top: 0;
left: 0;
Expand All @@ -24,7 +24,7 @@ function FloatingMobileMenu ({ children, visible }) {
text-decoration: none;
color: #e9e8e7;
}
`}
`)}
>
{children}
</nav>
Expand All @@ -35,7 +35,7 @@ FloatingMobileMenu.propTypes = {
visible: PropTypes.bool
}

FloatingMobileMenu.Separator = styled.hr`
FloatingMobileMenu.Separator = styled('hr')`
height: 0;
border: 0;
border-top: 1px solid rgba(255, 255, 255, 0.3);
Expand Down
3 changes: 2 additions & 1 deletion tsconfig.base.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
"strictNullChecks": true,
"strictPropertyInitialization": true,
"target": "es6",
"module": "commonjs"
"module": "commonjs",
"jsx": "react"
}
}
Loading

0 comments on commit cf2bd47

Please sign in to comment.