Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions .github/workflows/publish-adapter-minio.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: Publish Adapter Minio
on:
push:
branches:
- main
paths:
- "packages/adapter-minio/**"
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
with:
node-version: "14.x"
registry-url: "https://registry.npmjs.org"
scope: "@hyper63"
- run: cd packages/adapter-minio && yarn
- run: cd packages/adapter-minio && npm publish --access public
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
22 changes: 22 additions & 0 deletions .github/workflows/test-adapter-minio.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: test minio adapter
on:
push:
branches-ignore: main
paths:
- "packages/adapter-minio/**"
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [14.x]
steps:
- uses: actions/checkout@v2
- name: Use NodeJS ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
- run: cd packages/adapter-minio && yarn
- run: cd packages/adapter-minio && yarn test
env:
CI: true
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
"packages/adapter-fs",
"packages/adapter-minisearch",
"packages/adapter-hooks",
"packages/adapter-minio",
"packages/app-express",
"packages/app-graphql",
"packages/port-data",
Expand Down
26 changes: 26 additions & 0 deletions packages/adapter-minio/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# hyper63 MINIO Adapter

MinIO is a storage service that allows you to create
buckets and upload objects, like files, and media to
a storage solution.

## Install

```sh
npm install @hyper63/adapter-minio
```

## Configuration

```js
const minio = require("@hyper63/adapter-minio");

module.exports = {
adapter: [
{
port: "storage",
plugins: [minio({ url: "http://[user]:[password]/minio:9000" })],
},
],
};
```
4 changes: 2 additions & 2 deletions packages/adapter-minio/adapter.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import { Async } from 'crocks'
const { Async } = require('crocks')

const prop = (key) => (obj) => obj[key];

const asyncify = (client, method) =>
Async.fromPromise(client[method].bind(client));

export default (client) => ({
module.exports = (client) => ({
makeBucket: (name) =>
asyncify(
client,
Expand Down
4 changes: 2 additions & 2 deletions packages/adapter-minio/adapter_test.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { default as test } from 'tape'
import { default as createAdapter } from './adapter'
const test = require('tape')
const createAdapter = require('./adapter')

const client = ({
makeBucket(name) {
Expand Down
6 changes: 3 additions & 3 deletions packages/adapter-minio/index.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import { default as createAdapter } from './adapter'
import * as Minio from 'minio'
const createAdapter = require('./adapter')
const Minio = require('minio')

/**
* @param {object} config
* @returns {object}
*/
export default function MinioStorageAdapter (config) {
module.exports = function MinioStorageAdapter (config) {
/**
* @param {object} env
*/
Expand Down
2 changes: 1 addition & 1 deletion packages/adapter-minio/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,6 @@
"tape": "^5.0.1"
},
"scripts": {
"test": "tape -r esm *_test.js"
"test": "tape *_test.js"
}
}