Skip to content

Commit

Permalink
refactor(notifications): cleanup notification subpath exports (#4650)
Browse files Browse the repository at this point in the history
## Explanation

This cleans up the notification team packages subpath exports
(`@metamask/profile-sync-controller` &
`@metamask/notification-services-controller`).

Packages will now only export:
- Main/root (where there is a barrel file containing all files)
- `/mocks` for accessing mock data (also available as a named export in
root)
- `/ui` for some UI/framework files for specific platforms (web vs
mobile). This is subject to change (we may have a clearer distinction
for platforms, such as a React folder vs ReactNative folder).


We also fix a `jest-haste-map` silent error that was introduced due to
subpath modules.
- Fix removes the internal subpath package.json names as these are
internal only files.

<details><summary>**jest haste map silent error**</summary>

This was a silent error (CI still passes)

![Screenshot 2024-09-03 at 14 08
44](https://github.com/user-attachments/assets/24738886-3aab-4077-9c44-173b76df62e2)

</details> 

## References


## Changelog

<!--
If you're making any consumer-facing changes, list those changes here as
if you were updating a changelog, using the template below as a guide.

(CATEGORY is one of BREAKING, ADDED, CHANGED, DEPRECATED, REMOVED, or
FIXED. For security-related issues, follow the Security Advisory
process.)

Please take care to name the exact pieces of the API you've added or
changed (e.g. types, interfaces, functions, or methods).

If there are any breaking changes, make sure to offer a solution for
consumers to follow once they upgrade to the changes.

Finally, if you're only making changes to development scripts or tests,
you may replace the template below with "None".
-->

### `@metamask/profile-sync-controller`

- **CHANGED**: Updated subpath package.json files to be internal only to
resolve the `jest-haste-map` errors.

### `@metamask/notification-services-controller`

- **CHANGED**: Updated subpath package.json files to be internal only to
resolve the `jest-haste-map` errors.
- **REMOVED/BREAKING**: Removed `/types`, `/processors`, `/constants`
subpath exports. These are still accessible through root export.

## Checklist

- [x] I've updated the test suite for new or updated code as appropriate
- [x] I've updated documentation (JSDoc, Markdown, etc.) for new or
updated code as appropriate
- [x] I've highlighted breaking changes using the "BREAKING" category
above as appropriate
  • Loading branch information
Prithpal-Sooriya authored Sep 3, 2024
1 parent 60fb9b4 commit b4d5f3e
Show file tree
Hide file tree
Showing 18 changed files with 16 additions and 81 deletions.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@metamask/notification-services-controller",
"version": "1.0.0",
"private": true,
"description": "",
"license": "MIT",
"sideEffects": false,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@metamask/notification-services-controller",
"version": "1.0.0",
"private": true,
"description": "",
"license": "MIT",
"sideEffects": false,
Expand Down

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@metamask/notification-services-controller",
"version": "1.0.0",
"private": true,
"description": "",
"license": "MIT",
"sideEffects": false,
Expand Down
25 changes: 0 additions & 25 deletions packages/notification-services-controller/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,21 +27,6 @@
"require": "./dist/NotificationServicesController/index.js",
"types": "./dist/types/NotificationServicesController/index.d.ts"
},
"./notification-services/types": {
"import": "./dist/NotificationServicesController/types/index.mjs",
"require": "./dist/NotificationServicesController/types/index.js",
"types": "./dist/types/NotificationServicesController/types/index.d.ts"
},
"./notification-services/processors": {
"import": "./dist/NotificationServicesController/processors/index.mjs",
"require": "./dist/NotificationServicesController/processors/index.js",
"types": "./dist/types/NotificationServicesController/processors/index.d.ts"
},
"./notification-services/constants": {
"import": "./dist/NotificationServicesController/constants/index.mjs",
"require": "./dist/NotificationServicesController/constants/index.js",
"types": "./dist/types/NotificationServicesController/constants/index.d.ts"
},
"./notification-services/ui": {
"import": "./dist/NotificationServicesController/ui/index.mjs",
"require": "./dist/NotificationServicesController/ui/index.js",
Expand All @@ -57,16 +42,6 @@
"require": "./dist/NotificationServicesPushController/index.js",
"types": "./dist/types/NotificationServicesPushController/index.d.ts"
},
"./push-services/types": {
"import": "./dist/NotificationServicesPushController/types/index.mjs",
"require": "./dist/NotificationServicesPushController/types/index.js",
"types": "./dist/types/NotificationServicesPushController/types/index.d.ts"
},
"./push-services/utils": {
"import": "./dist/NotificationServicesPushController/utils/index.mjs",
"require": "./dist/NotificationServicesPushController/utils/index.js",
"types": "./dist/types/NotificationServicesPushController/utils/index.d.ts"
},
"./push-services/mocks": {
"import": "./dist/NotificationServicesPushController/__fixtures__/index.mjs",
"require": "./dist/NotificationServicesPushController/__fixtures__/index.js",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@metamask/notification-services-controller",
"version": "1.0.0",
"private": true,
"description": "",
"license": "MIT",
"sideEffects": false,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@metamask/notification-services-controller",
"version": "1.0.0",
"private": true,
"description": "",
"license": "MIT",
"sideEffects": false,
Expand Down

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,10 @@ export { Controller };
export default NotificationServicesController;
export * from './NotificationServicesController';
export * as Types from './types';
export * as Mocks from './__fixtures__';
export * from './types';
export * as Processors from './processors';
export * from './processors';
export * as Constants from './constants';
export * from './constants';
export * as Mocks from './__fixtures__';
export * as UI from './ui';
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,7 @@ export { Controller };
export default NotificationServicesPushController;
export * from './NotificationServicesPushController';
export * as Types from './types';
export * from './types';
export * as Utils from './utils';
export * from './utils';
export * as Mocks from './__fixtures__';
2 changes: 1 addition & 1 deletion packages/profile-sync-controller/auth/mocks/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@metamask/profile-sync-controller",
"version": "1.0.0",
"private": true,
"description": "",
"license": "MIT",
"sideEffects": false,
Expand Down
2 changes: 1 addition & 1 deletion packages/profile-sync-controller/auth/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@metamask/profile-sync-controller",
"version": "1.0.0",
"private": true,
"description": "",
"license": "MIT",
"sideEffects": false,
Expand Down
2 changes: 1 addition & 1 deletion packages/profile-sync-controller/sdk/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@metamask/profile-sync-controller",
"version": "1.0.0",
"private": true,
"description": "",
"license": "MIT",
"sideEffects": false,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@metamask/profile-sync-controller",
"version": "1.0.0",
"private": true,
"description": "",
"license": "MIT",
"sideEffects": false,
Expand Down
2 changes: 1 addition & 1 deletion packages/profile-sync-controller/user-storage/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@metamask/profile-sync-controller",
"version": "1.0.0",
"private": true,
"description": "",
"license": "MIT",
"sideEffects": false,
Expand Down

0 comments on commit b4d5f3e

Please sign in to comment.