Skip to content
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

refactor: add multiple file exports for notifications controllers #4604

Merged
merged 16 commits into from
Sep 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
16 commits
Select commit Hold shift + click to select a range
3a9b2e8
refactor: profile sync controller - add multiple file exports
Prithpal-Sooriya Aug 12, 2024
8a035a4
refactor: add multiple file exports for notification-services-controller
Prithpal-Sooriya Aug 13, 2024
21c96f1
chore: fix mock exports and tests that use mocks
Prithpal-Sooriya Aug 13, 2024
223cc34
refactor: revert some import changes as they are not compatible with …
Prithpal-Sooriya Aug 13, 2024
12fc043
Merge branch 'main' of github.com:MetaMask/core into notifications-mu…
Prithpal-Sooriya Aug 13, 2024
c9ace70
refactor: add back mocks to root index export for backwards compatibi…
Prithpal-Sooriya Aug 14, 2024
84fa5d7
Merge branch 'main' of github.com:MetaMask/core into notifications-mu…
Prithpal-Sooriya Aug 14, 2024
21d139e
chore: add package.json files for aliased paths
Prithpal-Sooriya Aug 14, 2024
5a93d65
refactor: add files folder and temporary remove workspace validation.
Prithpal-Sooriya Aug 14, 2024
723d61b
feat: add profile sync sdk package path
Prithpal-Sooriya Aug 15, 2024
2890cf4
Merge branch 'main' into notifications-multiple-exports
Prithpal-Sooriya Aug 16, 2024
a787f73
Merge branch 'main' of github.com:MetaMask/core into notifications-mu…
Prithpal-Sooriya Aug 29, 2024
0465715
Merge branch 'notifications-multiple-exports' of github.com:MetaMask/…
Prithpal-Sooriya Aug 29, 2024
3538e14
Merge branch 'main' into notifications-multiple-exports
Prithpal-Sooriya Aug 30, 2024
a7a41cf
Merge branch 'main' into notifications-multiple-exports
Prithpal-Sooriya Sep 2, 2024
98dc546
Merge branch 'main' into notifications-multiple-exports
Prithpal-Sooriya Sep 2, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"name": "@metamask/notification-services-controller",
"version": "1.0.0",
"description": "",
"license": "MIT",
"sideEffects": false,
"main": "../../dist/NotificationServicesController/constants/index.js",
"types": "../../dist/types/NotificationServicesController/constants/index.d.ts"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"name": "@metamask/notification-services-controller",
"version": "1.0.0",
"description": "",
"license": "MIT",
"sideEffects": false,
"main": "../../dist/NotificationServicesController/__fixtures__/index.js",
"types": "../../dist/types/NotificationServicesController/__fixtures__/index.d.ts"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"name": "@metamask/notification-services-controller",
"version": "1.0.0",
"description": "",
"license": "MIT",
"sideEffects": false,
"main": "../dist/NotificationServicesController/index.js",
"types": "../dist/types/NotificationServicesController/index.d.ts"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"name": "@metamask/notification-services-controller",
"version": "1.0.0",
"description": "",
"license": "MIT",
"sideEffects": false,
"main": "../../dist/NotificationServicesController/processors/index.js",
"types": "../../dist/types/NotificationServicesController/processors/index.d.ts"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"name": "@metamask/notification-services-controller",
"version": "1.0.0",
"description": "",
"license": "MIT",
"sideEffects": false,
"main": "../../dist/NotificationServicesController/types/index.js",
"types": "../../dist/types/NotificationServicesController/types/index.d.ts"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"name": "@metamask/notification-services-controller",
"version": "1.0.0",
"description": "",
"license": "MIT",
"sideEffects": false,
"main": "../../dist/NotificationServicesController/ui/index.js",
"types": "../../dist/types/NotificationServicesController/ui/index.d.ts"
}
54 changes: 53 additions & 1 deletion packages/notification-services-controller/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,64 @@
"require": "./dist/index.js",
"types": "./dist/types/index.d.ts"
},
"./notification-services": {
"import": "./dist/NotificationServicesController/index.mjs",
"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",
"types": "./dist/types/NotificationServicesController/ui/index.d.ts"
},
"./notification-services/mocks": {
"import": "./dist/NotificationServicesController/__fixtures__/index.mjs",
"require": "./dist/NotificationServicesController/__fixtures__/index.js",
"types": "./dist/types/NotificationServicesController/__fixtures__/index.d.ts"
},
"./push-services": {
"import": "./dist/NotificationServicesPushController/index.mjs",
"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",
"types": "./dist/types/NotificationServicesPushController/__fixtures__/index.d.ts"
},
"./package.json": "./package.json"
},
"main": "./dist/index.js",
"types": "./dist/types/index.d.ts",
"files": [
"dist/"
"dist/",
"notification-services/",
"push-services/"
],
"scripts": {
"build": "tsup --config ../../tsup.config.ts --tsconfig ./tsconfig.build.json --clean",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"name": "@metamask/notification-services-controller",
"version": "1.0.0",
"description": "",
"license": "MIT",
"sideEffects": false,
"main": "../../dist/NotificationServicesPushController/__fixtures__/index.js",
"types": "../../dist/types/NotificationServicesPushController/__fixtures__/index.d.ts"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"name": "@metamask/notification-services-controller",
"version": "1.0.0",
"description": "",
"license": "MIT",
"sideEffects": false,
"main": "../dist/NotificationServicesPushController/index.js",
"types": "../dist/types/NotificationServicesPushController/index.d.ts"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"name": "@metamask/notification-services-controller",
"version": "1.0.0",
"description": "",
"license": "MIT",
"sideEffects": false,
"main": "../../dist/NotificationServicesPushController/types/index.js",
"types": "../../dist/types/NotificationServicesPushController/types/index.d.ts"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"name": "@metamask/notification-services-controller",
"version": "1.0.0",
"description": "",
"license": "MIT",
"sideEffects": false,
"main": "../../dist/NotificationServicesPushController/utils/index.js",
"types": "../../dist/types/NotificationServicesPushController/utils/index.d.ts"
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import Controller from './NotificationServicesController';

const NotificationServicesController = Controller;
export { Controller };
export default NotificationServicesController;
export * from './NotificationServicesController';
export * as Types from './types';
export * as Mocks from './__fixtures__';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import Controller from './NotificationServicesPushController';

const NotificationServicesPushController = Controller;
export { Controller };
export default NotificationServicesPushController;
export * from './NotificationServicesPushController';
export * as Types from './types';
export * as Utils from './utils';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
import { Mocks, Processors } from '../../NotificationServicesController';
import type { TranslationKeys } from './get-notification-message';
import { createOnChainPushNotificationMessage } from './get-notification-message';

const {
import { Processors } from '../../NotificationServicesController';
import {
createMockNotificationERC1155Received,
createMockNotificationERC1155Sent,
createMockNotificationERC20Received,
Expand All @@ -18,7 +15,9 @@ const {
createMockNotificationMetaMaskSwapsCompleted,
createMockNotificationRocketPoolStakeCompleted,
createMockNotificationRocketPoolUnStakeCompleted,
} = Mocks;
} from '../../NotificationServicesController/__fixtures__';
import type { TranslationKeys } from './get-notification-message';
import { createOnChainPushNotificationMessage } from './get-notification-message';

const mockTranslations: TranslationKeys = {
pushPlatformNotificationsFundsSentTitle: () => 'Funds sent',
Expand Down
9 changes: 9 additions & 0 deletions packages/profile-sync-controller/auth/mocks/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"name": "@metamask/profile-sync-controller",
"version": "1.0.0",
"description": "",
"license": "MIT",
"sideEffects": false,
"main": "../../dist/controllers/authentication/__fixtures__/index.js",
"types": "../../dist/types/controllers/authentication/__fixtures__/index.d.ts"
}
9 changes: 9 additions & 0 deletions packages/profile-sync-controller/auth/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"name": "@metamask/profile-sync-controller",
"version": "1.0.0",
"description": "",
"license": "MIT",
"sideEffects": false,
"main": "../dist/controllers/authentication/index.js",
"types": "../dist/types/controllers/authentication/index.d.ts"
}
29 changes: 28 additions & 1 deletion packages/profile-sync-controller/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,39 @@
"require": "./dist/index.js",
"types": "./dist/types/index.d.ts"
},
"./sdk": {
"import": "./dist/sdk/index.mjs",
"require": "./dist/sdk/index.js",
"types": "./dist/types/sdk/index.d.ts"
},
"./auth": {
"import": "./dist/controllers/authentication/index.mjs",
"require": "./dist/controllers/authentication/index.js",
"types": "./dist/types/controllers/authentication/index.d.ts"
},
"./auth/mocks": {
"import": "./dist/controllers/authentication/__fixtures__/index.mjs",
"require": "./dist/controllers/authentication/__fixtures__/index.js",
"types": "./dist/types/controllers/authentication/__fixtures__/index.d.ts"
},
"./user-storage": {
"import": "./dist/controllers/user-storage/index.mjs",
"require": "./dist/controllers/user-storage/index.js",
"types": "./dist/types/controllers/user-storage/index.d.ts"
},
"./user-storage/mocks": {
"import": "./dist/controllers/user-storage/__fixtures__/index.mjs",
"require": "./dist/controllers/user-storage/__fixtures__/index.js",
"types": "./dist/types/controllers/user-storage/__fixtures__/index.d.ts"
},
"./package.json": "./package.json"
},
"main": "./dist/index.js",
"types": "./dist/types/index.d.ts",
"files": [
"dist/"
"dist/",
"auth/",
"user-storage/"
],
"scripts": {
"build": "tsup --config ../../tsup.config.ts --tsconfig ./tsconfig.build.json --clean",
Expand Down
9 changes: 9 additions & 0 deletions packages/profile-sync-controller/sdk/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"name": "@metamask/profile-sync-controller",
"version": "1.0.0",
"description": "",
"license": "MIT",
"sideEffects": false,
"main": "../dist/sdk/index.js",
"types": "../dist/types/sdk/index.d.ts"
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import Controller from './AuthenticationController';

const AuthenticationController = Controller;
export { Controller };
export default AuthenticationController;
export * from './AuthenticationController';
export * as Mocks from './__fixtures__';
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Env, Platform, getEnvUrls, getOidcClientId } from '../../sdk';
import { Env, Platform, getEnvUrls, getOidcClientId } from '../../sdk/env';

const ENV_URLS = getEnvUrls(Env.PRD);

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import Controller from './UserStorageController';

const UserStorageController = Controller;
export { Controller };
export default UserStorageController;
export * from './UserStorageController';
export * from './encryption';
export * as Mocks from './__fixtures__';
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import log from 'loglevel';

import { Env, getEnvUrls } from '../../sdk';
import { Env, getEnvUrls } from '../../sdk/env';
import encryption from './encryption';
import type {
UserStoragePathWithFeatureAndKey,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"name": "@metamask/profile-sync-controller",
"version": "1.0.0",
"description": "",
"license": "MIT",
"sideEffects": false,
"main": "../../dist/controllers/user-storage/__fixtures__/index.js",
"types": "../../dist/types/controllers/user-storage/__fixtures__/index.d.ts"
}
9 changes: 9 additions & 0 deletions packages/profile-sync-controller/user-storage/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"name": "@metamask/profile-sync-controller",
"version": "1.0.0",
"description": "",
"license": "MIT",
"sideEffects": false,
"main": "../dist/controllers/user-storage/index.js",
"types": "../dist/types/controllers/user-storage/index.d.ts"
}
Loading