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

Write generator in typescript #1734

Open
emileindik opened this issue Mar 26, 2020 · 8 comments
Open

Write generator in typescript #1734

emileindik opened this issue Mar 26, 2020 · 8 comments

Comments

@emileindik
Copy link

Is it possible to use yeoman with typescript?
If so, are there any sample generators written in typescript that you could point me to?

@mshima
Copy link
Member

mshima commented Mar 26, 2020

I know it’s possible because of yeoman/environment#164.
I don’t know any public generator or example.

I know that environment lookup and yo command doesn’t lists ts generators.
But I will change that.

@StfBauer
Copy link

StfBauer commented Jun 1, 2020

@emileindik The Microsoft Teams generator uses typescript you see how this project is set up there https://github.com/pnp/generator-teams

@jvanmelckebeke
Copy link

Sorry my answer is very late, I discovered this issue just today.

For clarification for future issue readers: yes it is possible to create a generator in typescript, however keep the following things in mind:

  1. your target JS flavour is esnext
  2. your target outDir is lib/ ( not dist/, apparently this directory does not get scanned by the yeoman generator discovery tool)

Hope this helps for future developers who want to create a generator in typescript

@gliviu
Copy link

gliviu commented Jan 10, 2021

For anyone looking for a quick start here is a template you could use to create new ts generators generator-typescript-template

@juliankrieger
Copy link

@jvanmelckebeke The way I solved it is to build to dist, but write a script that copies the package.json into dist as well as only keeping dependencies, not dev dependencies

@chanind
Copy link

chanind commented Jun 3, 2021

If you want to run a generator locally in a project, you can just use ts-node and run: ts-node node_modules/.bin/yo ./path/to/generator, and then your generator can be fully in typescript.

@RobertLowe
Copy link

Yeah, I want this. All said, it's really annoying to have to manage a build script and transpiled files, I wish this was seamless.

@Carlosf96
Copy link

Yeah, I want this. All said, it's really annoying to have to manage a build script and transpiled files, I wish this was seamless.

I too wish it was seamless UwU.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

9 participants