Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 488519

Summary: Investigate parsing package.json (and other well known files) for dependent libraries
Product: [ECD] Orion Reporter: Steve Northover <steve_northover>
Component: JS ToolsAssignee: Michael Rennie <Michael_Rennie>
Status: RESOLVED FIXED QA Contact:
Severity: enhancement    
Priority: P2 CC: kuschel, Michael_Rennie
Version: unspecified   
Target Milestone: ---   
Hardware: PC   
OS: Windows 7   
Whiteboard: 2017-02-24

Description Steve Northover CLA 2016-02-26 01:31:40 EST
1) Node.js and npm are pretty standard
2) Here is a package.json:
{
	"name": "NodejsStarterApp",
	"version": "0.0.1",
	"description": "A sample nodejs app for Bluemix",
	"dependencies": {
		"express": "3.4.7"
	},
	"engines": {
		"node": "0.10.*"
	},
	"repository": {}
}
3) We can see that it uses express
4) FEATURE REQUEST: make .tern use this information automatically

The first cut would be to initialize the .tern-project file but better would be to teach tern to eat this file so that when the file changes, tern is always up to date.
Comment 1 Michael Rennie CLA 2017-01-10 15:36:43 EST
Closing as part of a mass clean up of inactive bugs. Please reopen if this problem still occurs or is relevant to you. For more details see:

https://dev.eclipse.org/mhonarc/lists/orion-dev/msg04002.html
Comment 2 Michael Rennie CLA 2017-01-26 11:55:58 EST
It is still important that we use this information to pre-load the tooling
Comment 3 Michael Rennie CLA 2017-01-31 15:16:23 EST
Some thoughts:

1. if you have a node_modules folder (you have done an 'npm install'), we don't need to read this file since we will trace the dependencies into that folder

2. if you have no node_modules, we could look in the file to find package name + version to use to look up a definition for it. For example if we ever get the support completed to grab and convert a DefinitelyTyped interface into a Tern index, we could use this info to know which interface to look for.
Comment 4 Steve Northover CLA 2017-01-31 16:28:46 EST
The .tern-project file is for power users only.  If one is there, we use it (let's say entries in it override package.json ... need to decide).  None of our tooling ever creates it.
Comment 5 Steve Northover CLA 2017-02-01 09:29:35 EST
We can also get the version information from these files and warn the developer that our version of the type lib files doesn't match the version that is being use (I think that the thing McQ recently hit)
Comment 6 Michael Rennie CLA 2017-02-21 13:35:35 EST
Bug 511482 has the fix for this bug in it - it reads package.json and will auto-load any tern plugins available for the listed dependencies.

Bug 512517 was opened to track support for pre-loading plugins based on indexes added in the .definitions folder.

Closing this as fixed (via bug 511482).