tldraw/apps/apps-script/build-workspace-app.ts

31 lines
1.1 KiB
TypeScript
Raw Normal View History

google meet: add hardware whiteboard integration (#3765) pushing out my changes but this is a draft. we need to do look into this more: - [ ] we might need to reach out to Google support and request to be put on their "start a whiteboard" whitelist/partner list? it's actually pretty unclear how to get on that list. I don't see any permissions/API scopes that is meant to enable that 🤔 - [ ] but maybe this is something that you @steveruizok as Google Workspace admin see on your end? let's look together when you get back. I initially tried doing a bundle (using esbuild (and i tried parcel/rollup too)) but it didn't feel like the right path, and also it didn't work when loading it in the Apps Scripts. So then I went the route of just doing an iframe and I think that feels much better. This means though that we do want our iframe protector to let through this usecase. But also, we could maybe just redirect always to a new room? I'm not sure yet. The build script helps either build the prod or staging version depending on what you want. Once we do find that the staging version works, then we'll go through the process of: - [x] applied for https://developers.google.com/workspace/preview (already did this to get access to new Google Meet APIs just in case) - [x] added to google analytics (already done) - [ ] turn off testing mode for oauth and submit for review - [ ] continue publishing process to Create a store listing for our prod app: https://developers.google.com/workspace/marketplace/how-to-publish ### Change Type <!-- ❗ Please select a 'Scope' label ❗️ --> - [ ] `sdk` — Changes the tldraw SDK - [ ] `dotcom` — Changes the tldraw.com web app - [ ] `docs` — Changes to the documentation, examples, or templates. - [ ] `vs code` — Changes to the vscode plugin - [x] `internal` — Does not affect user-facing stuff <!-- ❗ Please select a 'Type' label ❗️ --> - [ ] `bugfix` — Bug fix - [x] `feature` — New feature - [ ] `improvement` — Improving existing features - [ ] `chore` — Updating dependencies, other boring stuff - [ ] `galaxy brain` — Architectural changes - [ ] `tests` — Changes to any test code - [ ] `tools` — Changes to infrastructure, CI, internal scripts, debugging tools, etc. - [ ] `dunno` — I don't know ### Release Notes - Google Meet: add hardware whiteboard integration
2024-05-20 14:52:05 +00:00
import { mkdirSync, writeFileSync } from 'fs'
import path from 'path'
import { exec } from '../../scripts/lib/exec'
import { readFileIfExists } from '../../scripts/lib/file'
async function build() {
await exec('rm', ['-rf', 'dist'])
mkdirSync('dist')
const appsScriptPath = './appsscript.json'
await exec('cp', ['-r', appsScriptPath, 'dist'])
const isProduction = process.env.IS_PRODUCTION === '1'
const scriptId = isProduction
? '1FWcAvz7Rl4iPXQX3KmXm2mNG_RK2kryS7Bja8Y7RHvuAHnic51p_pqe7'
: '1cJfZM0M_rGU-nYgG-4KR1DnERb7itkCsl1QmlqPxFvHnrz5n6Gfy8iht'
writeFileSync('./.clasp.json', `{"scriptId":"${scriptId}","rootDir":"./dist"}`)
const host = isProduction ? 'https://www.tldraw.com' : 'https://staging.tldraw.com'
await replaceInFile(appsScriptPath, 'TLDRAW_HOST', host)
}
async function replaceInFile(filename: string, searchValue: string, replaceValue: string) {
let contents = (await readFileIfExists(path.join('dist', filename))) ?? ''
contents = contents.replaceAll(searchValue, replaceValue)
writeFileSync(path.join('dist', filename), contents)
}
build()