GasPack Manager Documentation
Everything you need to know about using GPM for Google Apps Script development
Getting Started
GasPack Manager (GPM) is a modern package manager for Google Apps Script that brings npm-like functionality to GAS development. It allows you to easily share, install, and manage dependencies for your Google Apps Script projects.
Prerequisites: You'll need Node.js (14+) and npm installed on your system. Familiarity with Google Apps Script and clasp is recommended.
Installation
Install the GPM CLI globally using npm:
npm install -g gpm
Verify the installation:
gpm --version
CLI Commands
Project Management
gpm init
- Initialize a new GPM projectgpm install [package]
- Install a packagegpm build
- Build your project for deploymentgpm test
- Run your project tests
Package Publishing
gpm publish
- Publish your package to the registrygpm status
- Check package status and dependencies
Clasp Integration
gpm push
- Push to Google Apps Script (via clasp)gpm pull
- Pull from Google Apps Scriptgpm connect
- Connect to an existing GAS project
Project Structure
A typical GPM project has the following structure:
my-gas-project/ ├── src/ │ ├── index.ts # Main entry point │ └── utils.ts # Additional modules ├── test/ │ └── index.test.ts # Test files ├── dist/ # Built files (auto-generated) ├── gspkpack.json # GPM configuration ├── package.json # Node.js dependencies ├── tsconfig.json # TypeScript configuration └── .clasp.json # Clasp configuration
Configuration Files
- gspkpack.json - Contains package metadata and GPM-specific configuration
- package.json - Standard Node.js package file for development dependencies
- .clasp.json - Clasp configuration for Google Apps Script deployment
Publishing Packages
To publish a package to the GasPack Manager registry:
- Ensure your package is properly configured in
gspkpack.json
- Build your package:
gpm build
- Run tests:
gpm test
- Publish:
gpm publish
Authentication Required: You'll need to authenticate with Google OAuth before publishing packages.
Best Practices
Package Development
- Use semantic versioning for your packages
- Include comprehensive tests for your packages
- Write clear documentation and examples
- Keep packages focused on a single responsibility
Code Organization
- Use TypeScript for better type safety and IDE support
- Organize code into logical modules
- Export only the public API from your main index file
- Use proper error handling and logging
Performance
- Minimize dependencies to reduce bundle size
- Use caching strategies for API calls
- Optimize for Google Apps Script execution limits
- Test performance with realistic data volumes
Troubleshooting
Common Issues
Build Failures
If your build is failing:
- Check TypeScript errors:
npm run typecheck
- Verify all dependencies are installed
- Ensure your tsconfig.json is properly configured
Authentication Issues
If you can't authenticate or publish:
- Clear your authentication:
gpm auth logout
- Re-authenticate:
gpm auth login
- Check your Google account permissions
Deployment Issues
If clasp push fails:
- Verify your .clasp.json configuration
- Check that you have permission to edit the target project
- Ensure the project ID is correct
Getting Help
If you're still having issues:
- Check the GitHub Issues
- Join our Discord community
- Review the example packages for reference