AppsScriptPulse

Deploying an Apps Script Library Part 4: Essential Developer Tooling

 

 

In this series about deploying Google Apps Script libraries, Part 2 dove deep into Test-Driven Development (TDD) and highlighted jest as my go-to tool for outstanding outcomes. Now, let’s broaden our toolkit with additional essentials that not only elevate our development standards but also make our codebase more welcoming to collaborators.

First up, we’ve got ESLint. Linting, for those unfamiliar, is the process of running a program that will check your code for potential errors.

Next, we introduce Prettier, which takes our code and formats it into a structured style that you define. Think of Prettier as the stylist of your codebase, making sure everything looks ‘pretty’ and readable by cleaning up those messy or inconsistent styles left behind.

We also employ Husky, a tool for managing git hooks. Git hooks are scripts you can set to run before or after events like commits, push, and receive. Husky ensures that tools like ESLint, Prettier and Jest run every time you commit changes, helping catch issues before they hit production.

These tools are indispensable not just for solo developers but also for teams looking to contribute to the library. By maintaining consistent, pre-defined high standards of code hygiene, we ensure that our library remains robust, clean, and maintainable.

Prerequisites: You should be familiar with git, an essential skill for any developer. If you’re not, I recommend checking out the beginner’s guide at FreeCodeCamp. Additionally, being able to code locally and understanding clasp is crucial. If you need a refresher on this, visit my earlier post on setting up your local environment. Once you’re set, we can dive into making our development process even smoother and more efficient!

Here are the links to the repo and the NPM page again.

Source: Deploying an Apps Script Library Part 4: Essential Developer Tooling

Deploying an Apps Script Library Part 3: JSDoc vs TypeScript

About a year ago, a notable shift occurred in the developer community when SvelteKit made the decision to transition from TypeScript to JSDoc, specifically stating that TypeScript was not the ideal choice for developing libraries. This move definitely raised some eyebrows and stirred the pot among developers. Initially, I was skeptical, perceiving it as a regression rather than progress. TypeScript was even featured in one of my previous blog posts as a recommended tool. However, this decision began to resonate with me over time, leading me to adopt a similar approach in Google Apps Script. The reasons for this shift are manifold, with some being universally applicable and others specific to the peculiarities of Apps Script.

Here are the links to the repo and the NPM page again.

Let’s dive into why TypeScript was chosen in the first place and what has changed to endorse JSDoc over it.

Source: Deploying an Apps Script Library Part 3: JSDoc vs TypeScript

Deploying an Apps Script Library Part 2: Source Code and Project Structure

 

Following up from last week, we get into how I built the table() method in our ConsolAS class, using test-driven development (TDD). This is a cool way to make sure everything works perfectly by testing each part before we fully build it. We’re aiming to make it work just like the console.table() function in Google Chrome, which is pretty handy.

Source: Deploying an Apps Script Library Part 2: Source Code and Project Structure

Ever felt like you’re bringing a knife to a gunfight? That’s me coding without `console.table()` in Google Apps Script. Here’s what I did about it.

Here’s the scoop: While tinkering with a project, I needed a way to pinpoint the last row of data in various sheets — essentially to catch any “orphan” values lurking there. Typically, something like console.table() would be the hero of the day, allowing me to effortlessly display data like so:

| Sheet Name | Last Row |
| ---------- | -------- |
| Sheet1     | 513      |
| Sheet2     | 27       |
| Sheet3     | 50       |

But as fate would have it, Google Apps Script doesn’t include a console.table() function, or even a Logger.table()

Source: Ever felt like you’re bringing a knife to a gunfight? That’s me coding without console.table() in Google Apps Script. Here’s what I did about it.

How to Write to a JDBC Database with Google Apps Script: My Adventure with a Pesky Character Limit

I recently faced a frustrating issue when writing data to a CloudSQL database with the JDBC class in Apps Script. I kept getting the following error:

Exception: Argument too large: SQL

I also observed that it only happened when my SQL query reached a certain length. I considered breaking it down into multiple queries, but I was still puzzled 🤔 because I was only sending a few dozen kilobytes of data.

Now, the thing is, the official documentation could be more helpful; even though the solution is there, it needs to be better explained. So, I turned to StackOverflow. There was a discussion on this exact topic, but to my surprise, I was still waiting for an answer. Until, well, I wrote it 😉

Source: How to Write to a JDBC Database with Google Apps Script: My Adventure with a Pesky Character Limit

One Code to Rule Them All: Deploying Editor Add-Ons Across Google Sheets, Docs, Slides, and Forms

Mastering Google Apps Script: Deploy Once, Run Everywhere 🚀

What’s The Issue? 🤔

Building add-ons with Google Apps Script is akin to owning a magic wand for distributing your application. And if you’re like me, you’ve probably created an army of internal add-ons for clients and personal use, especially those sweet editor add-ons. But here’s the catch: every time you deploy your add-on, you need to specify the script ID and the deployment version for each context (Docs, Sheets, Slides, and Forms). Keeping up with 4 different files isn’t just tedious; it’s like trying to juggle flaming swords while on a unicycle 🙃. But don’t worry, there’s a better way!

Source: One Code to Rule Them All: Deploying Editor Add-Ons Across Google Sheets, Docs, Slides, and Forms

Master Google Apps Script UIs — Part 9: Elevating Your Game with TypeScript 👾

Taking JavaScript to the Next Level with TypeScript for your Google Apps Script Projects

A Warm Welcome Back to the Series 🎉

Hey there, and welcome back to our hands-on series on mastering Google Apps Script UIs! Now, if you’re serious about JavaScript, it’s high time we chat about TypeScript. TypeScript is a superset of JavaScript that brings static typing to the game. It’s like JavaScript put on its best suit and turned into a more organized, reliable version of itself. 😎

The reason a lot of developers are switching to TypeScript is because it can catch errors at compile-time, making debugging less of a headache (it’s like having a personal assistant who checks your work for mistakes so you don’t look silly later). In this part, we’ll let the Emojibar project rest (it’s earned it, after all!), and we’ll switch over to a different repository I frequently use as a boilerplate for my projects. This boilerplate is a work in progress, so don’t be surprised if it changes faster than you change your socks. 😅

Source: Master Google Apps Script UIs — Part 9: Elevating Your Game with TypeScript 👾

Master Google Apps Script UIs — Part 8: Deploying Across Multiple Environments

Streamlining Your Development Workflow with Multiple Deployment Environments 🚀

Kickoff: Marching Towards Deployment

Welcome back, dear coders! Our Emojibar is not just a fun prototype anymore — it’s a full-fledged tool ready to be unleashed into the wild. But before we let it run free, we need to get our house in order, or in our case, our environments. And no, I’m not talking about recycling, though you should be doing that too!

Professional development calls for setting up different environments — it’s a bit like having different outfits for different occasions. At the very least, you’ll want to have a development environment where you experiment and break things (yes, it’s encouraged!), a User Acceptance Testing (UAT) environment where your users can give your app a test drive, and a production environment, the red carpet where your app shines.

Source: Master Google Apps Script UIs — Part 8: Deploying Across Multiple Environments

Master Google Apps Script UIs — Part 7: Routing in Your GAS Front-End

Introduction

Hey there, code wranglers! 🤠 Welcome back to our Google Apps Script (GAS) UI series. Today, we’re venturing into the wild world of Single Page Applications (SPAs). For the uninitiated, a SPA is a web application that interacts with the user dynamically, rewriting the current web page with new data from the web server, instead of the default method of the browser loading entire new pages.📚

Now, why are SPAs a big deal? They help in reducing the time taken to load the entire page because only a part of the page gets updated. We’re going to bring this SPA magic to our sidebar with the help of a slick Navigo router. 🎩

No worries if ‘Navigo’ sounds like a hip new dance move. By now, you should be pretty comfy with installing dependencies from NPM. But if not, it’s like adding a shiny new tool to your utility belt. It just gives you the superpowers you need to build your web app.

Source Master Google Apps Script UIs — Part 7: Routing in Your GAS Front-End

Master Google Apps Script UIs — Part 6: Acing Client-to-Server Chatter with Promises 🤝

Welcome Back to Mastering Google Apps Script UIs: Client-to-Server Communication Spotlight

Oh, howdy folks! Just like a boomerang, you’ve found your way back to our marvelous series. If you thought the previous episodes were fire, wait till you see what’s cooking today! 🔥

We’re diving headfirst into the world of client-to-server communication. It’s like passing notes in class, but with a lot less paper and a lot more code. 📝➡️💻

Here’s the catch though — we can’t install Google Apps Script locally to run things on our dev server. Yep, that’s right. It’s like trying to install a toaster in a bathtub; it just ain’t happening. 🛁🚫🍞

But fear not, dear coder, for I’ve got a trick or two up my sleeve. We’re gonna finesse our way around this with some snazzy hacks like promises, polyfills, and mocks. Oh my!

Source: Master Google Apps Script UIs — Part 6: Acing Client-to-Server Chatter with Promises 🤝