Skip to content

Commit 1704ad3

Browse files
committed
refactor(): existsSync instead of deprecated exists
Signed-off-by: Vojtech Masek <[email protected]>
1 parent dfdf90d commit 1704ad3

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

src/generator.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { exists, mkdir, readFile, writeFile } from 'fs';
1+
import { existsSync, mkdir, readFile, writeFile } from 'fs';
22
import { ensureDir } from 'fs-extra';
33
import * as Mustache from 'mustache';
44
import { dirname, join } from 'path';
@@ -10,7 +10,7 @@ import { createMustacheViewModel } from './parser';
1010

1111
export async function generateAPIClient(swaggerFilePath: string, outputPath: string): Promise<void> {
1212
/* Create output folder if not already present */
13-
if (!await promisify(exists)(outputPath)) {
13+
if (!existsSync(outputPath)) {
1414
await ensureDir(outputPath);
1515
}
1616

@@ -38,7 +38,7 @@ async function generateModels(viewContext: MustacheData, outputPath: string): Pr
3838
const modelTemplate = (await promisify(readFile)(`${__dirname}/../templates/ngx-model.mustache`)).toString();
3939
const modelExportTemplate = (await promisify(readFile)(`${__dirname}/../templates/ngx-models-export.mustache`)).toString();
4040

41-
if (!await promisify(exists)(outputDir)) {
41+
if (!existsSync(outputDir)) {
4242
await promisify(mkdir)(outputDir);
4343
}
4444

src/tests.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
import { compare, DiffSet, State } from 'dir-compare';
2-
import { exists, mkdir } from 'fs';
2+
import { existsSync, mkdir } from 'fs';
33
import * as rimraf from 'rimraf';
44
import { promisify } from 'util';
55
import { generateAPIClient } from '../src/generator';
66

77
const enum Colors {
8-
Reset = "\x1b[0m",
9-
Red = "\x1b[31m",
10-
Green = "\x1b[32m",
8+
Reset = '\x1b[0m',
9+
Red = '\x1b[31m',
10+
Green = '\x1b[32m',
1111
}
1212

1313
const testReferences = ['esquare', 'gcloud-firestore', 'github'];
@@ -23,7 +23,7 @@ const stateSymbols: {[key in State]: string} = {
2323
async function runTests(): Promise<number> {
2424
const testsOutDir = `${__dirname}/../tests/tests-output`;
2525

26-
if (await promisify(exists)(testsOutDir)) {
26+
if (existsSync(testsOutDir)) {
2727
await promisify(rimraf)(testsOutDir);
2828
}
2929

0 commit comments

Comments
 (0)