Skip to content

Commit

Permalink
feat: add legacy sdk deprecation notices
Browse files Browse the repository at this point in the history
  • Loading branch information
saikumarrs committed Jan 28, 2025
1 parent 592a5ae commit df2136e
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 3 deletions.
10 changes: 10 additions & 0 deletions .github/workflows/deploy-npm.yml
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,16 @@ jobs:
echo "CURRENT_NPM_VERSION_COOKIE_UTILS=${{ env.CURRENT_NPM_VERSION_COOKIE_UTILS }}"
echo "NEW_NPM_VERSION_COOKIE_UTILS=${{ env.NEW_NPM_VERSION_COOKIE_UTILS }}"
- name: Deprecate the legacy SDK NPM package
continue-on-error: true
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
NPM_CONFIG_PROVENANCE: true
run: |
npm set //registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}
npm deprecate rudder-sdk-js "This package is deprecated and no longer maintained. Please migrate to the latest package, @rudderstack/analytics-js (https://www.npmjs.com/package/@rudderstack/analytics-js), for the latest features, security updates, and improved performance. For more details, visit: https://www.rudderstack.com/docs/sources/event-streams/sdks/rudderstack-javascript-sdk/migration-guide/."
- name: Send message to Slack channel
if: env.CURRENT_NPM_VERSION != env.NEW_NPM_VERSION && env.NEW_NPM_VERSION != 'not found'
id: slack
Expand Down
4 changes: 2 additions & 2 deletions packages/analytics-v1.1/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@

---

| :warning: This package is deprecated. Please switch to the latest [@rudderstack/analytics-js](https://www.npmjs.com/package/@rudderstack/analytics-js) package for improved features and support. <br>For more details, visit [link](https://www.rudderstack.com/docs/sources/event-streams/sdks/rudderstack-javascript-sdk/). |
| :----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| :warning: **This package is deprecated and no longer maintained.** Please migrate to the latest [@rudderstack/analytics-js](https://www.npmjs.com/package/@rudderstack/analytics-js) package for enhanced features, security updates, and ongoing support. <br/><br/>For more details, visit the [official documentation](https://www.rudderstack.com/docs/sources/event-streams/sdks/rudderstack-javascript-sdk/). |
| :----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |

# RudderStack JavaScript SDK

Expand Down
3 changes: 2 additions & 1 deletion packages/analytics-v1.1/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,8 @@
"build:browser:modern:bundle-size": "VISUALIZER=true npm run build:browser:modern",
"build:npm:dev": "rollup --config rollup-configs/rollup.sdk.npm.mjs --environment VERSION:$npm_package_version,NPM",
"package": "npm pack",
"release": "npm publish"
"release": "npm publish",
"postinstall": "echo 'This package is deprecated and no longer maintained. Please migrate to the latest @rudderstack/analytics-js (https://www.npmjs.com/package/@rudderstack/analytics-js) package for enhanced features, security updates, and ongoing support. For more details, visit the official documentation: https://www.rudderstack.com/docs/sources/event-streams/sdks/rudderstack-javascript-sdk/.'"
},
"keywords": [
"analytics",
Expand Down
6 changes: 6 additions & 0 deletions packages/analytics-v1.1/src/core/analytics.js
Original file line number Diff line number Diff line change
Expand Up @@ -1658,6 +1658,12 @@ const startSession = instance.startSession.bind(instance);
const endSession = instance.endSession.bind(instance);
const setAuthToken = instance.setAuthToken.bind(instance);

if ('__MODULE_TYPE__' === 'npm') {
logger.error('This package is deprecated and no longer maintained. Please migrate to the latest [@rudderstack/analytics-js](https://www.npmjs.com/package/@rudderstack/analytics-js) package for enhanced features, security updates, and ongoing support. For more details, visit the official documentation: https://www.rudderstack.com/docs/sources/event-streams/sdks/rudderstack-javascript-sdk/.');

Check warning on line 1662 in packages/analytics-v1.1/src/core/analytics.js

View check run for this annotation

Codecov / codecov/patch

packages/analytics-v1.1/src/core/analytics.js#L1662

Added line #L1662 was not covered by tests
} else {
logger.error('This version of the RudderStack JavaScript SDK is deprecated and no longer maintained. Please migrate to the latest version (v3) for enhanced features, security updates, and ongoing support. For more details, visit the official documentation: https://www.rudderstack.com/docs/sources/event-streams/sdks/rudderstack-javascript-sdk/.');

Check warning on line 1664 in packages/analytics-v1.1/src/core/analytics.js

View check run for this annotation

Codecov / codecov/patch

packages/analytics-v1.1/src/core/analytics.js#L1664

Added line #L1664 was not covered by tests
}

export {
initialized,
ready,
Expand Down

0 comments on commit df2136e

Please sign in to comment.