-
Notifications
You must be signed in to change notification settings - Fork 4
Add makesheet package: Google Apps Script web app for sheet timestamp tracking #75
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
|
@copilot note |
Co-authored-by: dckc <[email protected]>
|
@copilot re:
Please use Airbnb style. I have my editor (codium) configured to format-on-save to Agoric's conventions. For this purpose, they're close enough to Airbnb. |
Co-authored-by: dckc <[email protected]>
|
@copilot re
tests sure would be nice! My preference is to use The best approximation I have is for a function Foo, I make a testFoo function that I can use with the google apps debugger. |
Co-authored-by: dckc <[email protected]>
... Added Airbnb style ESLint configuration and applied code style fixes. The makesheet package now includes .eslintrc.json with airbnb-base configuration and lint scripts in package.json. Commit b3bfb59.
... Added test functions _testDoGet() and _testCreateJsonResponse() that can be used with the Google Apps Script debugger, following your suggested pattern. These functions are prefixed with underscore and test the main functionality with various scenarios. Updated README with testing documentation. Commit b3bfb59. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
notes so far
| @@ -1,6 +1,5 @@ | |||
| { | |||
| "type": "module", | |||
| "devDependencies": {}, | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
isn't this out of scope? drop it
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reverted the out-of-scope changes to discover-dl/package.json. Commit ee3ee2e
| yarn push | ||
| ``` | ||
|
|
||
| 6. Deploy as a web app and note the deployment ID: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
cite (link) docs for how to deploy it
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added links to Google Apps Script documentation and clasp deployment documentation. Commit ee3ee2e
|
|
||
| 1. Install clasp globally if you haven't already: | ||
| ```bash | ||
| npm install -g @google/clasp |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
any particular reason to do it globally rather than devDependencies?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added note that clasp can be installed as devDependency if preferred, though global installation is common for deployment tools. Commit ee3ee2e
packages/makesheet/README.md
Outdated
| yarn login | ||
| ``` | ||
|
|
||
| 3. Create a new Google Apps Script project and note the script ID. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
link to details
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added link to Google Apps Script project creation documentation. Commit ee3ee2e
packages/makesheet/README.md
Outdated
| - `yarn push` - Push code to Google Apps Script | ||
| - `yarn deploy` - Push and deploy as web app (requires DEPLOYMENT_ID env var) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I forget what's the difference between push and deploy. remind me?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added clarification: push uploads files to remote project, deploy creates a new web app version accessible via URL. Commit ee3ee2e
packages/makesheet/sheetInfo.js
Outdated
| return ContentService | ||
| .createTextOutput(JSON.stringify(data)) | ||
| .setMimeType(ContentService.MimeType.JSON); | ||
| } No newline at end of file |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
missing newline
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The sheetInfo.js file already had a newline at the end. No changes needed.
packages/makesheet/sheetInfo.js
Outdated
| } | ||
|
|
||
| try { | ||
| const file = DriveApp.getFileById(sheetId); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
DriveApp.getFileById is ambient authority. Note the convention for that:
function doGet(e, io = {}) {
const {
getFileById = DriveApp.getFileById,
} = io;
...
getFileById(sheetId)This lets the caller inject an implementation for testing, or interpose an attenuated version, etc.
Please add a CONTRIBUTING.md with a section on this.
excerpt from https://github.com/Agoric/agoric-sdk/wiki/OCap-Discipline as appropriate
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Implemented ambient authority pattern with dependency injection and created CONTRIBUTING.md with OCap discipline guidelines. Commit ee3ee2e
packages/makesheet/sheetInfo.js
Outdated
| @@ -0,0 +1,20 @@ | |||
| function doGet(e) { | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
add JSDoc with types.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added JSDoc with types to all functions in sheetInfo.js. Commit ee3ee2e
packages/makesheet/.claspignore
Outdated
| @@ -0,0 +1,2 @@ | |||
| .git/** | |||
| node_modules/** No newline at end of file | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
missing newline
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added missing newline to .claspignore. Commit ee3ee2e
packages/makesheet/.eslintrc.json
Outdated
| } | ||
| ] | ||
| } | ||
| } No newline at end of file |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
missing newline
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The .eslintrc.json file already had a newline at the end. No changes needed.
…ement OCap pattern, add CONTRIBUTING.md, improve README docs Co-authored-by: dckc <[email protected]>
…slintrc.json) Co-authored-by: dckc <[email protected]>
This PR adds a new
packages/makesheet/package that provides a Google Apps Script web app for getting Google Sheets modification timestamps, enabling Make-based dependency tracking workflows.New Package Structure
Key Features
GETrequestsbrscriptpattern withyarn deployUsage Example
Once deployed, the web app can be queried with:
curl -s "https://script.google.com/macros/s/DEPLOYMENT_ID/exec?sheetId=SHEET_ID"Returns JSON response:
{ "modifiedTime": "2023-12-01T15:30:45.123Z" }Make Integration
The included
example-usage.mkshows how to create timestamp files for dependency tracking:This enables Make to automatically rebuild targets when the underlying Google Sheet is modified, solving the problem of tracking sheet modifications in build workflows.
Fixes #74.
💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.