This is a starter project for anyone who wants to hit the ground running quickly with medium sized Typescript project if you are happy with the few handy presets I have chosen for you:
-
The project will build two bundles,
app.js
andvendor.js
. Doing so keeps the external libraries separate from your project, and can help with download times. -
The
jest
test runner is included, and it provides the same feature set asjasmine
andmocha
, so if you come from that world you will be totally comfortable.
To run application
`npm start`
To run tests
`npm test`
To watch tests
`npm run test:watch`
To publish package
`npm run publish`
-
Install packages
yarn add typescript webpack webpack-dev-server ts-node ts-loader @types/webpack --dev
-
Set up
webpack.config.ts
-
Run
webpack-dev-server
-
Add a shortcut to
package.json
so that we can use the convention ofnpm start
"scripts": { "start": "webpack-dev-server" }
-
Install packages
yarn add @types/jest jest ts-jest--dev yarn add corejs
-
Update
tsconfig.json
lib section so that it understands es6:"lib": [ "es2015", "dom" ],
-
Update
package.json
to providejest
specifications. See Jest Usage -
Update
package.sjon
so thatjest
will search ourbaseUrl
which is set tosrc/
:"jest": { "moduleDirectories": ["node_modules", "src"] }
-
Add a shortcut to
package.json
so that we can use the convention ofnpm test
andnpm test:watch
"scripts": { "test" : "jest", "test:watch": "jest --watch" }