@cley_faye/boilerplate 3.11.3 → 3.12.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
@@ -8,6 +8,16 @@ to transpile a webapp so it can work in most browsers.
8
8
  These tools allows some level of configuration, but most default options expects a specific
9
9
  directory layout for your project.
10
10
 
11
+ This is not a "starter project" but an actual dependency to keep in your project.
12
+
13
+ Install it using
14
+
15
+ ```shell
16
+ npm install @cley_faye/boilerplate
17
+ // alternatively, if you don't run an express server and only build a webapp offline
18
+ npm install -D @cley_faye/boilerplate
19
+ ```
20
+
11
21
  Managing dependencies
12
22
  ---------------------
13
23
  This project does not "really" depend on anything, since all parts are optional.
@@ -160,8 +170,8 @@ The webpack options support a host of properties:
160
170
  - resolve: a custom "resolve" object for webpack config
161
171
 
162
172
  ### SASS
163
- All `.sass` and `.scss` files in the webapp directory will be processed as `.css` files in the
164
- output directory, except for files named `.inc.*`.
173
+ All `.sass` and `.scss` files in the `webres` directory will be processed as `.css` files
174
+ in the output directory, except for files named `.inc.*`.
165
175
 
166
176
  ### Copy task
167
177
  It is possible to move other file types into the output directory using the copy task.
@@ -469,6 +479,8 @@ If you reference the output of the TypeScript compiler, you can keep it updated
469
479
 
470
480
  Using `ts-loader` can be done automatically by setting the `typescript` property in the webpack
471
481
  configuration to `true`.
482
+ If a `tsconfig-tsloader.json` file exists at the root of the project, it will be used instead of
483
+ `tsconfig.json`.
472
484
 
473
485
  For Express app, there is no particular things to take care, except that if you use a facility like
474
486
  `nodemon` you have to watch the TypeScript output instead of the actual source files.
@@ -111,19 +111,11 @@ const registerErrorLogger = (app, logOptions) => {
111
111
  const config = typeof error === "boolean"
112
112
  ? {}
113
113
  : error ?? {};
114
- if (logger) {
115
- app.use(express_winston_1.default.errorLogger({
116
- transports: logger.transports,
117
- meta: false,
118
- msg: "{{req.method}} {{req.url}}",
119
- }));
120
- }
121
- else {
122
- app.use(express_winston_1.default.errorLogger({
123
- transports: winston_js_1.transports,
124
- format: (0, winston_js_1.customFormat)(timestamp, config.collapseStacktrace ?? config.collapseNodeModules, getExtraFilter(config.extraFilter)),
125
- meta: false,
126
- }));
127
- }
114
+ const activeTransports = logger ? logger.transports : winston_js_1.transports;
115
+ app.use(express_winston_1.default.errorLogger({
116
+ transports: activeTransports,
117
+ format: (0, winston_js_1.customFormat)(timestamp, config.collapseStacktrace ?? config.collapseNodeModules, getExtraFilter(config.extraFilter)),
118
+ meta: false,
119
+ }));
128
120
  };
129
121
  exports.registerErrorLogger = registerErrorLogger;
@@ -31,6 +31,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
31
31
  Object.defineProperty(exports, "__esModule", { value: true });
32
32
  exports.handle = exports.webpackLoadersDefault = void 0;
33
33
  const path_1 = require("path");
34
+ const node_fs_1 = require("node:fs");
34
35
  const eslint_webpack_plugin_1 = __importDefault(require("eslint-webpack-plugin"));
35
36
  const resolve_typescript_plugin_1 = __importDefault(require("resolve-typescript-plugin"));
36
37
  const util_js_1 = require("./util.js");
@@ -108,9 +109,16 @@ const webpackLoadersDefault = (options) => {
108
109
  },
109
110
  ];
110
111
  if (options.typescript) {
112
+ const alternativeConfig = "tsconfig-tsloader.json";
113
+ const tsLoader = (0, node_fs_1.existsSync)(alternativeConfig)
114
+ ? [{
115
+ loader: "ts-loader",
116
+ options: { configFile: alternativeConfig },
117
+ }]
118
+ : "ts-loader";
111
119
  res.push({
112
120
  test: /.(?:ts|tsx)$/u,
113
- use: "ts-loader",
121
+ use: tsLoader,
114
122
  exclude: /node_modules/u,
115
123
  });
116
124
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cley_faye/boilerplate",
3
- "version": "3.11.3",
3
+ "version": "3.12.0",
4
4
  "description": "Boilerplate code generator for generic projects",
5
5
  "repository": {
6
6
  "type": "git",