This repository was archived by the owner on Feb 12, 2024. It is now read-only.
File tree Expand file tree Collapse file tree 7 files changed +22
-9
lines changed Expand file tree Collapse file tree 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()
1010const echoServer = EchoServer . createServer ( )
1111
1212module . exports = {
13- bundlesize : { maxSize : '685kB ' } ,
13+ bundlesize : { maxSize : '689kB ' } ,
1414 webpack : {
1515 resolve : {
1616 mainFields : [ 'browser' , 'main' ] ,
Original file line number Diff line number Diff line change @@ -283,6 +283,18 @@ Example:
283283const node = await IPFS .create ({ repo: ' /var/ipfs/data' })
284284```
285285
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+
286298##### ` options.init `
287299
288300| Type | Default |
Original file line number Diff line number Diff line change 103103 "ipfs-http-response" : " ~0.3.1" ,
104104 "ipfs-mfs" : " ^0.13.0" ,
105105 "ipfs-multipart" : " ^0.2.0" ,
106- "ipfs-repo" : " ^0.28.0 " ,
106+ "ipfs-repo" : " github:ipfs/js-ipfs-repo#feat/repo-migrations " ,
107107 "ipfs-unixfs" : " ~0.1.16" ,
108108 "ipfs-unixfs-exporter" : " ^0.38.0" ,
109109 "ipfs-unixfs-importer" : " ^0.40.0" ,
Original file line number Diff line number Diff line change @@ -28,6 +28,7 @@ const s = superstruct({
2828const configSchema = s ( {
2929 repo : optional ( s ( 'object|string' ) ) ,
3030 repoOwner : 'boolean?' ,
31+ repoAutoMigrate : 'boolean?' ,
3132 preload : s ( {
3233 enabled : 'boolean?' ,
3334 addresses : optional ( s ( [ 'multiaddr' ] ) ) ,
Original file line number Diff line number Diff line change @@ -70,7 +70,7 @@ class IPFS extends EventEmitter {
7070
7171 if ( typeof options . repo === 'string' ||
7272 options . repo === undefined ) {
73- this . _repo = defaultRepo ( options . repo )
73+ this . _repo = defaultRepo ( options )
7474 } else {
7575 this . _repo = options . repo
7676 }
Original file line number Diff line number Diff line change 22
33const IPFSRepo = require ( 'ipfs-repo' )
44
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 } )
88}
Original file line number Diff line number Diff line change @@ -4,8 +4,8 @@ const os = require('os')
44const IPFSRepo = require ( 'ipfs-repo' )
55const path = require ( 'path' )
66
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' )
99
10- return new IPFSRepo ( repoPath )
10+ return new IPFSRepo ( repoPath , { autoMigrate : options . repoAutoMigrate } )
1111}
You can’t perform that action at this time.
0 commit comments