Create typescript file feature

I am thinking something like the Unity Create C# file where it will take the name and create some default imports, class definition, etc. Save the file in the correct location and launch in VSCode. This would definitely save some time for me knowing that all the needed starter content is in the .ts file and ready for me to extend.

Original Post on Discord

by user 943936853348855838

That exists: just context click a npmdef file:
image.png

It only exists for npmdefs tho

Could add it to src/scripts too maybe. Is that what you mean?

I was thinking maybe from the main Needle Engine menu since you usually don’t have the src/scripts folder in the Unity project.

by user 943936853348855838

Personally I would only use src/scripts for prototyping / quick and dirty testing and not production

Yes i mean we could allow using that menu item if your current scene has an ExportInfo component and a project and then generate the script there

I need to look into the npmdefs, but the current project due in a little over a week is my priority right now.

by user 943936853348855838

Also, typescript and more advanced web dev is newish to me so that may be the issue as well.

by user 943936853348855838

It’s pretty much as simple as

  1. Create > NPM Definition
  2. In your ExportInfo, add the new NPM Definition as dependency if it hasn’t been added automatically already
  3. Rightclick on the NPM Definition > Create > Typescript

and you’re back to the same flow as when creating scripts in src/scripts, plus you can directly open VS Code by double-clicking on those Typescript files or the NPM Definition

Okay I will look into that. Thanks

by user 943936853348855838

The latest verison adds support for “Create/Typescript” in any folder and it creates the script in src/scripts and opens the workspace if you have a web project setup