Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add plugin system #84

Open
erxclau opened this issue Jun 15, 2023 · 0 comments
Open

Add plugin system #84

erxclau opened this issue Jun 15, 2023 · 0 comments

Comments

@erxclau
Copy link
Member

erxclau commented Jun 15, 2023

Motivation

For fetching or for deployment. There are a wide number of options for data sources and deployment platforms to sync with. However, not all of these strategies should be included in sink by default. Create a plugin system to allow for a greater number of potential options, without bloating the core library.

Fetching and deployment are fairly open entry points but I can imagine lifecycle entries such as pre- or post- fetch or deployment. For example, it may be useful to send a message to a Slack channel whenever sometimes deploys to AWS.

Examples

// sink.config.js

import notion from "@michigandaily/sink-plugin-notion";
import firebase from "@michigandaily/sink-plugin-firebase";

export default {
    fetch: [
        {
            "type": "notion",
            "id": "000000000",
            "auth": "./credentials.json"
        }
    ],
    deployment: {
        project: "",
        path: ""
    },
    plugins: [notion(), firebase()]
}

Fetch plugins should be integrated into sink-fetch.js, and run through yarn sink fetch <plugin-name>. This will require adding an optional argument to the fetch command.

// notion plugin
export default function notionPlugin() {
    return {
        name: "notion",
        fetch: (details) {
                 console.log(details.id, details.auth);
        }
    }
}

Deployment plugins should be integrated into sink-deploy.js, and run through yarn sink deploy <deployment-strategy>.

// firebase plugin
export default function firebasePlugin() {
     return {
         name: "firebase",
         fetch: () {
         },
         deploy: () {
         }
     } 
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant