diff --git a/apps/drive-integration/.prettierignore b/apps/drive-integration/.prettierignore new file mode 100644 index 0000000000..af93c54682 --- /dev/null +++ b/apps/drive-integration/.prettierignore @@ -0,0 +1,4 @@ +build/ +dist/ +node_modules/ +coverage/ diff --git a/apps/drive-integration/AGENTS.md b/apps/drive-integration/AGENTS.md index bdbdb039b8..bd911d5dc1 100644 --- a/apps/drive-integration/AGENTS.md +++ b/apps/drive-integration/AGENTS.md @@ -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 diff --git a/apps/drive-integration/contentful-app-manifest.json b/apps/drive-integration/contentful-app-manifest.json index 6cd5005c92..e52436fe72 100644 --- a/apps/drive-integration/contentful-app-manifest.json +++ b/apps/drive-integration/contentful-app-manifest.json @@ -17,12 +17,8 @@ "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", @@ -30,12 +26,8 @@ "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", @@ -43,12 +35,8 @@ "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", @@ -56,12 +44,8 @@ "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": [] diff --git a/apps/drive-integration/functions/tsconfig.json b/apps/drive-integration/functions/tsconfig.json index 64118301bd..659410e376 100644 --- a/apps/drive-integration/functions/tsconfig.json +++ b/apps/drive-integration/functions/tsconfig.json @@ -3,8 +3,7 @@ "target": "ES2020", "module": "CommonJS", "lib": ["ES2020"], - "strict": true, - + "strict": true }, "include": ["./**/*.ts"], "exclude": ["node_modules", "build"] diff --git a/apps/drive-integration/functions/vitest.config.mts b/apps/drive-integration/functions/vitest.config.mts index 3707c9161d..7fc43c4208 100644 --- a/apps/drive-integration/functions/vitest.config.mts +++ b/apps/drive-integration/functions/vitest.config.mts @@ -14,4 +14,3 @@ export default defineConfig(({ mode }) => ({ include: ['**/*.test.ts', '**/*.spec.ts'], }, })); - diff --git a/apps/drive-integration/package-lock.json b/apps/drive-integration/package-lock.json index 137e2433f3..b8378f2296 100644 --- a/apps/drive-integration/package-lock.json +++ b/apps/drive-integration/package-lock.json @@ -1,11 +1,11 @@ { - "name": "google-docs", + "name": "drive-integration", "version": "0.1.0", "lockfileVersion": 3, "requires": true, "packages": { "": { - "name": "google-docs", + "name": "drive-integration", "version": "0.1.0", "dependencies": { "@ai-sdk/openai": "^2.0.56", diff --git a/apps/drive-integration/package.json b/apps/drive-integration/package.json index 92558a31a3..c35c0b7184 100644 --- a/apps/drive-integration/package.json +++ b/apps/drive-integration/package.json @@ -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" diff --git a/apps/drive-integration/tsconfig.json b/apps/drive-integration/tsconfig.json index cf3307ce5e..7522ab1700 100644 --- a/apps/drive-integration/tsconfig.json +++ b/apps/drive-integration/tsconfig.json @@ -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, @@ -20,6 +19,6 @@ "@hooks/*": ["./src/hooks/*"] } }, - "include": ["src/**/*", "test/**/*"], + "include": ["src/**/*"], "exclude": ["actions", "functions"] } diff --git a/apps/drive-integration/tsconfig.test.json b/apps/drive-integration/tsconfig.test.json new file mode 100644 index 0000000000..a35c8b81bd --- /dev/null +++ b/apps/drive-integration/tsconfig.test.json @@ -0,0 +1,7 @@ +{ + "extends": "./tsconfig.json", + "compilerOptions": { + "types": ["vitest/globals", "@testing-library/jest-dom"] + }, + "include": ["src/**/*", "test/**/*"] +}