-
-
Notifications
You must be signed in to change notification settings - Fork 115
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: used nestjs logger & used ts-node to transpile & run ts file
- Loading branch information
1 parent
8b001a5
commit 3ba51a2
Showing
4 changed files
with
59 additions
and
308 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
module.exports = { | ||
parser: '@typescript-eslint/parser', | ||
parserOptions: { | ||
project: 'tsconfig.json', | ||
tsconfigRootDir: __dirname, | ||
sourceType: 'module' | ||
}, | ||
plugins: ['@typescript-eslint/eslint-plugin'], | ||
extends: [ | ||
'plugin:@typescript-eslint/recommended', | ||
'plugin:prettier/recommended' | ||
], | ||
root: true, | ||
env: { | ||
node: true, | ||
jest: true | ||
}, | ||
ignorePatterns: ['.eslintrc.js'], | ||
rules: { | ||
'@typescript-eslint/interface-name-prefix': 'off', | ||
'@typescript-eslint/explicit-function-return-type': 'off', | ||
'@typescript-eslint/explicit-module-boundary-types': 'off', | ||
'@typescript-eslint/no-explicit-any': 'off', | ||
'@typescript-eslint/no-unused-vars': ['warn'] | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,26 @@ | ||
import { execSync } from 'child_process'; | ||
import { platform } from 'os'; | ||
import { execSync } from 'child_process' | ||
import { platform } from 'os' | ||
import { Logger } from '@nestjs/common' | ||
|
||
const seconds = 3; | ||
const os = platform(); | ||
const logger = new Logger('SleepCommand') | ||
const seconds = 3 | ||
const os = platform() | ||
|
||
let command: string; | ||
let command: string | ||
if (os === 'win32') { | ||
command = `powershell -command "Start-Sleep -s ${seconds}"`; | ||
command = `powershell -command "Start-Sleep -s ${seconds}"` | ||
} else if (os === 'darwin' || os === 'linux') { | ||
command = `sleep ${seconds}`; | ||
command = `sleep ${seconds}` | ||
} else { | ||
console.error('Unsupported operating system'); | ||
process.exit(1); | ||
logger.error('Unsupported operating system') | ||
process.exit(1) | ||
} | ||
|
||
try { | ||
execSync(command); | ||
logger.log(`Executing sleep command for ${seconds} seconds on ${os}`) | ||
execSync(command) | ||
logger.log('Sleep command executed successfully') | ||
} catch (error) { | ||
console.error(`Error executing sleep command: ${error}`); | ||
process.exit(1); | ||
} | ||
logger.error(`Error executing sleep command: ${error}`) | ||
process.exit(1) | ||
} |
Oops, something went wrong.