-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: Update to babel 7 + Typescript (#5)
#3 Replaced Flow w/ Typescript and as a result removed Babel because TypeScript both transpiles and type checks. However this makes us miss out on a lot of the plugins that are a part of the Babel community. Babel 7 adds support for Typescript. Use babel 7 to build assets instead of tsc. The tsc command is still used for static type checking. Note that the babel typescript plugin will transpile code regardless of its typecheck correctyness. tsc is also still used to generate the declaration files, since it looks as though the babel-typescript-plugin does not support creating those at this time. However there's a "create declaration only" flag that is convenient for this. I've excluded the .spec files from the babel build, so now they won't appear in lib. I didn't move the ignore declaration into the .babelrc because I can imagine a situation where we might want to use a cool feature in our test suite that babel can transpile for is (even though node 8 gets us there at the moment). However there's never a need to have the transpiled versions in our lib. Lastly, we can now support async await etc with the additions of lib -- es2015 and dom which I think will be especially useful in our tests because most of our exports will likely be functions that return promises. PS: i'm not tied to the tests, i just want to prove that they work! I'm happy to remove them, as we definitely should in the future, thought it might be nice while we're building the foundation though. Fixes #4
- Loading branch information
1 parent
98d06d7
commit 45901bd
Showing
8 changed files
with
1,483 additions
and
859 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
{ | ||
"presets": [ | ||
["@babel/env", { | ||
"targets": { | ||
"browsers": ["last 2 versions"], | ||
"node": "current" | ||
}, | ||
"loose": true | ||
}], | ||
"@babel/typescript" | ||
], | ||
"plugins": [ | ||
"@babel/proposal-class-properties", | ||
"@babel/proposal-object-rest-spread" | ||
] | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
{ | ||
"moduleFileExtensions": ["ts", "js"], | ||
"transform": { | ||
"^.+\\.ts$": "<rootDir>/config/jest-preprocess-typescript.js" | ||
"^.+\\.(ts|js)$": "typescript-babel-jest" | ||
}, | ||
"testMatch": ["**/src/**/*.spec.(ts|js)"] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
{ | ||
"extends": "./tsconfig.json", | ||
"compilerOptions": { | ||
"declaration": true, | ||
"declarationDir": "./lib", | ||
"emitDeclarationOnly": true, | ||
"noEmit": false | ||
}, | ||
"exclude": [ | ||
"**/*.spec.ts" | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,8 @@ | ||
{ | ||
"compilerOptions": { | ||
"module": "commonjs", | ||
"target": "es5", | ||
"outDir": "./lib/cjs", | ||
"declaration": true, | ||
"noEmitOnError": true, | ||
"noImplicitAny": true | ||
}, | ||
"include": ["src/**/*"] | ||
"compilerOptions": { | ||
"lib": ["es2015", "dom"], | ||
"noImplicitAny": true, | ||
"noEmit": true | ||
}, | ||
"include": ["src/**/*"] | ||
} |
Oops, something went wrong.