Warning
The Optimization SDK Suite is pre-release (alpha). Breaking changes may be published at any time.
This is a reference implementation for the Optimization Node SDK and is part of the Contentful Optimization SDK Suite.
All steps should be run from the monorepo root.
-
Install pnpm packages:
pnpm install
-
Ensure the required packages can be built:
pnpm --stream build
-
Configure the environment in a
.envfile inimplementations/node-sdkbased on the.env.exampleincluded file. The file is pre-populated with values that are valid only against the mock server implementation. To test the implementation against a live server environment, see the mocks package for information on how to set up Contentful space with test data. -
Start the mock API and application servers:
pnpm --dir implementations/node-sdk --ignore-workspace serve
-
The application can be accessed via Web browser at
http://localhost:3000 -
Stop the mock API and application servers:
pnpm --dir implementations/node-sdk --ignore-workspace serve:stop
See implementations/node-sdk/package.json for more commands.
You can run this implementation from the monorepo root via the root package.json implementation
scripts.
-
Start servers:
pnpm run implementation:node-sdk -- serve
-
Stop servers:
pnpm run implementation:node-sdk -- serve:stop
-
Run E2E:
pnpm run implementation:node-sdk -- test:e2e
E2E tests are run using Playwright.
-
Install Playwright dependencies:
pnpm --dir implementations/node-sdk --ignore-workspace exec playwright install --with-deps -
Run the E2E test suite:
pnpm --dir implementations/node-sdk --ignore-workspace test:e2e
The tests can alternatively be run using Playwright's GUI:
pnpm --dir implementations/node-sdk --ignore-workspace test:e2e:ui