-
Notifications
You must be signed in to change notification settings - Fork 131
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Rebuild for TypeScript #514
Merged
Merged
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
770c2ec
Typescript-ify.
johnrom ab1247c
Add TS to build process.
johnrom b3a9f47
Fix build script.
johnrom a350e77
Remove proptypes.
johnrom 840fe99
Timeout should use the return type of setTimeout, as it could be Node…
johnrom 9e9a18f
Check for existing instance before checking for instance.target.
johnrom 7515613
Fixed createInstance Element warning.
johnrom 6b1f465
Fixed createInstance element warning (2)
johnrom 5b9412a
Clean up package.json.
johnrom cdad744
Remove prop-types from rollup config.
johnrom File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 |
---|---|---|
@@ -1,13 +1,16 @@ | ||
{ | ||
"plugins": ["@babel/plugin-proposal-class-properties"], | ||
"presets": [ | ||
["@babel/preset-env", { "modules": false }], | ||
"@babel/preset-react" | ||
"@babel/preset-react", | ||
"@babel/preset-typescript" | ||
], | ||
"plugins": ["@babel/plugin-proposal-class-properties"], | ||
"env": { | ||
"test": { | ||
"plugins": ["@babel/plugin-proposal-class-properties"], | ||
"presets": [["@babel/preset-env", { "targets": { "node": "current" } }]] | ||
"presets": [ | ||
["@babel/preset-env", { "targets": { "node": "current" } }] | ||
] | ||
} | ||
} | ||
} |
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
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,15 +1,20 @@ | ||
import babel from 'rollup-plugin-babel'; | ||
import resolve from '@rollup/plugin-node-resolve'; | ||
|
||
const extensions = ['.js', '.jsx', '.ts', '.tsx']; | ||
|
||
export default { | ||
input: 'src/index.js', | ||
input: 'src/index.ts', | ||
output: { | ||
file: 'build/index.js', | ||
format: 'cjs', | ||
}, | ||
plugins: [ | ||
resolve({ extensions }), | ||
babel({ | ||
exclude: 'node_modules/**', | ||
extensions, | ||
}), | ||
], | ||
external: ['countup.js', 'prop-types', 'react', 'react-dom', 'warning'], | ||
external: ['countup.js', 'react', 'react-dom', 'warning'], | ||
}; |
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
File renamed without changes.
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,24 @@ | ||
{ | ||
"compilerOptions": {/* Basic Options */ | ||
"target": "es5", /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', or 'ESNEXT'. */ | ||
"module": "commonjs", /* Specify module code generation: 'commonjs', 'amd', 'system', 'umd' or 'es2015'. */ | ||
"jsx": "react", /* Specify JSX code generation: 'preserve', 'react-native', or 'react'. */ | ||
"declaration": true, /* Generates corresponding '.d.ts' file. */ | ||
"noEmit": true, /* Do not emit outputs. */ | ||
|
||
/* Strict Type-Checking Options */ | ||
"strict": true, /* Enable all strict type-checking options. */ | ||
"noImplicitAny": true, /* Raise error on expressions and declarations with an implied 'any' type. */ | ||
"strictNullChecks": true, /* Enable strict null checks. */ | ||
"noImplicitThis": true, /* Raise error on 'this' expressions with an implied 'any' type. */ | ||
"alwaysStrict": true, /* Parse in strict mode and emit "use strict" for each source file. */ | ||
|
||
/* Additional Checks */ | ||
"noUnusedLocals": true, /* Report errors on unused locals. */ | ||
"noUnusedParameters": true, /* Report errors on unused parameters. */ | ||
"noImplicitReturns": true, /* Report error when not all code paths in function return a value. */ | ||
"noFallthroughCasesInSwitch": true, /* Report errors for fallthrough cases in switch statement. */ | ||
|
||
"esModuleInterop": true, | ||
} | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need to keep babel only for test files? I suppose that we can use ts-jest. But it can be done in separate PR
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IIRC my implementation transpiles typescript using @babel/preset-typescript for both the build and tests. This is generally recommended instead of using the Typescript compiler when Babel is used for the test of transpilation instead of combining methods.
If I'm wrong about that I'll double check when I have some dev time.
Tsc is used to generate d.ts files themselves, as babel only transpiles to javascript.
I also recommend using the same transpilation method for jest as the project itself, so there aren't transpilation differences that cause test failures.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Confirmed, this PR uses babel to transpile typescript for both build and test.