@expressots/shared 0.1.0 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/CHANGELOG.md +45 -1
- package/lib/cjs/index.js +1 -0
- package/lib/cjs/interfaces/application-express.interface.js +2 -0
- package/lib/cjs/interfaces/console.interface.js +2 -0
- package/lib/cjs/interfaces/environment.interface.js +22 -0
- package/lib/cjs/interfaces/index.js +7 -0
- package/lib/cjs/interfaces/middleware.interface.js +2 -0
- package/lib/cjs/interfaces/render/ejs.types.js +3 -0
- package/lib/cjs/interfaces/render/render.types.js +23 -0
- package/lib/cjs/types/index.d.ts +1 -0
- package/lib/cjs/types/interfaces/application-express.interface.d.ts +46 -0
- package/lib/cjs/types/interfaces/console.interface.d.ts +8 -0
- package/lib/cjs/types/interfaces/environment.interface.d.ts +37 -0
- package/lib/cjs/types/interfaces/index.d.ts +5 -0
- package/lib/cjs/types/interfaces/middleware.interface.d.ts +7 -0
- package/lib/cjs/types/interfaces/render/ejs.types.d.ts +169 -0
- package/lib/cjs/types/interfaces/render/render.types.d.ts +71 -0
- package/lib/package.json +6 -9
- package/package.json +1 -4
package/lib/CHANGELOG.md
CHANGED
|
@@ -1,8 +1,52 @@
|
|
|
1
1
|
|
|
2
2
|
|
|
3
|
+
## [0.2.0](https://github.com/expressots/shared/compare/0.1.0...0.2.0) (2024-11-16)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Features
|
|
7
|
+
|
|
8
|
+
* add interfaces for console, middleware, and environment; update index exports ([30d7dbb](https://github.com/expressots/shared/commit/30d7dbb0c24af12e4537f626be816f2f5d8a81a0))
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Bug Fixes
|
|
12
|
+
|
|
13
|
+
* standardize quotes in middleware interface file ([6b3f045](https://github.com/expressots/shared/commit/6b3f0459c3ba0bf58d1de920335c6ef7dd438e32))
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
### Tests
|
|
17
|
+
|
|
18
|
+
* enhance coverage for configDotenv function and add edge case handling ([58612bd](https://github.com/expressots/shared/commit/58612bd0040b592133bac687cfb29b9c6ece2a94))
|
|
19
|
+
|
|
20
|
+
## 0.1.0 (2024-11-10)
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
### Features
|
|
24
|
+
|
|
25
|
+
* add compiler and package definitions ([8352e66](https://github.com/expressots/shared/commit/8352e663c1a3429c70bbf7588380fe92f547e0a9))
|
|
26
|
+
* add early ai unit test generation and code coverage ([7eb5f38](https://github.com/expressots/shared/commit/7eb5f380f6b49ce6316a9749daaa7311fda74f04))
|
|
27
|
+
* add env and compiler modules ([f93f6c3](https://github.com/expressots/shared/commit/f93f6c3a719d1a1129112bee4e5e9cf6e42ddd89))
|
|
28
|
+
* add global config interface ([cbe2e12](https://github.com/expressots/shared/commit/cbe2e127db006273e9049220fe3ed20b964d697b))
|
|
29
|
+
* change to beta version ([4e835ca](https://github.com/expressots/shared/commit/4e835ca58933336bc78d66fb42935bf4d02ec641))
|
|
30
|
+
* update readme to include badges ([5995b1a](https://github.com/expressots/shared/commit/5995b1a3eab1481aa4552ca76683c6b16ae0dc60))
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
### Bug Fixes
|
|
34
|
+
|
|
35
|
+
* add express config file for testing ([d7ae7e1](https://github.com/expressots/shared/commit/d7ae7e1d91a73965be89a9f96df4dfdbc67575d4))
|
|
36
|
+
* change dependency installation from npm ci to npm install in CI workflow ([6bc1ece](https://github.com/expressots/shared/commit/6bc1ece4da3c9aca717e769a8d2f615058652579))
|
|
37
|
+
* remove compiler load lib ([c8f6085](https://github.com/expressots/shared/commit/c8f6085ffdd2af524522174789cfe51203827bbb))
|
|
38
|
+
* reorder build and test steps in CI workflow; update Jest config to ignore specific paths ([4500863](https://github.com/expressots/shared/commit/45008637af232929c8c20df24c3cf4d6b56a082e))
|
|
39
|
+
* update CI workflow to use npm ci for dependency installation; refine Jest configs ([356c232](https://github.com/expressots/shared/commit/356c232bbfcf6bad7254ee0ab3417fd82f831a9f))
|
|
40
|
+
* update package.json to use exact version numbers for dependencies ([7cdd924](https://github.com/expressots/shared/commit/7cdd924b468af56ccf5bdfaa36b7cad82034e007))
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
### Code Refactoring
|
|
44
|
+
|
|
45
|
+
* remove unused env property from ExpressoConfig interface ([97663e8](https://github.com/expressots/shared/commit/97663e8a386ece45111eba0c2f8b66d1eb9c90af))
|
|
46
|
+
|
|
3
47
|
## 0.0.1 (2023-09-05)
|
|
4
48
|
|
|
5
49
|
|
|
6
50
|
### Bug Fixes
|
|
7
51
|
|
|
8
|
-
* testing commitlint ([0e78653](https://github.com/expressots/<<repo_name>>/commit/0e786539402f69fdca3fe5b684d850e523db7698))
|
|
52
|
+
* testing commitlint ([0e78653](https://github.com/expressots/<<repo_name>>/commit/0e786539402f69fdca3fe5b684d850e523db7698))
|
package/lib/cjs/index.js
CHANGED
|
@@ -16,4 +16,5 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
17
|
__exportStar(require("./config"), exports);
|
|
18
18
|
__exportStar(require("./env"), exports);
|
|
19
|
+
__exportStar(require("./interfaces"), exports);
|
|
19
20
|
__exportStar(require("./utils"), exports);
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/* eslint-disable @typescript-eslint/no-namespace */
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.Env = void 0;
|
|
5
|
+
/**
|
|
6
|
+
* The Environment namespace contains all the types and interfaces related to environment configuration.
|
|
7
|
+
* @namespace Environment
|
|
8
|
+
* @public API
|
|
9
|
+
*/
|
|
10
|
+
var Env;
|
|
11
|
+
(function (Env) {
|
|
12
|
+
/**
|
|
13
|
+
* Enum representing possible server environments.
|
|
14
|
+
* @public API
|
|
15
|
+
*/
|
|
16
|
+
let ServerEnvironment;
|
|
17
|
+
(function (ServerEnvironment) {
|
|
18
|
+
ServerEnvironment["Development"] = "development";
|
|
19
|
+
ServerEnvironment["Production"] = "production";
|
|
20
|
+
ServerEnvironment["Remote"] = "remote";
|
|
21
|
+
})(ServerEnvironment = Env.ServerEnvironment || (Env.ServerEnvironment = {}));
|
|
22
|
+
})(Env || (exports.Env = Env = {}));
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Env = exports.RenderEngine = void 0;
|
|
4
|
+
var render_types_1 = require("./render/render.types");
|
|
5
|
+
Object.defineProperty(exports, "RenderEngine", { enumerable: true, get: function () { return render_types_1.RenderEngine; } });
|
|
6
|
+
var environment_interface_1 = require("./environment.interface");
|
|
7
|
+
Object.defineProperty(exports, "Env", { enumerable: true, get: function () { return environment_interface_1.Env; } });
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.RenderEngine = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* The Render namespace contains all the types and interfaces related to rendering views.
|
|
6
|
+
* @namespace Render
|
|
7
|
+
* @public API
|
|
8
|
+
*/
|
|
9
|
+
var RenderEngine;
|
|
10
|
+
(function (RenderEngine) {
|
|
11
|
+
/**
|
|
12
|
+
* The supported view engines.
|
|
13
|
+
* @enum {string} Engine - The supported view engines.
|
|
14
|
+
* @readonly - This enum is read-only.
|
|
15
|
+
* @public API
|
|
16
|
+
*/
|
|
17
|
+
let Engine;
|
|
18
|
+
(function (Engine) {
|
|
19
|
+
Engine["HBS"] = "hbs";
|
|
20
|
+
Engine["EJS"] = "ejs";
|
|
21
|
+
Engine["PUG"] = "pug";
|
|
22
|
+
})(Engine = RenderEngine.Engine || (RenderEngine.Engine = {}));
|
|
23
|
+
})(RenderEngine || (exports.RenderEngine = RenderEngine = {}));
|
package/lib/cjs/types/index.d.ts
CHANGED
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import express from "express";
|
|
2
|
+
import { Environment, IEnvironment } from "./environment.interface";
|
|
3
|
+
import { IConsoleMessage } from "./console.interface";
|
|
4
|
+
import { RenderEngine } from "./render/render.types";
|
|
5
|
+
/**
|
|
6
|
+
* Namespace for the Server Application.
|
|
7
|
+
* @namespace Server
|
|
8
|
+
* @public API
|
|
9
|
+
*/
|
|
10
|
+
export declare namespace Server {
|
|
11
|
+
/**
|
|
12
|
+
* Interface for the WebServer application implementation.
|
|
13
|
+
*/
|
|
14
|
+
interface IWebServer {
|
|
15
|
+
initEnvironment(environment: Environment, options?: IEnvironment): void;
|
|
16
|
+
listen(port: number | string, appInfo?: IConsoleMessage): Promise<void>;
|
|
17
|
+
setEngine<T extends RenderEngine.EngineOptions>(engine: RenderEngine.Engine, options?: T): Promise<void>;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Constructor type for IWebServer.
|
|
21
|
+
*/
|
|
22
|
+
interface IWebServerConstructor<T extends IWebServer> {
|
|
23
|
+
new (): T;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Public Interface for the WebServer application.
|
|
27
|
+
* @public API
|
|
28
|
+
*/
|
|
29
|
+
interface IWebServerPublic {
|
|
30
|
+
/**
|
|
31
|
+
* Start listening on the given port.
|
|
32
|
+
* @param port - The port number to listen on.
|
|
33
|
+
* @param consoleMessage - Optional App info message to display on startup.
|
|
34
|
+
*/
|
|
35
|
+
listen(port: number | string, consoleMessage?: IConsoleMessage): Promise<void>;
|
|
36
|
+
/**
|
|
37
|
+
* Get the underlying HTTP server. (default: Express.js)
|
|
38
|
+
* @returns The underlying HTTP server after initialization.
|
|
39
|
+
* @public API
|
|
40
|
+
*/
|
|
41
|
+
getHttpServer(): Promise<express.Application>;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
export type IWebServer = Server.IWebServer;
|
|
45
|
+
export type IWebServerConstructor<T extends IWebServer> = Server.IWebServerConstructor<T>;
|
|
46
|
+
export type IWebServerPublic = Server.IWebServerPublic;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The Environment namespace contains all the types and interfaces related to environment configuration.
|
|
3
|
+
* @namespace Environment
|
|
4
|
+
* @public API
|
|
5
|
+
*/
|
|
6
|
+
export declare namespace Env {
|
|
7
|
+
/**
|
|
8
|
+
* Enum representing possible server environments.
|
|
9
|
+
* @public API
|
|
10
|
+
*/
|
|
11
|
+
enum ServerEnvironment {
|
|
12
|
+
Development = "development",
|
|
13
|
+
Production = "production",
|
|
14
|
+
Remote = "remote"
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Type representing possible server environments.
|
|
18
|
+
*/
|
|
19
|
+
type TypeServerEnvironment = "development" | "production" | "remote";
|
|
20
|
+
/**
|
|
21
|
+
* Interface for environment configuration options.
|
|
22
|
+
* @public API
|
|
23
|
+
*/
|
|
24
|
+
interface IEnvironment {
|
|
25
|
+
env: {
|
|
26
|
+
development?: string;
|
|
27
|
+
production?: string;
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Type representing possible server environments.
|
|
32
|
+
* @public API
|
|
33
|
+
*/
|
|
34
|
+
type Environment = ServerEnvironment | TypeServerEnvironment | undefined;
|
|
35
|
+
}
|
|
36
|
+
export type Environment = Env.Environment;
|
|
37
|
+
export type IEnvironment = Env.IEnvironment;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export { RenderEngine } from "./render/render.types";
|
|
2
|
+
export { IConsoleMessage } from "./console.interface";
|
|
3
|
+
export { IExpressoMiddleware } from "./middleware.interface";
|
|
4
|
+
export { Environment, IEnvironment, Env } from "./environment.interface";
|
|
5
|
+
export { IWebServer, IWebServerConstructor, IWebServerPublic, Server, } from "./application-express.interface";
|
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* An object where {@link filename} is the final parsed path or {@link template} is the content of the included template
|
|
3
|
+
*/
|
|
4
|
+
export type IncluderResult = {
|
|
5
|
+
filename: string;
|
|
6
|
+
template?: never;
|
|
7
|
+
} | {
|
|
8
|
+
template: string;
|
|
9
|
+
filename?: never;
|
|
10
|
+
};
|
|
11
|
+
/**
|
|
12
|
+
* @param originalPath the path as it appears in the include statement
|
|
13
|
+
* @param parsedPath the previously resolved path
|
|
14
|
+
*
|
|
15
|
+
* @return An {@link IncluderResult} object containing the filename or template data.
|
|
16
|
+
*/
|
|
17
|
+
type IncluderCallback = (originalPath: string, parsedPath: string) => IncluderResult;
|
|
18
|
+
/**
|
|
19
|
+
* Escapes a string using HTML/XML escaping rules.
|
|
20
|
+
*
|
|
21
|
+
* Returns the empty string for `null` or `undefined`.
|
|
22
|
+
*
|
|
23
|
+
* @param markup Input string
|
|
24
|
+
* @return Escaped string
|
|
25
|
+
*/
|
|
26
|
+
type EscapeCallback = (markup?: any) => string;
|
|
27
|
+
export interface Options {
|
|
28
|
+
/**
|
|
29
|
+
* Log the generated JavaScript source for the EJS template to the console.
|
|
30
|
+
*
|
|
31
|
+
* @default false
|
|
32
|
+
*/
|
|
33
|
+
debug?: boolean | undefined;
|
|
34
|
+
/**
|
|
35
|
+
* Include additional runtime debugging information in generated template
|
|
36
|
+
* functions.
|
|
37
|
+
*
|
|
38
|
+
* @default true
|
|
39
|
+
*/
|
|
40
|
+
compileDebug?: boolean | undefined;
|
|
41
|
+
/**
|
|
42
|
+
* Whether or not to use `with () {}` construct in the generated template
|
|
43
|
+
* functions. If set to `false`, data is still accessible through the object
|
|
44
|
+
* whose name is specified by `ejs.localsName` (defaults to `locals`).
|
|
45
|
+
*
|
|
46
|
+
* @default true
|
|
47
|
+
*/
|
|
48
|
+
_with?: boolean | undefined;
|
|
49
|
+
/**
|
|
50
|
+
* Whether to run in strict mode or not.
|
|
51
|
+
* Enforces `_with=false`.
|
|
52
|
+
*
|
|
53
|
+
* @default false
|
|
54
|
+
*/
|
|
55
|
+
strict?: boolean | undefined;
|
|
56
|
+
/**
|
|
57
|
+
* An array of local variables that are always destructured from `localsName`,
|
|
58
|
+
* available even in strict mode.
|
|
59
|
+
*
|
|
60
|
+
* @default []
|
|
61
|
+
*/
|
|
62
|
+
destructuredLocals?: Array<string> | undefined;
|
|
63
|
+
/**
|
|
64
|
+
* Remove all safe-to-remove whitespace, including leading and trailing
|
|
65
|
+
* whitespace. It also enables a safer version of `-%>` line slurping for all
|
|
66
|
+
* scriptlet tags (it does not strip new lines of tags in the middle of a
|
|
67
|
+
* line).
|
|
68
|
+
*
|
|
69
|
+
* @default false
|
|
70
|
+
*/
|
|
71
|
+
rmWhitespace?: boolean | undefined;
|
|
72
|
+
/**
|
|
73
|
+
* Whether or not to compile a `ClientFunction` that can be rendered
|
|
74
|
+
* in the browser without depending on ejs.js. Otherwise, a `TemplateFunction`
|
|
75
|
+
* will be compiled.
|
|
76
|
+
*
|
|
77
|
+
* @default false
|
|
78
|
+
*/
|
|
79
|
+
client?: boolean | undefined;
|
|
80
|
+
/**
|
|
81
|
+
* The escaping function used with `<%=` construct. It is used in rendering
|
|
82
|
+
* and is `.toString()`ed in the generation of client functions.
|
|
83
|
+
*
|
|
84
|
+
* @default ejs.escapeXML
|
|
85
|
+
*/
|
|
86
|
+
escape?: EscapeCallback | undefined;
|
|
87
|
+
/**
|
|
88
|
+
* The filename of the template. Required for inclusion and caching unless
|
|
89
|
+
* you are using `renderFile`. Also used for error reporting.
|
|
90
|
+
*
|
|
91
|
+
* @default undefined
|
|
92
|
+
*/
|
|
93
|
+
filename?: string | undefined;
|
|
94
|
+
/**
|
|
95
|
+
* The path to templates root(s). When this is set, absolute paths for includes
|
|
96
|
+
* (/filename.ejs) will be relative to the templates root(s).
|
|
97
|
+
*
|
|
98
|
+
* @default undefined
|
|
99
|
+
*/
|
|
100
|
+
root?: Array<string> | string | undefined;
|
|
101
|
+
/**
|
|
102
|
+
* The opening delimiter for all statements. This allows you to clearly delinate
|
|
103
|
+
* the difference between template code and existing delimiters. (It is recommended
|
|
104
|
+
* to synchronize this with the closeDelimiter property.)
|
|
105
|
+
*
|
|
106
|
+
* @default ejs.openDelimiter
|
|
107
|
+
*/
|
|
108
|
+
openDelimiter?: string | undefined;
|
|
109
|
+
/**
|
|
110
|
+
* The closing delimiter for all statements. This allows to to clearly delinate
|
|
111
|
+
* the difference between template code and existing delimiters. (It is recommended
|
|
112
|
+
* to synchronize this with the openDelimiter property.)
|
|
113
|
+
*
|
|
114
|
+
* @default ejs.closeDelimiter
|
|
115
|
+
*/
|
|
116
|
+
closeDelimiter?: string | undefined;
|
|
117
|
+
/**
|
|
118
|
+
* Character to use with angle brackets for open/close
|
|
119
|
+
* @default '%'
|
|
120
|
+
*/
|
|
121
|
+
delimiter?: string | undefined;
|
|
122
|
+
/**
|
|
123
|
+
* Whether or not to enable caching of template functions. Beware that
|
|
124
|
+
* the options of compilation are not checked as being the same, so
|
|
125
|
+
* special handling is required if, for example, you want to cache client
|
|
126
|
+
* and regular functions of the same file.
|
|
127
|
+
*
|
|
128
|
+
* Requires `filename` to be set. Only works with rendering function.
|
|
129
|
+
*
|
|
130
|
+
* @default false
|
|
131
|
+
*/
|
|
132
|
+
cache?: boolean | undefined;
|
|
133
|
+
/**
|
|
134
|
+
* The Object to which `this` is set during rendering.
|
|
135
|
+
*
|
|
136
|
+
* @default this
|
|
137
|
+
*/
|
|
138
|
+
context?: any;
|
|
139
|
+
/**
|
|
140
|
+
* Whether or not to create an async function instead of a regular function.
|
|
141
|
+
* This requires language support.
|
|
142
|
+
*
|
|
143
|
+
* @default false
|
|
144
|
+
*/
|
|
145
|
+
async?: boolean | undefined;
|
|
146
|
+
/**
|
|
147
|
+
* Make sure to set this to 'false' in order to skip UglifyJS parsing,
|
|
148
|
+
* when using ES6 features (`const`, etc) as UglifyJS doesn't understand them.
|
|
149
|
+
* @default true
|
|
150
|
+
*/
|
|
151
|
+
beautify?: boolean | undefined;
|
|
152
|
+
/**
|
|
153
|
+
* Name to use for the object storing local variables when not using `with` or destructuring.
|
|
154
|
+
*
|
|
155
|
+
* @default ejs.localsName
|
|
156
|
+
*/
|
|
157
|
+
localsName?: string | undefined;
|
|
158
|
+
/** Set to a string (e.g., 'echo' or 'print') for a function to print output inside scriptlet tags. */
|
|
159
|
+
outputFunctionName?: string | undefined;
|
|
160
|
+
/**
|
|
161
|
+
* An array of paths to use when resolving includes with relative paths
|
|
162
|
+
*/
|
|
163
|
+
views?: Array<string> | undefined;
|
|
164
|
+
/**
|
|
165
|
+
* Custom function to handle EJS includes
|
|
166
|
+
*/
|
|
167
|
+
includer?: IncluderCallback;
|
|
168
|
+
}
|
|
169
|
+
export {};
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { Options } from "./ejs.types";
|
|
2
|
+
/**
|
|
3
|
+
* The Render namespace contains all the types and interfaces related to rendering views.
|
|
4
|
+
* @namespace Render
|
|
5
|
+
* @public API
|
|
6
|
+
*/
|
|
7
|
+
export declare namespace RenderEngine {
|
|
8
|
+
/**
|
|
9
|
+
* Ejs options
|
|
10
|
+
* @typedef {Object} EjsOptions
|
|
11
|
+
* @property {string | Array<string>} viewsDir - The path to the views folder
|
|
12
|
+
* @property {string} viewEngine - The view engine
|
|
13
|
+
* @property {ejs.Options} [serverOptions] - The server options
|
|
14
|
+
* @public API
|
|
15
|
+
*/
|
|
16
|
+
type EjsOptions = {
|
|
17
|
+
viewsDir?: string | Array<string>;
|
|
18
|
+
viewEngine?: string;
|
|
19
|
+
serverOptions?: Options;
|
|
20
|
+
};
|
|
21
|
+
/**
|
|
22
|
+
* Handlebars options
|
|
23
|
+
* @typedef {Object} HandlebarsOptions
|
|
24
|
+
* @property {string} viewsDir - The path to the views folder
|
|
25
|
+
* @property {string} viewEngine - The view engine to be used
|
|
26
|
+
* @property {ConfigOptions} [serverOptions] - The server options
|
|
27
|
+
* @public API
|
|
28
|
+
*/
|
|
29
|
+
type HandlebarsOptions = {
|
|
30
|
+
viewEngine?: string;
|
|
31
|
+
viewsDir?: string;
|
|
32
|
+
partialsDir?: string;
|
|
33
|
+
};
|
|
34
|
+
/**
|
|
35
|
+
* Pug options
|
|
36
|
+
* @typedef {Object} PugOptions
|
|
37
|
+
* @property {string} viewEngine - The view engine to be used
|
|
38
|
+
* @property {string} viewsDir - The path to the views folder
|
|
39
|
+
* @public API
|
|
40
|
+
*/
|
|
41
|
+
type PugOptions = {
|
|
42
|
+
viewEngine?: string;
|
|
43
|
+
viewsDir?: string;
|
|
44
|
+
};
|
|
45
|
+
/**
|
|
46
|
+
* The configuration options for the view engine.
|
|
47
|
+
* @typedef {HandlebarsOptions | EjsOptions | PugOptions} RenderOptions
|
|
48
|
+
* @public API
|
|
49
|
+
*/
|
|
50
|
+
type RenderOptions = {
|
|
51
|
+
engine: Engine;
|
|
52
|
+
options?: EngineOptions;
|
|
53
|
+
};
|
|
54
|
+
/**
|
|
55
|
+
* The supported view engines.
|
|
56
|
+
* @enum {string} Engine - The supported view engines.
|
|
57
|
+
* @readonly - This enum is read-only.
|
|
58
|
+
* @public API
|
|
59
|
+
*/
|
|
60
|
+
enum Engine {
|
|
61
|
+
HBS = "hbs",
|
|
62
|
+
EJS = "ejs",
|
|
63
|
+
PUG = "pug"
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* The configuration options for the view engine.
|
|
67
|
+
* @typedef {HandlebarsOptions | EjsOptions} EngineOptions
|
|
68
|
+
* @public API
|
|
69
|
+
*/
|
|
70
|
+
type EngineOptions = HandlebarsOptions | EjsOptions | PugOptions;
|
|
71
|
+
}
|
package/lib/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@expressots/shared",
|
|
3
|
-
"version": "0.0
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"description": "Shared library for ExpressoTS modules 🐎",
|
|
5
5
|
"author": "Richard Zampieri <richard.zampieri@expresso-ts.com>",
|
|
6
6
|
"main": "./lib/cjs/index.js",
|
|
@@ -47,9 +47,6 @@
|
|
|
47
47
|
"backend",
|
|
48
48
|
"library"
|
|
49
49
|
],
|
|
50
|
-
"engines": {
|
|
51
|
-
"node": ">=18.10.0"
|
|
52
|
-
},
|
|
53
50
|
"scripts": {
|
|
54
51
|
"prepare": "husky",
|
|
55
52
|
"clean": "node scripts/rm.js lib",
|
|
@@ -69,25 +66,25 @@
|
|
|
69
66
|
},
|
|
70
67
|
"dependencies": {
|
|
71
68
|
"reflect-metadata": "0.2.2",
|
|
72
|
-
"ts-node": "
|
|
69
|
+
"ts-node": "10.9.2"
|
|
73
70
|
},
|
|
74
71
|
"devDependencies": {
|
|
75
72
|
"@commitlint/cli": "19.4.1",
|
|
76
73
|
"@commitlint/config-conventional": "19.2.2",
|
|
77
74
|
"@release-it/conventional-changelog": "8.0.1",
|
|
78
75
|
"@types/express": "4.17.21",
|
|
79
|
-
"@types/jest": "
|
|
76
|
+
"@types/jest": "29.5.13",
|
|
80
77
|
"@types/node": "20.14.10",
|
|
81
78
|
"@typescript-eslint/eslint-plugin": "7.16.1",
|
|
82
79
|
"@typescript-eslint/parser": "7.16.1",
|
|
83
|
-
"chalk": "
|
|
80
|
+
"chalk": "4.1.2",
|
|
84
81
|
"eslint": "8.57.0",
|
|
85
82
|
"eslint-config-prettier": "9.1.0",
|
|
86
83
|
"husky": "9.1.1",
|
|
87
|
-
"jest": "
|
|
84
|
+
"jest": "29.7.0",
|
|
88
85
|
"prettier": "3.3.3",
|
|
89
86
|
"release-it": "17.6.0",
|
|
90
|
-
"ts-jest": "
|
|
87
|
+
"ts-jest": "29.2.5",
|
|
91
88
|
"typescript": "5.5.3"
|
|
92
89
|
},
|
|
93
90
|
"release-it": {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@expressots/shared",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"description": "Shared library for ExpressoTS modules 🐎",
|
|
5
5
|
"author": "Richard Zampieri <richard.zampieri@expresso-ts.com>",
|
|
6
6
|
"main": "./lib/cjs/index.js",
|
|
@@ -47,9 +47,6 @@
|
|
|
47
47
|
"backend",
|
|
48
48
|
"library"
|
|
49
49
|
],
|
|
50
|
-
"engines": {
|
|
51
|
-
"node": ">=18.10.0"
|
|
52
|
-
},
|
|
53
50
|
"scripts": {
|
|
54
51
|
"prepare": "husky",
|
|
55
52
|
"clean": "node scripts/rm.js lib",
|