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

Compile TypeScript? #331

Closed
p-bakker opened this issue Jan 22, 2020 · 11 comments
Closed

Compile TypeScript? #331

p-bakker opened this issue Jan 22, 2020 · 11 comments

Comments

@p-bakker
Copy link

Maybe this is not what this project is about, but while working on TypeScript files, it would be nice if the auto-compiled on save and when checking out updated .ts files from a repo.

I'd expected this to be already somewhere in WWD, but cannot find it (if I just missed it, please point me to it and I'll close the case).

Right now I have to install TypeScript IDE (which is outdated and suggests to use by WWD) to give me the option to Compile TypeScript via the Run As context menu option

@mickaelistria
Copy link
Contributor

You can configure it very simply:

  1. Right-click on project > Properties > Builder
  2. Select "Program"
  3. location => path to tsc; working directory => project directory; arguments...
  4. In Build Options
    a. select "Launch in background"
    b. select "During auto-build"
    c. select the interesting folder in "Select working set of relevant resources" to include the source folder.
  5. in Refresh, select what needs to be refreshed upon build.

@mickaelistria
Copy link
Contributor

Note that what I suggest above is more one way to do things. Indeed, it could make sense for Wild Web Developer to create a specific builder that would be placed on the project when it has .ts files. But there are so many ways of doing build (directly call tsc, or delegate to npm or whatever) that it's not really easy to do the thing right, so it was always deferred so far.

@p-bakker
Copy link
Author

tnx @mickaelistria

Used ${system_path:/tsc.cmd} as Location to use the globally installed TSC and ${project_loc} for the Working Directory. Works like a charm.

So, should I leave this issue open as a placeholder to add builder support natively to WWD or close it?

@mickaelistria
Copy link
Contributor

Used ${system_path:/tsc.cmd} as Location to use the globally installed TSC and ${project_loc} for the Working Directory. Works like a charm.

Great!

So, should I leave this issue open as a placeholder to add builder support natively to WWD or close it?

It's up to you, both a ok from my perspective ;)

@p-bakker
Copy link
Author

I do think it would be benefitial for WWD to support out of the box Natures and Builders for relevant languages like TypeScript. Of course, as a user if you want to do things other than the default way, you should be able to disable builder/remove the nature

@mickaelistria
Copy link
Contributor

FWIW, I totally disagree about natures: they're making things much more complex for users, integrators, they're not dynamic so they do not remove or add themselves where necessary. The less we use natures, the better the world is.
But a Builder could work, ideally with a detection of .ts file in project to dynamically suggest addition, removal or disablement of the builder. I also think if the Program build works well enough, there is no need to write a specific builder and we can use the Program builder directly.

@angelozerr
Copy link
Contributor

FWIW, I totally disagree about natures

I agree because you want for instance just open a TypeScript project in Eclipse IDE created by vscode and it should work. TypeScript IDE worked like this and to know if it's a TypeScript project, it searches if the project contains a tsconfig.json file. See more explanation at https://github.com/angelozerr/typescript.java/wiki/TypeScript-BuildPath#typescript-nature

But a Builder could work

TypeScript IDE have this builder, see https://github.com/angelozerr/typescript.java/blob/master/eclipse/ts.eclipse.ide.core/src/ts/eclipse/ide/core/builder/TypeScriptBuilder.java

To compile a TypeScript you can do that with :

@mickaelistria
Copy link
Contributor

@p-bakker
Copy link
Author

Didn't know you could compile JavaScript to TypeScript 😋

It's mentioned the wrong way around

@mickaelistria
Copy link
Contributor

I think #340 can help here, as usually there is a package.json file describing a build step to invoke tsc.

@mickaelistria
Copy link
Contributor

I believe there is already everything in place to compile typescript, as linked above. IMO, there is not much Wild Web Developer should do as compilation is orchestrated by external tools (like npm) that are easy enough to integrate.

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

3 participants