From 9741c314bd818dc25d88f6c4e43f6e57cd6a0c61 Mon Sep 17 00:00:00 2001 From: Hassan Khan Date: Sun, 21 Oct 2018 20:14:09 +0100 Subject: [PATCH] serverless: add Utils class types --- types/serverless/classes/Utils.d.ts | 22 ++++++++++++++++++++++ types/serverless/index.d.ts | 3 ++- 2 files changed, 24 insertions(+), 1 deletion(-) create mode 100644 types/serverless/classes/Utils.d.ts diff --git a/types/serverless/classes/Utils.d.ts b/types/serverless/classes/Utils.d.ts new file mode 100644 index 0000000000..d45f4890bb --- /dev/null +++ b/types/serverless/classes/Utils.d.ts @@ -0,0 +1,22 @@ +import Serverless = require("../index"); + +declare class Utils { + constructor(serverless: Serverless); + + getVersion(): string; + dirExistsSync(dirPath: string): boolean; + fileExistsSync(filePath: string): boolean; + writeFileDir(filePath: string): void; + writeFileSync(filePath: string, contents: string): void; + writeFile(filePath: string, contents: string): PromiseLike<{}>; + appendFileSync(filePath: string, contents: string): PromiseLike<{}>; + readFileSync(filePath: string): {}; + readFile(filePath: string): PromiseLike<{}>; + walkDirSync(dirPath: string): string[]; + copyDirContentsSync(srcDir: string, destDir: string): void; + generateShortId(length: number): string; + findServicePath(): string; + logStat(serverless: Serverless, context: string): PromiseLike<{}>; +} + +export = Utils; diff --git a/types/serverless/index.d.ts b/types/serverless/index.d.ts index e93ae97cf2..01f9d7a73e 100644 --- a/types/serverless/index.d.ts +++ b/types/serverless/index.d.ts @@ -6,6 +6,7 @@ import Service = require("./classes/Service"); import Plugin = require("./classes/Plugin"); import PluginManager = require("./classes/PluginManager"); +import Utils = require("./classes/Utils"); import YamlParser = require("./classes/YamlParser"); import AwsProvider = require("./plugins/aws/provider/awsProvider"); @@ -45,7 +46,7 @@ declare class Serverless { }; providers: {}; - utils: {}; + utils: Utils; variables: {}; yamlParser: YamlParser; pluginManager: PluginManager;