Skip to content

Commit

Permalink
chore: add migration guides templates
Browse files Browse the repository at this point in the history
- This adds migration guides templates for all packages to document all
the necessary changes for the migration to the new version.

- Fixed the names of test files `getPreferences` and `putPreferences`
to `getUserPreferences` and `putUserPreferences` respectively.

- Added missing exports to action factories.

- Minor internal repository fixes.
  • Loading branch information
Bruno Alexandre Oliveira authored and boliveira committed Jun 6, 2023
1 parent 123ed46 commit e24c618
Show file tree
Hide file tree
Showing 34 changed files with 3,051 additions and 62 deletions.
13 changes: 13 additions & 0 deletions MIGRATION.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Migrating from @farfetch/blackout-core

The `@farfetch/blackout-core` package has been split in 3 different packages now: `@farfetch/blackout-client`, `@farfetch/blackout-analytics` and `@farfetch/blackout-redux`.

If you were using client modules from `@farfetch/blackout-core/*/client`, check the [migration file for @farfetch/blackout-client](packages/client/MIGRATION.md) to know how you can upgrade to the `@farfetch/blackout-client` package and use its corresponding modules.

If you were using analytics modules from `@farfetch/blackout-core/analytics`, check the [migration file for @farfetch/blackout-analytics](packages/analytics/MIGRATION.md) to know how you can upgrade to the `@farfetch/blackout-analytics` package and use its corresponding modules.

If you were using redux modules from `@farfetch/blackout-core/*/redux` or using some utils like `buildListingHash`, check the [migration file for @farfetch/blackout-redux](packages/redux/MIGRATION.md) to know how you can upgrade to the `@farfetch/blackout-redux` package and use its corresponding modules.

# Migrating from @farfetch/blackout-react 0.X

- [Migration file for @farfetch/blackout-react](packages/react/MIGRATION.md)
74 changes: 74 additions & 0 deletions packages/analytics/MIGRATION.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
This guide will help you migrate `@farfetch/blackout-analytics` to the latest version.

# Table of Contents

- [Migrating from @farfetch/blackout-core](#migrating-from-farfetchblackout-core)

- [Analytics](#analytics)

## Migrating from @farfetch/blackout-core

If you are migrating from `@farfetch/blackout-core`, there are a few setup steps that you will need to follow first which are detailed below. Later in this guide, there are sections that contain the migration steps for each specific area so you can find the changes you need more easily.

**IMPORTANT**

This package is not meant to be used directly. If all you want is to use analytics in your web / react native application to track events/pageviews/screenviews with integrations please use the [`@farfetch/blackout-react`](../react/README.md) and [`@farfetch/blackout-react-analytics`](https://github.com/Farfetch/blackout-react-native) packages respectively. If you are migrating from `@farfetch/blackout-react` v0 to v1 check the migration steps from [here](../react/MIGRATION.md#migrating-from-react-v0-to-v1).

### Install `@farfetch/blackout-analytics` and its peer dependencies

You will need to install the `@farfetch/blackout-analytics` package to use the modules you would import from `@farfetch/blackout-core/analytics`.

Follow the [installation](README.md#installation) instructions to install the package and its peer dependencies.

### Change bundler/jest settings to support ESM module format

All modules provided by the new `@farfetch/blackout-analytics` package are in ESM-only format now. Check the [configuration](README.md#configuration) section to know what changes you might need to do to use this module format in your applications.

### Remove any alias to `src` folders

The packages do not include the `src` folder under its root anymore so any alias configurations you might have in your bundler/jest/typescript configurations are not needed now as they include the areas' folders directly under its root.

### Use a typescript-enabled IDE

The `@farfetch/blackout-analytics` package is entirely authored in typescript and ships with types that when used in conjunction with a typescript-enabled IDE (like VSCode) can help with the migration by suggesting imports and giving errors for invalid usage of the modules. Make sure you use an IDE that supports typescript to make the migration process easier.

### Change import style

The package supports 2 import styles: You can import everything from the root of the package or you can import directly from a file. We recommend using imports from the root of the package since we do not guarantee that imports directly to a file will be kept in future versions.

```js
// Previously:
import Analytics from '@farfetch/blackout-core/analytics';

// Change to:
import Analytics from '@farfetch/blackout-analytics';

// This also works but should be used only when it is not possible to import from the root of the package:
import Analytics from '@farfetch/blackout-analytics/Analytics';
```

Tip: Use VSCode's import suggestions to help you import the modules you need correctly.

### Analytics

#### Renamed exports

The following table contains the exports that were renamed and their new names you must use now.

| Old name | New name |
| ------------------------- | ------------------------ |
| eventTypes | EventType |
| fromParameterTypes | FromParameterType |
| interactionTypes | InteractionType |
| loginMethodParameterTypes | LoginMethodParameterType |
| pageTypes | PageType |
| platformTypes | PlatformType |
| trackTypes | TrackType |

#### Removed exports

The following table contains the exports that were removed and the alternatives you can use, if any.

| Removed export | Notes |
| ----------------------------- | ---------------------------- |
| integrations.AnalyticsService | Removed as it was deprecated |
17 changes: 13 additions & 4 deletions packages/analytics/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,21 @@ yarn add @farfetch/blackout-analytics
npm i @farfetch/blackout-analytics
```

### Peer dependencies

Make sure that you have installed the correct peer dependencies of this package:

- [`@farfetch/blackout-client`](https://www.npmjs.com/package/@farfetch/blackout-client)
- [`lodash-es`](https://www.npmjs.com/package/lodash-es)
**yarn**

```sh
yarn add @farfetch/blackout-client lodash-es
```

**npm**

```sh
npm i add @farfetch/blackout-client lodash-es
```

Note: You might also need to install the peer dependencies of [@farfetch/blackout-client](../client/README.md#installation) package if you do not have them installed yet.

### Configuration

Expand Down
Loading

0 comments on commit e24c618

Please sign in to comment.