Skip to content

Commit

Permalink
More housekeeping
Browse files Browse the repository at this point in the history
  • Loading branch information
wub committed Jul 18, 2017
1 parent 03661fe commit 03cf334
Show file tree
Hide file tree
Showing 4 changed files with 135 additions and 15 deletions.
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -36,3 +36,7 @@ lib
nbproject
.idea
.node_history

# These should only be in ./src
/tsconfig.json
/preact.config.js
25 changes: 10 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,9 @@
# preact-cli-plugin-typescript · [![Travis Status](https://img.shields.io/travis/wub/preact-cli-plugin-typescript/master.svg?label=travis&maxAge=43200)](https://travis-ci.org/wub/preact-cli-plugin-typescript) [![npm version](https://img.shields.io/npm/v/preact-cli-plugin-typescript.svg)](https://www.npmjs.com/package/preact-cli-plugin-typescript) [![JavaScript Style Guide](https://img.shields.io/badge/code_style-standard-brightgreen.svg)](https://standardjs.com)

Use TypeScript with [Preact CLI](https://github.com/developit/preact-cli).
Use TypeScript with [preact-cli](https://github.com/developit/preact-cli).

This will install:

- [typescript](https://github.com/Microsoft/TypeScript)
- [awesome-typescript-loader](https://github.com/s-panferov/awesome-typescript-loader)

In the future, you'll be able to choose between `awesome-typescript-loader`
and `ts-loader`.
This will install [typescript](https://github.com/Microsoft/TypeScript)
and [awesome-typescript-loader](https://github.com/s-panferov/awesome-typescript-loader).

If you prefer Flow, check out [preact-cli-plugin-flow](https://github.com/SaraVieira/preact-cli-plugin-flow).

Expand All @@ -23,18 +18,18 @@ npm i preact-cli-plugin-typescript --save-dev
After installation, this plugin will create a `tsconfig.json` (TypeScript
configuration file), and `preact.config.js`, if they don't exist already.

## Usage

In the root of your project, edit `preact.config.js` to add the plugin:

```js
import preactCliTypeScript from 'preact-cli-plugin-typescript';
import preactCliTypeScript from 'preact-cli-plugin-typescript'

export default function (config) {
preactCliTypeScript(config);
export default function(config) {
preactCliTypeScript(config)
}
```

## Usage

If you have an existing `tsconfig.json` file, be sure to use the correct
JSX factory:

Expand All @@ -48,9 +43,9 @@ JSX factory:
```

Now you can simply add `.ts`/`.tsx` files to your project, and they'll
be compiled. Cool.
be compiled. Cool. Make sure you use `.tsx` if you want to use JSX.

If you want to incrementally move to TypeScript, be sure to enable `allowJs`
If you want to incrementally move to TypeScript, enable `allowJs`
in your `tsconfig.json`:

```json
Expand Down
120 changes: 120 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
"typescript": "^2.4.1"
},
"devDependencies": {
"eslint": "^3.19.0",
"publish-please": "^2.3.1",
"standard": "^10.0.2"
}
Expand Down

0 comments on commit 03cf334

Please sign in to comment.