@cley_faye/boilerplate 3.13.0 → 3.15.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
@@ -29,8 +29,6 @@ required, and for what. It's up to the calling project to have the proper depend
29
29
 
30
30
  For webapp building:
31
31
 
32
- - resolve-typescript-plugin (due to the way webpack plugins are handled, this is mandatory for dev
33
- install)
34
32
  - babel-loader
35
33
  - eslint-webpack-plugin
36
34
  - @babel/core
@@ -333,6 +331,9 @@ It supports the following properties:
333
331
  property.
334
332
  - logger: an instance of a winston logger.
335
333
  - timestamp: set to true to prepend a timestamp to each log line
334
+ - ignoredRoutes: array of path to not log
335
+
336
+ Note that if `route` is a full object, some of the other proprties might be ignored.
336
337
 
337
338
  The middleware options allow enabling/disabling common middlewares.
338
339
  Currently only support a few builtin middlewares from express:
@@ -81,7 +81,7 @@ const defaultRouteLoggerConfig = (authFromReq) => ({
81
81
  });
82
82
  exports.defaultRouteLoggerConfig = defaultRouteLoggerConfig;
83
83
  const registerRouteLogger = (app, logOptions) => {
84
- const { route, timestamp, userFromReq, authFromReq } = logOptions ?? {};
84
+ const { route, timestamp, userFromReq, authFromReq, ignoredRoutes } = logOptions ?? {};
85
85
  let extraConfig;
86
86
  if (typeof route === "boolean") {
87
87
  extraConfig = (0, exports.defaultRouteLoggerConfig)(authFromReq ?? userFromReq);
@@ -100,6 +100,7 @@ const registerRouteLogger = (app, logOptions) => {
100
100
  expressFormat: false,
101
101
  format: customRouteFormat(timestamp),
102
102
  msg: "{{req.method}} {{req.url}} {{res.statusCode}} {{res.responseTime}}ms",
103
+ ignoredRoutes,
103
104
  };
104
105
  app.use(express_winston_1.default.logger({
105
106
  transports: winston_js_1.transports,
@@ -31,6 +31,7 @@ export interface LogOptions {
31
31
  logger?: winston.Logger;
32
32
  timestamp?: boolean;
33
33
  extraStacktraceFilter?: Array<RegExp> | RegExp;
34
+ ignoredRoutes?: Array<string>;
34
35
  /** @deprecated Use `authFromReq` instead */
35
36
  userFromReq?: UserFromReqFunc;
36
37
  authFromReq?: UserFromReqFunc;
@@ -1,3 +1,4 @@
1
+ import { ResolveOptions } from "webpack";
1
2
  import { BaseOptions } from "../util.js";
2
3
  import { HandlerFunctionResult } from "../reactapp.js";
3
4
  import { GruntConfig } from "./util.js";
@@ -27,7 +28,8 @@ export interface WebpackLoadersOptions {
27
28
  * Version of core-js to use (default to 3)
28
29
  *
29
30
  * @param [options.babel.targets]
30
- * Browser targets (default to " > 1%, last 1 safari version")
31
+ * Browser targets (default to "> 2% and not dead, last 2 safari version, last 2 firefox version,
32
+ * last 2 chrome version, last 2 edge version, Firefox ESR")
31
33
  *
32
34
  * @param [options.babel.plugins]
33
35
  * Plugins to add to babel
@@ -49,7 +51,7 @@ export interface WebpackOptions extends BaseOptions {
49
51
  plugins?: Array<Record<string, unknown>>;
50
52
  babelPlugins?: Array<Record<string, unknown>>;
51
53
  defines?: Record<string, string>;
52
- resolve?: Record<string, unknown>;
54
+ resolve?: ResolveOptions;
53
55
  typescript?: boolean;
54
56
  }
55
57
  /** Add a webpack task for the reactApp recipe
@@ -33,7 +33,6 @@ exports.handle = exports.webpackLoadersDefault = void 0;
33
33
  const path_1 = require("path");
34
34
  const node_fs_1 = require("node:fs");
35
35
  const eslint_webpack_plugin_1 = __importDefault(require("eslint-webpack-plugin"));
36
- const resolve_typescript_plugin_1 = __importDefault(require("resolve-typescript-plugin"));
37
36
  const util_js_1 = require("./util.js");
38
37
  const defaultCoreJS = 3;
39
38
  const eslintPlugin = () => new eslint_webpack_plugin_1.default({ cache: true });
@@ -50,7 +49,7 @@ const defaultLoadersDefine = (options) => [
50
49
  const defaultLoadersPresetEnv = (options) => [
51
50
  "@babel/preset-env",
52
51
  {
53
- targets: (options.babel?.targets) ?? "> 1%, last 1 safari version",
52
+ targets: (options.babel?.targets) ?? "> 2% and not dead, last 2 safari version, last 2 firefox version, last 2 chrome version, last 2 edge version, Firefox ESR",
54
53
  useBuiltIns: "usage",
55
54
  corejs: (options.babel?.corejs) ?? defaultCoreJS,
56
55
  modules: false,
@@ -76,7 +75,8 @@ const defaultLoadersReact = (options) => [
76
75
  * Version of core-js to use (default to 3)
77
76
  *
78
77
  * @param [options.babel.targets]
79
- * Browser targets (default to " > 1%, last 1 safari version")
78
+ * Browser targets (default to "> 2% and not dead, last 2 safari version, last 2 firefox version,
79
+ * last 2 chrome version, last 2 edge version, Firefox ESR")
80
80
  *
81
81
  * @param [options.babel.plugins]
82
82
  * Plugins to add to babel
@@ -170,10 +170,11 @@ const registerTasks = (gruntConfig, targetName, webpackConfig) => {
170
170
  const computeWebpackResolve = (webpackOptions) => {
171
171
  const res = { ...webpackOptions.resolve };
172
172
  if (webpackOptions.typescript) {
173
- if (res.plugins === undefined) {
174
- res.plugins = [];
173
+ if (res.extensionAlias === undefined) {
174
+ res.extensionAlias = {};
175
175
  }
176
- res.plugins.push(new resolve_typescript_plugin_1.default());
176
+ res.extensionAlias[".js"] = [".ts", ".tsx", ".js", ".jsx"];
177
+ res.extensionAlias[".mjs"] = [".mts", ".mtsx", ".mjs", ".mjsx"];
177
178
  }
178
179
  return res;
179
180
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cley_faye/boilerplate",
3
- "version": "3.13.0",
3
+ "version": "3.15.0",
4
4
  "description": "Boilerplate code generator for generic projects",
5
5
  "repository": {
6
6
  "type": "git",
@@ -18,14 +18,14 @@
18
18
  },
19
19
  "homepage": "https://github.com/CleyFaye/boilerplate#readme",
20
20
  "devDependencies": {
21
- "@keeex/eslint-config": "^1.9.2",
21
+ "@keeex/eslint-config": "^1.9.3",
22
22
  "@types/express": "^4.17.17",
23
23
  "@types/grunt": "^0.4.27",
24
24
  "@types/http-errors": "^2.0.1",
25
- "@types/node": "^18.11.19",
26
- "@typescript-eslint/eslint-plugin": "^5.50.0",
27
- "@typescript-eslint/parser": "^5.50.0",
28
- "eslint": "^8.33.0",
25
+ "@types/node": "^18.14.2",
26
+ "@typescript-eslint/eslint-plugin": "^5.53.0",
27
+ "@typescript-eslint/parser": "^5.53.0",
28
+ "eslint": "^8.35.0",
29
29
  "eslint-plugin-deprecation": "^1.3.3",
30
30
  "eslint-plugin-import": "^2.27.5",
31
31
  "eslint-plugin-promise": "^6.1.1",
@@ -36,8 +36,9 @@
36
36
  "grunt-contrib-clean": "^2.0.1",
37
37
  "grunt-run": "^0.8.1",
38
38
  "load-grunt-tasks": "^5.1.0",
39
- "logform": "^2.4.2",
39
+ "logform": "^2.5.1",
40
40
  "typescript": "^4.9.5",
41
+ "webpack": "^5.75.0",
41
42
  "winston": "^3.8.2"
42
43
  },
43
44
  "peerDependencies": {
@@ -57,7 +58,6 @@
57
58
  "grunt-contrib-watch": "1.x",
58
59
  "grunt-sass": "3.x",
59
60
  "grunt-webpack": "5.x",
60
- "resolve-typescript-plugin": "^2.0.0",
61
61
  "sass": "1.x",
62
62
  "ts-loader": "^9.4.1",
63
63
  "winston": "3.x"
@@ -111,9 +111,6 @@
111
111
  "grunt-webpack": {
112
112
  "optional": true
113
113
  },
114
- "resolve-typescript-plugin": {
115
- "optional": false
116
- },
117
114
  "sass": {
118
115
  "optional": true
119
116
  },