Giter Club home page Giter Club logo

Comments (6)

RobinCK avatar RobinCK commented on June 6, 2024 6

please check next solution

  1. install ts-node for dev environment
  2. update this package to 0.4.0
  3. npx fixtures ./fixtures --config ./ormconfig.ts --sync --require ts-node/register

from typeorm-fixtures.

RobinCK avatar RobinCK commented on June 6, 2024 1

Everything works if you

  • add the name property, for example default
  • then build the project
  • and in cli specify the path to js file

tested on sample project
config:

module.exports = {
    name: 'default',
    type: 'postgres',
    host: 'localhost',
    database: 'test',
    username: 'root',
    password: 'root',
    entities: ['./dist/entity/**/*.js'],
    cli: {
        entitiesDir: 'entity',
    },
};

run command:

npx fixtures ./fixtures --config dist/ormconfig.js --sync

from typeorm-fixtures.

RobinCK avatar RobinCK commented on June 6, 2024

please show configuration example

from typeorm-fixtures.

Insidexa avatar Insidexa commented on June 6, 2024
import { SnakeNamingStrategy } from '../modules/common/typeorm/snake-case-naming.strategy';

const {
    DB_TYPE,
    DB_HOST,
    DB_PORT,
    DB_NAME,
    DB_PASSWORD,
    DB_USERNAME,
    DB_MIGRATIONS,
    DB_MIGRATIONS_DIR,
    DB_ENTITIES,
} = process.env;

module.exports = {
    type: DB_TYPE,
    host: DB_HOST,
    port: DB_PORT,
    database: DB_NAME,
    username: DB_USERNAME,
    password: DB_PASSWORD,
    entities: [DB_ENTITIES],
    migrations: [DB_MIGRATIONS],
    cli: {
        migrationsDir: DB_MIGRATIONS_DIR,
    },
    namingStrategy: new SnakeNamingStrategy(),
}

from typeorm-fixtures.

Insidexa avatar Insidexa commented on June 6, 2024

but need in dev mode without build project, typeorm in dev mode loaded ts config
maybe you need see source code how typeorm load ormconfig.ts and apply to your project :)

from typeorm-fixtures.

Insidexa avatar Insidexa commented on June 6, 2024

Thank you, its worked ! )

from typeorm-fixtures.

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.