@rws-framework/client 2.5.1 → 2.5.4

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/_tools.js CHANGED
@@ -3,7 +3,9 @@ const fs = require('fs');
3
3
  const ts = require('typescript');
4
4
  const { spawn } = require('child_process');
5
5
  const JSON5 = require('json5');
6
+ const md5 = require('md5');
6
7
  const chalk = require('chalk');
8
+ const { rwsPath } = require('@rws-framework/console');
7
9
 
8
10
  function findRootWorkspacePath(currentPath) {
9
11
  const parentPackageJsonPath = path.join(currentPath + '/..', 'package.json');
@@ -330,40 +332,53 @@ function getAllFilesInFolder(folderPath, ignoreFilenames = [], recursive = false
330
332
  return files;
331
333
  }
332
334
 
333
- function setupTsConfig(tsConfigPath)
335
+ function setupTsConfig(tsConfigPath, executionDir)
334
336
  {
335
337
 
336
338
  if(!fs.existsSync(tsConfigPath)){
337
339
  throw new Error(`Typescript config file "${tsConfigPath}" does not exist`);
338
340
  }
339
341
 
342
+ console.log('tspath', tsConfigPath);
343
+
340
344
  const tsConfigContents = fs.readFileSync(tsConfigPath, 'utf-8');
341
345
 
342
346
  try{
343
- const tsConfig = JSON.parse(tsConfigContents);
347
+ let tsConfig = JSON.parse(tsConfigContents);
344
348
 
345
349
  const declarationsPath = path.resolve(__dirname, 'types') + '/declarations.d.ts';
346
350
  const testsPath = path.resolve(__dirname, 'tests');
351
+ const declarationsPathMD5 = md5(fs.readFileSync(declarationsPath, 'utf-8'));
352
+ const testsPathMD5 = fs.existsSync(testsPath) ? md5(fs.readFileSync(testsPath, 'utf-8')) : null;
347
353
 
354
+ const includedMD5 = [];
355
+
348
356
  let changed = false;
357
+
358
+ const included = [];
349
359
 
350
360
  if(!Object.keys(tsConfig).includes('include')){
351
361
  tsConfig['include'] = [];
362
+ }else{
363
+ tsConfig['include'] = tsConfig['include'].map((inc) => fs.existsSync(rwsPath.relativize(tsConfig['include'], executionDir)))
352
364
  }
353
365
 
354
366
  if(!Object.keys(tsConfig).includes('exclude')){
355
367
  tsConfig['exclude'] = [];
356
368
  }
357
369
 
358
- if(!tsConfig['include'].includes(declarationsPath)){
370
+ if(!included.includes(declarationsPath) && !includedMD5.includes(declarationsPathMD5)){
359
371
  console.log(chalk.blueBright('[RWS TS CONFIG]'), 'adding RWS typescript declarations to project tsconfig.json');
360
- tsConfig['include'].push(declarationsPath);
372
+ included.push(declarationsPath);
373
+ includedMD5.push(md5(fs.readFileSync(declarationsPath, 'utf-8')));
361
374
  changed = true;
362
375
  }
363
376
 
364
- if(!tsConfig['exclude'].includes(testsPath)){
377
+ tsConfig['include'] = included;
378
+
379
+ if(testsPathMD5 && (!tsConfig['exclude'].includes(testsPath) && !included.includes(testsPathMD5))){
365
380
  console.log(chalk.blueBright('[RWS TS CONFIG]'), 'adding RWS typescript exclusions to project tsconfig.json');
366
- tsConfig['exclude'].push(testsPath);
381
+ tsConfig['exclude'].push(testsPath);
367
382
  changed = true;
368
383
  }
369
384
 
@@ -7,6 +7,7 @@ const _DEFAULT_CONFIG_VARS = {
7
7
  publicIndex: 'index.html',
8
8
  outputFileName: 'client.rws.js',
9
9
  outputDir: './build',
10
+ tsConfigPath: './tsconfig.json',
10
11
  //Frontend RWS client configs
11
12
  backendUrl: null,
12
13
  wsUrl: null,
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@rws-framework/client",
3
3
  "private": false,
4
- "version": "2.5.1",
4
+ "version": "2.5.4",
5
5
  "main": "src/index.ts",
6
6
  "scripts": {
7
7
  "docs": "typedoc --tsconfig ./tsconfig.json"
@@ -28,7 +28,7 @@
28
28
  "dependencies": {
29
29
  "@microsoft/fast-element": "^1.12.0",
30
30
  "@microsoft/fast-foundation": "^2.46.2",
31
- "@rws-framework/console": "^0.3.0",
31
+ "@rws-framework/console": "^0.3.1",
32
32
  "@types/moment": "^2.13.0",
33
33
  "dragula": "^3.7.3",
34
34
  "he": "^1.2.0",
@@ -52,16 +52,16 @@
52
52
  },
53
53
  "devDependencies": {
54
54
  "@types/dragula": "^3.7.4",
55
+ "@types/eslint": "^6.0.0",
55
56
  "@types/express-fileupload": "^1.4.4",
56
57
  "@types/glob": "^8.1.0",
57
- "@types/he": "^1.2.3",
58
- "@types/sanitize-html": "^2.11.0",
58
+ "@types/he": "^1.2.3",
59
+ "@types/sanitize-html": "^2.11.0",
59
60
  "@types/uuid": "^9.0.7",
60
- "@types/eslint": "^6.0.0",
61
61
  "@typescript-eslint/parser": "^5.0.0",
62
62
  "clean-webpack-plugin": "^4.0.0",
63
63
  "css-loader": "^6.8.1",
64
- "css-minimizer-webpack-plugin": "^5.0.1",
64
+ "css-minimizer-webpack-plugin": "^5.0.1",
65
65
  "eslint": "^6.0.0",
66
66
  "file-loader": "^6.2.0",
67
67
  "html-webpack-plugin": "^5.5.3",
@@ -16,6 +16,7 @@ const CssMinimizerPlugin = require('css-minimizer-webpack-plugin');
16
16
  const JsMinimizerPlugin = require('terser-webpack-plugin');
17
17
 
18
18
  const json5 = require('json5');
19
+ const { rwsPath } = require('@rws-framework/console');
19
20
 
20
21
 
21
22
  const RWSWebpackWrapper = (config) => {
@@ -43,7 +44,9 @@ const RWSWebpackWrapper = (config) => {
43
44
 
44
45
  const publicIndex = BuildConfigurator.get('publicIndex') || config.publicIndex;
45
46
 
46
-
47
+
48
+ const tsConfigPath = rwsPath.relativize(BuildConfigurator.get('tsConfigPath') || config.tsConfigPath, executionDir);
49
+
47
50
  let WEBPACK_PLUGINS = [
48
51
  new webpack.DefinePlugin({
49
52
  'process.env._RWS_DEFAULTS': JSON.stringify(BuildConfigurator.exportDefaultConfig()),
@@ -218,7 +221,7 @@ const RWSWebpackWrapper = (config) => {
218
221
  }
219
222
  }
220
223
 
221
- const tsValidated = tools.setupTsConfig(path.resolve(config.tsConfigPath));
224
+ const tsValidated = tools.setupTsConfig(tsConfigPath, executionDir);
222
225
 
223
226
  if(!tsValidated){
224
227
  throw new Error('RWS Webpack build failed.');
@@ -276,7 +279,7 @@ const RWSWebpackWrapper = (config) => {
276
279
  loader: 'ts-loader',
277
280
  options: {
278
281
  allowTsInNodeModules: true,
279
- configFile: path.resolve(config.tsConfigPath)
282
+ configFile: path.resolve(tsConfigPath)
280
283
  }
281
284
  },
282
285
  {
package/bun.lockb DELETED
Binary file