Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions apps/drive-integration/.prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
build/
dist/
node_modules/
coverage/
18 changes: 10 additions & 8 deletions apps/drive-integration/AGENTS.md
Original file line number Diff line number Diff line change
@@ -1,26 +1,28 @@
# Agent Guide — drive-integration

## What This App Does

Connects Google Docs to Contentful. Lets editors import a Google Doc's content directly into a Contentful rich-text field, handling the conversion from Google Docs format to Contentful's rich-text document model.

## Archetype

Standard Vite app.

## Locations

| Location | File | Purpose |
|----------|------|---------|
| Location | File | Purpose |
| --------------------- | -------------------------------- | ----------------------------------------------- |
| `LOCATION_APP_CONFIG` | `src/locations/ConfigScreen.tsx` | Configure Google OAuth credentials and mappings |
| `LOCATION_PAGE` | `src/locations/Page/` | Main import UI — browse/select Google Docs |
| `LOCATION_PAGE` | `src/locations/Page/` | Main import UI — browse/select Google Docs |

## Key Dependencies

| Package | Role |
|---------|------|
| `@contentful/app-sdk` | App Framework SDK |
| Package | Role |
| ------------------------------- | --------------------------------------- |
| `@contentful/app-sdk` | App Framework SDK |
| `@contentful/field-editor-json` | JSON field editor (for raw doc preview) |
| `@contentful/node-apps-toolkit` | Shared utilities |
| `contentful-management` | CMA for writing imported content |
| `@contentful/node-apps-toolkit` | Shared utilities |
| `contentful-management` | CMA for writing imported content |

## Source Layout

Expand Down
32 changes: 8 additions & 24 deletions apps/drive-integration/contentful-app-manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,51 +17,35 @@
"description": "Initiates the OAuth flow for Drive Integration",
"path": "functions/oauth/initiateOauth.js",
"entryFile": "functions/oauth/initiateOauth.ts",
"allowNetworks": [
"oauth2.googleapis.com"
],
"accepts": [
"appaction.call"
]
"allowNetworks": ["oauth2.googleapis.com"],
"accepts": ["appaction.call"]
},
{
"id": "completeGdocOauth",
"name": "Complete Gdoc OAuth Flow",
"description": "Completes the OAuth flow for Drive Integration",
"path": "functions/oauth/completeOauth.js",
"entryFile": "functions/oauth/completeOauth.ts",
"allowNetworks": [
"oauth2.googleapis.com"
],
"accepts": [
"appaction.call"
]
"allowNetworks": ["oauth2.googleapis.com"],
"accepts": ["appaction.call"]
},
{
"id": "revokeGdocOauthToken",
"name": "Revoke Gdoc OAuth Token",
"description": "Revoke token for the Drive Integration app to disconnect from the app",
"path": "functions/oauth/disconnect.js",
"entryFile": "functions/oauth/disconnect.ts",
"allowNetworks": [
"oauth2.googleapis.com"
],
"accepts": [
"appaction.call"
]
"allowNetworks": ["oauth2.googleapis.com"],
"accepts": ["appaction.call"]
},
{
"id": "checkGdocOauthTokenStatus",
"name": "Check Gdoc OAuth Token Status",
"description": "Checks the status of the Drive Integration OAuth token to see if it is valid",
"path": "functions/oauth/checkStatus.js",
"entryFile": "functions/oauth/checkStatus.ts",
"allowNetworks": [
"oauth2.googleapis.com"
],
"accepts": [
"appaction.call"
]
"allowNetworks": ["oauth2.googleapis.com"],
"accepts": ["appaction.call"]
}
],
"actions": []
Expand Down
3 changes: 1 addition & 2 deletions apps/drive-integration/functions/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@
"target": "ES2020",
"module": "CommonJS",
"lib": ["ES2020"],
"strict": true,

"strict": true
},
"include": ["./**/*.ts"],
"exclude": ["node_modules", "build"]
Expand Down
1 change: 0 additions & 1 deletion apps/drive-integration/functions/vitest.config.mts
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,3 @@ export default defineConfig(({ mode }) => ({
include: ['**/*.test.ts', '**/*.spec.ts'],
},
}));

4 changes: 2 additions & 2 deletions apps/drive-integration/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 7 additions & 9 deletions apps/drive-integration/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,27 +22,25 @@
},
"scripts": {
"start": "vite",
"dev": "vite",
"preview": "vite preview",
"test": "vitest",
"test:ci": "vitest run",
"build:frontend": "rm -rf build && tsc && vite build",
"build:functions": "contentful-app-scripts build-functions --ci",
"build": "rimraf build && npm run build:frontend && npm run build:functions",
"upload:app-dev": "contentful-app-scripts upload --bundle-dir ./build --organization-id 6xdLsz6lCsk0yPOccSsDK7 --definition-id 653vTnuQw3j5onU1tUoH6t --token $CONTENTFUL_ACCESS_TOKEN",
"deploy:sync-dev": "aws s3 sync ./build ${STATIC_S3_BASE}/google-docs-dev/dev && aws cloudfront create-invalidation --distribution-id $GOOGLE_DOCS_TEST_CLOUDFRONT_DIST_ID --paths \"/*\" > /dev/null 2>&1",
"deploy:dev": "npm run build && npm run upload:app-dev && npm run deploy:sync-dev",
"upload:app-dev2": "contentful-app-scripts upload --bundle-dir ./build --organization-id 6xdLsz6lCsk0yPOccSsDK7 --definition-id 7GZyBCU0FGVnR1mpRYJQ5L --token $CONTENTFUL_ACCESS_TOKEN",
"deploy:sync-dev2": "aws s3 sync ./build ${STATIC_S3_BASE}/google-docs-dev/dev2 && aws cloudfront create-invalidation --distribution-id $GOOGLE_DOCS_TEST_CLOUDFRONT_DIST_ID --paths \"/*\" > /dev/null 2>&1",
"deploy:dev2": "npm run build && npm run upload:app-dev2 && npm run deploy:sync-dev2",
"upload:app-staging": "contentful-app-scripts upload --bundle-dir ./build --organization-id 6xdLsz6lCsk0yPOccSsDK7 --definition-id 4i0mp5lQtgNsHYVrD5jIkj --token $CONTENTFUL_ACCESS_TOKEN",
"deploy:sync-staging": "aws s3 sync ./build ${STATIC_S3_BASE}/google-docs-dev/staging && aws cloudfront create-invalidation --distribution-id $GOOGLE_DOCS_TEST_CLOUDFRONT_DIST_ID --paths \"/*\" > /dev/null 2>&1",
"deploy:staging": "npm run build && npm run upload:app-staging && npm run deploy:sync-staging",
"upload:app-flinkly": "contentful-app-scripts upload --bundle-dir ./build --organization-id 3m1Cqy5lzALpWNY9GjP2Zm --definition-id 7r10omUtVNoq8X3Yy4YfBL --token $FLINKLY_CONTENTFUL_ACCESS_TOKEN",
"deploy:sync-flinkly": "aws s3 sync ./build ${STATIC_S3_BASE}/google-docs-dev/flinkly && aws cloudfront create-invalidation --distribution-id $GOOGLE_DOCS_TEST_CLOUDFRONT_DIST_ID --paths \"/*\" > /dev/null 2>&1",
"deploy:flinkly": "npm run build && npm run upload:app-flinkly && npm run deploy:sync-flinkly",
"upload:app-prod": "contentful-app-scripts upload --ci --bundle-dir ./build --organization-id 5EJGHo8tYJcjnEhYWDxivp --definition-id 3EaGZUMKRKVZUyrcoNJ4o4 --token $CONTENTFUL_ACCESS_TOKEN",
"deploy:sync-prod": "aws s3 sync ./build ${PROD_STATIC_S3_BASE}/google-docs && aws cloudfront create-invalidation --distribution-id $GOOGLE_DOCS_PROD_CLOUDFRONT_DIST_ID --paths \"/*\" > /dev/null 2>&1",
"upload": "contentful-app-scripts upload --bundle-dir ./build --organization-id 5EJGHo8tYJcjnEhYWDxivp --definition-id 3EaGZUMKRKVZUyrcoNJ4o4 --token $CONTENTFUL_ACCESS_TOKEN",
"deploy:prod": "npm run build && npm run upload && npm run deploy:sync-prod"
"deploy:prod": "npm run build && npm run upload:app-prod && npm run deploy:sync-prod",
"deploy": "npm run deploy:prod",
"deploy:test": "npm run deploy:flinkly",
"format": "prettier --write .",
"format:check": "prettier --check ."
},
"eslintConfig": {
"extends": "react-app"
Expand Down
3 changes: 1 addition & 2 deletions apps/drive-integration/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
"compilerOptions": {
"target": "ESNext",
"lib": ["DOM", "DOM.Iterable", "ESNext"],
"types": ["vitest/globals", "@testing-library/jest-dom"],
"skipLibCheck": true,
"esModuleInterop": true,
"allowSyntheticDefaultImports": true,
Expand All @@ -20,6 +19,6 @@
"@hooks/*": ["./src/hooks/*"]
}
},
"include": ["src/**/*", "test/**/*"],
"include": ["src/**/*"],
"exclude": ["actions", "functions"]
}
7 changes: 7 additions & 0 deletions apps/drive-integration/tsconfig.test.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"extends": "./tsconfig.json",
"compilerOptions": {
"types": ["vitest/globals", "@testing-library/jest-dom"]
},
"include": ["src/**/*", "test/**/*"]
}
Loading