In the last article, I introduced glasp, a Go-based CLI tool for Google Apps Script (GAS) that operates without a dependency on Node.js.
Previous Article: glasp — A Go-based, zero-dependency CLI for Google Apps Script (clasp Alternative)
GitHub Repository: takihito/glasp
In this post, we will focus on the following:
- The benefits of being "npm-independent" in CI/CD environments using GitHub Actions.
- A performance comparison between
claspandglasp.
1. "npm-Independence" in GitHub Actions
It is common to see developers using clasp within GitHub Actions to handle deploy or push operations. Typically, the workflow involves these steps:
- Setting up the Node.js environment via
actions/setup-node. - Installing the tool via
npm install -g @google/clasp.
However, this standard approach presents a few challenges.
Reducing Startup Time
npm install can take anywhere from tens of seconds to several minutes, depending on network conditions and cache status.
glasp, on the other hand, is a single binary built with Go. It requires neither the Node.js runtime nor the extraction of a massive node_modules folder. By using the takihito/glasp action for GitHub Actions, you execute the binary directly, significantly reducing environment setup overhead.
Lowering Supply Chain Risk
While the Node.js ecosystem is incredibly powerful, the sheer number of dependency packages increases the risk of vulnerabilities (exposure to supply chain attacks). While multi-functional CLIs like clasp carry many transitive dependencies, glasp is provided as a static binary independent of external runtimes. This keeps your CI environment's stability and security much simpler.
2. Performance Comparison
I conducted a comparison across several metrics.
Lead Time from Setup to Execution
Because glasp eliminates the need to build a Node.js environment, there is a massive difference in the lead time before execution begins.
| Metric | glasp | clasp | Speed Ratio (vs clasp) |
|---|---|---|---|
| Setup Time | 1,337ms | 19,150ms | 14.3x |
| Push Time (Avg) | 1,015ms | 1,229ms | 1.2x |
| Pull Time (Avg) | 359ms | 1,270ms | 3.5x |
| Total Time | 2,711ms | 21,649ms | 7.9x |
The most significant advantage is the Setup Time. While clasp requires a global installation via npm install -g @google/clasp every time (taking roughly 19 seconds), glasp finishes in about 1.3 seconds just by fetching the pre-compiled single binary. The total cycle of setup → push → pull is 7.9 times faster, a benefit that compounds in pipelines with high deployment frequencies.
Execution Speed (Push/Pull)
glasp optimizes file scanning and upload processes through concurrent processing using Goroutines. While the difference might be subtle in small projects, projects with a large number of files or heavy content benefit greatly from Go’s runtime characteristics and optimized I/O.
Reference: glasp Documentation - GitHub Actions
3. Practical Example: GitHub Actions Configuration
Defining a GitHub Action with glasp is simple. Just remove the setup-node step and call the action directly.
name: Deploy GAS
on:
push:
branches: [ main ]
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4 # Use the latest stable version
- uses: takihito/glasp@v0.2.9
with:
version: 'v0.2.9'
auth: ${{ secrets.CLASPRC_JSON }}
Simply register the contents of your local ~/.clasprc.json as a GitHub Secret named CLASPRC_JSON, and you are ready to go.
4. Conclusion
clasp is the official tool and remains a solid choice for Node.js-centric development environments. However, if you have requirements such as:
- Reducing CI execution time
- Removing dependencies on Node.js (npm-independence)
- Building a simple, robust binary-based workflow
Then I encourage you to give glasp a try.
Related Links:
Top comments (0)