Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(typescript): detect typescript based on tsconfig.json #5412

Merged
merged 8 commits into from Mar 29, 2019

Conversation

pi0
Copy link
Member

@pi0 pi0 commented Mar 29, 2019

  • Refactor registerTSNode from @nuxt/typescript into @nuxt-cli. This way users can keep @nuxt-typescript (~55.2 MB) into devDependencies and ts-node (1.6 MB) in dependencies. This means much less production install size and also have runtime support.
  • Move external imports into cli/imports.js for better maintenance.
  • Only enable typescript for a project if tsconfig.json exists in the rootDir.
  • Only If tsconfig.json is empty JSON, defaults will be written into it by @nuxt/typescript.

@pi0 pi0 requested a review from kevinmarrec March 29, 2019 15:08
@manniL
Copy link
Member

manniL commented Mar 29, 2019

We have to highlight that change in the release notes (as done before with changes on experimental features) ☺️

@pi0
Copy link
Member Author

pi0 commented Mar 29, 2019

@manniL Sure. Actually it is a complement of #5367. New migration guide would be:

  1. Remove nuxt-ts dependency
  2. Add nuxt and ts-node to dependencies:
    • yarn: yarn add nuxt ts-node
    • npm: npm i nuxt ts-node
  3. Add @nuxt/typescript to devDependencies:
    • yarn: yarn add -D @nuxt/typescript
    • npm: npm i @nuxt/typescript
  4. Create an empty tsconfig.json file. Nuxt will automatically generate it with defaults at first run, then you can edit it to fit your needs.

Nuxt 2.5 users may only require to add ts-node to the dependencies

kevinmarrec
kevinmarrec previously approved these changes Mar 29, 2019
Copy link
Contributor

@kevinmarrec kevinmarrec left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wow, nice work @pi0 !!!

So I guess we can close nuxt/docs#1269 (which was linked to #5367 ) and start from current docs https://nuxtjs.org/guide/typescript to just add the ts-node thing ?

@kevinmarrec
Copy link
Contributor

Migration guide for 2.5.x projects should be just installing ts-node as dependency if they need runtime support.

@kevinmarrec
Copy link
Contributor

kevinmarrec commented Mar 29, 2019

@pi0 ts-node shouldn't be removed from packages/typescript/package.json then ?

@pi0
Copy link
Member Author

pi0 commented Mar 29, 2019

@kevinmarrec Migration guide updated. Does it looks good now? (Feel free editing my comment).

@pi0 ts-node shouldn't be removed from package.json then ?

For lazy people who only install @nuxt/typescript that would be harmless. But can be removed as well.

@kevinmarrec
Copy link
Contributor

kevinmarrec commented Mar 29, 2019

@pi0 perfect

Yeah I see, but if it's not used anymore within this package, we probably should remove it ?
It would indeed mean we need to warn users in release notes they need to install ts-node back when migrating to 2.6 (if they're using nuxt.config.ts or any thing that need runtime support)

@pi0
Copy link
Member Author

pi0 commented Mar 29, 2019

@kevinmarrec Done. Dependency removed and guide updated. I had to add ts-node to nuxt mono-repo root package.json in order to CI passing

@kevinmarrec
Copy link
Contributor

Alright perfect @pi0, worth mentionning that the guide is applicable for 2.4.x -> 2.6.x.
For 2.5.x -> 2.6.x it's only the ts-node step.

Don't know how exactly we're gonna wrap it up in release notes but yeah 🙈

@codecov-io
Copy link

codecov-io commented Mar 29, 2019

Codecov Report

Merging #5412 into dev will increase coverage by <.01%.
The diff coverage is 90%.

Impacted file tree graph

@@            Coverage Diff             @@
##              dev    #5412      +/-   ##
==========================================
+ Coverage   96.17%   96.17%   +<.01%     
==========================================
  Files          74       74              
  Lines        2534     2539       +5     
  Branches      644      646       +2     
==========================================
+ Hits         2437     2442       +5     
  Misses         81       81              
  Partials       16       16
Impacted Files Coverage Δ
packages/cli/src/command.js 98.97% <100%> (ø) ⬆️
packages/typescript/src/index.js 100% <100%> (ø) ⬆️
packages/cli/src/imports.js 100% <100%> (ø) ⬆️
packages/cli/src/utils/typescript.js 85.71% <83.33%> (+19.04%) ⬆️
packages/vue-renderer/src/renderer.js 95.52% <0%> (-0.5%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 91f4eb0...82cdf05. Read the comment docs.

@pi0 pi0 changed the title feat: detect typescript based on tsconfig.json feat(typescript): detect typescript based on tsconfig.json Mar 29, 2019
@pi0 pi0 merged commit 6ffc5c5 into dev Mar 29, 2019
@pi0 pi0 deleted the fix/ts-support-detect branch March 29, 2019 19:19
@pi0 pi0 mentioned this pull request Mar 31, 2019
@danielroe danielroe added the 2.x label Jan 18, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants