Skip to content
This repository was archived by the owner on Oct 1, 2021. It is now read-only.

Commit f5f3ddf

Browse files
committed
Removing package.json mentions and discussing migration's dependencies
1 parent 54c7cbb commit f5f3ddf

File tree

1 file changed

+22
-10
lines changed

1 file changed

+22
-10
lines changed

README.md

Lines changed: 22 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -94,19 +94,18 @@ a case, you should provide a way how to trigger migrations manually.**
9494
Migrations are one of those things that can be extremely painful on users. At the end of the day, we want users never to have to think about it. The process should be:
9595

9696
- SAFE. No data lost. Ever.
97-
- Revertible. Tools must implement forward and backward migrations.
98-
- Frozen. After the tool is written, all code must be frozen and vendored.
97+
- Revertible. Tools must implement forward and backward (if possible) migrations.
98+
- Tests. Migrations have to be well tested.
9999
- To Spec. The tools must conform to the spec.
100100

101101
#### Architecture of migrations
102102

103-
All migrations are placed in `/migrations` folder. Each folder there represents one migration that behaves as stand-alone
104-
package that has its own `package.json` file that states migration's dependencies, has its own tests and follows migration
105-
API.
103+
All migrations are placed in `/migrations` folder. Each folder there represents one migration that follows migration
104+
API.
106105

107106
All migrations are collected in `/migrations/index.js`, which should not be edited manually is it is regenerated on
108107
every run of `jsipfs-migrations add` (or the manual changes should follow same style of modifications).
109-
The order of migrations is important and the migrations have to be sorted in the growing order.
108+
**The order of migrations is important and the migrations have to be sorted in the growing order**.
110109

111110
Each migration has to follow this API. It has to export object in its `index.js` that has following properties:
112111

@@ -164,11 +163,24 @@ write the rest of migration!
164163
The `node_modules` of the migration should be committed to the repo to ensure that the dependencies are resolved even in
165164
far future, when the package might be removed from registry.
166165

166+
#### Migration's dependencies
167+
168+
Size of `js-ipfs`'s bundle is crucial for distribution in browser environment, hence dependency management of all related
169+
packages is important.
170+
171+
If migration need to depend on some package, this dependency should be declared in the root's `package.json`. Author
172+
of migrations should be thoughtful about adding dependencies that would significantly increase the size of the final bundle.
173+
174+
Most of the migration's dependencies will most likely overlap with `js-ipfs`'s dependencies and hence should not introduce
175+
any significant overhead, but it requires to keep the versions of these dependencies in sync with `js-ipfs`. For this
176+
reason migrations should be well tested to ensure correct behaviour over its dependencies updates. It might happen
177+
that update of some dependency could introduce breaking change, in such a case the next steps should be discussed with broader
178+
audience.
179+
167180
#### Integration with js-ipfs
168181

169-
When new migration is created, the repo version in [`js-ipfs-repo`](https://github.com/ipfs/js-ipfs-repo) should be updated with the new version.
170-
After releasing the updated version of `js-ipfs-repo` this version should be propagated into `js-ipfs` together with
171-
updated version of this package.
182+
When new migration is created, the repo version in [`js-ipfs-repo`](https://github.com/ipfs/js-ipfs-repo) should be updated with the new version,
183+
together with updated version of this package. And afterwards propagate the updated version to `js-ipfs`.
172184

173185
#### Tests
174186

@@ -179,7 +191,7 @@ If migration affects working of any of the following functionality, it has to pr
179191
* `/src/repo/lock.js`:`lock()` - locking repository that uses file system
180192
* `/src/repo/lock-memory.js`:`lock()` - locking repository that uses memory
181193

182-
Migration has to have a test coverage. Tests for migration should be placed in `/test/migrations/` folder. Most probably
194+
Every mgration has to have a test coverage. Tests for migration should be placed in `/test/migrations/` folder. Most probably
183195
you will have to plug the tests into `browser.js`/`node.js` if they require specific bootstrap on each platform.
184196

185197
#### Empty migrations

0 commit comments

Comments
 (0)