feat(storage-fs): adapt to the new storage option and rename the package
This commit is contained in:
parent
8e87ade5c0
commit
7d8ac9b185
8 changed files with 52 additions and 41 deletions
5
.changeset/heavy-toes-cheer.md
Normal file
5
.changeset/heavy-toes-cheer.md
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
---
|
||||
'@emigrate/storage-fs': minor
|
||||
---
|
||||
|
||||
Adapt to the new plugin structure and rename from "@emigrate/plugin-storage-fs" to just "@emigrate/storage-fs"
|
||||
|
|
@ -1,24 +0,0 @@
|
|||
# @emigrate/plugin-storage-fs
|
||||
|
||||
A file system storage plugin for Emigrate, suitable for simple migration setups. To support containerized environments, it is recommended to use a database storage plugin instead.
|
||||
|
||||
## Installation
|
||||
|
||||
Install the plugin in your project, alongside the Emigrate CLI:
|
||||
|
||||
```bash
|
||||
npm install --save-dev @emigrate/cli @emigrate/plugin-storage-fs
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
Configure the plugin in your `emigrate.config.js` file:
|
||||
|
||||
```js
|
||||
import storageFs from '@emigrate/plugin-storage-fs';
|
||||
|
||||
export default {
|
||||
directory: 'migrations',
|
||||
plugins: [storageFs({ filename: '.migrated.json' })],
|
||||
};
|
||||
```
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
# @emigrate/plugin-storage-fs
|
||||
# @emigrate/storage-fs
|
||||
|
||||
## 0.1.1
|
||||
|
||||
30
packages/storage-fs/README.md
Normal file
30
packages/storage-fs/README.md
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
# @emigrate/storage-fs
|
||||
|
||||
A file system storage plugin for Emigrate, suitable for simple migration setups. To support containerized environments, it is recommended to use a database storage plugin instead.
|
||||
|
||||
## Installation
|
||||
|
||||
Install the storage plugin in your project, alongside the Emigrate CLI:
|
||||
|
||||
```bash
|
||||
npm install --save-dev @emigrate/cli @emigrate/storage-fs
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
Configure the storage in your `emigrate.config.js` file:
|
||||
|
||||
```js
|
||||
import storageFs from '@emigrate/storage-fs';
|
||||
|
||||
export default {
|
||||
directory: 'migrations',
|
||||
storage: storageFs({ filename: '.migrated.json' }),
|
||||
};
|
||||
```
|
||||
|
||||
Or use the CLI option `--storage` (or `-s`):
|
||||
|
||||
```bash
|
||||
emigrate up --storage fs # the @emigrate/storage- prefix is optional
|
||||
```
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
{
|
||||
"name": "@emigrate/plugin-storage-fs",
|
||||
"name": "@emigrate/storage-fs",
|
||||
"version": "0.1.1",
|
||||
"publishConfig": {
|
||||
"access": "public"
|
||||
|
|
@ -24,14 +24,14 @@
|
|||
},
|
||||
"keywords": [
|
||||
"emigrate",
|
||||
"emigrate-plugin",
|
||||
"emigrate-storage",
|
||||
"plugin",
|
||||
"migrations",
|
||||
"storage"
|
||||
],
|
||||
"author": "Aboviq AB <dev@aboviq.com> (https://www.aboviq.com)",
|
||||
"homepage": "https://github.com/aboviq/emigrate/tree/main/packages/plugin-storage-fs#readme",
|
||||
"repository": "https://github.com/aboviq/emigrate/tree/main/packages/plugin-storage-fs",
|
||||
"homepage": "https://github.com/aboviq/emigrate/tree/main/packages/storage-fs#readme",
|
||||
"repository": "https://github.com/aboviq/emigrate/tree/main/packages/storage-fs",
|
||||
"bugs": "https://github.com/aboviq/emigrate/issues",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
|
|
@ -1,7 +1,7 @@
|
|||
import fs from 'node:fs/promises';
|
||||
import path from 'node:path';
|
||||
import process from 'node:process';
|
||||
import { type StoragePlugin, type MigrationStatus } from '@emigrate/plugin-tools/types';
|
||||
import { type EmigrateStorage, type MigrationStatus } from '@emigrate/plugin-tools/types';
|
||||
|
||||
export type StorageFsOptions = {
|
||||
filename: string;
|
||||
|
|
@ -13,7 +13,7 @@ type SerializedError = {
|
|||
stack?: string;
|
||||
};
|
||||
|
||||
export default function storageFs({ filename }: StorageFsOptions): StoragePlugin {
|
||||
export default function storageFs({ filename }: StorageFsOptions): EmigrateStorage {
|
||||
const filePath = path.resolve(process.cwd(), filename);
|
||||
const lockFilePath = `${filePath}.lock`;
|
||||
|
||||
20
pnpm-lock.yaml
generated
20
pnpm-lock.yaml
generated
|
|
@ -95,16 +95,6 @@ importers:
|
|||
specifier: workspace:*
|
||||
version: link:../tsconfig
|
||||
|
||||
packages/plugin-storage-fs:
|
||||
dependencies:
|
||||
'@emigrate/plugin-tools':
|
||||
specifier: workspace:*
|
||||
version: link:../plugin-tools
|
||||
devDependencies:
|
||||
'@emigrate/tsconfig':
|
||||
specifier: workspace:*
|
||||
version: link:../tsconfig
|
||||
|
||||
packages/plugin-tools:
|
||||
dependencies:
|
||||
import-from-esm:
|
||||
|
|
@ -115,6 +105,16 @@ importers:
|
|||
specifier: workspace:*
|
||||
version: link:../tsconfig
|
||||
|
||||
packages/storage-fs:
|
||||
dependencies:
|
||||
'@emigrate/plugin-tools':
|
||||
specifier: workspace:*
|
||||
version: link:../plugin-tools
|
||||
devDependencies:
|
||||
'@emigrate/tsconfig':
|
||||
specifier: workspace:*
|
||||
version: link:../tsconfig
|
||||
|
||||
packages/tsconfig: {}
|
||||
|
||||
packages:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue