• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

typeorm / typeorm / 19549987525

20 Nov 2025 08:11PM UTC coverage: 80.769% (+4.3%) from 76.433%
19549987525

push

github

web-flow
ci: run tests on commits to master and next (#11783)

Co-authored-by: Oleg "OSA413" Sokolov <OSA413@users.noreply.github.com>

26500 of 32174 branches covered (82.36%)

Branch coverage included in aggregate %.

91252 of 113615 relevant lines covered (80.32%)

88980.79 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

45.0
/src/commands/EntityCreateCommand.ts
1
import ansi from "ansis"
26✔
2
import path from "path"
26✔
3
import yargs from "yargs"
26✔
4
import { PlatformTools } from "../platform/PlatformTools"
26✔
5
import { CommandUtils } from "./CommandUtils"
26✔
6

26✔
7
/**
26✔
8
 * Generates a new entity.
26✔
9
 */
26✔
10
export class EntityCreateCommand implements yargs.CommandModule {
208✔
11
    command = "entity:create <path>"
208✔
12
    describe = "Generates a new entity."
208✔
13

208✔
14
    builder(args: yargs.Argv) {
208✔
15
        return args.positional("path", {
×
16
            type: "string",
×
17
            describe: "Path of the entity file",
×
18
            demandOption: true,
×
19
        })
×
20
    }
×
21

208✔
22
    async handler(args: yargs.Arguments) {
208✔
23
        try {
×
24
            const fullPath = (args.path as string).startsWith("/")
×
25
                ? (args.path as string)
×
26
                : path.resolve(process.cwd(), args.path as string)
×
27
            const filename = path.basename(fullPath)
×
28
            const fileContent = EntityCreateCommand.getTemplate(filename)
×
29
            const fileExists = await CommandUtils.fileExists(fullPath + ".ts")
×
30
            if (fileExists) {
×
31
                throw new Error(`File "${fullPath}.ts" already exists`)
×
32
            }
×
33
            await CommandUtils.createFile(fullPath + ".ts", fileContent)
×
34
            console.log(
×
35
                ansi.green`Entity ${ansi.blue`${fullPath}.ts`} has been created successfully.`,
×
36
            )
×
37
        } catch (error) {
×
38
            PlatformTools.logCmdErr("Error during entity creation:", error)
×
39
            process.exit(1)
×
40
        }
×
41
    }
×
42

208✔
43
    // -------------------------------------------------------------------------
208✔
44
    // Protected Static Methods
208✔
45
    // -------------------------------------------------------------------------
208✔
46

208✔
47
    /**
208✔
48
     * Gets contents of the entity file.
208✔
49
     */
208✔
50
    protected static getTemplate(name: string): string {
208✔
51
        return `import { Entity } from "typeorm"
×
52

×
53
@Entity()
×
54
export class ${name} {
×
55

×
56
}
×
57
`
×
58
    }
×
59
}
208✔
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc