@expressots/shared 3.0.0 → 4.0.0-preview.3
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/LICENSE.md +21 -21
- package/README.md +51 -118
- package/lib/CHANGELOG.md +27 -7
- package/lib/README.md +51 -118
- package/lib/cjs/config/index.js +3 -0
- package/lib/cjs/config/project-config.js +17 -0
- package/lib/cjs/env/cli-options.js +2 -2
- package/lib/cjs/env/environment.js +17 -17
- 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 +6 -1
- 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 +16 -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 +167 -147
- package/package.json +167 -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,167 @@
|
|
|
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
|
-
"
|
|
40
|
-
"
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
"
|
|
44
|
-
"
|
|
45
|
-
"
|
|
46
|
-
"
|
|
47
|
-
"
|
|
48
|
-
"
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
"
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
"
|
|
55
|
-
"
|
|
56
|
-
"
|
|
57
|
-
"
|
|
58
|
-
"
|
|
59
|
-
"
|
|
60
|
-
"
|
|
61
|
-
"
|
|
62
|
-
"
|
|
63
|
-
"
|
|
64
|
-
"
|
|
65
|
-
"
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
"
|
|
69
|
-
"
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
"
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
"
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
"
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
"
|
|
85
|
-
"
|
|
86
|
-
"release-it": "
|
|
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
|
-
"type": "
|
|
128
|
-
"section": "
|
|
129
|
-
},
|
|
130
|
-
{
|
|
131
|
-
"type": "
|
|
132
|
-
"section": "
|
|
133
|
-
},
|
|
134
|
-
{
|
|
135
|
-
"type": "
|
|
136
|
-
"section": "
|
|
137
|
-
},
|
|
138
|
-
{
|
|
139
|
-
"type": "
|
|
140
|
-
"section": "
|
|
141
|
-
}
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
1
|
+
{
|
|
2
|
+
"name": "@expressots/shared",
|
|
3
|
+
"version": "4.0.0-preview.3",
|
|
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
|
+
"engines": {
|
|
40
|
+
"node": ">=20.18.0"
|
|
41
|
+
},
|
|
42
|
+
"keywords": [
|
|
43
|
+
"expressots",
|
|
44
|
+
"nodejs",
|
|
45
|
+
"typescript",
|
|
46
|
+
"clean-architecture",
|
|
47
|
+
"typescript-framework",
|
|
48
|
+
"framework",
|
|
49
|
+
"server-side",
|
|
50
|
+
"backend",
|
|
51
|
+
"library"
|
|
52
|
+
],
|
|
53
|
+
"scripts": {
|
|
54
|
+
"prepare": "husky",
|
|
55
|
+
"clean": "node scripts/rm.js lib",
|
|
56
|
+
"copy": "node scripts/copy.js package.json README.md CHANGELOG.md lib",
|
|
57
|
+
"build": "npm run clean && npm run build:cjs && npm run build:esm && npm run copy",
|
|
58
|
+
"build:cjs": "tsc -p tsconfig.cjs.json",
|
|
59
|
+
"build:esm": "node scripts/build-esm.js",
|
|
60
|
+
"release": "release-it",
|
|
61
|
+
"release:prepare": "node scripts/release/prepare-publish.mjs",
|
|
62
|
+
"release:restore": "node scripts/release/restore-package-json.mjs",
|
|
63
|
+
"release:publish": "npm run build && npm run release:prepare && npm publish --tag next --access public && npm run release:restore",
|
|
64
|
+
"prepublish": "npm run build && npm pack",
|
|
65
|
+
"test": "jest",
|
|
66
|
+
"test:watch": "jest --watch",
|
|
67
|
+
"coverage": "jest --coverage",
|
|
68
|
+
"format": "prettier --write \"src/**/*.ts\" --cache",
|
|
69
|
+
"lint": "eslint \"src/**/*.ts\" --cache --cache-location node_modules/.cache/eslint/",
|
|
70
|
+
"lint:fix": "eslint \"src/**/*.ts\" --fix --cache --cache-location node_modules/.cache/eslint/"
|
|
71
|
+
},
|
|
72
|
+
"dependencies": {
|
|
73
|
+
"chalk": "4.1.2"
|
|
74
|
+
},
|
|
75
|
+
"peerDependencies": {
|
|
76
|
+
"ts-node": ">=10.0.0"
|
|
77
|
+
},
|
|
78
|
+
"peerDependenciesMeta": {
|
|
79
|
+
"ts-node": {
|
|
80
|
+
"optional": true
|
|
81
|
+
}
|
|
82
|
+
},
|
|
83
|
+
"devDependencies": {
|
|
84
|
+
"@commitlint/cli": "19.6.0",
|
|
85
|
+
"@commitlint/config-conventional": "19.6.0",
|
|
86
|
+
"@release-it/conventional-changelog": "^11.0.0",
|
|
87
|
+
"@types/express": "4.17.21",
|
|
88
|
+
"@types/jest": "29.5.13",
|
|
89
|
+
"@types/node": "20.14.10",
|
|
90
|
+
"@typescript-eslint/eslint-plugin": "8.25.0",
|
|
91
|
+
"@typescript-eslint/parser": "8.25.0",
|
|
92
|
+
"eslint": "8.57.0",
|
|
93
|
+
"eslint-config-prettier": "10.0.2",
|
|
94
|
+
"husky": "9.1.1",
|
|
95
|
+
"jest": "29.7.0",
|
|
96
|
+
"lint-staged": "^15.2.10",
|
|
97
|
+
"prettier": "3.5.3",
|
|
98
|
+
"reflect-metadata": "0.2.2",
|
|
99
|
+
"release-it": "^20.0.1",
|
|
100
|
+
"ts-jest": "29.2.5",
|
|
101
|
+
"ts-node": "10.9.2",
|
|
102
|
+
"typescript": "5.5.3"
|
|
103
|
+
},
|
|
104
|
+
"lint-staged": {
|
|
105
|
+
"src/**/*.ts": [
|
|
106
|
+
"eslint --cache --cache-location node_modules/.cache/eslint/ --fix",
|
|
107
|
+
"prettier --write --cache"
|
|
108
|
+
]
|
|
109
|
+
},
|
|
110
|
+
"release-it": {
|
|
111
|
+
"git": {
|
|
112
|
+
"commitMessage": "chore(release): ${version}"
|
|
113
|
+
},
|
|
114
|
+
"github": {
|
|
115
|
+
"release": true
|
|
116
|
+
},
|
|
117
|
+
"npm": {
|
|
118
|
+
"publish": false
|
|
119
|
+
},
|
|
120
|
+
"plugins": {
|
|
121
|
+
"@release-it/conventional-changelog": {
|
|
122
|
+
"infile": "CHANGELOG.md",
|
|
123
|
+
"preset": {
|
|
124
|
+
"name": "conventionalcommits",
|
|
125
|
+
"types": [
|
|
126
|
+
{
|
|
127
|
+
"type": "feat",
|
|
128
|
+
"section": "Features"
|
|
129
|
+
},
|
|
130
|
+
{
|
|
131
|
+
"type": "fix",
|
|
132
|
+
"section": "Bug Fixes"
|
|
133
|
+
},
|
|
134
|
+
{
|
|
135
|
+
"type": "perf",
|
|
136
|
+
"section": "Performance Improvements"
|
|
137
|
+
},
|
|
138
|
+
{
|
|
139
|
+
"type": "revert",
|
|
140
|
+
"section": "Reverts"
|
|
141
|
+
},
|
|
142
|
+
{
|
|
143
|
+
"type": "docs",
|
|
144
|
+
"section": "Documentation"
|
|
145
|
+
},
|
|
146
|
+
{
|
|
147
|
+
"type": "refactor",
|
|
148
|
+
"section": "Code Refactoring"
|
|
149
|
+
},
|
|
150
|
+
{
|
|
151
|
+
"type": "test",
|
|
152
|
+
"section": "Tests"
|
|
153
|
+
},
|
|
154
|
+
{
|
|
155
|
+
"type": "build",
|
|
156
|
+
"section": "Build System"
|
|
157
|
+
},
|
|
158
|
+
{
|
|
159
|
+
"type": "ci",
|
|
160
|
+
"section": "Continuous Integrations"
|
|
161
|
+
}
|
|
162
|
+
]
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
}
|