Skip to content

Commit

Permalink
fix: log time took by eslint-all and lint-all
Browse files Browse the repository at this point in the history
  • Loading branch information
kirillgroshkov committed Aug 2, 2023
1 parent 713df88 commit 6b98fce
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
5 changes: 5 additions & 0 deletions src/cmd/eslint-all.command.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
import * as fs from 'node:fs'
import { _since } from '@naturalcycles/js-lib'
import { boldGrey, dimGrey } from '@naturalcycles/nodejs-lib/dist/colors'
import * as yargs from 'yargs'
import { cfgDir } from '../cnst/paths.cnst'
import { getTSConfigPathScripts, runESLintAsync } from '../util/lint.util'
Expand All @@ -7,6 +9,7 @@ import { getTSConfigPathScripts, runESLintAsync } from '../util/lint.util'
* Runs `eslint` command for all predefined paths (e.g /src, /scripts, etc).
*/
export async function eslintAllCommand(): Promise<void> {
const started = Date.now()
const { ext, fix } = yargs.options({
ext: {
type: 'string',
Expand Down Expand Up @@ -53,4 +56,6 @@ export async function eslintAllCommand(): Promise<void> {
// /e2e
await runESLintAsync(`./e2e`, eslintConfigPathE2e, tsconfigPathE2e, undefined, fix)
}

console.log(`${boldGrey('eslint-all')} ${dimGrey(`took ` + _since(started))}`)
}
6 changes: 5 additions & 1 deletion src/cmd/lint-all.command.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import * as fs from 'node:fs'
import { _truncate } from '@naturalcycles/js-lib'
import { boldGrey, dimGrey } from '@naturalcycles/nodejs-lib/dist/colors'
import { _since, _truncate } from '@naturalcycles/js-lib'
import * as yargs from 'yargs'
import {
commitMessageToTitleMessage,
Expand All @@ -17,6 +18,7 @@ import { eslintAllCommand } from './eslint-all.command'
* We run eslint BEFORE Prettier, because eslint can delete e.g unused imports.
*/
export async function lintAllCommand(): Promise<void> {
const started = Date.now()
const { commitOnChanges, failOnChanges } = yargs.options({
commitOnChanges: {
type: 'boolean',
Expand Down Expand Up @@ -46,6 +48,8 @@ export async function lintAllCommand(): Promise<void> {
await ktlintLib.ktlintAll()
}

console.log(`${boldGrey('lint-all')} ${dimGrey(`took ` + _since(started))}`)

if (commitOnChanges || failOnChanges) {
// detect changes
const hasChanges = gitHasUncommittedChanges()
Expand Down

0 comments on commit 6b98fce

Please sign in to comment.