Skip to content
This repository was archived by the owner on Feb 20, 2019. It is now read-only.

Commit 51df698

Browse files
authored
Lint readme update (#4)
* refactor(async naming conventions): Added some missing 'async' postfix to some methods * docs(readme.md): Mentioned NYC as prerequisit in the readme as it is required to run unit tests
1 parent 4622ffd commit 51df698

5 files changed

Lines changed: 19 additions & 9 deletions

File tree

README.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,9 @@ This package is under development and not released yet.
1212

1313
## Installation
1414
### Prerequisites
15-
* Node.JS ^6.1.0
16-
* NPM ^4.0.0
15+
* [Node.JS](https://nodejs.org) ^6.1.0
16+
* [NPM](https://www.npmjs.com) ^4.0.0
17+
* [NYC](https://www.npmjs.com/package/nyc) for running tests
1718

1819
You can get the latest version with NPM
1920

src/sn-fetch-types.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ export async function DoFetchTypes(initializer: Initializer = Initializer.Curren
2626
await initializer.Stage.CallGulpRunAsync('tsc', initializer.Stage.TempFolderPath);
2727
await initializer.Stage.CallGulpRunAsync('nyc mocha -p tsconfig.json dist/test/index.js', initializer.Stage.TempFolderPath);
2828
await initializer.Stage.UpdateModuleAsync();
29-
await initializer.Stage.Cleanup();
29+
await initializer.Stage.CleanupAsync();
3030

3131
console.log('All done.');
3232
} catch (error) {

src/utils/ask.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,9 @@ export class Ask {
6262
public static async MissingConfigs<K extends keyof SnConfigModel>(...missingConfigs: K[]): Promise<Partial<SnConfigModel>> {
6363
return new Promise<Partial<SnConfigModel>>((resolve, reject) => {
6464
Prompt.start();
65-
const configs = missingConfigs.map(this.createPromptQuestionFromConfigName);
65+
const configs = missingConfigs.map((cfg) => {
66+
this.createPromptQuestionFromConfigName(cfg);
67+
});
6668
Prompt.get(configs, (err, res) => {
6769
resolve();
6870
});

src/utils/download.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ export class Download {
5151
* Executes the download request, flatterns the data into a simple in-memory buffer
5252
* @returns {Promise<Buffer>} An awaitable promise with the in-memory buffer
5353
*/
54-
public GetAsBufferAsync(): Promise<Buffer> {
54+
public async GetAsBufferAsync(): Promise<Buffer> {
5555
return new Promise<Buffer>((resolve) => {
5656
Http.get({
5757
headers: this.headers,

src/utils/stage.ts

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ export class Stage {
4242
* - Copies the existing Typescript source files and testss
4343
*/
4444
public async PrepareAsync() {
45-
this.Cleanup();
45+
await this.CleanupAsync();
4646
const task = Gulp.src([
4747
`./src/**/*.ts`,
4848
`./test/**/*.ts`,
@@ -67,7 +67,7 @@ export class Stage {
6767
cwd: this.TempFolderPath,
6868
})
6969
.pipe(Gulp.dest(this.paths.SnClientPath));
70-
await task.resume();
70+
return await task.resume();
7171
}
7272

7373
public async InitializeConfigAsync() {
@@ -99,7 +99,14 @@ export class Stage {
9999
/**
100100
* Cleans up (deletes) the specified temporary folder
101101
*/
102-
public Cleanup() {
103-
Delete.sync(this.TempFolderPath, { force: true });
102+
public async CleanupAsync() {
103+
return new Promise((resolve, reject) => {
104+
try {
105+
Delete.sync(this.TempFolderPath, { force: true });
106+
resolve();
107+
} catch (error) {
108+
reject(error);
109+
}
110+
});
104111
}
105112
}

0 commit comments

Comments
 (0)