Giter Club home page Giter Club logo

Comments (4)

gustawdaniel avatar gustawdaniel commented on May 18, 2024 1

fixed by

TS_NODE_DEV=1 tsx src/index.ts up

lol

from mongo-migrate-ts.

gustawdaniel avatar gustawdaniel commented on May 18, 2024

User

tsx src/index.ts new

instead of mongo-migrate command and src/index.ts like

import { mongoMigrateCli } from 'mongo-migrate-ts';

mongoMigrateCli({
  uri: 'mongodb://username:[email protected]:27017',
  database: 'db',
  migrationsDir: __dirname + '/../migrations',
  migrationsCollection: 'migrations_collection',
});

finally to apply migrations

tsx src/index.ts up

from mongo-migrate-ts.

gustawdaniel avatar gustawdaniel commented on May 18, 2024

I tested and it does not works with tsx.

Problem is with migrations detection because of line

    const fileExt = (0, isTsNode_1.isTsNode)() ? new RegExp(/\.ts$/i) : new RegExp(/\.js$/i);

in loadMigrations function.

Ther is js extension detected in tsx because of output of function isTsNode_1.isTsNode

where

const isTsNode_1 = require("./utils/isTsNode");

which is implemented as

const isTsNode = () => {
    const symbol = Symbol.for('ts-node.register.instance');
    return !!process[symbol] || !!process.env.TS_NODE_DEV;
};

from mongo-migrate-ts.

mycodeself avatar mycodeself commented on May 18, 2024

Yes, it supports ts-node, I haven't tried tsx, but I think this is a good workaround

from mongo-migrate-ts.

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.