Skip to content

Commit

Permalink
Social Logos | Fix package.json exports to expose built in types (#40801
Browse files Browse the repository at this point in the history
)

* Social Logos | Fix package.json exports to expose built in types

* Deprecate default import

* Update docs

---------

Co-authored-by: tbradsha <[email protected]>
  • Loading branch information
manzoorwanijk and tbradsha authored Jan 2, 2025
1 parent 9a96a30 commit dc66341
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 4 deletions.
2 changes: 1 addition & 1 deletion projects/js-packages/social-logos/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ npm install social-logos --save
#### Usage

```
import SocialLogo from 'social-logos';
import { SocialLogo } from 'social-logos';
function MyComponent() {
return <SocialLogo icon="wordpress" size={ 48 } />;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
Significance: patch
Type: deprecated

Default import is now deprecated in favor of named import and will be removed in future.

```diff
- import SocialLogos from 'social-logos';
+ import { SocialLogo } from 'social-logos';
```
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Significance: patch
Type: fixed

Fixed package.json exports to expose built in types
7 changes: 5 additions & 2 deletions projects/js-packages/social-logos/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,16 @@
"bugs": {
"url": "https://github.com/Automattic/jetpack/labels/[JS Package] Social Logos"
},
"main": "build/react/index.js",
"module": "build/react/index.js",
"types": "build/react/index.d.ts",
"exports": {
".": {
"jetpack:src": "./src/react/index.ts",
"default": "./build/react/index.js"
},
"./svg-sprite/social-logos.svg": {
"default": "./build/svg-sprite/social-logos.svg"
"./svg-sprite/*": {
"default": "./build/svg-sprite/*"
},
"./font/*": {
"default": "./build/font/*"
Expand Down
9 changes: 8 additions & 1 deletion projects/js-packages/social-logos/src/react/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,12 @@
* Export components.
*/
export * from './social-logo';
export { SocialLogo as default } from './social-logo';
import { SocialLogo } from './social-logo';
export { SocialLogoData } from './social-logo-data';

/**
* @deprecated Use named import instead - `import { SocialLogo } from 'social-logos';`
*/
const DeprecatedDefaultImport = SocialLogo;

export default DeprecatedDefaultImport;

0 comments on commit dc66341

Please sign in to comment.