Skip to content

Commit ce8530a

Browse files
committed
Not much to say, converting everything to TypeScript
1 parent 6970c83 commit ce8530a

File tree

14 files changed

+5430
-193
lines changed

14 files changed

+5430
-193
lines changed

.babelrc

Lines changed: 0 additions & 10 deletions
This file was deleted.

.eslintrc

Lines changed: 0 additions & 61 deletions
This file was deleted.

.npmignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,4 @@ npm-debug.*
99
.babelrc
1010
.debug.log
1111
webpack.*
12-
gulpfile.js
12+
gulpfile.ts

demo/.eslintrc

Lines changed: 0 additions & 6 deletions
This file was deleted.

demo/client.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ import React from 'react';
22
import { render } from 'react-dom';
33
import App from './App';
44

5-
65
// stylings
76
import '../node_modules/normalize.css/normalize.css';
87
import '../node_modules/font-awesome/css/font-awesome.css';

gulpfile.js

Lines changed: 40 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,40 @@
1-
const gulp = require('gulp');
2-
const rename = require('gulp-rename');
3-
const babel = require("gulp-babel");
4-
const webpack = require('gulp-webpack');
5-
const webpackConfig = require('./webpack.config.demo.prod.js');
6-
const sass = require('gulp-sass');
7-
8-
gulp.task('build_styles', function () {
9-
return gulp.src('./src/styles/*.scss')
10-
.pipe(sass().on('error', sass.logError))
11-
.pipe(gulp.dest('./lib/styles'));
12-
});
13-
14-
// library
15-
gulp.task('copy_styles', function () {
16-
return gulp.src('./src/styles/**/*')
17-
.pipe(gulp.dest('./lib/styles'));
18-
});
19-
20-
gulp.task('build', ['copy_styles', 'build_styles'], function () {
21-
return gulp.src("./src/**/*.js")
22-
.pipe(babel())
23-
.pipe(gulp.dest("./lib"));
24-
});
25-
26-
// demo
27-
// removes the output configuration from the webpack.config.js file, otherwise it doesn't work.
28-
webpackConfig.output.path = null;
29-
30-
gulp.task('copy-index', function () {
31-
return gulp.src('./demo/index.prod.html')
32-
.pipe(rename('index.html'))
33-
.pipe(gulp.dest('./docs'));
34-
});
35-
36-
gulp.task('build-demo', ['copy-index'], function () {
37-
return gulp.src("./demo/client.js")
38-
.pipe(webpack(webpackConfig))
39-
.pipe(gulp.dest('./docs'));
40-
});
1+
// const gulp = require('gulp');
2+
// const rename = require('gulp-rename');
3+
// const babel = require("gulp-babel");
4+
// const webpack = require('gulp-webpack');
5+
// const webpackConfig = require('./webpack.config.demo.prod.js');
6+
// const sass = require('gulp-sass');
7+
//
8+
// gulp.task('build_styles', function () {
9+
// return gulp.src('./src/styles/*.scss')
10+
// .pipe(sass().on('error', sass.logError))
11+
// .pipe(gulp.dest('./lib/styles'));
12+
// });
13+
//
14+
// // library
15+
// gulp.task('copy_styles', function () {
16+
// return gulp.src('./src/styles/!**!/!*')
17+
// .pipe(gulp.dest('./lib/styles'));
18+
// });
19+
//
20+
// gulp.task('build', ['copy_styles', 'build_styles'], function () {
21+
// return gulp.src("./src/!**/!*.js")
22+
// .pipe(babel())
23+
// .pipe(gulp.dest("./lib"));
24+
// });
25+
//
26+
// // demo
27+
// // removes the output configuration from the webpack.config.js file, otherwise it doesn't work.
28+
// webpackConfig.output.path = null;
29+
//
30+
// gulp.task('copy-index', function () {
31+
// return gulp.src('./demo/index.prod.html')
32+
// .pipe(rename('index.html'))
33+
// .pipe(gulp.dest('./docs'));
34+
// });
35+
//
36+
// gulp.task('build-demo', ['copy-index'], function () {
37+
// return gulp.src("./demo/client.js")
38+
// .pipe(webpack(webpackConfig))
39+
// .pipe(gulp.dest('./docs'));
40+
// });

package.json

Lines changed: 20 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -26,48 +26,39 @@
2626
"url": "https://github.com/andrerpena/react-mde.git/issues"
2727
},
2828
"devDependencies": {
29-
"babel-cli": "^6.18.0",
30-
"babel-loader": "^7.0.0",
31-
"babel-plugin-add-module-exports": "^0.2.1",
32-
"babel-preset-es2015": "^6.18.0",
33-
"babel-preset-react": "^6.16.0",
34-
"babel-preset-react-hmre": "^1.1.1",
35-
"babel-preset-stage-0": "^6.16.0",
36-
"bootstrap": "^4.0.0-alpha.5",
37-
"chai": "^3.5.0",
29+
"@types/react": "^16.0.18",
30+
"@types/react-dom": "^16.0.2",
31+
"@types/showdown": "^1.7.1",
32+
"awesome-typescript-loader": "^3.2.3",
33+
"chai": "^4.1.2",
3834
"colors": "^1.1.2",
39-
"cross-env": "^4.0.0",
40-
"css-loader": "^0.27.0",
35+
"cross-env": "^5.1.0",
36+
"css-loader": "^0.28.7",
4137
"express": "^4.14.0",
42-
"extract-text-webpack-plugin": "^2.1.0",
43-
"file-loader": "^0.10.0",
38+
"extract-text-webpack-plugin": "^3.0.2",
39+
"file-loader": "^1.1.5",
4440
"gulp": "^3.9.1",
45-
"gulp-babel": "^6.1.2",
4641
"gulp-cli": "^1.2.2",
4742
"gulp-rename": "^1.2.2",
4843
"gulp-webpack": "^1.5.0",
49-
"mocha": "^3.2.0",
50-
"normalize.css": "^6.0.0",
44+
"mocha": "^4.0.1",
5145
"node-sass": "^4.1.1",
46+
"normalize.css": "^7.0.0",
5247
"react-hot-loader": "^3.0.0-beta.6",
53-
"react-redux": "^5.0.1",
54-
"redux": "^3.6.0",
5548
"sass-loader": "^6.0.1",
56-
"style-loader": "^0.14.0",
57-
"webpack": "^2.2.1",
49+
"style-loader": "^0.19.0",
50+
"tslint": "^5.8.0",
51+
"tslint-react": "^3.2.0",
52+
"typescript": "^2.5.3",
53+
"webpack": "^3.8.1",
5854
"webpack-dev-middleware": "^1.8.4",
59-
"webpack-hot-middleware": "^2.13.2",
60-
"eslint": "^3.19.0",
61-
"eslint-config-airbnb": "^15.0.0",
62-
"eslint-plugin-import": "^2.2.0",
63-
"eslint-plugin-jsx-a11y": "^4.0.0",
64-
"eslint-plugin-react": "^7.0.1"
55+
"webpack-hot-middleware": "^2.13.2"
6556
},
6657
"homepage": "https://github.com/andrerpena/react-mde.git#readme",
6758
"dependencies": {
6859
"font-awesome": "^4.7.0",
69-
"react": "^15.4.1",
70-
"react-dom": "^15.4.1",
71-
"showdown": "^1.5.4"
60+
"react": "^16.0.0",
61+
"react-dom": "^16.0.0",
62+
"showdown": "^1.8.0"
7263
}
7364
}

src/components/HeaderGroup.js

Lines changed: 0 additions & 15 deletions
This file was deleted.

src/components/HeaderGroup.tsx

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
import * as React from 'react';
2+
3+
interface HeaderGroupProps {
4+
}
5+
6+
export const HeaderGroup: React.SFC<HeaderGroupProps> = (props) => {
7+
return (
8+
<ul className="mde-header-group">
9+
{props.children}
10+
</ul>
11+
);
12+
};
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,24 @@
1-
import React, { PropTypes } from 'react';
1+
import * as React from 'react';
2+
3+
interface HeaderItemProps {
4+
tooltip: string;
5+
onClick: React.MouseEventHandler<any>;
6+
icon: React.ReactNode;
7+
}
8+
9+
export const HeaderItem: React.SFC<HeaderItemProps> = (props) => {
10+
11+
const {icon, tooltip, onClick} = props;
212

3-
const HeaderItem = ({ icon, onClick, tooltip }) => {
413
// if icon is a text, print a font-awesome <i/>, otherwise, consider it a React component and print it
5-
const iconElement = React.isValidElement(icon) ? icon : <i className={`fa fa-${icon}`} aria-hidden="true" />;
14+
const iconElement = React.isValidElement(icon) ? icon : <i className={`fa fa-${icon}`} aria-hidden="true"/>;
615

716
let buttonProps = {};
817

918
if (tooltip) {
1019
buttonProps = {
1120
'aria-label': tooltip,
12-
className: 'tooltipped'
21+
className: 'tooltipped',
1322
};
1423
}
1524

@@ -20,19 +29,4 @@ const HeaderItem = ({ icon, onClick, tooltip }) => {
2029
</button>
2130
</li>
2231
);
23-
};
24-
25-
HeaderItem.propTypes = {
26-
tooltip: PropTypes.string,
27-
onClick: PropTypes.func.isRequired,
28-
icon: React.PropTypes.oneOfType([
29-
React.PropTypes.string,
30-
React.PropTypes.element
31-
]).isRequired
32-
};
33-
34-
HeaderItem.defaultProps = {
35-
tooltip: undefined
36-
};
37-
38-
export default HeaderItem;
32+
};

0 commit comments

Comments
 (0)