jmmk / javascript-externs-generator

Generate externs for use with Google Closure Compiler
https://jmmk.github.io/javascript-externs-generator/
ISC License
135 stars 9 forks source link

extern creation failure: react-dates #32

Closed ddellacosta closed 7 years ago

ddellacosta commented 7 years ago

Using a file generated via running boot package install target via the cljsjs package (https://github.com/cljsjs/packages/pull/1062), I got:

$ generate-extern -f target/cljsjs/react-dates/development/react-dates.inc.js -n ReactDates -o react-dates.ext.js

/usr/local/lib/node_modules/externs-generator/bin/extern:261
ma(sd,"exit").call(null,1));null==c&&(console.error("Please specify namespace to extern (e.g. -n jQuery)"),ma(sd,"exit").call(null,1));null==a&&(console.error("Please specify an output file for the extern (e.g. -o jquery-extern.js)"),ma(sd,"exit").call(null,1));for(var b=K(b),e=null,g=0,h=0;;)if(h<g){var k=e.W(null,h);Mf(d,k);h+=1}else if(b=K(b))e=b,Cc(e)?(b=tb(e),h=ub(e),e=b,g=S(b),b=h):(b=M(e),Mf(d,b),b=O(e),e=null,g=0),h=0;else break;d=ma(d,c);if(null==d)throw[B("Namespace '"),B(c),B("' was not found. Make sure the library is loaded and the name is spelled correctly.")].join("");

Namespace 'ReactDates' was not found. Make sure the library is loaded and the name is spelled correctly.
$

Am I doing something obviously wrong? I wasn't sure if this was the right file to attempt to generate externs from, but it wasn't obvious what to use otherwise. Any help or suggestions would be most appreciated!

Original codebase I'm working from in case it's helpful: https://github.com/airbnb/react-dates

jmmk commented 7 years ago

@ddellacosta I was able to generate the extern using the following steps:

Web App

Command-Line Tool

ddellacosta commented 7 years ago

@jmmk Thank you so much!! That was a great help both in getting this file generated and in improving my understanding of how the extern generator works. I really appreciate it.