This repository was archived by the owner on Feb 12, 2024. It is now read-only.
File tree 7 files changed +22
-9
lines changed
7 files changed +22
-9
lines changed Original file line number Diff line number Diff line change @@ -10,7 +10,7 @@ const preloadNode = MockPreloadNode.createNode()
10
10
const echoServer = EchoServer . createServer ( )
11
11
12
12
module . exports = {
13
- bundlesize : { maxSize : '685kB ' } ,
13
+ bundlesize : { maxSize : '689kB ' } ,
14
14
webpack : {
15
15
resolve : {
16
16
mainFields : [ 'browser' , 'main' ] ,
Original file line number Diff line number Diff line change @@ -283,6 +283,18 @@ Example:
283
283
const node = await IPFS .create ({ repo: ' /var/ipfs/data' })
284
284
```
285
285
286
+ ##### ` options.repoAutoMigrate `
287
+
288
+ | Type | Default |
289
+ | ------| ---------|
290
+ | boolean | ` true ` |
291
+
292
+ ` js-ipfs ` comes bundled with tool that automatically migrate the version of your IPFS repository when new version is available.
293
+
294
+ ** For tools that build on top of ` js-ipfs ` and run mainly in the browser environment, be aware that disabling automatic
295
+ migrations leaves the user with no way to run the migrations because there is no CLI in the browser. In such
296
+ a case, you should provide a way to trigger migrations manually.**
297
+
286
298
##### ` options.init `
287
299
288
300
| Type | Default |
Original file line number Diff line number Diff line change 103
103
"ipfs-http-response" : " ~0.3.1" ,
104
104
"ipfs-mfs" : " ^0.13.0" ,
105
105
"ipfs-multipart" : " ^0.2.0" ,
106
- "ipfs-repo" : " ^0.28.0 " ,
106
+ "ipfs-repo" : " github:ipfs/js-ipfs-repo#feat/repo-migrations " ,
107
107
"ipfs-unixfs" : " ~0.1.16" ,
108
108
"ipfs-unixfs-exporter" : " ^0.38.0" ,
109
109
"ipfs-unixfs-importer" : " ^0.40.0" ,
Original file line number Diff line number Diff line change @@ -28,6 +28,7 @@ const s = superstruct({
28
28
const configSchema = s ( {
29
29
repo : optional ( s ( 'object|string' ) ) ,
30
30
repoOwner : 'boolean?' ,
31
+ repoAutoMigrate : 'boolean?' ,
31
32
preload : s ( {
32
33
enabled : 'boolean?' ,
33
34
addresses : optional ( s ( [ 'multiaddr' ] ) ) ,
Original file line number Diff line number Diff line change @@ -70,7 +70,7 @@ class IPFS extends EventEmitter {
70
70
71
71
if ( typeof options . repo === 'string' ||
72
72
options . repo === undefined ) {
73
- this . _repo = defaultRepo ( options . repo )
73
+ this . _repo = defaultRepo ( options )
74
74
} else {
75
75
this . _repo = options . repo
76
76
}
Original file line number Diff line number Diff line change 2
2
3
3
const IPFSRepo = require ( 'ipfs-repo' )
4
4
5
- module . exports = ( dir ) => {
6
- const repoPath = dir || 'ipfs'
7
- return new IPFSRepo ( repoPath )
5
+ module . exports = ( options ) => {
6
+ const repoPath = options . repo || 'ipfs'
7
+ return new IPFSRepo ( repoPath , { autoMigrate : options . repoAutoMigrate } )
8
8
}
Original file line number Diff line number Diff line change @@ -4,8 +4,8 @@ const os = require('os')
4
4
const IPFSRepo = require ( 'ipfs-repo' )
5
5
const path = require ( 'path' )
6
6
7
- module . exports = ( dir ) => {
8
- const repoPath = dir || path . join ( os . homedir ( ) , '.jsipfs' )
7
+ module . exports = ( options ) => {
8
+ const repoPath = options . repo || path . join ( os . homedir ( ) , '.jsipfs' )
9
9
10
- return new IPFSRepo ( repoPath )
10
+ return new IPFSRepo ( repoPath , { autoMigrate : options . repoAutoMigrate } )
11
11
}
You can’t perform that action at this time.
0 commit comments