From 12b8ac89a6b643933d3440b2b42f9f5f142d0d35 Mon Sep 17 00:00:00 2001 From: Alex Potsides Date: Wed, 19 Oct 2022 15:06:30 +0100 Subject: [PATCH] fix: move migrations to published folder (#427) In order to simplify the config, move the migrations into a folder that's already published to npm. --- packages/ipfs-repo-migrations/README.md | 10 ++++---- packages/ipfs-repo-migrations/package.json | 7 +++++- packages/ipfs-repo-migrations/src/index.js | 2 +- .../{ => src}/migrations/index.js | 2 +- .../migrations/migration-10/index.js | 8 +++--- .../migrations/migration-11/index.js | 10 ++++---- .../migrations/migration-12/index.js | 25 +++++++++---------- .../migration-12/pb/address-book.d.ts | 0 .../migration-12/pb/address-book.js | 0 .../migration-12/pb/address-book.proto | 0 .../migrations/migration-12/pb/envelope.d.ts | 0 .../migrations/migration-12/pb/envelope.js | 0 .../migrations/migration-12/pb/envelope.proto | 0 .../migration-12/pb/peer-record.d.ts | 0 .../migrations/migration-12/pb/peer-record.js | 0 .../migration-12/pb/peer-record.proto | 0 .../migrations/migration-12/pb/peer.d.ts | 0 .../migrations/migration-12/pb/peer.js | 0 .../migrations/migration-12/pb/peer.proto | 0 .../migration-12/pb/proto-book.d.ts | 0 .../migrations/migration-12/pb/proto-book.js | 0 .../migration-12/pb/proto-book.proto | 0 .../{ => src}/migrations/migration-8/index.js | 4 +-- .../{ => src}/migrations/migration-9/index.js | 6 ++--- .../migrations/migration-9/pin-set.js | 0 .../{ => src}/migrations/migration-9/pin.d.ts | 0 .../{ => src}/migrations/migration-9/pin.js | 0 .../migrations/migration-9/pin.proto | 0 .../{ => src}/migrations/migration-9/utils.js | 2 +- .../test/migrations/migration-10-test.js | 2 +- .../test/migrations/migration-11-test.js | 2 +- .../test/migrations/migration-12-test.js | 2 +- .../test/migrations/migration-8-test.js | 2 +- .../test/migrations/migration-9-test.js | 4 +-- packages/ipfs-repo-migrations/tsconfig.json | 9 +++---- 35 files changed, 50 insertions(+), 47 deletions(-) rename packages/ipfs-repo-migrations/{ => src}/migrations/index.js (95%) rename packages/ipfs-repo-migrations/{ => src}/migrations/migration-10/index.js (95%) rename packages/ipfs-repo-migrations/{ => src}/migrations/migration-11/index.js (81%) rename packages/ipfs-repo-migrations/{ => src}/migrations/migration-12/index.js (90%) rename packages/ipfs-repo-migrations/{ => src}/migrations/migration-12/pb/address-book.d.ts (100%) rename packages/ipfs-repo-migrations/{ => src}/migrations/migration-12/pb/address-book.js (100%) rename packages/ipfs-repo-migrations/{ => src}/migrations/migration-12/pb/address-book.proto (100%) rename packages/ipfs-repo-migrations/{ => src}/migrations/migration-12/pb/envelope.d.ts (100%) rename packages/ipfs-repo-migrations/{ => src}/migrations/migration-12/pb/envelope.js (100%) rename packages/ipfs-repo-migrations/{ => src}/migrations/migration-12/pb/envelope.proto (100%) rename packages/ipfs-repo-migrations/{ => src}/migrations/migration-12/pb/peer-record.d.ts (100%) rename packages/ipfs-repo-migrations/{ => src}/migrations/migration-12/pb/peer-record.js (100%) rename packages/ipfs-repo-migrations/{ => src}/migrations/migration-12/pb/peer-record.proto (100%) rename packages/ipfs-repo-migrations/{ => src}/migrations/migration-12/pb/peer.d.ts (100%) rename packages/ipfs-repo-migrations/{ => src}/migrations/migration-12/pb/peer.js (100%) rename packages/ipfs-repo-migrations/{ => src}/migrations/migration-12/pb/peer.proto (100%) rename packages/ipfs-repo-migrations/{ => src}/migrations/migration-12/pb/proto-book.d.ts (100%) rename packages/ipfs-repo-migrations/{ => src}/migrations/migration-12/pb/proto-book.js (100%) rename packages/ipfs-repo-migrations/{ => src}/migrations/migration-12/pb/proto-book.proto (100%) rename packages/ipfs-repo-migrations/{ => src}/migrations/migration-8/index.js (96%) rename packages/ipfs-repo-migrations/{ => src}/migrations/migration-9/index.js (95%) rename packages/ipfs-repo-migrations/{ => src}/migrations/migration-9/pin-set.js (100%) rename packages/ipfs-repo-migrations/{ => src}/migrations/migration-9/pin.d.ts (100%) rename packages/ipfs-repo-migrations/{ => src}/migrations/migration-9/pin.js (100%) rename packages/ipfs-repo-migrations/{ => src}/migrations/migration-9/pin.proto (100%) rename packages/ipfs-repo-migrations/{ => src}/migrations/migration-9/utils.js (94%) diff --git a/packages/ipfs-repo-migrations/README.md b/packages/ipfs-repo-migrations/README.md index 4d1a94a4..ed9222c1 100644 --- a/packages/ipfs-repo-migrations/README.md +++ b/packages/ipfs-repo-migrations/README.md @@ -69,13 +69,13 @@ This framework: ### Use in Node.js ```js -const migrations from 'ipfs-repo-migrations') +import migrations from 'ipfs-repo-migrations' ``` ### Use in a browser with browserify, webpack or any other bundler ```js -const migrations from 'ipfs-repo-migrations') +import migrations from 'ipfs-repo-migrations' ``` ## Usage @@ -83,7 +83,7 @@ const migrations from 'ipfs-repo-migrations') Example: ```js -const migrations from 'ipfs-repo-migrations') +import migrations from 'ipfs-repo-migrations' const repoPath = 'some/repo/path' const currentRepoVersion = 7 @@ -161,10 +161,10 @@ be run again. ### Architecture of a migration -All migrations are placed in the `/migrations` folder. Each folder there represents one migration that follows the migration +All migrations are placed in the `/src/migrations` folder. Each folder there represents one migration that follows the migration API. -All migrations are collected in `/migrations/index.js`, which should not be edited manually. +All migrations are collected in `/src/migrations/index.js`, which should not be edited manually. **The order of migrations is important and migrations must be sorted in ascending order**. diff --git a/packages/ipfs-repo-migrations/package.json b/packages/ipfs-repo-migrations/package.json index 24dae4f2..259657c7 100644 --- a/packages/ipfs-repo-migrations/package.json +++ b/packages/ipfs-repo-migrations/package.json @@ -54,7 +54,12 @@ "extends": "ipfs", "parserOptions": { "sourceType": "module" - } + }, + "ignorePatterns": [ + "src/migrations/migration-9/pin.js", + "src/migrations/migration-9/pin.d.ts", + "src/migrations/migration-12/pb/*" + ] }, "release": { "branches": [ diff --git a/packages/ipfs-repo-migrations/src/index.js b/packages/ipfs-repo-migrations/src/index.js index 899232fb..c2620ec5 100644 --- a/packages/ipfs-repo-migrations/src/index.js +++ b/packages/ipfs-repo-migrations/src/index.js @@ -1,6 +1,6 @@ /* eslint complexity: ["error", 28] */ -import defaultMigrations from '../migrations/index.js' +import defaultMigrations from './migrations/index.js' import * as repoVersion from './repo/version.js' import * as Errors from './errors.js' import { wrapBackends } from './utils.js' diff --git a/packages/ipfs-repo-migrations/migrations/index.js b/packages/ipfs-repo-migrations/src/migrations/index.js similarity index 95% rename from packages/ipfs-repo-migrations/migrations/index.js rename to packages/ipfs-repo-migrations/src/migrations/index.js index fb92371c..5213208a 100644 --- a/packages/ipfs-repo-migrations/migrations/index.js +++ b/packages/ipfs-repo-migrations/src/migrations/index.js @@ -5,7 +5,7 @@ import { migration as migration11 } from './migration-11/index.js' import { migration as migration12 } from './migration-12/index.js' /** - * @type {import('../src/types').Migration} + * @type {import('../types').Migration} */ const emptyMigration = { description: 'Empty migration.', diff --git a/packages/ipfs-repo-migrations/migrations/migration-10/index.js b/packages/ipfs-repo-migrations/src/migrations/migration-10/index.js similarity index 95% rename from packages/ipfs-repo-migrations/migrations/migration-10/index.js rename to packages/ipfs-repo-migrations/src/migrations/migration-10/index.js index 97a24a79..ceef20dd 100644 --- a/packages/ipfs-repo-migrations/migrations/migration-10/index.js +++ b/packages/ipfs-repo-migrations/src/migrations/migration-10/index.js @@ -1,13 +1,13 @@ -import { findLevelJs } from '../../src/utils.js' +import { findLevelJs } from '../../utils.js' import { fromString } from 'uint8arrays/from-string' import { toString } from 'uint8arrays/to-string' /** - * @typedef {import('../../src/types').Migration} Migration + * @typedef {import('../../types').Migration} Migration * @typedef {import('interface-datastore').Datastore} Datastore * @typedef {import('interface-blockstore').Blockstore} Blockstore - * @typedef {import('../../src/types').MigrationProgressCallback} MigrationProgressCallback + * @typedef {import('../../types').MigrationProgressCallback} MigrationProgressCallback * * @typedef {{ type: 'del', key: string | Uint8Array } | { type: 'put', key: string | Uint8Array, value: Uint8Array }} Operation * @typedef {function (string, Uint8Array): Operation[]} UpgradeFunction @@ -87,7 +87,7 @@ function unwrap (store) { } /** - * @param {import('../../src/types').Backends} backends + * @param {import('../../types').Backends} backends * @param {MigrationProgressCallback} onProgress * @param {*} fn */ diff --git a/packages/ipfs-repo-migrations/migrations/migration-11/index.js b/packages/ipfs-repo-migrations/src/migrations/migration-11/index.js similarity index 81% rename from packages/ipfs-repo-migrations/migrations/migration-11/index.js rename to packages/ipfs-repo-migrations/src/migrations/migration-11/index.js index 60216257..76b749ea 100644 --- a/packages/ipfs-repo-migrations/migrations/migration-11/index.js +++ b/packages/ipfs-repo-migrations/src/migrations/migration-11/index.js @@ -4,8 +4,8 @@ import { Key } from 'interface-datastore/key' const MFS_ROOT_KEY = new Key('/local/filesroot') /** - * @param {import('../../src/types').Backends} backends - * @param {import('../../src/types').MigrationProgressCallback} onProgress + * @param {import('../../types').Backends} backends + * @param {import('../../types').MigrationProgressCallback} onProgress */ async function storeMfsRootInDatastore (backends, onProgress = () => {}) { onProgress(100, 'Migrating MFS root to repo datastore') @@ -26,8 +26,8 @@ async function storeMfsRootInDatastore (backends, onProgress = () => {}) { } /** - * @param {import('../../src/types').Backends} backends - * @param {import('../../src/types').MigrationProgressCallback} onProgress + * @param {import('../../types').Backends} backends + * @param {import('../../types').MigrationProgressCallback} onProgress */ async function storeMfsRootInRoot (backends, onProgress = () => {}) { onProgress(100, 'Migrating MFS root to repo root datastore') @@ -47,7 +47,7 @@ async function storeMfsRootInRoot (backends, onProgress = () => {}) { onProgress(100, 'Stored MFS root in repo root datastore') } -/** @type {import('../../src/types').Migration} */ +/** @type {import('../../types').Migration} */ export const migration = { version: 11, description: 'Store mfs root in the datastore', diff --git a/packages/ipfs-repo-migrations/migrations/migration-12/index.js b/packages/ipfs-repo-migrations/src/migrations/migration-12/index.js similarity index 90% rename from packages/ipfs-repo-migrations/migrations/migration-12/index.js rename to packages/ipfs-repo-migrations/src/migrations/migration-12/index.js index 58fb848a..8e4fb8fe 100644 --- a/packages/ipfs-repo-migrations/migrations/migration-12/index.js +++ b/packages/ipfs-repo-migrations/src/migrations/migration-12/index.js @@ -1,9 +1,4 @@ -import $protobuf from "protobufjs/minimal.js" - -// @ts-expect-error Explicitly disable long.js support -$protobuf.util.Long = undefined -$protobuf.configure() - +import $protobuf from 'protobufjs/minimal.js' import { Key } from 'interface-datastore/key' import { Protocols } from './pb/proto-book.js' import { Addresses } from './pb/address-book.js' @@ -12,9 +7,13 @@ import { Envelope } from './pb/envelope.js' import { PeerRecord } from './pb/peer-record.js' import { multiaddr } from '@multiformats/multiaddr' +// @ts-expect-error Explicitly disable long.js support +$protobuf.util.Long = undefined +$protobuf.configure() + /** - * @param {import('../../src/types').Backends} backends - * @param {import('../../src/types').MigrationProgressCallback} onProgress + * @param {import('../../types').Backends} backends + * @param {import('../../types').MigrationProgressCallback} onProgress */ async function storePeerUnderSingleDatastoreKey (backends, onProgress = () => {}) { onProgress(0, 'Storing each peerstore key under a single datastore key') @@ -31,7 +30,7 @@ async function storePeerUnderSingleDatastoreKey (backends, onProgress = () => {} })) { keys.push(key) const keyStr = key.toString() - const [_, prefix, type, peerId, metadataKey] = keyStr.split('/') + const [, prefix, type, peerId, metadataKey] = keyStr.split('/') if (prefix !== 'peers') { continue @@ -95,8 +94,8 @@ async function storePeerUnderSingleDatastoreKey (backends, onProgress = () => {} } /** - * @param {import('../../src/types').Backends} backends - * @param {import('../../src/types').MigrationProgressCallback} onProgress + * @param {import('../../types').Backends} backends + * @param {import('../../types').MigrationProgressCallback} onProgress */ async function storePeerUnderMultipleDatastoreKeys (backends, onProgress = () => {}) { onProgress(0, 'Storing each peerstore key under a multiple datastore keys') @@ -114,7 +113,7 @@ async function storePeerUnderMultipleDatastoreKeys (backends, onProgress = () => keys.push(key) const keyStr = key.toString() - const [_, _prefix, peerId] = keyStr.split('/') + const [, , peerId] = keyStr.split('/') peers[peerId] = Peer.decode(value) } @@ -170,7 +169,7 @@ async function storePeerUnderMultipleDatastoreKeys (backends, onProgress = () => onProgress(100, 'Stored each peerstore key under multiple datastore keys') } -/** @type {import('../../src/types').Migration} */ +/** @type {import('../../types').Migration} */ export const migration = { version: 12, description: 'Store each peerstore peer under a single datastore key', diff --git a/packages/ipfs-repo-migrations/migrations/migration-12/pb/address-book.d.ts b/packages/ipfs-repo-migrations/src/migrations/migration-12/pb/address-book.d.ts similarity index 100% rename from packages/ipfs-repo-migrations/migrations/migration-12/pb/address-book.d.ts rename to packages/ipfs-repo-migrations/src/migrations/migration-12/pb/address-book.d.ts diff --git a/packages/ipfs-repo-migrations/migrations/migration-12/pb/address-book.js b/packages/ipfs-repo-migrations/src/migrations/migration-12/pb/address-book.js similarity index 100% rename from packages/ipfs-repo-migrations/migrations/migration-12/pb/address-book.js rename to packages/ipfs-repo-migrations/src/migrations/migration-12/pb/address-book.js diff --git a/packages/ipfs-repo-migrations/migrations/migration-12/pb/address-book.proto b/packages/ipfs-repo-migrations/src/migrations/migration-12/pb/address-book.proto similarity index 100% rename from packages/ipfs-repo-migrations/migrations/migration-12/pb/address-book.proto rename to packages/ipfs-repo-migrations/src/migrations/migration-12/pb/address-book.proto diff --git a/packages/ipfs-repo-migrations/migrations/migration-12/pb/envelope.d.ts b/packages/ipfs-repo-migrations/src/migrations/migration-12/pb/envelope.d.ts similarity index 100% rename from packages/ipfs-repo-migrations/migrations/migration-12/pb/envelope.d.ts rename to packages/ipfs-repo-migrations/src/migrations/migration-12/pb/envelope.d.ts diff --git a/packages/ipfs-repo-migrations/migrations/migration-12/pb/envelope.js b/packages/ipfs-repo-migrations/src/migrations/migration-12/pb/envelope.js similarity index 100% rename from packages/ipfs-repo-migrations/migrations/migration-12/pb/envelope.js rename to packages/ipfs-repo-migrations/src/migrations/migration-12/pb/envelope.js diff --git a/packages/ipfs-repo-migrations/migrations/migration-12/pb/envelope.proto b/packages/ipfs-repo-migrations/src/migrations/migration-12/pb/envelope.proto similarity index 100% rename from packages/ipfs-repo-migrations/migrations/migration-12/pb/envelope.proto rename to packages/ipfs-repo-migrations/src/migrations/migration-12/pb/envelope.proto diff --git a/packages/ipfs-repo-migrations/migrations/migration-12/pb/peer-record.d.ts b/packages/ipfs-repo-migrations/src/migrations/migration-12/pb/peer-record.d.ts similarity index 100% rename from packages/ipfs-repo-migrations/migrations/migration-12/pb/peer-record.d.ts rename to packages/ipfs-repo-migrations/src/migrations/migration-12/pb/peer-record.d.ts diff --git a/packages/ipfs-repo-migrations/migrations/migration-12/pb/peer-record.js b/packages/ipfs-repo-migrations/src/migrations/migration-12/pb/peer-record.js similarity index 100% rename from packages/ipfs-repo-migrations/migrations/migration-12/pb/peer-record.js rename to packages/ipfs-repo-migrations/src/migrations/migration-12/pb/peer-record.js diff --git a/packages/ipfs-repo-migrations/migrations/migration-12/pb/peer-record.proto b/packages/ipfs-repo-migrations/src/migrations/migration-12/pb/peer-record.proto similarity index 100% rename from packages/ipfs-repo-migrations/migrations/migration-12/pb/peer-record.proto rename to packages/ipfs-repo-migrations/src/migrations/migration-12/pb/peer-record.proto diff --git a/packages/ipfs-repo-migrations/migrations/migration-12/pb/peer.d.ts b/packages/ipfs-repo-migrations/src/migrations/migration-12/pb/peer.d.ts similarity index 100% rename from packages/ipfs-repo-migrations/migrations/migration-12/pb/peer.d.ts rename to packages/ipfs-repo-migrations/src/migrations/migration-12/pb/peer.d.ts diff --git a/packages/ipfs-repo-migrations/migrations/migration-12/pb/peer.js b/packages/ipfs-repo-migrations/src/migrations/migration-12/pb/peer.js similarity index 100% rename from packages/ipfs-repo-migrations/migrations/migration-12/pb/peer.js rename to packages/ipfs-repo-migrations/src/migrations/migration-12/pb/peer.js diff --git a/packages/ipfs-repo-migrations/migrations/migration-12/pb/peer.proto b/packages/ipfs-repo-migrations/src/migrations/migration-12/pb/peer.proto similarity index 100% rename from packages/ipfs-repo-migrations/migrations/migration-12/pb/peer.proto rename to packages/ipfs-repo-migrations/src/migrations/migration-12/pb/peer.proto diff --git a/packages/ipfs-repo-migrations/migrations/migration-12/pb/proto-book.d.ts b/packages/ipfs-repo-migrations/src/migrations/migration-12/pb/proto-book.d.ts similarity index 100% rename from packages/ipfs-repo-migrations/migrations/migration-12/pb/proto-book.d.ts rename to packages/ipfs-repo-migrations/src/migrations/migration-12/pb/proto-book.d.ts diff --git a/packages/ipfs-repo-migrations/migrations/migration-12/pb/proto-book.js b/packages/ipfs-repo-migrations/src/migrations/migration-12/pb/proto-book.js similarity index 100% rename from packages/ipfs-repo-migrations/migrations/migration-12/pb/proto-book.js rename to packages/ipfs-repo-migrations/src/migrations/migration-12/pb/proto-book.js diff --git a/packages/ipfs-repo-migrations/migrations/migration-12/pb/proto-book.proto b/packages/ipfs-repo-migrations/src/migrations/migration-12/pb/proto-book.proto similarity index 100% rename from packages/ipfs-repo-migrations/migrations/migration-12/pb/proto-book.proto rename to packages/ipfs-repo-migrations/src/migrations/migration-12/pb/proto-book.proto diff --git a/packages/ipfs-repo-migrations/migrations/migration-8/index.js b/packages/ipfs-repo-migrations/src/migrations/migration-8/index.js similarity index 96% rename from packages/ipfs-repo-migrations/migrations/migration-8/index.js rename to packages/ipfs-repo-migrations/src/migrations/migration-8/index.js index ed9c0091..1cecaddb 100644 --- a/packages/ipfs-repo-migrations/migrations/migration-8/index.js +++ b/packages/ipfs-repo-migrations/src/migrations/migration-8/index.js @@ -10,7 +10,7 @@ import * as mhd from 'multiformats/hashes/digest' const log = debug('ipfs:repo:migrator:migration-8') /** - * @typedef {import('../../src/types').Migration} Migration + * @typedef {import('../../types').Migration} Migration * @typedef {import('interface-datastore').Datastore} Datastore */ @@ -64,7 +64,7 @@ function keyToCid (key) { } /** - * @param {import('../../src/types').Backends} backends + * @param {import('../../types').Backends} backends * @param {(percent: number, message: string) => void} onProgress * @param {(key: Key) => Key} keyFunction */ diff --git a/packages/ipfs-repo-migrations/migrations/migration-9/index.js b/packages/ipfs-repo-migrations/src/migrations/migration-9/index.js similarity index 95% rename from packages/ipfs-repo-migrations/migrations/migration-9/index.js rename to packages/ipfs-repo-migrations/src/migrations/migration-9/index.js index 4cee2d7b..82b459b2 100644 --- a/packages/ipfs-repo-migrations/migrations/migration-9/index.js +++ b/packages/ipfs-repo-migrations/src/migrations/migration-9/index.js @@ -10,8 +10,8 @@ import * as mhd from 'multiformats/hashes/digest' import { base32 } from 'multiformats/bases/base32' /** - * @typedef {import('../../src/types').Migration} Migration - * @typedef {import('../../src/types').MigrationProgressCallback} MigrationProgressCallback + * @typedef {import('../../types').Migration} Migration + * @typedef {import('../../types').MigrationProgressCallback} MigrationProgressCallback * @typedef {import('interface-datastore').Datastore} Datastore * @typedef {import('interface-blockstore').Blockstore} Blockstore * @typedef {import('multiformats/cid').Version} CIDVersion @@ -129,7 +129,7 @@ async function pinsToDAG (blockstore, datastore, pinstore, onProgress) { } /** - * @param {import('../../src/types').Backends} backends + * @param {import('../../types').Backends} backends * @param {MigrationProgressCallback} onProgress * @param {*} fn */ diff --git a/packages/ipfs-repo-migrations/migrations/migration-9/pin-set.js b/packages/ipfs-repo-migrations/src/migrations/migration-9/pin-set.js similarity index 100% rename from packages/ipfs-repo-migrations/migrations/migration-9/pin-set.js rename to packages/ipfs-repo-migrations/src/migrations/migration-9/pin-set.js diff --git a/packages/ipfs-repo-migrations/migrations/migration-9/pin.d.ts b/packages/ipfs-repo-migrations/src/migrations/migration-9/pin.d.ts similarity index 100% rename from packages/ipfs-repo-migrations/migrations/migration-9/pin.d.ts rename to packages/ipfs-repo-migrations/src/migrations/migration-9/pin.d.ts diff --git a/packages/ipfs-repo-migrations/migrations/migration-9/pin.js b/packages/ipfs-repo-migrations/src/migrations/migration-9/pin.js similarity index 100% rename from packages/ipfs-repo-migrations/migrations/migration-9/pin.js rename to packages/ipfs-repo-migrations/src/migrations/migration-9/pin.js diff --git a/packages/ipfs-repo-migrations/migrations/migration-9/pin.proto b/packages/ipfs-repo-migrations/src/migrations/migration-9/pin.proto similarity index 100% rename from packages/ipfs-repo-migrations/migrations/migration-9/pin.proto rename to packages/ipfs-repo-migrations/src/migrations/migration-9/pin.proto diff --git a/packages/ipfs-repo-migrations/migrations/migration-9/utils.js b/packages/ipfs-repo-migrations/src/migrations/migration-9/utils.js similarity index 94% rename from packages/ipfs-repo-migrations/migrations/migration-9/utils.js rename to packages/ipfs-repo-migrations/src/migrations/migration-9/utils.js index 92bb6e9d..27934fb7 100644 --- a/packages/ipfs-repo-migrations/migrations/migration-9/utils.js +++ b/packages/ipfs-repo-migrations/src/migrations/migration-9/utils.js @@ -16,6 +16,6 @@ export const PinTypes = { /** * @param {import('multiformats').CID} cid */ - export function cidToKey (cid) { +export function cidToKey (cid) { return new Key(`/${base32.encode(cid.multihash.bytes).toUpperCase().substring(1)}`) } diff --git a/packages/ipfs-repo-migrations/test/migrations/migration-10-test.js b/packages/ipfs-repo-migrations/test/migrations/migration-10-test.js index a7a5c847..d66b2d18 100644 --- a/packages/ipfs-repo-migrations/test/migrations/migration-10-test.js +++ b/packages/ipfs-repo-migrations/test/migrations/migration-10-test.js @@ -4,7 +4,7 @@ import { expect } from 'aegir/chai' import { CID } from 'multiformats/cid' import { BaseBlockstore } from 'blockstore-core/base' -import { migration } from '../../migrations/migration-10/index.js' +import { migration } from '../../src/migrations/migration-10/index.js' import { Key } from 'interface-datastore/key' import { fromString } from 'uint8arrays/from-string' import { equals } from 'uint8arrays/equals' diff --git a/packages/ipfs-repo-migrations/test/migrations/migration-11-test.js b/packages/ipfs-repo-migrations/test/migrations/migration-11-test.js index a8195f18..d2e9810c 100644 --- a/packages/ipfs-repo-migrations/test/migrations/migration-11-test.js +++ b/packages/ipfs-repo-migrations/test/migrations/migration-11-test.js @@ -3,7 +3,7 @@ import { expect } from 'aegir/chai' import { CID } from 'multiformats/cid' -import { migration } from '../../migrations/migration-11/index.js' +import { migration } from '../../src/migrations/migration-11/index.js' import { Key } from 'interface-datastore/key' const MFS_ROOT_KEY = new Key('/local/filesroot') diff --git a/packages/ipfs-repo-migrations/test/migrations/migration-12-test.js b/packages/ipfs-repo-migrations/test/migrations/migration-12-test.js index 6ce66041..0911217f 100644 --- a/packages/ipfs-repo-migrations/test/migrations/migration-12-test.js +++ b/packages/ipfs-repo-migrations/test/migrations/migration-12-test.js @@ -2,7 +2,7 @@ /* eslint-disable max-nested-callbacks */ import { expect } from 'aegir/chai' -import { migration } from '../../migrations/migration-12/index.js' +import { migration } from '../../src/migrations/migration-12/index.js' import { fromString as uint8ArrayFromString } from 'uint8arrays/from-string' import { toString as uint8ArrayToString } from 'uint8arrays/to-string' import { Key } from 'interface-datastore/key' diff --git a/packages/ipfs-repo-migrations/test/migrations/migration-8-test.js b/packages/ipfs-repo-migrations/test/migrations/migration-8-test.js index a3d5e86a..f03edc07 100644 --- a/packages/ipfs-repo-migrations/test/migrations/migration-8-test.js +++ b/packages/ipfs-repo-migrations/test/migrations/migration-8-test.js @@ -3,7 +3,7 @@ import { expect } from 'aegir/chai' import { fromString as uint8ArrayFromString } from 'uint8arrays/from-string' -import { migration } from '../../migrations/migration-8/index.js' +import { migration } from '../../src/migrations/migration-8/index.js' import { Key } from 'interface-datastore/key' /** diff --git a/packages/ipfs-repo-migrations/test/migrations/migration-9-test.js b/packages/ipfs-repo-migrations/test/migrations/migration-9-test.js index bed152c4..147b141b 100644 --- a/packages/ipfs-repo-migrations/test/migrations/migration-9-test.js +++ b/packages/ipfs-repo-migrations/test/migrations/migration-9-test.js @@ -3,8 +3,8 @@ import { expect } from 'aegir/chai' import * as cbor from 'cborg' -import { migration } from '../../migrations/migration-9/index.js' -import { PIN_DS_KEY } from '../../migrations/migration-9/utils.js' +import { migration } from '../../src/migrations/migration-9/index.js' +import { PIN_DS_KEY } from '../../src/migrations/migration-9/utils.js' import { CID } from 'multiformats/cid' import { CarReader } from '@ipld/car' import loadFixture from 'aegir/fixtures' diff --git a/packages/ipfs-repo-migrations/tsconfig.json b/packages/ipfs-repo-migrations/tsconfig.json index 86f70192..9d7e01fa 100644 --- a/packages/ipfs-repo-migrations/tsconfig.json +++ b/packages/ipfs-repo-migrations/tsconfig.json @@ -6,12 +6,11 @@ }, "include": [ "src", - "test", - "migrations" + "test" ], "exclude": [ - "migrations/migration-9/pin.js", - "migrations/migration-9/pin.d.ts", - "migrations/migration-12/pb" + "src/migrations/migration-9/pin.js", + "src/migrations/migration-9/pin.d.ts", + "src/migrations/migration-12/pb" ] }