Gasup
raw JSON → 1.0.10 verified Fri May 01 auth: no javascript
A CLI tool for bundling Google Apps Script (GAS) projects using esbuild and the esbuild-gas-plugin. Version 1.0.10 provides commands to initialize config, build, and watch for changes. It handles GAS-specific optimizations, copies appsscript.json and HTML files to the output directory, and supports TypeScript. Differentiates from other GAS bundlers by integrating directly with esbuild and providing an interactive configuration wizard.
Common errors
error Error: Cannot find module 'gasup' ↓
cause gasup is not installed or not in the current directory's node_modules.
fix
Run 'npm install -D gasup' or use 'npx gasup'
error TypeError: (0 , gasup_1.default) is not a function ↓
cause Using default import instead of named import for Config type.
fix
Change 'import Config from "gasup"' to 'import { Config } from "gasup"'
error ReferenceError: myFunction is not defined ↓
cause Functions intended for GAS are not exposed to the global scope.
fix
Assign functions to (global as any) as shown in the documentation.
error ENOENT: no such file or directory, open 'dist/appsscript.json' ↓
cause appsscript.json is missing from the project root.
fix
Create appsscript.json in the same directory as gasup.config.ts.
Warnings
gotcha Functions must be assigned to the global object; standard function declarations are not exposed to GAS. ↓
fix Use (global as any).functionName = () => { ... }
gotcha Configuration file must be named gasup.config.ts (or .js) and export a Config object. ↓
fix Ensure file is named correctly and uses named export.
breaking Version 1.0.0 introduced a breaking change: configuration format changed from JSON to TypeScript config file. ↓
fix Create gasup.config.ts with export default config; remove old config.json
gotcha The output directory (default dist/) is overwritten on each build. Do not place other files there. ↓
fix Store custom files outside the output directory.
gotcha HTML files are copied automatically; but only if they are in the project root or specified. ↓
fix Place HTML files in the root or adjust config to include them.
Install
npm install gasup yarn add gasup pnpm add gasup Imports
- Config wrong
import Config from 'gasup'correctimport { Config } from 'gasup' - gasup CLI wrong
gasup initcorrectnpx gasup init - global functions wrong
function myFunction() {}correct(global as any).myFunction = () => {}
Quickstart
// Install gasup as dev dependency
npm install -D gasup
// Add scripts to package.json
{
"scripts": {
"build": "gasup",
"dev": "gasup --watch",
"init": "gasup init",
"config": "gasup config"
}
}
// Initialize configuration
npm run init
// Bundle your project
npm run build
// Push to Google Apps Script using clasp
npx @google/clasp push