abcnews / aunty

A toolkit for working with ABC News projects
https://www.npmjs.com/package/@abcnews/aunty
MIT License
32 stars 5 forks source link

TypeScript support #115

Closed colingourlay closed 4 years ago

colingourlay commented 4 years ago

aunty_typescript

This big ol' bundle of changes brings full TypeScript support to @abcnews/aunty, across all project types. From here on, you have the choice of writing your source, tests, or both in TypeScript.

tl;dr

npm i -g @abcnews/aunty@next
nt n my-typescript-project
# Enter 'y' when asked "Will you be authoring your project in TypeScript?"
cd my-typescript-project
npm test
npm start

New project generators

All new project templates are available with a TypeScript opt-in prompted during initialisation (aunty new / aunty init). The main differences you'll see from older templates are:

How to upgrade existing projects

Aunty's extensible internal TypeScript config and definitions for module imports facilitated by webpack's various loaders will have you up and running in existing projects by adding a tsconfig.json file to the root of your project containing the following:

{
  "extends": "@abcnews/aunty/ts/config.json",
  "include": ["src/**/*", "node_modules/@abcnews/aunty/ts/*"]
}

...and installing the relevant DefinitelyTyped dev dependencies:

At this point, you should be able to rename any file in your project from .js to .ts (or .tsx if it contains JSX syntax), and test, serve & build to your heart's content.

VSCode setup

The TypeScript compiler will catch problems when serving/building/testing your project, but if you want to take advantage of real-time checking in VSCode, make sure you have the following extensions installed:

phocks commented 4 years ago

Exciting. Just installed. Giving it a try.

andrewkesper commented 4 years ago

Wow what a huge release. I'm trying it out now. Looking good so far!

andrewkesper commented 4 years ago

A potential bug: If I start a Typescript Preact project and then run aunty generate component it generates a Javascript component for me.

phocks commented 4 years ago

A potential bug: If I start a Typescript Preact project and then run aunty generate component it generates a Javascript component for me.

I believe component generation is a feature still to be added @colingourlay ?

colingourlay commented 4 years ago

@andrewkesper component generators will be dropping later today!

colingourlay commented 4 years ago

Alrighty folks, give things another shot now (including component generation)

colingourlay commented 4 years ago

This closes #106