-
Notifications
You must be signed in to change notification settings - Fork 383
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
feat: export static GoogleAuth #249
Conversation
My initial approach here was to try using es6 default exports: export default new GoogleAuth(); However - given the lack of compat between CommonJS and es6 modules, consumers would have to use this syntax: const auth = require('google-auth-library').default; That doesn't feel terribly discoverable, and isn't much better from what we have today. Webpack works around this, but apparently TypeScript isn't really planning on muddying the waters: Instead, I ended up taking the named export approach. I export both the const {auth} = require('google-auth-library');
auth.getApplicationDefault()... The This seems like a fair compromise, but I'm looking for opinions :) |
@ofrobots and @MylesBorins, would love to hear your thoughts too :) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead, I ended up taking the named export approach.
This the right way to go at this point; given uncertainty about how ES6 interop is going to be settled. Regardless, default exports are banned by the style guide.
LGTM w/ nit.
src/index.ts
Outdated
@@ -13,6 +13,8 @@ | |||
* See the License for the specific language governing permissions and | |||
* limitations under the License. | |||
*/ | |||
import {GoogleAuth} from './auth/googleauth'; | |||
|
|||
export {Compute} from './auth/computeclient'; | |||
export {GoogleAuth} from './auth/googleauth'; |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
Addresses #4