-
Notifications
You must be signed in to change notification settings - Fork 2
[FSSDK-11466] Upgrade JS SDK version and modernize #9
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
Open
mikechu-optimizely
wants to merge
62
commits into
master
Choose a base branch
from
mike/fssdk-11466-upgrade-fx-js-version
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
62 commits
Select commit
Hold shift + click to select a range
e65d4ee
chore: update Optimizely SDK version to ^6.1.0
mikechu-optimizely 7a640e0
chore: update project version to 2.0.0 and change license to Apache-2.0
mikechu-optimizely dc97646
chore: update prettier version to ^3.6.2 in devDependencies
mikechu-optimizely 5b8221a
refactor: ran prettier
mikechu-optimizely 3abde31
fix: update Optimizely SDK import to use universal bundle
mikechu-optimizely fdeb882
docs: update copyright year and formatting in license header
mikechu-optimizely 5a8bb69
feat: migrate configuration from wrangler.toml to wrangler.jsonc
mikechu-optimizely 8a77cd5
fix: remove uuid dependency and use crypto.randomUUID for user ID gen…
mikechu-optimizely f68b3da
chore: update cookie dependency version to ^1.0.2 in package.json and…
mikechu-optimizely 0c3e84c
build: remove custom build leverage default esbuild
mikechu-optimizely e8ec1e5
fix: update SDK import path and convert to ES module format
mikechu-optimizely d135972
refactor: lint fix
mikechu-optimizely 94f723f
doc: update copyright
mikechu-optimizely 7bb9fd2
refactor: replace console.log with console.info for decision logging
mikechu-optimizely e27abd1
fix: add missing "type" field in package.json for module support
mikechu-optimizely 0757085
refactor: rearrange package.json
mikechu-optimizely 7535c62
test: add vitest + miniflare
mikechu-optimizely 5df56fc
feat: add biomejs + update format & add lint scripts
mikechu-optimizely feb7e74
refactor: run biome format
mikechu-optimizely b9e67cc
refactor: run biome lint
mikechu-optimizely 2f98dbe
chore: clean up .gitignore by removing unused entries and organizing …
mikechu-optimizely 04a1a77
chore: remove webpack configuration file
mikechu-optimizely c297210
feat: add build script to --dry-run a deployment
mikechu-optimizely 47d6c8e
feat: implement caching for Optimizely client and refactor datafile f…
mikechu-optimizely 6fe5fe3
feat: update getOptimizelyClient to use SDK key from environment vari…
mikechu-optimizely b48348c
chore: remove .editorconfig file
mikechu-optimizely 9fe30af
docs: update README to reflect repo modernization
mikechu-optimizely 0c94a88
test(wip): initial test suite
mikechu-optimizely 1e5f83d
refactor: lint/format
mikechu-optimizely c92bc48
chore: set the correct next major semver
mikechu-optimizely 2b21d23
test: remove unnecessary crypto mock and clean up test setup
mikechu-optimizely ab2214a
refactor: lint & format
mikechu-optimizely 24bf516
Update README.md
mikechu-optimizely b8a4114
Update .biome.jsonc
mikechu-optimizely e9d6b7c
fix: add missing parameter to getOptimizelyClient function
mikechu-optimizely 039df35
Merge branch 'mike/fssdk-11466-upgrade-fx-js-version' of github.com:o…
mikechu-optimizely 0a7cb12
feat: add CloudflareRequestHandler class for handling fetch requests
mikechu-optimizely 367a111
fix: datafile fetching and v6 client initialization logic
mikechu-optimizely 11d3551
test: add unit tests for CloudflareRequestHandler class
mikechu-optimizely 1ae4ce5
fix: update getDatafile call and improve request handler tests
mikechu-optimizely a0325ce
feat: enhance CloudflareRequestHandler to utilize execution context f…
mikechu-optimizely 8aa1725
fix: update requestHandler initialization and context handling in get…
mikechu-optimizely 39ddda2
Update src/optimizely_helper.js
mikechu-optimizely 2bedafd
Update src/optimizely_helper.js
mikechu-optimizely 8cd2dae
Update test/setup.js
mikechu-optimizely 19ddb5e
fix: format & lint
mikechu-optimizely 9b84fb4
feat: update precommit script to include test execution
mikechu-optimizely b78fc9f
fix: improve event handling and reduce datafile cache TTL
mikechu-optimizely 0397984
refactor: simplify request handling and improve response parsing
mikechu-optimizely 5769b5f
refactor: enhance datafile caching logic and error handling
mikechu-optimizely 241f2c0
fix: improve error handling for datafile fetching and caching
mikechu-optimizely f41f36f
fix: biome.jsonc name + updated configuration version
mikechu-optimizely 44c7da0
fix: add dist/ directory to .gitignore for better packaging management
mikechu-optimizely afda97f
fix: simplify format and lint scripts in package.json
mikechu-optimizely 6739a8b
refactor: update formatting & lints
mikechu-optimizely f312f51
fix: improve datafile cache TTL handling and fallback logic
mikechu-optimizely 1042eb7
doc: enhance internal documentation for Cloudflare Worker and Optimiz…
mikechu-optimizely 97d8599
doc: update README to include ttl & important file info
mikechu-optimizely 7587ed3
fix: set datafile cache TTL to default value of 300 seconds
mikechu-optimizely f2e3189
fix: enhance error handling for Optimizely client and user context in…
mikechu-optimizely e0916cc
fix: update constructor and method parameters for clarity and consist…
mikechu-optimizely 06993cb
doc: updated changelog for version
mikechu-optimizely File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
# Optimizely SDK Configuration | ||
# Get your SDK key from the Optimizely dashboard: Settings > Environments | ||
OPTIMIZELY_SDK_KEY=your_optimizely_sdk_key | ||
|
||
# Optional: Set datafile cache TTL in seconds (default is 300 seconds / 5 minutes) | ||
# Example values: "300" (5 minutes), "600" (10 minutes), etc | ||
OPTIMIZELY_DATAFILE_CACHE_TTL_SECONDS="300" | ||
|
||
# Optional: Set log level for development (Error, Warn, Info, Debug) | ||
# LOG_LEVEL=Error |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"recommendations": ["biomejs.biome"] | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"cSpell.words": ["miniflare"] | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,63 @@ | ||
# Change Log | ||
|
||
All notable changes to this project will be documented in this file. | ||
|
||
The format is based on [Keep a Changelog](http://keepachangelog.com/) | ||
and this project adheres to [Semantic Versioning](http://semver.org/). | ||
|
||
|
||
## [1.0.0] - October 10, 2025 | ||
|
||
### Changed | ||
|
||
- Updated `@optimizely/optimizely-sdk` to version `6.1.0` with ES modules support. | ||
- Migrated from addEventListener pattern to modern Cloudflare Workers fetch handler export syntax. | ||
- Replaced `uuid` package with native `crypto.randomUUID()` for user ID generation. | ||
- Replaced Webpack build with native ES modules. | ||
- Migrated configuration from `wrangler.toml` to `wrangler.jsonc`. | ||
- Refactored request handler to return standardized response format: `{statusCode: number, body: string, headers: Object}`. | ||
- Implemented graceful degradation: worker continues to function even if Optimizely initialization fails. | ||
- Enhanced error handling with try-catch blocks around all Optimizely operations - errors are logged but don't break the worker. | ||
- Added comprehensive JSDoc documentation throughout the codebase. | ||
- Improved datafile caching with module-scope cache and configurable TTL via `OPTIMIZELY_DATAFILE_CACHE_TTL_SECONDS` environment variable (default: 300 seconds). | ||
- Updated `cookie` package from `0.4.2` to `1.0.2`. | ||
- Migrated from Prettier to Biome for code formatting and linting. | ||
|
||
### Added | ||
|
||
- New `CloudflareRequestHandler` class implementing custom request handler for Cloudflare Workers environment. | ||
- New `getOptimizelyClient` helper function for centralized client management with smart caching. | ||
- New `getDatafile` helper function for fetching datafiles from Optimizely CDN. | ||
- Comprehensive unit test suite using Vitest and vitest-environment-miniflare. | ||
- Test files: `index.test.js`, `optimizely_helper.test.js`, `request_handler.test.js`. | ||
- Test utilities and setup files for easier testing. | ||
- `biome.jsonc` configuration for code quality tools. | ||
- `vitest.config.js` for test configuration. | ||
|
||
### Removed | ||
|
||
- Removed `uuid` package dependency (replaced with native Web Crypto API). | ||
- Removed Webpack build configuration (`webpack.config.js`). | ||
- Removed old `wrangler.toml` (replaced with `wrangler.jsonc`). | ||
- Removed Prettier in favor of Biome. | ||
|
||
### Fixed | ||
|
||
- Response body is now always returned as a string for consistent interface with Optimizely SDK expectations. | ||
- Worker no longer returns 500 errors on Optimizely failures; continues with degraded functionality. | ||
- Improved AbortError handling in request handler with proper error wrapping. | ||
|
||
## [0.2.0] - April 4, 2022 | ||
|
||
### Added | ||
|
||
- Added cookie based user id memorization to support sticky [bucketing](https://docs.developers.optimizely.com/full-stack/v4.0/docs/how-bucketing-works). | ||
|
||
### Changed | ||
|
||
- Updated `@optimizely/optimizely-sdk` version to `4.9.1`. | ||
|
||
## [0.1.0] - November 18, 2021 | ||
|
||
### Added | ||
|
||
- First version of Cloudflare worker template with datafile caching and event dispatcher. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -41,4 +41,4 @@ The YEAR above should be the year of the contribution. If work on the file has b | |
|
||
## Contact | ||
|
||
If you have questions, please contact [email protected]. | ||
If you have questions, please contact [email protected]. |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.