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

How to specify typescript version? #852

Closed
wizardnet972 opened this issue Sep 5, 2020 · 3 comments
Closed

How to specify typescript version? #852

wizardnet972 opened this issue Sep 5, 2020 · 3 comments
Labels
kind: support Asking for support with something or a specific use case problem: removed issue template OP removed the issue template without good cause solution: already possible This is already possible / this feature already exists

Comments

@wizardnet972
Copy link

wizardnet972 commented Sep 5, 2020

npx tsdx create mylib

this command creates mylib with the lastest of typescript package (v4).

but I want to change to typescript: "^3.9.3" .

Is there a way to configure this? like a config file such as:

{
 "typescript": "^3.9.3"
}

if not supplier config the default is latest.

@agilgur5

@agilgur5 agilgur5 added problem: removed issue template OP removed the issue template without good cause kind: support Asking for support with something or a specific use case labels Sep 6, 2020
@agilgur5
Copy link
Collaborator

agilgur5 commented Sep 6, 2020

Yes, TSDX uses whatever version of TS is in your node_modules. So if you change your package.json to use 3.9, it'll use 3.9 (once you've npm install'd that version).

@agilgur5 agilgur5 closed this as completed Sep 6, 2020
@wizardnet972
Copy link
Author

wizardnet972 commented Sep 6, 2020

@agilgur5 not sure what you mean.
I mean the package.json who generated from create action has typescript dependency of v4.

Lets say I create a folder foo. then in foo I run the create command. its create a package json inside I have typescript with version of 4.

In the source code you do: npm i typescript as part of the basic template.

so how tsdx uses another version of typescript if the node_modules doen't exist yet?

I can send a PR -> create read config file (if exist) and merge (using lodash) the dependencies list with whatever write in the config file.
the config file will have something like that:

module.exports = {
 packageJson: {
  dependencies: ['typescript@3.9.3']
 }
}

I just say let me decided what version I want to install in those dependencies. because sometimes I use monorepo with one version and otherwise it will mess up my repo.

@agilgur5
Copy link
Collaborator

agilgur5 commented Sep 7, 2020

so how tsdx uses another version of typescript if the node_modules doen't exist yet?

You can do:

npx tsdx create mylib
cd mylib
npm i typescript@3

In the source code you do: npm i typescript as part of the basic template.

You can also use patch-package to change this to typescript@3 if that's what you want.

I can send a PR -> create read config file (if exist) and merge (using lodash) the dependencies list with whatever write in the config file.
[...]
I just say let me decided what version I want to install in those dependencies. because sometimes I use monorepo with one version and otherwise it will mess up my repo.

No I think this is out of scope and too large of a request, it increases the API surface and maintenance burden therein tremendously for little value. We can't accept every request and that creates sprawl; meanwhile TSDX's mission is enabling zero-config as much as possible.

If you want to use different versions of dependencies and customize your templates heavily, you don't have to use tsdx create, can use your own templates, and are more than welcome to do so. These templates should really be seen as starter templates that you can base your own opinions and templates off of, they cannot by nature be all inclusive of everyone's wants and needs and opinions. As an example, I use TSDX plenty but personally do not use the templates

See also #441 and related PRs, which invert your ask but still introduce a new API

@agilgur5 agilgur5 added the kind: feature New feature or request label Sep 7, 2020
Repository owner locked as resolved and limited conversation to collaborators Sep 10, 2020
@agilgur5 agilgur5 added solution: already possible This is already possible / this feature already exists and removed kind: feature New feature or request labels Sep 14, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
kind: support Asking for support with something or a specific use case problem: removed issue template OP removed the issue template without good cause solution: already possible This is already possible / this feature already exists
Projects
None yet
Development

No branches or pull requests

2 participants