@expressots/shared 3.0.0 → 4.0.0-preview.1
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/README.md +31 -98
- package/lib/CHANGELOG.md +82 -65
- package/lib/README.md +31 -98
- package/lib/cjs/env/cli-options.js +2 -2
- package/lib/cjs/env/environment.js +10 -10
- package/lib/cjs/env/index.js +1 -1
- package/lib/cjs/index.js +4 -4
- package/lib/cjs/interfaces/index.js +3 -5
- package/lib/cjs/types/config/index.d.ts +1 -1
- package/lib/cjs/types/config/project-config.d.ts +5 -0
- package/lib/cjs/types/env/cli-options.d.ts +1 -1
- package/lib/cjs/types/env/env-options.d.ts +1 -1
- package/lib/cjs/types/env/environment.d.ts +1 -1
- package/lib/cjs/types/env/index.d.ts +2 -2
- package/lib/cjs/types/index.d.ts +4 -4
- package/lib/cjs/types/interfaces/application-express.interface.d.ts +9 -4
- package/lib/cjs/types/interfaces/console.interface.d.ts +6 -0
- package/lib/cjs/types/interfaces/index.d.ts +5 -5
- package/lib/cjs/types/interfaces/render/render.types.d.ts +1 -1
- package/lib/cjs/types/utils/compiler.d.ts +1 -1
- package/lib/cjs/types/utils/index.d.ts +1 -1
- package/lib/cjs/utils/index.js +2 -2
- package/lib/esm/config/index.js +1 -0
- package/lib/esm/config/project-config.js +1 -0
- package/lib/esm/env/cli-options.js +15 -0
- package/lib/esm/env/constants.js +10 -0
- package/lib/esm/env/env-options.js +19 -0
- package/lib/esm/env/environment.js +304 -0
- package/lib/esm/env/index.js +1 -0
- package/lib/esm/env/interfaces.js +1 -0
- package/lib/esm/index.mjs +4 -0
- package/lib/esm/interfaces/application-express.interface.js +1 -0
- package/lib/esm/interfaces/console.interface.js +1 -0
- package/lib/esm/interfaces/environment.interface.js +19 -0
- package/lib/esm/interfaces/index.js +1 -0
- package/lib/esm/interfaces/middleware.interface.js +1 -0
- package/lib/esm/interfaces/render/ejs.types.js +2 -0
- package/lib/esm/interfaces/render/render.types.js +20 -0
- package/lib/esm/package.json +3 -0
- package/lib/esm/types/config/index.d.ts +1 -0
- package/lib/esm/types/config/project-config.d.ts +43 -0
- package/lib/esm/types/env/cli-options.d.ts +7 -0
- package/lib/esm/types/env/constants.d.ts +10 -0
- package/lib/esm/types/env/env-options.d.ts +9 -0
- package/lib/esm/types/env/environment.d.ts +83 -0
- package/lib/esm/types/env/index.d.ts +2 -0
- package/lib/esm/types/env/interfaces.d.ts +71 -0
- package/lib/esm/types/index.d.ts +4 -0
- package/lib/esm/types/interfaces/application-express.interface.d.ts +58 -0
- package/lib/esm/types/interfaces/console.interface.d.ts +14 -0
- package/lib/esm/types/interfaces/environment.interface.d.ts +37 -0
- package/lib/esm/types/interfaces/index.d.ts +5 -0
- package/lib/esm/types/interfaces/middleware.interface.d.ts +7 -0
- package/lib/esm/types/interfaces/render/ejs.types.d.ts +169 -0
- package/lib/esm/types/interfaces/render/render.types.d.ts +71 -0
- package/lib/esm/types/utils/compiler.d.ts +17 -0
- package/lib/esm/types/utils/index.d.ts +1 -0
- package/lib/esm/types/utils/logger.d.ts +19 -0
- package/lib/esm/utils/compiler.js +69 -0
- package/lib/esm/utils/index.js +1 -0
- package/lib/esm/utils/logger.js +60 -0
- package/lib/package.json +154 -147
- package/package.json +154 -147
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { stdout } from "process";
|
|
2
|
+
import chalk from "chalk";
|
|
3
|
+
/**
|
|
4
|
+
* Logger utility for dotenv
|
|
5
|
+
*/
|
|
6
|
+
export var LogLevel;
|
|
7
|
+
(function (LogLevel) {
|
|
8
|
+
LogLevel["Info"] = "info";
|
|
9
|
+
LogLevel["Warn"] = "warn";
|
|
10
|
+
LogLevel["Debug"] = "debug";
|
|
11
|
+
})(LogLevel || (LogLevel = {}));
|
|
12
|
+
/**
|
|
13
|
+
* Log a message
|
|
14
|
+
* @param message - The message to log
|
|
15
|
+
* @param logLevel - The log level. Defaults to LogLevel.Info
|
|
16
|
+
*/
|
|
17
|
+
export function log(message, logLevel = LogLevel.Info) {
|
|
18
|
+
switch (logLevel) {
|
|
19
|
+
case LogLevel.Info:
|
|
20
|
+
stdout.write(`[ExpressoTS][INFO] ${message}\n`);
|
|
21
|
+
break;
|
|
22
|
+
case LogLevel.Warn:
|
|
23
|
+
stdout.write(`[ExpressoTS][WARN] ${message}\n`);
|
|
24
|
+
break;
|
|
25
|
+
case LogLevel.Debug:
|
|
26
|
+
stdout.write(`[ExpressoTS][DEBUG] ${message}\n`);
|
|
27
|
+
break;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
export function printError(message, component) {
|
|
31
|
+
const formattedMessage = message ? `${message}: ` : ": ";
|
|
32
|
+
const formattedComponent = component ? `[${component}]` : "[]";
|
|
33
|
+
const output = chalk.red(`${formattedMessage}${chalk.bold(chalk.white(`${formattedComponent} ❌\n`))}`);
|
|
34
|
+
stdout.write(output);
|
|
35
|
+
}
|
|
36
|
+
export function printSuccess(message, component) {
|
|
37
|
+
const formattedMessage = message ? `${message}: ` : ": ";
|
|
38
|
+
const formattedComponent = component ? `[${component}]` : "[]";
|
|
39
|
+
const output = chalk.green(`${formattedMessage}${chalk.bold(chalk.white(`${formattedComponent} ✔️\n`))}`);
|
|
40
|
+
stdout.write(output);
|
|
41
|
+
}
|
|
42
|
+
export function printWarning(message, component) {
|
|
43
|
+
if (component === undefined) {
|
|
44
|
+
stdout.write(chalk.yellow(`${message} ⚠️\n`));
|
|
45
|
+
return;
|
|
46
|
+
}
|
|
47
|
+
stdout.write(chalk.yellow(`${message}:`, chalk.bold(chalk.white(`[${component}] ⚠️\n`))));
|
|
48
|
+
}
|
|
49
|
+
export async function printGenerateError(schematic, file) {
|
|
50
|
+
const schematicFormatted = `[${schematic}]`.padEnd(14);
|
|
51
|
+
const fileNameFormatted = chalk.bold.white(`${file.split(".")[0]} not created! ❌\n`);
|
|
52
|
+
const output = chalk.redBright(schematicFormatted) + fileNameFormatted;
|
|
53
|
+
stdout.write(output);
|
|
54
|
+
}
|
|
55
|
+
export async function printGenerateSuccess(schematic, file) {
|
|
56
|
+
const schematicFormatted = `[${schematic}]`.padEnd(14);
|
|
57
|
+
const fileNameFormatted = chalk.bold.white(`${file.split(".")[0]} created! ✔️\n`);
|
|
58
|
+
const output = chalk.greenBright(schematicFormatted) + fileNameFormatted;
|
|
59
|
+
stdout.write(output);
|
|
60
|
+
}
|
package/lib/package.json
CHANGED
|
@@ -1,147 +1,154 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@expressots/shared",
|
|
3
|
-
"version": "
|
|
4
|
-
"description": "Shared library for ExpressoTS modules 🐎",
|
|
5
|
-
"author": "Richard Zampieri <richard.zampieri@expresso-ts.com>",
|
|
6
|
-
"main": "./lib/cjs/index.js",
|
|
7
|
-
"types": "./lib/cjs/types/index.d.ts",
|
|
8
|
-
"exports": {
|
|
9
|
-
".": {
|
|
10
|
-
"import": {
|
|
11
|
-
"types": "./lib/esm/types/index.d.ts",
|
|
12
|
-
"default": "./lib/esm/index.mjs"
|
|
13
|
-
},
|
|
14
|
-
"require": {
|
|
15
|
-
"types": "./lib/cjs/types/index.d.ts",
|
|
16
|
-
"default": "./lib/cjs/index.js"
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
},
|
|
20
|
-
"files": [
|
|
21
|
-
"lib/**/*"
|
|
22
|
-
],
|
|
23
|
-
"license": "MIT",
|
|
24
|
-
"homepage": "https://expresso-ts.com",
|
|
25
|
-
"funding": {
|
|
26
|
-
"type": "github",
|
|
27
|
-
"url": "https://github.com/sponsors/expressots"
|
|
28
|
-
},
|
|
29
|
-
"repository": {
|
|
30
|
-
"type": "git",
|
|
31
|
-
"url": "https://github.com/expressots/shared"
|
|
32
|
-
},
|
|
33
|
-
"bugs": {
|
|
34
|
-
"url": "https://github.com/expressots/shared/issues"
|
|
35
|
-
},
|
|
36
|
-
"publishConfig": {
|
|
37
|
-
"access": "public"
|
|
38
|
-
},
|
|
39
|
-
"keywords": [
|
|
40
|
-
"expressots",
|
|
41
|
-
"nodejs",
|
|
42
|
-
"typescript",
|
|
43
|
-
"clean-architecture",
|
|
44
|
-
"typescript-framework",
|
|
45
|
-
"framework",
|
|
46
|
-
"server-side",
|
|
47
|
-
"backend",
|
|
48
|
-
"library"
|
|
49
|
-
],
|
|
50
|
-
"scripts": {
|
|
51
|
-
"prepare": "husky",
|
|
52
|
-
"clean": "node scripts/rm.js lib",
|
|
53
|
-
"copy": "node scripts/copy.js package.json README.md CHANGELOG.md lib",
|
|
54
|
-
"build": "npm run clean && npm run build:cjs && npm run copy",
|
|
55
|
-
"build:cjs": "tsc -p tsconfig.cjs.json",
|
|
56
|
-
"build:esm": "
|
|
57
|
-
"release": "release-it",
|
|
58
|
-
"prepublish": "npm run build && npm pack",
|
|
59
|
-
"
|
|
60
|
-
"test": "jest",
|
|
61
|
-
"
|
|
62
|
-
"
|
|
63
|
-
"
|
|
64
|
-
"lint": "eslint \"src/**/*.ts\""
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
"
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
"
|
|
79
|
-
"@
|
|
80
|
-
"
|
|
81
|
-
"
|
|
82
|
-
"
|
|
83
|
-
"
|
|
84
|
-
"
|
|
85
|
-
"
|
|
86
|
-
"
|
|
87
|
-
"
|
|
88
|
-
"
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
"
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
"
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
"
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
"
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
"
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
"
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
"
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
"
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
"
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
1
|
+
{
|
|
2
|
+
"name": "@expressots/shared",
|
|
3
|
+
"version": "4.0.0-preview.1",
|
|
4
|
+
"description": "Shared library for ExpressoTS modules 🐎",
|
|
5
|
+
"author": "Richard Zampieri <richard.zampieri@expresso-ts.com>",
|
|
6
|
+
"main": "./lib/cjs/index.js",
|
|
7
|
+
"types": "./lib/cjs/types/index.d.ts",
|
|
8
|
+
"exports": {
|
|
9
|
+
".": {
|
|
10
|
+
"import": {
|
|
11
|
+
"types": "./lib/esm/types/index.d.ts",
|
|
12
|
+
"default": "./lib/esm/index.mjs"
|
|
13
|
+
},
|
|
14
|
+
"require": {
|
|
15
|
+
"types": "./lib/cjs/types/index.d.ts",
|
|
16
|
+
"default": "./lib/cjs/index.js"
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
},
|
|
20
|
+
"files": [
|
|
21
|
+
"lib/**/*"
|
|
22
|
+
],
|
|
23
|
+
"license": "MIT",
|
|
24
|
+
"homepage": "https://expresso-ts.com",
|
|
25
|
+
"funding": {
|
|
26
|
+
"type": "github",
|
|
27
|
+
"url": "https://github.com/sponsors/expressots"
|
|
28
|
+
},
|
|
29
|
+
"repository": {
|
|
30
|
+
"type": "git",
|
|
31
|
+
"url": "https://github.com/expressots/shared"
|
|
32
|
+
},
|
|
33
|
+
"bugs": {
|
|
34
|
+
"url": "https://github.com/expressots/shared/issues"
|
|
35
|
+
},
|
|
36
|
+
"publishConfig": {
|
|
37
|
+
"access": "public"
|
|
38
|
+
},
|
|
39
|
+
"keywords": [
|
|
40
|
+
"expressots",
|
|
41
|
+
"nodejs",
|
|
42
|
+
"typescript",
|
|
43
|
+
"clean-architecture",
|
|
44
|
+
"typescript-framework",
|
|
45
|
+
"framework",
|
|
46
|
+
"server-side",
|
|
47
|
+
"backend",
|
|
48
|
+
"library"
|
|
49
|
+
],
|
|
50
|
+
"scripts": {
|
|
51
|
+
"prepare": "husky",
|
|
52
|
+
"clean": "node scripts/rm.js lib",
|
|
53
|
+
"copy": "node scripts/copy.js package.json README.md CHANGELOG.md lib",
|
|
54
|
+
"build": "npm run clean && npm run build:cjs && npm run build:esm && npm run copy",
|
|
55
|
+
"build:cjs": "tsc -p tsconfig.cjs.json",
|
|
56
|
+
"build:esm": "node scripts/build-esm.js",
|
|
57
|
+
"release": "release-it",
|
|
58
|
+
"prepublish": "npm run build && npm pack",
|
|
59
|
+
"test": "jest",
|
|
60
|
+
"test:watch": "jest --watch",
|
|
61
|
+
"coverage": "jest --coverage",
|
|
62
|
+
"format": "prettier --write \"src/**/*.ts\" --cache",
|
|
63
|
+
"lint": "eslint \"src/**/*.ts\"",
|
|
64
|
+
"lint:fix": "eslint \"src/**/*.ts\" --fix"
|
|
65
|
+
},
|
|
66
|
+
"dependencies": {
|
|
67
|
+
"chalk": "4.1.2"
|
|
68
|
+
},
|
|
69
|
+
"peerDependencies": {
|
|
70
|
+
"ts-node": ">=10.0.0"
|
|
71
|
+
},
|
|
72
|
+
"peerDependenciesMeta": {
|
|
73
|
+
"ts-node": {
|
|
74
|
+
"optional": true
|
|
75
|
+
}
|
|
76
|
+
},
|
|
77
|
+
"devDependencies": {
|
|
78
|
+
"ts-node": "10.9.2",
|
|
79
|
+
"@commitlint/cli": "19.6.0",
|
|
80
|
+
"@commitlint/config-conventional": "19.6.0",
|
|
81
|
+
"@release-it/conventional-changelog": "8.0.1",
|
|
82
|
+
"@types/express": "4.17.21",
|
|
83
|
+
"@types/jest": "29.5.13",
|
|
84
|
+
"@types/node": "20.14.10",
|
|
85
|
+
"@typescript-eslint/eslint-plugin": "8.25.0",
|
|
86
|
+
"@typescript-eslint/parser": "8.25.0",
|
|
87
|
+
"eslint": "8.57.0",
|
|
88
|
+
"eslint-config-prettier": "10.0.2",
|
|
89
|
+
"husky": "9.1.1",
|
|
90
|
+
"jest": "29.7.0",
|
|
91
|
+
"prettier": "3.5.3",
|
|
92
|
+
"reflect-metadata": "0.2.2",
|
|
93
|
+
"release-it": "17.6.0",
|
|
94
|
+
"ts-jest": "29.2.5",
|
|
95
|
+
"typescript": "5.5.3"
|
|
96
|
+
},
|
|
97
|
+
"release-it": {
|
|
98
|
+
"git": {
|
|
99
|
+
"commitMessage": "chore(release): ${version}"
|
|
100
|
+
},
|
|
101
|
+
"github": {
|
|
102
|
+
"release": true
|
|
103
|
+
},
|
|
104
|
+
"npm": {
|
|
105
|
+
"publish": false
|
|
106
|
+
},
|
|
107
|
+
"plugins": {
|
|
108
|
+
"@release-it/conventional-changelog": {
|
|
109
|
+
"infile": "CHANGELOG.md",
|
|
110
|
+
"preset": {
|
|
111
|
+
"name": "conventionalcommits",
|
|
112
|
+
"types": [
|
|
113
|
+
{
|
|
114
|
+
"type": "feat",
|
|
115
|
+
"section": "Features"
|
|
116
|
+
},
|
|
117
|
+
{
|
|
118
|
+
"type": "fix",
|
|
119
|
+
"section": "Bug Fixes"
|
|
120
|
+
},
|
|
121
|
+
{
|
|
122
|
+
"type": "perf",
|
|
123
|
+
"section": "Performance Improvements"
|
|
124
|
+
},
|
|
125
|
+
{
|
|
126
|
+
"type": "revert",
|
|
127
|
+
"section": "Reverts"
|
|
128
|
+
},
|
|
129
|
+
{
|
|
130
|
+
"type": "docs",
|
|
131
|
+
"section": "Documentation"
|
|
132
|
+
},
|
|
133
|
+
{
|
|
134
|
+
"type": "refactor",
|
|
135
|
+
"section": "Code Refactoring"
|
|
136
|
+
},
|
|
137
|
+
{
|
|
138
|
+
"type": "test",
|
|
139
|
+
"section": "Tests"
|
|
140
|
+
},
|
|
141
|
+
{
|
|
142
|
+
"type": "build",
|
|
143
|
+
"section": "Build System"
|
|
144
|
+
},
|
|
145
|
+
{
|
|
146
|
+
"type": "ci",
|
|
147
|
+
"section": "Continuous Integrations"
|
|
148
|
+
}
|
|
149
|
+
]
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
}
|