Skip to content

Commit 889b995

Browse files
authored
refactor: improved typing, readme fixes (#26)
* refactor: improved typing, readme fixes * 1.10.1
1 parent 54dc06d commit 889b995

20 files changed

+41
-41
lines changed

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -86,15 +86,15 @@ In addition to steps from Basic Usage, you can improve results by changing some
8686

8787
The main configuration is stored in the `config.json` file in a root directory and you can change this config file according to your needs:
8888

89-
```
89+
```json
9090
{
9191
"tailwind": true,
9292
"theme": "minimalistic",
9393
"locale": "en"
9494
}
9595
```
9696

97-
There possible to run hot-reload server to develop your own theme with custom markup, styles, and scripts. To start dev-server just run command `npm run dev`. This command will start server on 8080 port ([http://localhost:8080](http://localhost:8080). By default, this address will be opened with a first status code, defined in `src` directory, which corresponds to configured `locale` value. You can choose any other code to continue specific page development. Don't be surprised with injected parts of code in a rendered page, because this is a part of hot-reload mode. Any change of the main configuration will require dev-server restart. The only configured theme and locale directories are watching during development.
97+
There possible to run hot-reload server to develop your own theme with custom markup, styles, and scripts. To start dev-server just run command `npm run dev`. This command will start server on 8080 port ([http://localhost:8080](http://localhost:8080)). By default, this address will be opened with a first status code, defined in `src` directory, which corresponds to configured `locale` value. You can choose any other code to continue specific page development. Don't be surprised with injected parts of code in a rendered page, because this is a part of hot-reload mode. Any change of the main configuration will require dev-server restart. The only configured theme and locale directories are watching during development.
9898

9999

100100
### Templates
@@ -132,7 +132,7 @@ The config snippet itself I would recommend to place in the `/etc/nginx/snippets
132132

133133
Here is an example of web server configuration with included the error pages snippet:
134134

135-
```
135+
```nginx
136136
server {
137137
server_name example.com;
138138
access_log /var/log/nginx/example.access.log;

dev/server.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ import { MessagesEnum } from "../messages";
1515
import { pr } from "../path-registry";
1616

1717
import { DEFAULTS } from "../lib/constants";
18-
import { Config, TemplateVariables } from "../lib/interfaces";
18+
import { Config, TemplateVariables } from "../lib/models";
1919
import { DI_TOKENS } from "../lib/tokens";
2020

2121
const STATUS_PATH_REGEX = /^\/([0-9]{3})$/i;

index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import { Main } from "./lib/classes/Main";
77
import { initContainer } from "./container";
88
import { pr } from "./path-registry";
99

10-
import { Config } from "./lib/interfaces";
10+
import { Config } from "./lib/models";
1111
import { Messages } from "./lib/classes/Messages";
1212
import { MessagesEnum } from "./messages";
1313

lib/classes/ChildProcessWrapper.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ export interface IChildProcessWrapper {
88

99
@injectable()
1010
export class ChildProcessWrapper implements IChildProcessWrapper {
11-
exec(cmd: string) {
11+
exec(cmd: string): Promise<{ stdout: string; stderr: string }> {
1212
return promisify(exec)(cmd);
1313
}
1414
}

lib/classes/Compiler.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import { ILogger } from "./Logger";
66
import { Messages } from "./Messages";
77
import { Renderer } from "./Renderer";
88

9-
import { Config, SnippetVariables, TemplateVariables } from "../interfaces";
9+
import { Config, SnippetVariables, TemplateVariables } from "../models";
1010
import { DI_TOKENS } from "../tokens";
1111
import { MessagesEnum } from "../../messages";
1212
import { PathRegistry } from "./PathRegistry";

lib/classes/FileSystemHelper.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { injectable, inject } from "inversify";
22

3-
import { Config } from "../interfaces";
3+
import { Config } from "../models";
44
import { Messages } from "./Messages";
55
import { Styler } from "./Styler";
66
import { ILogger } from "./Logger";

lib/classes/FileSystemWrapper.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -14,36 +14,36 @@ export interface IFileSystemWrapper {
1414
readDir(path: string): Promise<string[]>;
1515
readFile(path: string): Promise<Buffer>;
1616
rm(path: string, opts?: fs.RmOptions): Promise<void>;
17-
writeFile(path: string, data: string, opts?: WriteOptions);
17+
writeFile(path: string, data: string, opts?: WriteOptions): Promise<void>;
1818
}
1919

2020
@injectable()
2121
export class NodeFS implements IFileSystemWrapper {
22-
access(path: string) {
22+
access(path: string): Promise<void> {
2323
return fsp.access(path);
2424
}
2525

26-
cp(src: string, dest: string, opts?: fs.CopyOptions) {
26+
cp(src: string, dest: string, opts?: fs.CopyOptions): Promise<void> {
2727
return fsp.cp(src, dest, opts);
2828
}
2929

30-
mkdir(path: string, opts?: fs.MakeDirectoryOptions) {
30+
mkdir(path: string, opts?: fs.MakeDirectoryOptions): Promise<string> {
3131
return fsp.mkdir(path, opts);
3232
}
3333

34-
readDir(path: string) {
34+
readDir(path: string): Promise<string[]> {
3535
return fsp.readdir(path);
3636
}
3737

38-
readFile(path: string) {
38+
readFile(path: string): Promise<Buffer> {
3939
return fsp.readFile(path);
4040
}
4141

42-
rm(path: string, opts?: fs.RmOptions) {
42+
rm(path: string, opts?: fs.RmOptions): Promise<void> {
4343
return fsp.rm(path, opts);
4444
}
4545

46-
writeFile(path: string, data: string, opts?: WriteOptions) {
46+
writeFile(path: string, data: string, opts?: WriteOptions): Promise<void> {
4747
return fsp.writeFile(path, data, opts);
4848
}
4949
}

lib/classes/Logger.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ export interface ILogger {
66

77
@injectable()
88
export class Logger implements ILogger {
9-
print(message: string) {
9+
print(message: string): void {
1010
console.log(message);
1111
}
1212
}

lib/classes/Main.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import { IStyler } from "./Styler";
77
import { Messages } from "./Messages";
88
import { PathRegistry } from "./PathRegistry";
99

10-
import { Config } from "../interfaces";
10+
import { Config } from "../models";
1111
import { DI_TOKENS } from "../tokens";
1212
import { MessagesEnum } from "../../messages";
1313

@@ -22,7 +22,7 @@ export class Main {
2222
@inject(DI_TOKENS.PATH) private pr: PathRegistry
2323
) {}
2424

25-
async start() {
25+
async start(): Promise<void> {
2626
const startTime = Date.now();
2727

2828
this.logger.print(Messages.info(MessagesEnum.START));

lib/classes/Messages.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { render } from "mustache";
22

3-
import { AnyVariables } from "../interfaces";
3+
import { AnyVariables } from "../models";
44

55
export class Messages {
66
static error(msg: string, vars: AnyVariables = {}): string {

0 commit comments

Comments
 (0)