@cley_faye/boilerplate 3.21.3 → 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 -219
- 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 +9 -80
- package/lib/grunt/reactapp/webpack.js +71 -125
- package/lib/grunt/reactapp.d.ts +22 -64
- 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 +22 -29
- 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 -156
- 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.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import
|
|
1
|
+
import * as reactAppCopy from "./reactapp/copy.js";
|
|
2
|
+
import * as reactAppImage from "./reactapp/image.js";
|
|
3
|
+
import * as reactAppPug from "./reactapp/pug.js";
|
|
4
|
+
import * as reactAppSass from "./reactapp/sass.js";
|
|
5
|
+
import * as reactAppUtil from "./reactapp/util.js";
|
|
6
|
+
import * as reactAppWebpack from "./reactapp/webpack.js";
|
|
7
|
+
import * as util from "./util.js";
|
|
8
8
|
export declare enum HandlerType {
|
|
9
9
|
PUG = "pug",
|
|
10
10
|
IMAGE = "image",
|
|
@@ -13,11 +13,11 @@ export declare enum HandlerType {
|
|
|
13
13
|
COPY = "copy"
|
|
14
14
|
}
|
|
15
15
|
export interface ReactAppOptions {
|
|
16
|
-
[HandlerType.PUG]?: PugOptions;
|
|
17
|
-
[HandlerType.IMAGE]?: ImageOptions;
|
|
18
|
-
[HandlerType.WEBPACK]?: WebpackOptions;
|
|
19
|
-
[HandlerType.SASS]?: SassOptions;
|
|
20
|
-
[HandlerType.COPY]?: CopyOptions;
|
|
16
|
+
[HandlerType.PUG]?: reactAppPug.PugOptions;
|
|
17
|
+
[HandlerType.IMAGE]?: reactAppImage.ImageOptions;
|
|
18
|
+
[HandlerType.WEBPACK]?: reactAppWebpack.WebpackOptions;
|
|
19
|
+
[HandlerType.SASS]?: reactAppSass.SassOptions;
|
|
20
|
+
[HandlerType.COPY]?: reactAppCopy.CopyOptions;
|
|
21
21
|
watch?: number | boolean;
|
|
22
22
|
}
|
|
23
23
|
export interface WatchTaskDef {
|
|
@@ -30,7 +30,7 @@ export interface HandlerFunctionResult {
|
|
|
30
30
|
handledFiles: Array<string>;
|
|
31
31
|
watchTasks: Array<WatchTaskDef>;
|
|
32
32
|
}
|
|
33
|
-
export type HandlerFunction = (gruntConfig: GruntConfig, targetName: string, options: BaseOptions) => HandlerFunctionResult;
|
|
33
|
+
export type HandlerFunction = (gruntConfig: reactAppUtil.GruntConfig, targetName: string, options: util.BaseOptions) => HandlerFunctionResult;
|
|
34
34
|
/** Insert necessary build step for a React/Web app.
|
|
35
35
|
*
|
|
36
36
|
* This function will add the following Grunt tasks:
|
|
@@ -41,73 +41,31 @@ export type HandlerFunction = (gruntConfig: GruntConfig, targetName: string, opt
|
|
|
41
41
|
* - "sass:<targetName>": compile sass/scss files
|
|
42
42
|
* - "copy:<targetName>": copy files not handled in other tasks
|
|
43
43
|
*
|
|
44
|
-
* @param gruntConfig
|
|
45
|
-
* The Grunt configuration with other tasks, before it is passed to
|
|
44
|
+
* @param gruntConfig - The Grunt configuration with other tasks, before it is passed to
|
|
46
45
|
* grunt.initConfig()
|
|
47
46
|
*
|
|
48
|
-
* @param
|
|
49
|
-
* Name for the various targets added to Grunt. Defaults to "reactApp"
|
|
47
|
+
* @param targetName - Name for the various targets added to Grunt. Defaults to "reactApp"
|
|
50
48
|
*
|
|
51
|
-
* @param
|
|
52
|
-
* Options to control the extra tasks
|
|
49
|
+
* @param options - Options to control the extra tasks
|
|
53
50
|
*
|
|
54
|
-
* @
|
|
55
|
-
* Options for the pug task. See pug.js for details.
|
|
56
|
-
*
|
|
57
|
-
* @param [options.pug.disabled]
|
|
58
|
-
* Do not generate pug task
|
|
59
|
-
*
|
|
60
|
-
* @param [options.image]
|
|
61
|
-
* Options for the image task. See image.js for details.
|
|
62
|
-
*
|
|
63
|
-
* @param [options.image.disabled]
|
|
64
|
-
* Do not generate image task
|
|
65
|
-
*
|
|
66
|
-
* @param [options.webpack]
|
|
67
|
-
* Options for the webpack task. See webpack.js for details.
|
|
68
|
-
*
|
|
69
|
-
* @param [options.webpack.disabled]
|
|
70
|
-
* Do not generate webpack task
|
|
71
|
-
*
|
|
72
|
-
* @param [options.sass]
|
|
73
|
-
* Options for the sass task. See sass.js for details.
|
|
74
|
-
*
|
|
75
|
-
* @param [options.sass.disabled]
|
|
76
|
-
* Do not generate sass task
|
|
77
|
-
*
|
|
78
|
-
* @param [options.copy]
|
|
79
|
-
* Optiosn for the copy task. See copy.js for details.
|
|
80
|
-
*
|
|
81
|
-
* @param [options.copy.disabled]
|
|
82
|
-
* Do not generate copy task
|
|
83
|
-
*
|
|
84
|
-
* @return
|
|
51
|
+
* @returns
|
|
85
52
|
* List of tasks to build the application
|
|
86
53
|
*/
|
|
87
|
-
export declare const reactApp: (gruntConfig: GruntConfig, targetName?: string, options?: ReactAppOptions) => Array<string>;
|
|
54
|
+
export declare const reactApp: (gruntConfig: reactAppUtil.GruntConfig, targetName?: string, options?: ReactAppOptions) => Array<string>;
|
|
88
55
|
export interface HelperOptions {
|
|
89
56
|
production?: boolean;
|
|
90
57
|
watch?: boolean | number;
|
|
91
58
|
}
|
|
92
59
|
/** Helper for common options shared across multiple tasks.
|
|
93
60
|
*
|
|
94
|
-
* @param
|
|
95
|
-
* Options shared by multiple tasks
|
|
96
|
-
*
|
|
97
|
-
* @param [helperOptions.production]
|
|
98
|
-
* Make a production build.
|
|
99
|
-
* - set outputStyle and sourceMap for sass
|
|
100
|
-
* - set pretty for pug
|
|
101
|
-
* - add a "productionBuild" property in pug data
|
|
102
|
-
* - set mode for webpack
|
|
61
|
+
* @param helperOptions - Options shared by multiple tasks
|
|
103
62
|
*
|
|
104
|
-
* @param
|
|
105
|
-
* Initial options for reactApp().
|
|
63
|
+
* @param options - Initial options for reactApp().
|
|
106
64
|
* This object will be copied and required parameters will be added by this
|
|
107
65
|
* function.
|
|
108
66
|
* Modified object are also duplicated, so no original data is modified.
|
|
109
67
|
*
|
|
110
|
-
* @
|
|
68
|
+
* @returns
|
|
111
69
|
* A configuration object for reactApp().
|
|
112
70
|
*/
|
|
113
71
|
export declare const reactAppOptionsHelper: (helperOptions: HelperOptions, options: ReactAppOptions) => ReactAppOptions;
|
|
@@ -116,4 +74,4 @@ export declare const reactAppOptionsHelper: (helperOptions: HelperOptions, optio
|
|
|
116
74
|
*
|
|
117
75
|
* Must be called before any other `grunt.registerTask()`
|
|
118
76
|
*/
|
|
119
|
-
export declare const reactAppDynamicTasks: (grunt: grunt.task.CommonTaskModule, gruntConfig: GruntConfig) => void;
|
|
77
|
+
export declare const reactAppDynamicTasks: (grunt: grunt.task.CommonTaskModule, gruntConfig: reactAppUtil.GruntConfig) => void;
|
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,51 +21,50 @@
|
|
|
21
21
|
},
|
|
22
22
|
"homepage": "https://github.com/CleyFaye/boilerplate#readme",
|
|
23
23
|
"devDependencies": {
|
|
24
|
-
"@
|
|
25
|
-
"@
|
|
26
|
-
"@types/
|
|
27
|
-
"@types/
|
|
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",
|
|
28
29
|
"@types/minimist": "^1.2.5",
|
|
29
|
-
"@types/node": "^
|
|
30
|
+
"@types/node": "^24.10.0",
|
|
30
31
|
"@types/webpack-bundle-analyzer": "^4.7.0",
|
|
31
|
-
"
|
|
32
|
-
"
|
|
33
|
-
"eslint": "^
|
|
34
|
-
"eslint-plugin-
|
|
35
|
-
"eslint-plugin-
|
|
36
|
-
"
|
|
37
|
-
"express-winston": "^4.2.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",
|
|
38
38
|
"grunt": "^1.6.1",
|
|
39
39
|
"grunt-banner": "^0.6.0",
|
|
40
40
|
"grunt-contrib-clean": "^2.0.1",
|
|
41
41
|
"grunt-run": "^0.8.1",
|
|
42
42
|
"load-grunt-tasks": "^5.1.0",
|
|
43
|
-
"logform": "^2.
|
|
44
|
-
"
|
|
45
|
-
"
|
|
46
|
-
"
|
|
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"
|
|
47
48
|
},
|
|
48
49
|
"peerDependencies": {
|
|
49
50
|
"@babel/core": "7.x",
|
|
50
51
|
"@babel/plugin-transform-runtime": "7.x",
|
|
51
52
|
"@babel/preset-env": "7.x",
|
|
52
53
|
"@babel/preset-react": "7.x",
|
|
53
|
-
"babel-loader": "9.x",
|
|
54
|
+
"babel-loader": "9.x || 10.x",
|
|
54
55
|
"babel-plugin-transform-define": "2.x",
|
|
55
56
|
"core-js": "3.x",
|
|
56
|
-
"express": "4.x",
|
|
57
|
-
"express-winston": "4.x",
|
|
57
|
+
"express": "4.x || 5.x",
|
|
58
58
|
"grunt": "1.x",
|
|
59
59
|
"grunt-contrib-copy": "1.x",
|
|
60
60
|
"grunt-contrib-pug": "3.x",
|
|
61
61
|
"grunt-contrib-watch": "1.x",
|
|
62
62
|
"grunt-sass": "3.x",
|
|
63
|
-
"grunt-webpack": "5.x||6.x",
|
|
63
|
+
"grunt-webpack": "5.x||6.x||7.x",
|
|
64
64
|
"minimist": "^1.2.8",
|
|
65
65
|
"sass": "1.x",
|
|
66
66
|
"ts-loader": "^9.4.1",
|
|
67
|
-
"webpack-bundle-analyzer": "^4.9.1"
|
|
68
|
-
"winston": "3.x"
|
|
67
|
+
"webpack-bundle-analyzer": "^4.9.1"
|
|
69
68
|
},
|
|
70
69
|
"peerDependenciesMeta": {
|
|
71
70
|
"@babel/core": {
|
|
@@ -92,9 +91,6 @@
|
|
|
92
91
|
"express": {
|
|
93
92
|
"optional": true
|
|
94
93
|
},
|
|
95
|
-
"express-winston": {
|
|
96
|
-
"optional": true
|
|
97
|
-
},
|
|
98
94
|
"grunt": {
|
|
99
95
|
"optional": true
|
|
100
96
|
},
|
|
@@ -124,9 +120,6 @@
|
|
|
124
120
|
},
|
|
125
121
|
"webpack-bundle-analyzer": {
|
|
126
122
|
"optional": true
|
|
127
|
-
},
|
|
128
|
-
"winston": {
|
|
129
|
-
"optional": true
|
|
130
123
|
}
|
|
131
124
|
},
|
|
132
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;
|