ez-clasp
Template repository to start a Google Apps Script project using Typescript and some other helper dev stuff
AI Summary
EZ CLASP
Provides a ready-to-use template to start Google Apps Script development with TypeScript, testing and CI tooling.
Target Users
Intermediate-to-advanced developers who need an efficient Google Apps Script workflow with TypeScript and unit testing.
Problems Solved
Using raw CLASP requires manually setting up TypeScript transpilation, testing, env management and build steps each time.
Tags
Main Features
TypeScript & modern ECMAScript
Pre-configured Babel + Rollup pipeline transpiles TS/ESNext into GAS-compatible code.
Built-in unit testing
Jest with ts-jest is ready; README shows how to mock global Google services for tests.
Dotenv-style env variables
Rollup plugin injects process.env values so secrets can be referenced in code; test setup script provided.
Auto format & lint
Biome + Ultracite enforce formatting/linting, executed pre-commit via Husky & lint-staged.
Automated deploy & tree-shaking
`pnpm run deploy` builds, tree-shakes and pushes code to GAS via CLASP in one step.
Usage Examples
Reading an API key from .env
// src/index.ts
// Assume .env contains API_KEY=xxxxxxxx
/**
* Example function that calls an external API using an API key.
*/
export function fetchSample() {
const apiKey = process.env.API_KEY; // Replaced inline by Rollup during build
const url = `https://example.com/data?key=${apiKey}`;
// UrlFetchApp is a built-in GAS service
const response = UrlFetchApp.fetch(url);
return JSON.parse(response.getContentText());
}Add API_KEY to your .env, run pnpm run deploy, and the compiled script will be pushed to Apps Script. You can then execute fetchSample() from the editor or via web apps to verify the workflow.