Google Drive Upload
Srcpack can automatically upload bundles to Google Drive, making them accessible from any device or shareable with your team.
Setup
1. Create OAuth Credentials
- Go to Google Cloud Console
- Create a project (or select existing)
- Enable the Google Drive API
- Go to Credentials → Create Credentials → OAuth client ID
- Select Desktop app
- Copy the Client ID and Client Secret
2. Configure Srcpack
Add the upload config to srcpack.config.ts:
import { defineConfig } from "srcpack";
export default defineConfig({
bundles: {
web: "apps/web/**/*",
api: "apps/api/**/*",
local: "local/**/*", // local-only bundle
},
upload: {
provider: "gdrive",
folderId: "1ABC...", // From Drive folder URL
clientId: "...",
clientSecret: "...",
exclude: ["local"], // skip these bundles
},
});Upload options:
| Option | Type | Description |
|---|---|---|
provider | "gdrive" | Upload provider (currently only gdrive) |
folderId | string | Google Drive folder ID (optional, defaults root) |
clientId | string | OAuth 2.0 client ID |
clientSecret | string | OAuth 2.0 client secret |
exclude | string[] | Bundle names to skip during upload |
Finding your folder ID:
Open the target folder in Google Drive. The URL looks like:
https://drive.google.com/drive/folders/1ABCxyz123...
└─────────┘
folder ID3. Authenticate
Run the login command:
npx srcpack loginbunx srcpack loginpnpm dlx srcpack loginyarn dlx srcpack loginThis opens a browser window to authorize access. Tokens are stored locally and refreshed automatically.
Usage
Once configured, npx srcpack uploads bundles after bundling:
web 24 files 842 lines → .srcpack/web.txt
api 18 files 511 lines → .srcpack/api.txt
Bundled: 2 bundles, 42 files, 1,353 lines
Uploaded: 2 files to Google Drive
web.txt → https://drive.google.com/file/d/...
api.txt → https://drive.google.com/file/d/...Exclude Bundles
To skip specific bundles from upload, use the exclude option:
upload: {
provider: "gdrive",
clientId: "...",
clientSecret: "...",
exclude: ["local", "debug"], // these bundles won't upload
}This is useful for local-only bundles that shouldn't be shared — a bundle of Linear issues, say. Names are checked against your configured bundles, so a typo fails the run instead of quietly uploading what it was meant to hold back.
Skip Upload
To bundle without uploading:
npx srcpack --no-uploadbunx srcpack --no-uploadpnpm dlx srcpack --no-uploadyarn dlx srcpack --no-uploadUpload Specific Bundles
npx srcpack webbunx srcpack webpnpm dlx srcpack webyarn dlx srcpack webEnvironment Variables
Never commit clientId and clientSecret directly in your config file. Use environment variables for shared or public repositories. :::
For CI/CD or shared configs, use environment variables:
export default defineConfig({
bundles: {/* ... */},
upload: {
provider: "gdrive",
folderId: process.env.GDRIVE_FOLDER_ID,
clientId: process.env.GDRIVE_CLIENT_ID,
clientSecret: process.env.GDRIVE_CLIENT_SECRET,
},
});Sharing with Your Team
Once uploaded, bundles appear in your Google Drive folder. You can:
- Share the folder with team members
- Open in ChatGPT/Claude — use the Google Drive integration
- Download — grab the latest bundle from any device