Skip to content
This repository has been archived by the owner on Nov 8, 2021. It is now read-only.

Commit

Permalink
feat: one-shot TS upgrade for existing codebases (#48)
Browse files Browse the repository at this point in the history
* feat: enhance upgrade algorithm with latest core integrations

* docs(README): add some info and deprecation notice

* feat(code-update): apply store and route helpers (#1)

* feat(code-update): apply store and route helpers

* refactor: solve TODOs

* chore(linting): revert quasar eslint package usage
  • Loading branch information
IlCallo authored Apr 14, 2020
1 parent 1fbe046 commit b6d156c
Show file tree
Hide file tree
Showing 13 changed files with 605 additions and 369 deletions.
31 changes: 26 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,23 +1,44 @@
# quasar-app-extension-typescript [wip]
# quasar-app-extension-typescript

> ### WARNING
>
> This app extension is out of date with the Current version of Quasar app-v1.6.0 and will may not work as expected. This extension will be updated shortly.
> An updated starter that support Typescript natively is currently being tested and should be integrated with the `Quasar create` command soon. If you would like to try it out now run the following command `quasar create <project name> --kit IlCallo/quasar-starter-kit --branch dev`
> This extension will bring you in sync with Quasar + TS setup as of `[email protected]` and `@quasar/[email protected]`
>
> This extension is DEPRECATED and is only meant to ease the transition of pre-existing codebases. For new projects use starter-kit `TypeScript` option
>
> ESLint configuration will be overwritten, only Prettier flavour is supported out-of-the-box.
> `airbnb` and `default` configuration should be manually merged using your previous `.eslintrc.js` or one generated when creating a new Quasar project.
>
> You need to remove this extension and `typescript` dependency after a successful installation: the extension will only do the migration and there's no point into keeping it after that, while `typescript` dependency is already provided by `@quasar/app`
>
> **This extension is one-shot and does not provide uninstall script, make sure you've some form of version control in place to perform rollbacks**
Add TypeScript to your Quasar project (won't work for 0.x Quasar versions).

For simpler cases, just running this extension will do the job.

Add typescript to your Quasar 1.0 project
For the majority of cases, many tweaks on your side will be needed to fix type or linting issues, take some time when trying the migration.

visit https://hackmd.io/Ypx6VMWUQp6R1iPyCvRHWQ?edit to join the conversation
If you don't trust a software to automatically update your code, you can manually update your project following the [official documentation](https://quasar.dev/quasar-cli/cli-documentation/supporting-ts#Installation-of-TypeScript-Support).

## Installation

Add the app extension to your project:

```shell
$ quasar ext add @quasar/typescript
```

To test the various build types, cd into test-extension and:

```
$ yarn
$ quasar ext invoke @quasar/typescript
```

## Fallback

If you experience problems you cannot understand or resolve, copy your `src` folder (and any project specific configuration) into a freshly created project with `TypeScript` option enabled.
Then proceed to manually update your files to use TypeScript.

To create a new project, run `quasar create <your project name>` using the global Quasar CLI and enable the `TypeScript` option.
3 changes: 0 additions & 3 deletions extension/README.md

This file was deleted.

10 changes: 2 additions & 8 deletions extension/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,7 @@
"main": "src/index.js",
"dependencies": {
"execa": "^3.2.0",
"fork-ts-checker-webpack-plugin": "^1.5.1",
"glob": "^7.1.4",
"ts-loader": "^6.2.0",
"vue-class-component": "^7.1.0",
"vue-property-decorator": "^8.3.0",
"vue-template-compiler": "^2.6.10"
"glob": "^7.1.4"
},
"devDependencies": {
}
"devDependencies": {}
}
26 changes: 1 addition & 25 deletions extension/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,28 +5,4 @@
* API: https://github.com/quasarframework/quasar/blob/master/app/lib/app-extension/IndexAPI.js
*/

module.exports = function(api, ctx) {
api.chainWebpack((chain, invoke) => {
const ForkTsCheckerWebpackPlugin = require('fork-ts-checker-webpack-plugin')
const useForkTsChecker = api.prompts.webpack === 'plugin'

chain.resolve.extensions.add('.ts').add('.tsx')
chain.module
.rule('typescript')
.test(/\.tsx?$/)
.use('ts-loader')
.loader('ts-loader')
.options({
appendTsSuffixTo: [/\.vue$/],
onlyCompileBundledFiles: !useForkTsChecker,
// Type checking is handled by fork-ts-checker-webpack-plugin
transpileOnly: useForkTsChecker
})
if (useForkTsChecker) {
chain
.plugin('ts-checker')
// https://github.com/TypeStrong/fork-ts-checker-webpack-plugin#options
.use(ForkTsCheckerWebpackPlugin, [{ eslint: true, vue: true }])
}
})
}
module.exports = function() {}
Loading

0 comments on commit b6d156c

Please sign in to comment.