0

I'm trying to use Tern's condense script to generate a type definition file for the p5.js Javascript library.

The Tern documentation says: "Pass --plugin name or --plugin name={jsonconfig} to load plugins. Use --def file to load JSON definitions."

I put the p5.js source code in the project's root and ran node condense --plugin ../p5/p5.js

I'm getting reference errors for all window, screen, and document-related functions, which makes me think the command is trying to run p5.js files, not analyze them.

Am I structuring the command incorrectly? Do I need a .tern-project file for this?

Jen Kagan
  • 1
  • 2
  • `--plugin` is for tern's server plugins. You use them for instance to resolve `require()` and `import` in the library you want to condense. You can try `condense ../p5/p5.js` without using any plugins. The documentation doesn't go into detail about how this works, so it's hard to troubleshoot when things go wrong. – Håken Lid Sep 02 '17 at 16:29
  • It is treating p5.js as a plugin the syntax is `node condense --plugin {pluginName} fileName` eg `node condense --plugin angular ../p5/p5.js` – linusx Sep 09 '17 at 14:42

0 Answers0