Skip to content

Commit b67ae67

Browse files
rewrite lib using typescript
1 parent 0d9c325 commit b67ae67

File tree

12 files changed

+1588
-454
lines changed

12 files changed

+1588
-454
lines changed

.babelrc.js

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,25 @@ const output = process.env.BABEL_OUTPUT;
44
const requirePolyfills = process.env.INCLUDE_POLYFILLS;
55
const modules = output == null ? false : output;
66
const options = {
7-
presets: [['@babel/env', {loose: true, modules}], '@babel/react'],
7+
presets: [
8+
['@babel/env', {loose: true, modules}],
9+
'@babel/react',
10+
[
11+
'@babel/preset-typescript',
12+
{
13+
isTSX: true,
14+
allExtensions: true,
15+
},
16+
],
17+
],
818
plugins: [
19+
[
20+
'@babel/plugin-transform-typescript',
21+
{
22+
isTSX: true,
23+
allExtensions: true,
24+
},
25+
],
926
'@babel/plugin-transform-react-jsx',
1027
[
1128
'transform-react-remove-prop-types',
@@ -18,7 +35,7 @@ const options = {
1835
env: {
1936
test: {
2037
// extra configuration for process.env.NODE_ENV === 'test'
21-
presets: ['@babel/env'], // overwrite env-config from above with transpiled module syntax
38+
presets: ['@babel/env', '@babel/preset-typescript'], // overwrite env-config from above with transpiled module syntax
2239
},
2340
},
2441
};

README.md

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -23,17 +23,11 @@ Create React component from string
2323
## Installation
2424

2525
```js
26-
$ npm install string-to-react-component --save
26+
# with npm
27+
$ npm install string-to-react-component @babel/standalone --save
2728

28-
or
29-
30-
$ yarn add string-to-react-component
31-
```
32-
33-
`string-to-react-component` has a peer dependency of `@babel/standalone`, then you should install `@babel/standalone` package :
34-
35-
```js
36-
$ npm install @babel/standalone --save
29+
# with yarn
30+
yarn add string-to-react-component @babel/standalone
3731
```
3832

3933
### CDN Links

0 commit comments

Comments
 (0)