Local development

While you can accomplish all connector-related tasks using the online Apps Script environment, some of them can become repetitive and error-prone over time.

dscc-gen is an opinionated tool that's meant to address these repetitive tasks so you can focus on solving your business problem instead of errors that can be avoided through automation.

Requirements

Using dscc-gen

dscc-gen can create new community-connector projects or be used with existing ones.

Existing connectors

dscc-gen can also be used with existing projects. First, copy your scriptId, then run the following command (replacing YOUR_SCRIPT_ID with your scriptId.):

npx @google/dscc-gen connector --script_id YOUR_SCRIPT_ID

You'll be prompted for a few details for your connector. If you don't already have a deployment called "Production", one will be created for you. None of your existing code will be modified, but you will have access to everything dscc-gen can do.

New connectors

To create a new community-connector with dscc-gen, run the following command:

npx @google/dscc-gen connector

You'll be prompted for a few details for your new connector. First-time users will be asked to authenticate clasp. clasp is a tool for creating & modifying Apps Script projects from the command-line.

After completing the prompts, dscc-gen will create a new Apps Script project and print out everything it can do.

What can dscc-gen do?

Command Description
npm run open Open your project in Apps Script.
npm run push Push your local changes to Apps Script.
npm run watch Watch for local changes, and push them to Apps Script.
npm run prettier Format your code using community standards.
npm run try_latest Open the deployment with your latest code in Looker Studio.
npm run try_production Open your Production deployment in Looker Studio.
npm run update_production Update your production deployment to use your latest code.

How should I Use it?

Using dscc-gen often goes a little like this:

  1. Identify a feature you'd like to add to your connector.
  2. Run npm run watch, so local changes will be pushed to Apps Script.
  3. Make your code changes using your favorite JavaScript editor.
  4. Run npm run tryLatest and check that your new feature is working as expected.
  5. Run npm run updateProduction to update your production deployment to have your new feature.
  6. Run npm run tryProduction and double check that the new feature works.

Get your script Id

To get your scriptId, navigate to your existing project, then copy the section of the url after /d/ and before /edit. For example: the following url:

  • Original Url: https://script.google.com/a/google.com/d/example-script-id/edit
  • Script Id: example-script-id