Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@grant
Copy link
Contributor

@grant grant commented Mar 8, 2019

Adds main entry point to Node module

  • Updates the name in preparation of publishing to npm. (Feel free to suggest a different name)
  • (Does not modify package.json#version since this package has not been published yet.)
  • Adds index.js that exports all quickstarts
    • We may want to export snippets too in the future.

Example usage

import {quickstart} from '@gsuite/samples'
const quickstart = quickstart.sheets_v4;

// TODO: Get `auth` object
console.log(quickstart.SCOPES);
quickstart.listMajors(auth);

I chose to put the quickstarts in a quickstart object so we can just do a for-loop through all quickstarts (since they have the same format).

Future Considerations

In the future, we may consider:

  • exporting a consistent name for our quickstarts (i.e. execute/run).

    module.exports = {
      SCOPES,
      execute,
    };

    (In TypeScript, this would be conforming to an interface:)

    {
      SCOPES: string[],
      execute: () => string
    }
  • Testing quickstarts since they are now exported.

  • Modifying the quickstart to return values instead of console.loging values.

    • This will be a lot easier when we have async/await since we can add this return without modifying the quickstart that is embedded within developers.google.com

@grant grant requested a review from erickoledadevrel March 8, 2019 19:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants