https://github.com/fdiskas/preact-ui
https://github.com/fdiskas/preact-ui
Last synced: 4 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/fdiskas/preact-ui
- Owner: FDiskas
- License: mit
- Created: 2020-12-08T23:45:31.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2021-01-02T22:25:23.000Z (over 5 years ago)
- Last Synced: 2025-02-28T10:17:01.365Z (over 1 year ago)
- Language: TypeScript
- Size: 1.56 MB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# parcel-preact-typescript
> Simple set-up using [Parcel](https://parceljs.org/), [Preact X](https://preactjs.com/) and [TypeScript](https://www.typescriptlang.org/).
This template provides the simplest possible set-up that combines Parcel, Preact X and TypeScript. Jest is used for testing.
## Getting started
Clone the repository and install its dependencies.
```bash
git clone git@github.com:metonym/parcel-preact-typescript.git
cd parcel-preact-typescript
yarn install
```
## Available scripts
### `yarn start`
Runs the app in development mode. Visit [http://localhost:1234](http://localhost:1234).
### `yarn build`
Builds the project for production. The build directory is `dist`; types will be written to `dist/index.d.ts`. Customize the build directory in the `outDir` configuration option in the [tsconfig.json](tsconfig.json).
### `yarn test`
Run the tests using the [jest](https://jestjs.io/) JavaScript testing framework.
The jest configuration for this project is in `package.json`:
```js
"jest": {
"preset": "ts-jest"
}
```
## Customizing `tsconfig.json`
The default [`tsconfig.json`](tsconfig.json) contains the following:
```js
// tsconfig.json
{
"compilerOptions": {
"esModuleInterop": true,
"jsx": "react",
"jsxFactory": "h",
"lib": ["dom", "esnext"],
"module": "esnext",
"moduleResolution": "node",
"strict": true,
"target": "es5"
},
"include": ["src"]
}
```
Note that `jsxFactory` must be `"h"` in order for preact to work with parcel.
### Decorators
Enable decorators ([stage 2](https://github.com/tc39/proposal-decorators)) by setting `compilerOptions.experimentalDecorators` to `true`:
```js
{
"compilerOptions": {
"experimentalDecorators": true
}
}
```
## License
[MIT](LICENSE)