Git Product home page Git Product logo

Comments (4)

pwalsh avatar pwalsh commented on May 24, 2024

The minimal approach was to just expose the tools we already have for (i) migrations, and (ii) starting a default server, using npm's bin functionality, so:

npx govflow-migrate
npx govflow-start

See https://github.com/govflow/govflow/tree/5fe9deca10e18eafa4623c4813992b6b0bda3312#getting-started and 5fe9dec

Kind of hard to verify properly without transpiring the typescript and releasing a version, so will close this issue only when I have also done that.

from govflow.

pwalsh avatar pwalsh commented on May 24, 2024

@amirozer

Nope.

I'm not sure I 100% tracked down the issue - current problem in 0.0.18-alpha may just be because of missing file extension - but in any event I now see even fixing that won't work as I them need to make the file executable, but, I don't know how to do that on the relevant output file after typescript transpile to javascript (I could force it when we build on CI, but feels wrong).

I guess there is a reason why using a tool like https://github.com/oclif/oclif which is built around typescript will be the best choice here.

Meanwhile, until we dive into using a fully fledged framework for typescript CLIs, the solution is that codebases with govflow as a dependency, that need to run migrations, can write a file like the following and call it as the migration script:

# from https://github.com/govflow/govflow/blob/main/src/cli/migrate.ts

# save as my-migrator.ts

import { initConfig } from '../config';
import { initMigrator } from '../db/engine';
import type { DatabaseEngine } from '../types';

(async () => {
    const config = await initConfig();
    const { database, settings } = config;
    const migrator = initMigrator(database as DatabaseEngine, settings?.databaseExtraMigrationPaths as string);
    migrator.runAsCLI();
})();

And run like:

ts-node my-migrator.ts

from govflow.

pwalsh avatar pwalsh commented on May 24, 2024

Should be resolved in 1318330 but I will verify with a build from NPM (did verify locally with global install)

from govflow.

pwalsh avatar pwalsh commented on May 24, 2024

Confirmed working with 0.0.19-alpha. CLI commands listed in https://github.com/govflow/govflow#getting-started

from govflow.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.