-
Notifications
You must be signed in to change notification settings - Fork 153
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
fix: update Vite config for delivery function examples [EXT-6273] #9585
Conversation
✅ Deploy Preview for ecommerce-app-base-components canceled.
|
|
||
type InstallationParameters = { | ||
apiEndpoint: string; | ||
url: string; | ||
}; | ||
|
||
type EventHandler = FunctionEventHandler<FunctionEventType, InstallationParameters>; | ||
type QueryHandler = FunctionEventHandler<'graphql.query', InstallationParameters>; | ||
type FieldMappingHandler = FunctionEventHandler<'graphql.field.mapping'>; | ||
type QueryHandler = FunctionEventHandler<FunctionTypeEnum.GraphqlQuery, InstallationParameters>; |
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.
👏
@@ -41,19 +39,19 @@ | |||
] | |||
}, | |||
"devDependencies": { | |||
"@contentful/app-scripts": "1.33.2", | |||
"@contentful/app-scripts": "^2.3.0", |
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.
Nice! I believe that's add-locations release!
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.
Yes, this should bump all of these examples so they'll have that available!
"jsx": "react" | ||
}, | ||
"include": ["./src/**/*.ts", "./setupTests.ts", "./functions/**/*.ts"] | ||
"exclude": ["functions"] |
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.
This is because build:functions uses a different tsc?
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.
Exactly! I ended up updating this example to follow the convention we had in some examples where we have separate tsconfigs for the frontend app and then the functions directory
Purpose
We updated the example apps to use Vite instead of CRA/react-scripts in this PR. However, a few things were missed, so this PR aims to clean those up.
Approach
Here's an overview of the changes:
Vite updates
./build
instead of the default./dist
. This is because thebuild-functions
script from the@contentful/app-scripts
package expects this to be the name for the build directory/// <reference types="vitest/config" />
when using Vitest, adding the triple slash command as documented herestart
script in package.json in addition to todev
tsconfig.json
updatestsconfig
and the associatedreact-app-env.d.ts
file; add any necessary configuration after removing thattsconfig.json
like our function templatesContentful package dependency updates
@contentful/app-scripts
and@contentful/node-apps-toolkit
FunctionTypeEnum
instead of string valuesDocumentation updates
Example-specific changes
The
function-mock-shop
app had some mistakes copied from another app in thepackage.json file
, so I've addressed those.The
native-external-references-tmdb
example needed some additional updates in the test files to move from Jest to Vitest.Testing steps
I tested these locally in the apps repo and also tested them using CCA according these instructions
Breaking Changes
Dependencies and/or References
Deployment