@cley_faye/boilerplate 3.21.2 → 4.0.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 +7 -220
- package/bin/serve_spa.js +0 -1
- package/lib/bin/serve_spa.js +67 -39
- package/lib/express/middlewares/singlepageapp.d.ts +2 -2
- package/lib/express/middlewares/singlepageapp.js +20 -13
- package/lib/grunt/args.d.ts +14 -42
- package/lib/grunt/args.js +27 -41
- package/lib/grunt/reactapp/copy.d.ts +8 -34
- package/lib/grunt/reactapp/copy.js +47 -49
- package/lib/grunt/reactapp/image.d.ts +8 -23
- package/lib/grunt/reactapp/image.js +45 -42
- package/lib/grunt/reactapp/pug.d.ts +8 -30
- package/lib/grunt/reactapp/pug.js +49 -50
- package/lib/grunt/reactapp/sass.d.ts +8 -29
- package/lib/grunt/reactapp/sass.js +48 -43
- package/lib/grunt/reactapp/util.d.ts +5 -9
- package/lib/grunt/reactapp/util.js +12 -15
- package/lib/grunt/reactapp/webpack.d.ts +10 -81
- package/lib/grunt/reactapp/webpack.js +72 -132
- package/lib/grunt/reactapp.d.ts +22 -65
- package/lib/grunt/reactapp.js +70 -93
- package/lib/grunt/util.d.ts +4 -7
- package/lib/grunt/util.js +5 -8
- package/lib/grunt.d.ts +2 -3
- package/lib/grunt.js +5 -5
- package/lib/util.js +5 -4
- package/package.json +24 -36
- package/grunt.js +0 -3
- package/lib/express/autoclose.d.ts +0 -17
- package/lib/express/autoclose.js +0 -76
- package/lib/express/logger.d.ts +0 -25
- package/lib/express/logger.js +0 -132
- package/lib/express/middlewares/bodylogger.d.ts +0 -9
- package/lib/express/middlewares/bodylogger.js +0 -90
- package/lib/express/pipelinebuilder.d.ts +0 -115
- package/lib/express/pipelinebuilder.js +0 -288
- package/lib/express/unprocessableentityerror.d.ts +0 -8
- package/lib/express/unprocessableentityerror.js +0 -57
- package/lib/express.d.ts +0 -158
- package/lib/express.js +0 -218
- package/lib/repl.d.ts +0 -27
- package/lib/repl.js +0 -68
- package/lib/winston.d.ts +0 -38
- package/lib/winston.js +0 -224
package/lib/grunt/reactapp.js
CHANGED
|
@@ -25,16 +25,48 @@
|
|
|
25
25
|
*
|
|
26
26
|
*/
|
|
27
27
|
"use strict";
|
|
28
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
29
|
+
if (k2 === undefined) k2 = k;
|
|
30
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
31
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
32
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
33
|
+
}
|
|
34
|
+
Object.defineProperty(o, k2, desc);
|
|
35
|
+
}) : (function(o, m, k, k2) {
|
|
36
|
+
if (k2 === undefined) k2 = k;
|
|
37
|
+
o[k2] = m[k];
|
|
38
|
+
}));
|
|
39
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
40
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
41
|
+
}) : function(o, v) {
|
|
42
|
+
o["default"] = v;
|
|
43
|
+
});
|
|
44
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
45
|
+
var ownKeys = function(o) {
|
|
46
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
47
|
+
var ar = [];
|
|
48
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
49
|
+
return ar;
|
|
50
|
+
};
|
|
51
|
+
return ownKeys(o);
|
|
52
|
+
};
|
|
53
|
+
return function (mod) {
|
|
54
|
+
if (mod && mod.__esModule) return mod;
|
|
55
|
+
var result = {};
|
|
56
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
57
|
+
__setModuleDefault(result, mod);
|
|
58
|
+
return result;
|
|
59
|
+
};
|
|
60
|
+
})();
|
|
28
61
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
62
|
exports.reactAppDynamicTasks = exports.reactAppOptionsHelper = exports.reactApp = exports.HandlerType = void 0;
|
|
30
|
-
const
|
|
31
|
-
const
|
|
32
|
-
const
|
|
33
|
-
const
|
|
34
|
-
const
|
|
35
|
-
const
|
|
36
|
-
const
|
|
37
|
-
// eslint-disable-next-line no-shadow
|
|
63
|
+
const reactAppCopy = __importStar(require("./reactapp/copy.js"));
|
|
64
|
+
const reactAppImage = __importStar(require("./reactapp/image.js"));
|
|
65
|
+
const reactAppPug = __importStar(require("./reactapp/pug.js"));
|
|
66
|
+
const reactAppSass = __importStar(require("./reactapp/sass.js"));
|
|
67
|
+
const reactAppUtil = __importStar(require("./reactapp/util.js"));
|
|
68
|
+
const reactAppWebpack = __importStar(require("./reactapp/webpack.js"));
|
|
69
|
+
const util = __importStar(require("./util.js"));
|
|
38
70
|
var HandlerType;
|
|
39
71
|
(function (HandlerType) {
|
|
40
72
|
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
@@ -48,24 +80,19 @@ var HandlerType;
|
|
|
48
80
|
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
49
81
|
HandlerType["COPY"] = "copy";
|
|
50
82
|
})(HandlerType || (exports.HandlerType = HandlerType = {}));
|
|
51
|
-
const gatherTasks = (handlers, gruntConfig, targetName, options) => Object.keys(handlers)
|
|
52
|
-
.reduce((acc, cur) => acc.concat((options?.[cur] && options[cur]?.disabled)
|
|
83
|
+
const gatherTasks = (handlers, gruntConfig, targetName, options) => Object.keys(handlers).reduce((acc, cur) => acc.concat(options?.[cur]?.disabled
|
|
53
84
|
? []
|
|
54
|
-
: handlers[cur](gruntConfig, targetName,
|
|
85
|
+
: handlers[cur](gruntConfig, targetName, options?.[cur] ?? {})), []);
|
|
55
86
|
const mergeResults = (tasksResults) => tasksResults.reduce((acc, cur) => {
|
|
56
87
|
acc.requiredTasks = acc.requiredTasks.concat(cur.requiredTasks);
|
|
57
88
|
acc.handledFiles = acc.handledFiles.concat(cur.handledFiles);
|
|
58
89
|
acc.watchTasks = acc.watchTasks.concat(cur.watchTasks);
|
|
59
90
|
return acc;
|
|
60
|
-
}, {
|
|
61
|
-
requiredTasks: [],
|
|
62
|
-
handledFiles: [],
|
|
63
|
-
watchTasks: [],
|
|
64
|
-
});
|
|
91
|
+
}, { handledFiles: [], requiredTasks: [], watchTasks: [] });
|
|
65
92
|
const createCopyTask = (gruntConfig, targetName, mergedResults, options) => {
|
|
66
|
-
const copyOptions =
|
|
93
|
+
const copyOptions = options?.[HandlerType.COPY] ?? {};
|
|
67
94
|
copyOptions.skipFiles = mergedResults.handledFiles;
|
|
68
|
-
const copyTask =
|
|
95
|
+
const copyTask = reactAppCopy.handle(gruntConfig, targetName, copyOptions);
|
|
69
96
|
mergedResults.requiredTasks = mergedResults.requiredTasks.concat(copyTask.requiredTasks);
|
|
70
97
|
mergedResults.watchTasks = mergedResults.watchTasks.concat(copyTask.watchTasks);
|
|
71
98
|
};
|
|
@@ -81,14 +108,9 @@ const getWatchTaskName = (watchTask) => {
|
|
|
81
108
|
return `unnamed${unnamedIndex++}`;
|
|
82
109
|
}
|
|
83
110
|
if (Array.isArray(watchTask.taskToRun)) {
|
|
84
|
-
return watchTask.taskToRun
|
|
85
|
-
.join("_")
|
|
86
|
-
.split(":")
|
|
87
|
-
.join("_");
|
|
111
|
+
return watchTask.taskToRun.join("_").split(":").join("_");
|
|
88
112
|
}
|
|
89
|
-
return watchTask.taskToRun
|
|
90
|
-
.split(":")
|
|
91
|
-
.join("_");
|
|
113
|
+
return watchTask.taskToRun.split(":").join("_");
|
|
92
114
|
};
|
|
93
115
|
const getEffectiveTasksToRun = (watchTask) => {
|
|
94
116
|
if (!watchTask.taskToRun) {
|
|
@@ -103,13 +125,10 @@ const createWatchTasks = (gruntConfig, mergedResults, watchMode) => {
|
|
|
103
125
|
if (watchMode === false) {
|
|
104
126
|
return;
|
|
105
127
|
}
|
|
106
|
-
mergedResults.watchTasks.forEach(watchTask => {
|
|
107
|
-
|
|
108
|
-
options: getWatcherOptions(watchMode),
|
|
128
|
+
mergedResults.watchTasks.forEach((watchTask) => {
|
|
129
|
+
reactAppUtil.insertTask(gruntConfig, "watch", getWatchTaskName(watchTask), {
|
|
109
130
|
files: watchTask.filesToWatch.reduce((acc, cur) => {
|
|
110
|
-
const prefix = watchTask.fromRoot
|
|
111
|
-
? ""
|
|
112
|
-
: "webres/";
|
|
131
|
+
const prefix = watchTask.fromRoot ? "" : "webres/";
|
|
113
132
|
if (cur.startsWith("!")) {
|
|
114
133
|
acc.push(`!${prefix}${cur.substring(1)}`);
|
|
115
134
|
}
|
|
@@ -118,6 +137,7 @@ const createWatchTasks = (gruntConfig, mergedResults, watchMode) => {
|
|
|
118
137
|
}
|
|
119
138
|
return acc;
|
|
120
139
|
}, []),
|
|
140
|
+
options: getWatcherOptions(watchMode),
|
|
121
141
|
tasks: getEffectiveTasksToRun(watchTask),
|
|
122
142
|
});
|
|
123
143
|
});
|
|
@@ -132,55 +152,22 @@ const createWatchTasks = (gruntConfig, mergedResults, watchMode) => {
|
|
|
132
152
|
* - "sass:<targetName>": compile sass/scss files
|
|
133
153
|
* - "copy:<targetName>": copy files not handled in other tasks
|
|
134
154
|
*
|
|
135
|
-
* @param gruntConfig
|
|
136
|
-
* The Grunt configuration with other tasks, before it is passed to
|
|
155
|
+
* @param gruntConfig - The Grunt configuration with other tasks, before it is passed to
|
|
137
156
|
* grunt.initConfig()
|
|
138
157
|
*
|
|
139
|
-
* @param
|
|
140
|
-
* Name for the various targets added to Grunt. Defaults to "reactApp"
|
|
141
|
-
*
|
|
142
|
-
* @param [options]
|
|
143
|
-
* Options to control the extra tasks
|
|
144
|
-
*
|
|
145
|
-
* @param [options.pug]
|
|
146
|
-
* Options for the pug task. See pug.js for details.
|
|
158
|
+
* @param targetName - Name for the various targets added to Grunt. Defaults to "reactApp"
|
|
147
159
|
*
|
|
148
|
-
* @param
|
|
149
|
-
* Do not generate pug task
|
|
160
|
+
* @param options - Options to control the extra tasks
|
|
150
161
|
*
|
|
151
|
-
* @
|
|
152
|
-
* Options for the image task. See image.js for details.
|
|
153
|
-
*
|
|
154
|
-
* @param [options.image.disabled]
|
|
155
|
-
* Do not generate image task
|
|
156
|
-
*
|
|
157
|
-
* @param [options.webpack]
|
|
158
|
-
* Options for the webpack task. See webpack.js for details.
|
|
159
|
-
*
|
|
160
|
-
* @param [options.webpack.disabled]
|
|
161
|
-
* Do not generate webpack task
|
|
162
|
-
*
|
|
163
|
-
* @param [options.sass]
|
|
164
|
-
* Options for the sass task. See sass.js for details.
|
|
165
|
-
*
|
|
166
|
-
* @param [options.sass.disabled]
|
|
167
|
-
* Do not generate sass task
|
|
168
|
-
*
|
|
169
|
-
* @param [options.copy]
|
|
170
|
-
* Optiosn for the copy task. See copy.js for details.
|
|
171
|
-
*
|
|
172
|
-
* @param [options.copy.disabled]
|
|
173
|
-
* Do not generate copy task
|
|
174
|
-
*
|
|
175
|
-
* @return
|
|
162
|
+
* @returns
|
|
176
163
|
* List of tasks to build the application
|
|
177
164
|
*/
|
|
178
165
|
const reactApp = (gruntConfig, targetName = "reactApp", options) => {
|
|
179
166
|
const handlers = {
|
|
180
|
-
[HandlerType.PUG]:
|
|
181
|
-
[HandlerType.IMAGE]:
|
|
182
|
-
[HandlerType.WEBPACK]:
|
|
183
|
-
[HandlerType.SASS]:
|
|
167
|
+
[HandlerType.PUG]: reactAppPug.handle,
|
|
168
|
+
[HandlerType.IMAGE]: reactAppImage.handle,
|
|
169
|
+
[HandlerType.WEBPACK]: reactAppWebpack.handle,
|
|
170
|
+
[HandlerType.SASS]: reactAppSass.handle,
|
|
184
171
|
};
|
|
185
172
|
const tasksResults = gatherTasks(handlers, gruntConfig, targetName, options);
|
|
186
173
|
const mergedResults = mergeResults(tasksResults);
|
|
@@ -193,31 +180,22 @@ const reactApp = (gruntConfig, targetName = "reactApp", options) => {
|
|
|
193
180
|
exports.reactApp = reactApp;
|
|
194
181
|
/** Helper for common options shared across multiple tasks.
|
|
195
182
|
*
|
|
196
|
-
* @param
|
|
197
|
-
* Options shared by multiple tasks
|
|
198
|
-
*
|
|
199
|
-
* @param [helperOptions.production]
|
|
200
|
-
* Make a production build.
|
|
201
|
-
* - set outputStyle and sourceMap for sass
|
|
202
|
-
* - set pretty for pug
|
|
203
|
-
* - add a "productionBuild" property in pug data
|
|
204
|
-
* - set mode for webpack
|
|
183
|
+
* @param helperOptions - Options shared by multiple tasks
|
|
205
184
|
*
|
|
206
|
-
* @param
|
|
207
|
-
* Initial options for reactApp().
|
|
185
|
+
* @param options - Initial options for reactApp().
|
|
208
186
|
* This object will be copied and required parameters will be added by this
|
|
209
187
|
* function.
|
|
210
188
|
* Modified object are also duplicated, so no original data is modified.
|
|
211
189
|
*
|
|
212
|
-
* @
|
|
190
|
+
* @returns
|
|
213
191
|
* A configuration object for reactApp().
|
|
214
192
|
*/
|
|
215
193
|
const reactAppOptionsHelper = (helperOptions, options) => {
|
|
216
|
-
let result =
|
|
217
|
-
result =
|
|
218
|
-
result =
|
|
219
|
-
result =
|
|
220
|
-
result =
|
|
194
|
+
let result = util.deepSet(options, "sass.options.outputStyle", helperOptions.production ? "compressed" : "expanded");
|
|
195
|
+
result = util.deepSet(result, "sass.options.sourceMap", !helperOptions.production);
|
|
196
|
+
result = util.deepSet(result, "pug.options.pretty", !helperOptions.production);
|
|
197
|
+
result = util.deepSet(result, "pug.options.data.productionBuild", Boolean(helperOptions.production));
|
|
198
|
+
result = util.deepSet(result, "webpack.mode", helperOptions.production ? "production" : "development");
|
|
221
199
|
if (helperOptions.watch !== undefined) {
|
|
222
200
|
result.watch = helperOptions.watch;
|
|
223
201
|
}
|
|
@@ -230,12 +208,11 @@ exports.reactAppOptionsHelper = reactAppOptionsHelper;
|
|
|
230
208
|
* Must be called before any other `grunt.registerTask()`
|
|
231
209
|
*/
|
|
232
210
|
const reactAppDynamicTasks = (grunt, gruntConfig) => {
|
|
233
|
-
if (!(
|
|
211
|
+
if (!(reactAppUtil.dynamicKey in gruntConfig)) {
|
|
234
212
|
return;
|
|
235
213
|
}
|
|
236
|
-
Object.keys(gruntConfig[
|
|
237
|
-
|
|
238
|
-
grunt.registerTask(dynamicTaskName, gruntConfig[util_js_2.dynamicKey][dynamicTaskName]);
|
|
214
|
+
Object.keys(gruntConfig[reactAppUtil.dynamicKey]).forEach((dynamicTaskName) => {
|
|
215
|
+
grunt.registerTask(dynamicTaskName, gruntConfig[reactAppUtil.dynamicKey][dynamicTaskName]);
|
|
239
216
|
});
|
|
240
217
|
};
|
|
241
218
|
exports.reactAppDynamicTasks = reactAppDynamicTasks;
|
package/lib/grunt/util.d.ts
CHANGED
|
@@ -8,16 +8,13 @@ export type GenericConfigObject = Record<string, ConfigValue>;
|
|
|
8
8
|
* This will set, for example, sourceObject.foo.bar = value by making copies of
|
|
9
9
|
* all intermediate objects.
|
|
10
10
|
*
|
|
11
|
-
* @param sourceObject
|
|
12
|
-
* Object to copy/update
|
|
11
|
+
* @param sourceObject - Object to copy/update
|
|
13
12
|
*
|
|
14
|
-
* @param path
|
|
15
|
-
* Properties path (for the example above: "foo.bar")
|
|
13
|
+
* @param path - Properties path (for the example above: "foo.bar")
|
|
16
14
|
*
|
|
17
|
-
* @param value
|
|
18
|
-
* The value to set
|
|
15
|
+
* @param value - The value to set
|
|
19
16
|
*
|
|
20
|
-
* @
|
|
17
|
+
* @returns
|
|
21
18
|
* A copy of sourceObject with the property set
|
|
22
19
|
*/
|
|
23
20
|
export declare const deepSet: (sourceObject: GenericConfigObject, path: string, value: string | number | boolean | Record<string, unknown> | null) => GenericConfigObject;
|
package/lib/grunt/util.js
CHANGED
|
@@ -32,23 +32,20 @@ exports.deepSet = void 0;
|
|
|
32
32
|
* This will set, for example, sourceObject.foo.bar = value by making copies of
|
|
33
33
|
* all intermediate objects.
|
|
34
34
|
*
|
|
35
|
-
* @param sourceObject
|
|
36
|
-
* Object to copy/update
|
|
35
|
+
* @param sourceObject - Object to copy/update
|
|
37
36
|
*
|
|
38
|
-
* @param path
|
|
39
|
-
* Properties path (for the example above: "foo.bar")
|
|
37
|
+
* @param path - Properties path (for the example above: "foo.bar")
|
|
40
38
|
*
|
|
41
|
-
* @param value
|
|
42
|
-
* The value to set
|
|
39
|
+
* @param value - The value to set
|
|
43
40
|
*
|
|
44
|
-
* @
|
|
41
|
+
* @returns
|
|
45
42
|
* A copy of sourceObject with the property set
|
|
46
43
|
*/
|
|
47
44
|
const deepSet = (sourceObject, path, value) => {
|
|
48
45
|
const result = { ...sourceObject };
|
|
49
46
|
const pathElements = path.split(".");
|
|
50
47
|
let cursor = result;
|
|
51
|
-
pathElements.slice(0, -1).forEach(pathElement => {
|
|
48
|
+
pathElements.slice(0, -1).forEach((pathElement) => {
|
|
52
49
|
cursor[pathElement] = { ...cursor[pathElement] };
|
|
53
50
|
cursor = cursor[pathElement];
|
|
54
51
|
});
|
package/lib/grunt.d.ts
CHANGED
|
@@ -1,3 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
export { reactApp, reactAppOptionsHelper, reactAppDynamicTasks, getOpts, OptType, };
|
|
1
|
+
export { getOptionsFromGruntCLI as getOpts, OptType } from "./grunt/args.js";
|
|
2
|
+
export { reactApp, reactAppOptionsHelper, reactAppDynamicTasks } from "./grunt/reactapp.js";
|
package/lib/grunt.js
CHANGED
|
@@ -26,11 +26,11 @@
|
|
|
26
26
|
*/
|
|
27
27
|
"use strict";
|
|
28
28
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
-
exports.
|
|
30
|
-
|
|
29
|
+
exports.reactAppDynamicTasks = exports.reactAppOptionsHelper = exports.reactApp = exports.OptType = exports.getOpts = void 0;
|
|
30
|
+
var args_js_1 = require("./grunt/args.js");
|
|
31
|
+
Object.defineProperty(exports, "getOpts", { enumerable: true, get: function () { return args_js_1.getOptionsFromGruntCLI; } });
|
|
32
|
+
Object.defineProperty(exports, "OptType", { enumerable: true, get: function () { return args_js_1.OptType; } });
|
|
33
|
+
var reactapp_js_1 = require("./grunt/reactapp.js");
|
|
31
34
|
Object.defineProperty(exports, "reactApp", { enumerable: true, get: function () { return reactapp_js_1.reactApp; } });
|
|
32
35
|
Object.defineProperty(exports, "reactAppOptionsHelper", { enumerable: true, get: function () { return reactapp_js_1.reactAppOptionsHelper; } });
|
|
33
36
|
Object.defineProperty(exports, "reactAppDynamicTasks", { enumerable: true, get: function () { return reactapp_js_1.reactAppDynamicTasks; } });
|
|
34
|
-
const args_js_1 = require("./grunt/args.js");
|
|
35
|
-
Object.defineProperty(exports, "getOpts", { enumerable: true, get: function () { return args_js_1.getOptionsFromGruntCLI; } });
|
|
36
|
-
Object.defineProperty(exports, "OptType", { enumerable: true, get: function () { return args_js_1.OptType; } });
|
package/lib/util.js
CHANGED
|
@@ -39,10 +39,11 @@ const trimWordEnd = 3;
|
|
|
39
39
|
const camelToKebab = (camel) => camel.length === 0
|
|
40
40
|
? ""
|
|
41
41
|
: `${camel[0].toUpperCase()}${camel.substring(1)}`
|
|
42
|
-
.replace(/[A-Z][A-Z0-9]+[a-z0-9]/
|
|
43
|
-
|
|
44
|
-
|
|
42
|
+
.replace(/[A-Z][A-Z0-9]+[a-z0-9]/gu, (value) => value[0] +
|
|
43
|
+
value.substring(1, value.length - trimWordEnd + 1).toLowerCase() +
|
|
44
|
+
value.substring(value.length - trimWordStart))
|
|
45
|
+
.replace(/[A-Z][A-Z]+$/u, (value) => value[0] + value.substring(1).toLowerCase())
|
|
45
46
|
.split(/(?=[A-Z])/u)
|
|
46
|
-
.map(word => word.toLowerCase())
|
|
47
|
+
.map((word) => word.toLowerCase())
|
|
47
48
|
.join("-");
|
|
48
49
|
exports.camelToKebab = camelToKebab;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cley_faye/boilerplate",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "4.0.1",
|
|
4
4
|
"description": "Boilerplate code generator for generic projects",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -21,53 +21,50 @@
|
|
|
21
21
|
},
|
|
22
22
|
"homepage": "https://github.com/CleyFaye/boilerplate#readme",
|
|
23
23
|
"devDependencies": {
|
|
24
|
-
"@
|
|
25
|
-
"@
|
|
26
|
-
"@types/
|
|
27
|
-
"@types/
|
|
28
|
-
"@types/
|
|
29
|
-
"@types/
|
|
30
|
-
"@types/
|
|
31
|
-
"@
|
|
32
|
-
"
|
|
33
|
-
"eslint": "^
|
|
34
|
-
"eslint-plugin-
|
|
35
|
-
"eslint-plugin-
|
|
36
|
-
"eslint-plugin-
|
|
37
|
-
"
|
|
38
|
-
"express-winston": "^4.2.0",
|
|
24
|
+
"@eslint/js": "^9.39.0",
|
|
25
|
+
"@keeex/eslint-config": "^2.6.0",
|
|
26
|
+
"@types/express": "^5.0.5",
|
|
27
|
+
"@types/grunt": "^0.4.32",
|
|
28
|
+
"@types/http-errors": "^2.0.5",
|
|
29
|
+
"@types/minimist": "^1.2.5",
|
|
30
|
+
"@types/node": "^24.10.0",
|
|
31
|
+
"@types/webpack-bundle-analyzer": "^4.7.0",
|
|
32
|
+
"eslint": "9.38",
|
|
33
|
+
"eslint-import-resolver-typescript": "^4.4.4",
|
|
34
|
+
"eslint-plugin-import-x": "^4.16.1",
|
|
35
|
+
"eslint-plugin-promise": "^7.2.1",
|
|
36
|
+
"eslint-plugin-tsdoc": "^0.4.0",
|
|
37
|
+
"globals": "^16.5.0",
|
|
39
38
|
"grunt": "^1.6.1",
|
|
40
39
|
"grunt-banner": "^0.6.0",
|
|
41
40
|
"grunt-contrib-clean": "^2.0.1",
|
|
42
41
|
"grunt-run": "^0.8.1",
|
|
43
42
|
"load-grunt-tasks": "^5.1.0",
|
|
44
|
-
"logform": "^2.
|
|
45
|
-
"
|
|
46
|
-
"
|
|
47
|
-
"
|
|
43
|
+
"logform": "^2.7.0",
|
|
44
|
+
"prettier": "^3.6.2",
|
|
45
|
+
"typescript": "^5.9.3",
|
|
46
|
+
"typescript-eslint": "^8.46.2",
|
|
47
|
+
"webpack": "^5.102.1"
|
|
48
48
|
},
|
|
49
49
|
"peerDependencies": {
|
|
50
50
|
"@babel/core": "7.x",
|
|
51
51
|
"@babel/plugin-transform-runtime": "7.x",
|
|
52
52
|
"@babel/preset-env": "7.x",
|
|
53
53
|
"@babel/preset-react": "7.x",
|
|
54
|
-
"babel-loader": "9.x",
|
|
54
|
+
"babel-loader": "9.x || 10.x",
|
|
55
55
|
"babel-plugin-transform-define": "2.x",
|
|
56
56
|
"core-js": "3.x",
|
|
57
|
-
"
|
|
58
|
-
"express": "4.x",
|
|
59
|
-
"express-winston": "4.x",
|
|
57
|
+
"express": "4.x || 5.x",
|
|
60
58
|
"grunt": "1.x",
|
|
61
59
|
"grunt-contrib-copy": "1.x",
|
|
62
60
|
"grunt-contrib-pug": "3.x",
|
|
63
61
|
"grunt-contrib-watch": "1.x",
|
|
64
62
|
"grunt-sass": "3.x",
|
|
65
|
-
"grunt-webpack": "5.x||6.x",
|
|
63
|
+
"grunt-webpack": "5.x||6.x||7.x",
|
|
66
64
|
"minimist": "^1.2.8",
|
|
67
65
|
"sass": "1.x",
|
|
68
66
|
"ts-loader": "^9.4.1",
|
|
69
|
-
"webpack-bundle-analyzer": "^4.9.1"
|
|
70
|
-
"winston": "3.x"
|
|
67
|
+
"webpack-bundle-analyzer": "^4.9.1"
|
|
71
68
|
},
|
|
72
69
|
"peerDependenciesMeta": {
|
|
73
70
|
"@babel/core": {
|
|
@@ -91,15 +88,9 @@
|
|
|
91
88
|
"core-js": {
|
|
92
89
|
"optional": true
|
|
93
90
|
},
|
|
94
|
-
"eslint-webpack-plugin": {
|
|
95
|
-
"optional": true
|
|
96
|
-
},
|
|
97
91
|
"express": {
|
|
98
92
|
"optional": true
|
|
99
93
|
},
|
|
100
|
-
"express-winston": {
|
|
101
|
-
"optional": true
|
|
102
|
-
},
|
|
103
94
|
"grunt": {
|
|
104
95
|
"optional": true
|
|
105
96
|
},
|
|
@@ -129,9 +120,6 @@
|
|
|
129
120
|
},
|
|
130
121
|
"webpack-bundle-analyzer": {
|
|
131
122
|
"optional": true
|
|
132
|
-
},
|
|
133
|
-
"winston": {
|
|
134
|
-
"optional": true
|
|
135
123
|
}
|
|
136
124
|
},
|
|
137
125
|
"files": [
|
package/grunt.js
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { Server } from "net";
|
|
2
|
-
/** Store a server instance for closing it later.
|
|
3
|
-
*
|
|
4
|
-
* @param {Object} ref
|
|
5
|
-
* The server instance
|
|
6
|
-
*/
|
|
7
|
-
export declare const setRef: (ref: Server) => void;
|
|
8
|
-
/** Remove a server instance from the closing list.
|
|
9
|
-
*
|
|
10
|
-
* @param {Object} ref
|
|
11
|
-
* The server instance
|
|
12
|
-
*/
|
|
13
|
-
export declare const unsetRef: (ref: Server) => void;
|
|
14
|
-
/** Close the stored server reference */
|
|
15
|
-
export declare const closeServer: () => void;
|
|
16
|
-
/** Stop the server on SIGINT */
|
|
17
|
-
export declare const setSignalHandler: () => void;
|
package/lib/express/autoclose.js
DELETED
|
@@ -1,76 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @license
|
|
3
|
-
* @preserve
|
|
4
|
-
* MIT License
|
|
5
|
-
*
|
|
6
|
-
* Copyright (c) 2021 Gabriel Paul "Cley Faye" Risterucci
|
|
7
|
-
*
|
|
8
|
-
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
9
|
-
* of this software and associated documentation files (the "Software"), to deal
|
|
10
|
-
* in the Software without restriction, including without limitation the rights
|
|
11
|
-
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
12
|
-
* copies of the Software, and to permit persons to whom the Software is
|
|
13
|
-
* furnished to do so, subject to the following conditions:
|
|
14
|
-
*
|
|
15
|
-
* The above copyright notice and this permission notice shall be included in all
|
|
16
|
-
* copies or substantial portions of the Software.
|
|
17
|
-
*
|
|
18
|
-
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
19
|
-
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
20
|
-
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
21
|
-
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
22
|
-
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
23
|
-
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
24
|
-
* SOFTWARE.
|
|
25
|
-
*
|
|
26
|
-
*/
|
|
27
|
-
"use strict";
|
|
28
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
-
exports.setSignalHandler = exports.closeServer = exports.unsetRef = exports.setRef = void 0;
|
|
30
|
-
const serverRefs = [];
|
|
31
|
-
/** Store a server instance for closing it later.
|
|
32
|
-
*
|
|
33
|
-
* @param {Object} ref
|
|
34
|
-
* The server instance
|
|
35
|
-
*/
|
|
36
|
-
const setRef = (ref) => {
|
|
37
|
-
if (serverRefs.includes(ref)) {
|
|
38
|
-
return;
|
|
39
|
-
}
|
|
40
|
-
serverRefs.push(ref);
|
|
41
|
-
};
|
|
42
|
-
exports.setRef = setRef;
|
|
43
|
-
/** Remove a server instance from the closing list.
|
|
44
|
-
*
|
|
45
|
-
* @param {Object} ref
|
|
46
|
-
* The server instance
|
|
47
|
-
*/
|
|
48
|
-
const unsetRef = (ref) => {
|
|
49
|
-
if (!serverRefs.includes(ref)) {
|
|
50
|
-
return;
|
|
51
|
-
}
|
|
52
|
-
serverRefs.splice(serverRefs.indexOf(ref), 1);
|
|
53
|
-
};
|
|
54
|
-
exports.unsetRef = unsetRef;
|
|
55
|
-
/** Close the stored server reference */
|
|
56
|
-
const closeServer = () => {
|
|
57
|
-
serverRefs.forEach(ref => ref.close());
|
|
58
|
-
serverRefs.length = 0;
|
|
59
|
-
};
|
|
60
|
-
exports.closeServer = closeServer;
|
|
61
|
-
/** Stop the server on SIGINT */
|
|
62
|
-
const setSignalHandler = () => {
|
|
63
|
-
if (process.platform === "win32") {
|
|
64
|
-
process.on("message", msg => {
|
|
65
|
-
if (msg === "shutdown") {
|
|
66
|
-
(0, exports.closeServer)();
|
|
67
|
-
}
|
|
68
|
-
});
|
|
69
|
-
}
|
|
70
|
-
else {
|
|
71
|
-
process.on("SIGINT", () => {
|
|
72
|
-
(0, exports.closeServer)();
|
|
73
|
-
});
|
|
74
|
-
}
|
|
75
|
-
};
|
|
76
|
-
exports.setSignalHandler = setSignalHandler;
|
package/lib/express/logger.d.ts
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import expressWinston, { BaseLoggerOptions } from "express-winston";
|
|
2
|
-
import { Request, Router } from "express";
|
|
3
|
-
import { LogOptions, UserFromReqFunc } from "./pipelinebuilder.js";
|
|
4
|
-
export type LoggerOptions = expressWinston.BaseLoggerOptions | boolean;
|
|
5
|
-
interface ErrorLoggerConfiguration {
|
|
6
|
-
/** @deprecated Use collapseStacktrace */
|
|
7
|
-
collapseNodeModules?: boolean;
|
|
8
|
-
collapseStacktrace?: boolean;
|
|
9
|
-
extraFilter?: Array<RegExp> | RegExp;
|
|
10
|
-
}
|
|
11
|
-
export type ErrorLoggerOptions = ErrorLoggerConfiguration | boolean;
|
|
12
|
-
export interface LoggingData {
|
|
13
|
-
extraLoggingData?: Record<string, unknown>;
|
|
14
|
-
}
|
|
15
|
-
export interface RequestWithLoggingData extends Request {
|
|
16
|
-
_cleyfayeLogging?: LoggingData;
|
|
17
|
-
_routeWhitelists?: {
|
|
18
|
-
body?: Array<string>;
|
|
19
|
-
};
|
|
20
|
-
}
|
|
21
|
-
/** Return the default value for route logger is it is set as `true` */
|
|
22
|
-
export declare const defaultRouteLoggerConfig: (authFromReq?: UserFromReqFunc) => BaseLoggerOptions;
|
|
23
|
-
export declare const registerRouteLogger: (app: Router, logOptions?: LogOptions) => void;
|
|
24
|
-
export declare const registerErrorLogger: (app: Router, logOptions?: LogOptions) => void;
|
|
25
|
-
export {};
|