halvardssm / deno-nessie

A modular Deno library for PostgreSQL, MySQL, MariaDB and SQLite migrations
MIT License
527 stars 31 forks source link

[IDEA]: Use a deps file for imports in config #139

Open ebebbington opened 3 years ago

ebebbington commented 3 years ago

The Idea

Be great if the generated config file imports from a "./deps.ts" file, where nessie would also append the exports into the deps.ts file

And again, always happy to open a PR

halvardssm commented 3 years ago

Hey @ebebbington ! Thanks for sharing your idea! Could you expand a bit on what you imagine this to look like? Do you have some examples?

ebebbington commented 3 years ago

Hey @ebebbington ! Thanks for sharing your idea! Could you expand a bit on what you imagine this to look like? Do you have some examples?

sorry for not getting back to you sooner, so the init command would not produce this:

// nessie.config.ts
import {
    ClientMySQL,
    ClientPostgreSQL,
    ClientSQLite,
    NessieConfig,
} from "https://deno.land/x/nessie@2.0.2/mod.ts";

and instead it would export those deps from a deps file, and import them from the config file:

// nessie.config.ts
import {
    ClientMySQL,
    ClientPostgreSQL,
    ClientSQLite,
    NessieConfig,
} from "./deps.ts";
// deps.ts - write to this file in append mode, to create it if it doesnt exist, or add to it if it does
export {
    ClientMySQL,
    ClientPostgreSQL,
    ClientSQLite,
    NessieConfig,
} from "https://deno.land/x/nessie@2.0.2/mod.ts";
ebebbington commented 3 years ago

This will make dependency management much easier, saves the user having to move them into a deps file themselves

halvardssm commented 2 years ago

Hey! So, I don't think I want to provide this as an option as initializing Nessie is a one time thing, and it gives minimal return for the effort. In general, I don't think it is good to do this as everyone has their own way of structuring a repo, and it is better if they modify the files themselves. Nessie should be as standalone as possible, so you should be able to create a repo, do nessie init, and that should be it, no more files or adjustments. Nessie should also be easy to add to any repo in the sense that it should not alter existing files or make unexpected changes. I hope you understand what I want Nessie to be and act like 😄