Skip to content

Commit

Permalink
chore: instead of require, import chalk from chalk (#6637)
Browse files Browse the repository at this point in the history
  • Loading branch information
imnotjames committed Sep 2, 2020
1 parent c99ba40 commit 4f7481b
Show file tree
Hide file tree
Showing 15 changed files with 16 additions and 18 deletions.
2 changes: 1 addition & 1 deletion src/commands/CacheClearCommand.ts
Expand Up @@ -2,7 +2,7 @@ import {createConnection} from "../index";
import {ConnectionOptionsReader} from "../connection/ConnectionOptionsReader";
import {Connection} from "../connection/Connection";
import * as yargs from "yargs";
const chalk = require("chalk");
import chalk from "chalk";

/**
* Clear cache command.
Expand Down
2 changes: 1 addition & 1 deletion src/commands/EntityCreateCommand.ts
@@ -1,7 +1,7 @@
import {ConnectionOptionsReader} from "../connection/ConnectionOptionsReader";
import {CommandUtils} from "./CommandUtils";
import * as yargs from "yargs";
const chalk = require("chalk");
import chalk from "chalk";

/**
* Generates a new entity.
Expand Down
2 changes: 1 addition & 1 deletion src/commands/InitCommand.ts
Expand Up @@ -2,7 +2,7 @@ import {CommandUtils} from "./CommandUtils";
import {ObjectLiteral} from "../common/ObjectLiteral";
import * as path from "path";
import * as yargs from "yargs";
const chalk = require("chalk");
import chalk from "chalk";

/**
* Generates a new project with TypeORM.
Expand Down
2 changes: 1 addition & 1 deletion src/commands/MigrationCreateCommand.ts
Expand Up @@ -2,7 +2,7 @@ import {ConnectionOptionsReader} from "../connection/ConnectionOptionsReader";
import {CommandUtils} from "./CommandUtils";
import {camelCase} from "../util/StringUtils";
import * as yargs from "yargs";
const chalk = require("chalk");
import chalk from "chalk";

/**
* Creates a new migration file.
Expand Down
2 changes: 1 addition & 1 deletion src/commands/MigrationGenerateCommand.ts
Expand Up @@ -6,7 +6,7 @@ import {MysqlDriver} from "../driver/mysql/MysqlDriver";
import {camelCase} from "../util/StringUtils";
import * as yargs from "yargs";
import {AuroraDataApiDriver} from "../driver/aurora-data-api/AuroraDataApiDriver";
const chalk = require("chalk");
import chalk from "chalk";

/**
* Generates a new migration file with sql needs to be executed to update schema.
Expand Down
2 changes: 1 addition & 1 deletion src/commands/MigrationRevertCommand.ts
Expand Up @@ -2,7 +2,7 @@ import {createConnection} from "../index";
import {ConnectionOptionsReader} from "../connection/ConnectionOptionsReader";
import {Connection} from "../connection/Connection";
import * as yargs from "yargs";
const chalk = require("chalk");
import chalk from "chalk";

/**
* Reverts last migration command.
Expand Down
2 changes: 1 addition & 1 deletion src/commands/MigrationRunCommand.ts
Expand Up @@ -3,7 +3,7 @@ import {ConnectionOptionsReader} from "../connection/ConnectionOptionsReader";
import {Connection} from "../connection/Connection";
import * as process from "process";
import * as yargs from "yargs";
const chalk = require("chalk");
import chalk from "chalk";

/**
* Runs migration command.
Expand Down
2 changes: 1 addition & 1 deletion src/commands/MigrationShowCommand.ts
Expand Up @@ -3,7 +3,7 @@ import {ConnectionOptionsReader} from "../connection/ConnectionOptionsReader";
import {Connection} from "../connection/Connection";
import * as process from "process";
import * as yargs from "yargs";
const chalk = require("chalk");
import chalk from "chalk";

/**
* Runs migration command.
Expand Down
2 changes: 1 addition & 1 deletion src/commands/QueryCommand.ts
Expand Up @@ -4,7 +4,7 @@ import {ConnectionOptionsReader} from "../connection/ConnectionOptionsReader";
import {Connection} from "../connection/Connection";
import {PlatformTools} from "../platform/PlatformTools";
import * as yargs from "yargs";
const chalk = require("chalk");
import chalk from "chalk";

/**
* Executes an sql query on the given connection.
Expand Down
2 changes: 1 addition & 1 deletion src/commands/SchemaDropCommand.ts
Expand Up @@ -2,7 +2,7 @@ import {createConnection} from "../index";
import {Connection} from "../connection/Connection";
import {ConnectionOptionsReader} from "../connection/ConnectionOptionsReader";
import * as yargs from "yargs";
const chalk = require("chalk");
import chalk from "chalk";

/**
* Drops all tables of the database from the given connection.
Expand Down
5 changes: 2 additions & 3 deletions src/commands/SchemaLogCommand.ts
Expand Up @@ -3,8 +3,7 @@ import {Connection} from "../connection/Connection";
import {ConnectionOptionsReader} from "../connection/ConnectionOptionsReader";
import {highlight} from "cli-highlight";
import * as yargs from "yargs";

const chalk = require("chalk");
import chalk from "chalk";

/**
* Shows sql to be executed by schema:sync command.
Expand Down Expand Up @@ -53,7 +52,7 @@ export class SchemaLogCommand implements yargs.CommandModule {
} else {
const lengthSeparators = String(sqlInMemory.upQueries.length).split("").map(char => "-").join("");
console.log(chalk.yellow("---------------------------------------------------------------" + lengthSeparators));
console.log(chalk.yellow.bold(`-- Schema syncronization will execute following sql queries (${chalk.white(sqlInMemory.upQueries.length)}):`));
console.log(chalk.yellow.bold(`-- Schema syncronization will execute following sql queries (${chalk.white(sqlInMemory.upQueries.length.toString())}):`));
console.log(chalk.yellow("---------------------------------------------------------------" + lengthSeparators));

sqlInMemory.upQueries.forEach(upQuery => {
Expand Down
2 changes: 1 addition & 1 deletion src/commands/SchemaSyncCommand.ts
Expand Up @@ -2,7 +2,7 @@ import {createConnection} from "../index";
import {Connection} from "../connection/Connection";
import {ConnectionOptionsReader} from "../connection/ConnectionOptionsReader";
import * as yargs from "yargs";
const chalk = require("chalk");
import chalk from "chalk";

/**
* Synchronizes database schema with entities.
Expand Down
2 changes: 1 addition & 1 deletion src/commands/SubscriberCreateCommand.ts
@@ -1,7 +1,7 @@
import {ConnectionOptionsReader} from "../connection/ConnectionOptionsReader";
import {CommandUtils} from "./CommandUtils";
import * as yargs from "yargs";
const chalk = require("chalk");
import chalk from "chalk";

/**
* Generates a new subscriber.
Expand Down
2 changes: 1 addition & 1 deletion src/commands/VersionCommand.ts
@@ -1,5 +1,5 @@
import * as yargs from "yargs";
const exec = require("child_process").exec;
import {exec} from "child_process";

/**
* Shows typeorm version.
Expand Down
3 changes: 1 addition & 2 deletions src/platform/PlatformTools.ts
@@ -1,12 +1,11 @@
import * as path from "path";
import * as fs from "fs";
import chalk from "chalk";
import {highlight, Theme} from "cli-highlight";
export {ReadStream} from "fs";
export {EventEmitter} from "events";
export {Readable, Writable} from "stream";

const chalk = require("chalk");

/**
* Platform-specific tools.
*/
Expand Down

0 comments on commit 4f7481b

Please sign in to comment.