@cley_faye/boilerplate 3.0.4 → 3.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/README.md CHANGED
@@ -27,7 +27,6 @@ For webapp building:
27
27
  - babel-plugin-transform-define
28
28
  - core-js
29
29
  - @babel/plugin-transform-runtime
30
- - grunt-contrib-imagemin
31
30
  - grunt-contrib-pug
32
31
  - grunt-contrib-copy
33
32
  - grunt-contrib-watch
@@ -63,13 +63,13 @@ const setSignalHandler = () => {
63
63
  if (process.platform === "win32") {
64
64
  process.on("message", msg => {
65
65
  if (msg === "shutdown") {
66
- exports.closeServer();
66
+ (0, exports.closeServer)();
67
67
  }
68
68
  });
69
69
  }
70
70
  else {
71
71
  process.on("SIGINT", () => {
72
- exports.closeServer();
72
+ (0, exports.closeServer)();
73
73
  });
74
74
  }
75
75
  };
@@ -229,7 +229,7 @@ class PipelineBuilder {
229
229
  const { route } = logOptions ?? {};
230
230
  if (route) {
231
231
  this.internalLog("Adding route logger");
232
- logger_js_1.registerRouteLogger(router, logOptions);
232
+ (0, logger_js_1.registerRouteLogger)(router, logOptions);
233
233
  }
234
234
  }
235
235
  /** Register post-route loggers
@@ -244,7 +244,7 @@ class PipelineBuilder {
244
244
  const { error } = logOptions ?? {};
245
245
  if (error) {
246
246
  this.internalLog("Adding error logger");
247
- logger_js_1.registerErrorLogger(router, logOptions);
247
+ (0, logger_js_1.registerErrorLogger)(router, logOptions);
248
248
  }
249
249
  }
250
250
  _setDefaultErrorHandler(router, enableDefaultErrorHandler) {
package/lib/express.js CHANGED
@@ -176,8 +176,8 @@ const appStart = ({ app, allowNonLocal, port, shutdownFunction, logger, }) => ne
176
176
  if (logger) {
177
177
  logger.info(`Listening on port ${effectivePort} (PID: ${process.pid})`);
178
178
  }
179
- autoclose_js_1.setRef(server);
180
- autoclose_js_1.setSignalHandler();
179
+ (0, autoclose_js_1.setRef)(server);
180
+ (0, autoclose_js_1.setSignalHandler)();
181
181
  resolve({
182
182
  port: effectivePort,
183
183
  server,
package/lib/grunt/args.js CHANGED
@@ -89,7 +89,7 @@ const handleOptionDef = (optionDef, rawValue) => {
89
89
  * Get a value from the command line
90
90
  */
91
91
  const getFromOptionProvider = (keyName, optionProvider) => {
92
- const kebabName = util_js_1.camelToKebab(keyName);
92
+ const kebabName = (0, util_js_1.camelToKebab)(keyName);
93
93
  return optionProvider.option(kebabName);
94
94
  };
95
95
  // eslint-disable-next-line no-console
@@ -106,7 +106,7 @@ const getTypeInfoString = (optionType, kebabName) => {
106
106
  */
107
107
  const displayHelpForConfigKey = (keyName, optionDef) => {
108
108
  const isMandatory = optionDef.defaultValue === undefined;
109
- const kebabName = util_js_1.camelToKebab(keyName);
109
+ const kebabName = (0, util_js_1.camelToKebab)(keyName);
110
110
  const mandatoryString = isMandatory
111
111
  ? ""
112
112
  : ` (optional, default value:${optionDef.defaultValue})`;
@@ -141,7 +141,7 @@ const getOptionsFromGruntCLI = (optionProvider, configDef) => {
141
141
  result[keyName] = handleOptionDef(configDef[keyName], getFromOptionProvider(keyName, optionProvider));
142
142
  }
143
143
  catch (error) {
144
- throw new Error(`CLI Argument "${util_js_1.camelToKebab(keyName)}": ${error}`);
144
+ throw new Error(`CLI Argument "${(0, util_js_1.camelToKebab)(keyName)}": ${error}`);
145
145
  }
146
146
  });
147
147
  return result;
@@ -77,13 +77,13 @@ const handle = (gruntConfig, targetName, copyOptions) => {
77
77
  {
78
78
  dot: copyOptions.dot,
79
79
  expand: true,
80
- cwd: copyOptions.sourcePath ?? path_1.join("webres", targetName),
80
+ cwd: copyOptions.sourcePath ?? (0, path_1.join)("webres", targetName),
81
81
  src: srcList,
82
- dest: copyOptions.outputPath ?? path_1.join("dist", targetName),
82
+ dest: copyOptions.outputPath ?? (0, path_1.join)("dist", targetName),
83
83
  },
84
84
  ],
85
85
  };
86
- const requiredTasks = [util_js_1.insertTask(gruntConfig, "copy", targetName, copyTask)];
86
+ const requiredTasks = [(0, util_js_1.insertTask)(gruntConfig, "copy", targetName, copyTask)];
87
87
  const watchTasks = [
88
88
  {
89
89
  filesToWatch: srcList,
@@ -18,10 +18,10 @@ export interface ImageOptions extends BaseOptions {
18
18
  * Options for the image task configuration.
19
19
  *
20
20
  * @param [imageOptions.options]
21
- * Options to pass to grunt-contrib-imagemin.
21
+ * Options to pass to @cley_faye/imagemin-lite.
22
22
  *
23
23
  * @param [imageOptions.sourcePath]
24
- * Path where the pug templates can be found. Subdirectories will be searched.
24
+ * Path where the source images can be found. Subdirectories will be searched.
25
25
  * Default to "webres/<targetName>"
26
26
  *
27
27
  * @param [imageOptions.outputPath]
@@ -47,10 +47,10 @@ const handledExtensions = [
47
47
  * Options for the image task configuration.
48
48
  *
49
49
  * @param [imageOptions.options]
50
- * Options to pass to grunt-contrib-imagemin.
50
+ * Options to pass to @cley_faye/imagemin-lite.
51
51
  *
52
52
  * @param [imageOptions.sourcePath]
53
- * Path where the pug templates can be found. Subdirectories will be searched.
53
+ * Path where the source images can be found. Subdirectories will be searched.
54
54
  * Default to "webres/<targetName>"
55
55
  *
56
56
  * @param [imageOptions.outputPath]
@@ -63,19 +63,20 @@ const handledExtensions = [
63
63
  */
64
64
  const handle = (gruntConfig, targetName, imageOptions) => {
65
65
  const handledFiles = handledExtensions.map(ext => `**/*${ext}`);
66
+ // TODO use @cley_faye/imagemin-lite once it exists
66
67
  const newImageTask = {
67
68
  options: imageOptions.options,
68
69
  files: [
69
70
  {
70
71
  expand: true,
71
- cwd: imageOptions.sourcePath ?? path_1.join("webres", targetName),
72
+ cwd: imageOptions.sourcePath ?? (0, path_1.join)("webres", targetName),
72
73
  src: handledFiles,
73
- dest: imageOptions.outputPath ?? path_1.join("dist", targetName),
74
+ dest: imageOptions.outputPath ?? (0, path_1.join)("dist", targetName),
74
75
  },
75
76
  ],
76
77
  };
77
78
  const requiredTasks = [
78
- util_js_1.insertTask(gruntConfig, "imagemin", targetName, newImageTask),
79
+ (0, util_js_1.insertTask)(gruntConfig, "copy", `${targetName}_image`, newImageTask),
79
80
  ];
80
81
  const watchTasks = [
81
82
  {
@@ -35,7 +35,7 @@ const createDynamicTask = (gruntConfig, targetName, pugOptions, pugTask, require
35
35
  if (!pugOptions.dynamicData) {
36
36
  return;
37
37
  }
38
- requiredTasks.splice(0, 0, util_js_1.insertDynamicTask(gruntConfig, "pugDynamicData", targetName, () => {
38
+ requiredTasks.splice(0, 0, (0, util_js_1.insertDynamicTask)(gruntConfig, "pugDynamicData", targetName, () => {
39
39
  if (!pugOptions.dynamicData) {
40
40
  return Promise.reject(new Error("Missing expected function"));
41
41
  }
@@ -91,15 +91,15 @@ const handle = (gruntConfig, targetName, pugOptions) => {
91
91
  files: [
92
92
  {
93
93
  expand: true,
94
- cwd: pugOptions.sourcePath ?? path_1.join("webres", targetName),
94
+ cwd: pugOptions.sourcePath ?? (0, path_1.join)("webres", targetName),
95
95
  src: handledFiles,
96
- dest: pugOptions.outputPath ?? path_1.join("dist", targetName),
96
+ dest: pugOptions.outputPath ?? (0, path_1.join)("dist", targetName),
97
97
  ext: pugOptions.fileSuffix ?? ".html",
98
98
  },
99
99
  ],
100
100
  };
101
101
  const requiredTasks = [
102
- util_js_1.insertTask(gruntConfig, "pug", targetName, newPugTask),
102
+ (0, util_js_1.insertTask)(gruntConfig, "pug", targetName, newPugTask),
103
103
  ];
104
104
  createDynamicTask(gruntConfig, targetName, pugOptions, newPugTask, requiredTasks);
105
105
  const watchTasks = [
@@ -76,9 +76,9 @@ const handle = (gruntConfig, targetName, sassOptions) => {
76
76
  files: [
77
77
  {
78
78
  expand: true,
79
- cwd: sassOptions.sourcePath ?? path_1.join("webres", targetName),
79
+ cwd: sassOptions.sourcePath ?? (0, path_1.join)("webres", targetName),
80
80
  src: handledFiles,
81
- dest: sassOptions.outputPath ?? path_1.join("dist", targetName),
81
+ dest: sassOptions.outputPath ?? (0, path_1.join)("dist", targetName),
82
82
  ext: sassOptions.fileSuffix ?? ".css",
83
83
  },
84
84
  ],
@@ -87,7 +87,7 @@ const handle = (gruntConfig, targetName, sassOptions) => {
87
87
  // eslint-disable-next-line @typescript-eslint/no-require-imports, global-require, @typescript-eslint/no-var-requires
88
88
  sassTask.options.implementation = require("sass");
89
89
  }
90
- const requiredTasks = [util_js_1.insertTask(gruntConfig, "sass", targetName, sassTask)];
90
+ const requiredTasks = [(0, util_js_1.insertTask)(gruntConfig, "sass", targetName, sassTask)];
91
91
  const watchTasks = [
92
92
  {
93
93
  filesToWatch: [...handledExtensions.map(ext => `**/*${ext}`)],
@@ -101,7 +101,7 @@ const webpackLoadersDefault = (options) => [
101
101
  ];
102
102
  exports.webpackLoadersDefault = webpackLoadersDefault;
103
103
  const computeWebpackOutput = (webpackOptions, targetName) => webpackOptions.output ?? {
104
- path: path_1.resolve("dist", targetName, "js"),
104
+ path: (0, path_1.resolve)("dist", targetName, "js"),
105
105
  filename: "[name].js",
106
106
  };
107
107
  const lastNamePosition = 2;
@@ -110,7 +110,7 @@ const getHandledFiles = (webpackEntry) => Object.keys(webpackEntry).reduce((acc,
110
110
  const split = webpackEntry[cur].split("/");
111
111
  acc.push(split.slice(lastNamePosition).join("/"));
112
112
  }
113
- webpackEntry[cur] = path_1.resolve(webpackEntry[cur]);
113
+ webpackEntry[cur] = (0, path_1.resolve)(webpackEntry[cur]);
114
114
  return acc;
115
115
  }, []);
116
116
  const getOutputToWatch = (webpackOptions, targetName) => {
@@ -120,7 +120,7 @@ const getOutputToWatch = (webpackOptions, targetName) => {
120
120
  const entries = webpackOptions.entry
121
121
  ? Object.keys(webpackOptions.entry)
122
122
  : [targetName];
123
- return entries.map(entryName => path_1.join("dist", targetName, "js", `${entryName}.js`));
123
+ return entries.map(entryName => (0, path_1.join)("dist", targetName, "js", `${entryName}.js`));
124
124
  };
125
125
  const getWatchTasks = (webpackOptions, targetName) => {
126
126
  const outputToWatch = getOutputToWatch(webpackOptions, targetName);
@@ -135,12 +135,12 @@ const getWatchTasks = (webpackOptions, targetName) => {
135
135
  return [];
136
136
  };
137
137
  const registerTasks = (gruntConfig, targetName, webpackConfig) => {
138
- util_js_1.insertTask(gruntConfig, "webpack", `${targetName}_watch`, {
138
+ (0, util_js_1.insertTask)(gruntConfig, "webpack", `${targetName}_watch`, {
139
139
  ...webpackConfig,
140
140
  watch: true,
141
141
  });
142
142
  return [
143
- util_js_1.insertTask(gruntConfig, "webpack", targetName, webpackConfig),
143
+ (0, util_js_1.insertTask)(gruntConfig, "webpack", targetName, webpackConfig),
144
144
  ];
145
145
  };
146
146
  /** Add a webpack task for the reactApp recipe
@@ -201,11 +201,11 @@ const registerTasks = (gruntConfig, targetName, webpackConfig) => {
201
201
  */
202
202
  const handle = (gruntConfig, targetName, webpackOptions) => {
203
203
  const webpackEntry = webpackOptions.entry
204
- ?? { [targetName]: path_1.join("webres", targetName, "js", "loader.js") };
204
+ ?? { [targetName]: (0, path_1.join)("webres", targetName, "js", "loader.js") };
205
205
  const handledFiles = getHandledFiles(webpackEntry);
206
206
  const webpackOutput = computeWebpackOutput(webpackOptions, targetName);
207
207
  const webpackLoaders = webpackOptions.loaders
208
- ?? exports.webpackLoadersDefault({
208
+ ?? (0, exports.webpackLoadersDefault)({
209
209
  development: webpackOptions.mode === "development",
210
210
  defines: webpackOptions.defines,
211
211
  babel: { plugins: webpackOptions.babelPlugins },
@@ -225,7 +225,7 @@ const handle = (gruntConfig, targetName, webpackOptions) => {
225
225
  // Special case: I'm not sure I can move options in the task-specific part of
226
226
  // the configuration, so I add it at the toplevel of the "webpack" task.
227
227
  if (webpackOptions.options) {
228
- util_js_1.insertTask(gruntConfig, "webpack", "options", webpackOptions.options);
228
+ (0, util_js_1.insertTask)(gruntConfig, "webpack", "options", webpackOptions.options);
229
229
  }
230
230
  const requiredTasks = registerTasks(gruntConfig, targetName, webpackConfig);
231
231
  const watchTasks = getWatchTasks(webpackOptions, targetName);
@@ -65,7 +65,7 @@ const mergeResults = (tasksResults) => tasksResults.reduce((acc, cur) => {
65
65
  const createCopyTask = (gruntConfig, targetName, mergedResults, options) => {
66
66
  const copyOptions = (options?.[HandlerType.COPY]) ?? {};
67
67
  copyOptions.skipFiles = mergedResults.handledFiles;
68
- const copyTask = copy_js_1.handle(gruntConfig, targetName, copyOptions);
68
+ const copyTask = (0, copy_js_1.handle)(gruntConfig, targetName, copyOptions);
69
69
  mergedResults.requiredTasks = mergedResults.requiredTasks.concat(copyTask.requiredTasks);
70
70
  mergedResults.watchTasks = mergedResults.watchTasks.concat(copyTask.watchTasks);
71
71
  };
@@ -104,10 +104,10 @@ const createWatchTasks = (gruntConfig, mergedResults, watchMode) => {
104
104
  return;
105
105
  }
106
106
  if (mergedResults.watchTasks.length > 0) {
107
- util_js_2.insertTask(gruntConfig, "watch", "options", getWatcherOptions(watchMode));
107
+ (0, util_js_2.insertTask)(gruntConfig, "watch", "options", getWatcherOptions(watchMode));
108
108
  }
109
109
  mergedResults.watchTasks.forEach(watchTask => {
110
- util_js_2.insertTask(gruntConfig, "watch", getWatchTaskName(watchTask), {
110
+ (0, util_js_2.insertTask)(gruntConfig, "watch", getWatchTaskName(watchTask), {
111
111
  options: getWatcherOptions(watchMode),
112
112
  files: watchTask.filesToWatch.reduce((acc, cur) => {
113
113
  const prefix = watchTask.fromRoot
@@ -215,11 +215,11 @@ exports.reactApp = reactApp;
215
215
  * A configuration object for reactApp().
216
216
  */
217
217
  const reactAppOptionsHelper = (helperOptions, options) => {
218
- let result = util_js_1.deepSet(options, "sass.options.outputStyle", helperOptions.production ? "compressed" : "expanded");
219
- result = util_js_1.deepSet(result, "sass.options.sourceMap", !helperOptions.production);
220
- result = util_js_1.deepSet(result, "pug.options.pretty", !helperOptions.production);
221
- result = util_js_1.deepSet(result, "pug.options.data.productionBuild", Boolean(helperOptions.production));
222
- result = util_js_1.deepSet(result, "webpack.mode", helperOptions.production ? "production" : "development");
218
+ let result = (0, util_js_1.deepSet)(options, "sass.options.outputStyle", helperOptions.production ? "compressed" : "expanded");
219
+ result = (0, util_js_1.deepSet)(result, "sass.options.sourceMap", !helperOptions.production);
220
+ result = (0, util_js_1.deepSet)(result, "pug.options.pretty", !helperOptions.production);
221
+ result = (0, util_js_1.deepSet)(result, "pug.options.data.productionBuild", Boolean(helperOptions.production));
222
+ result = (0, util_js_1.deepSet)(result, "webpack.mode", helperOptions.production ? "production" : "development");
223
223
  if (helperOptions.watch !== undefined) {
224
224
  result.watch = helperOptions.watch;
225
225
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cley_faye/boilerplate",
3
- "version": "3.0.4",
3
+ "version": "3.2.0",
4
4
  "description": "Boilerplate code generator for generic projects",
5
5
  "repository": {
6
6
  "type": "git",
@@ -8,7 +8,7 @@
8
8
  },
9
9
  "scripts": {
10
10
  "prepack": "npm run grunt -- clean build",
11
- "grunt": "npm exec grunt -- --gruntfile Gruntfile.cjs"
11
+ "grunt": "npx grunt --gruntfile Gruntfile.cjs"
12
12
  },
13
13
  "author": "Gabriel Paul \"Cley Faye\" Risterucci",
14
14
  "license": "MIT",
@@ -17,21 +17,21 @@
17
17
  },
18
18
  "homepage": "https://github.com/CleyFaye/boilerplate#readme",
19
19
  "devDependencies": {
20
- "@keeex/eslint-config": "^1.4.3",
20
+ "@keeex/eslint-config": "^1.5.9",
21
21
  "@types/express": "^4.17.11",
22
22
  "@types/grunt": "^0.4.25",
23
23
  "@types/http-errors": "^1.8.0",
24
24
  "@types/node": "^16.0.0",
25
- "@typescript-eslint/eslint-plugin": "^4.15.0",
26
- "@typescript-eslint/parser": "^4.15.0",
25
+ "@typescript-eslint/eslint-plugin": "^5.3.1",
26
+ "@typescript-eslint/parser": "^5.3.1",
27
27
  "eslint": "^7.20.0",
28
- "eslint-plugin-promise": "^5.1.0",
29
- "eslint-webpack-plugin": "^2.5.4",
28
+ "eslint-plugin-promise": "^5.1.1",
29
+ "eslint-webpack-plugin": "^3.0.1",
30
30
  "express-winston": "^4.0.5",
31
31
  "grunt": "^1.4.1",
32
32
  "grunt-banner": "^0.6.0",
33
33
  "grunt-contrib-clean": "^2.0.0",
34
- "grunt-ts": "^6.0.0-beta.22",
34
+ "grunt-run": "^0.8.1",
35
35
  "load-grunt-tasks": "^5.1.0",
36
36
  "typescript": "^4.1.5",
37
37
  "winston": "^3.3.3"
@@ -44,16 +44,15 @@
44
44
  "babel-loader": "8.x",
45
45
  "babel-plugin-transform-define": "2.x",
46
46
  "core-js": "3.x",
47
- "eslint-webpack-plugin": "2.x",
47
+ "eslint-webpack-plugin": "^3.0.1",
48
48
  "express": "4.x",
49
49
  "express-winston": "4.x",
50
50
  "grunt": "1.x",
51
51
  "grunt-contrib-copy": "1.x",
52
- "grunt-contrib-imagemin": "4.x",
53
52
  "grunt-contrib-pug": "3.x",
54
53
  "grunt-contrib-watch": "1.x",
55
54
  "grunt-sass": "3.x",
56
- "grunt-webpack": "4.x",
55
+ "grunt-webpack": "5.x",
57
56
  "sass": "1.x",
58
57
  "winston": "3.x"
59
58
  },
@@ -79,9 +78,6 @@
79
78
  "grunt-contrib-pug": {
80
79
  "optional": true
81
80
  },
82
- "grunt-contrib-imagemin": {
83
- "optional": true
84
- },
85
81
  "@babel/plugin-transform-runtime": {
86
82
  "optional": true
87
83
  },