@eui/tools 5.3.32 → 5.3.35

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.
@@ -1 +1 @@
1
- 5.3.32
1
+ 5.3.35
package/CHANGELOG.md CHANGED
@@ -1,3 +1,34 @@
1
+ ## 5.3.35 (2022-07-14)
2
+
3
+ ##### Chores
4
+
5
+ * **other:**
6
+ * minor - EUI-6231 [EUI-6231](https://webgate.ec.europa.eu/CITnet/jira/browse/EUI-6231) ([f0c7b31b](https://webgate.ec.europa.eu/CITnet/stash/scm/csdr/eui-tools.git/commits/f0c7b31bbc6c30daef688f5b4bdbf38a7470ebc5))
7
+ ##### Bug Fixes
8
+
9
+ * **other:**
10
+ * incorrect tsconfig filename ([6c65019b](https://webgate.ec.europa.eu/CITnet/stash/scm/csdr/eui-tools.git/commits/6c65019b150736f2a6bd5d1b9801bbfafe3a5a5b))
11
+
12
+ * * *
13
+ * * *
14
+ ## 5.3.34 (2022-07-14)
15
+
16
+ ##### Chores
17
+
18
+ * **other:**
19
+ * support esLint for apps - EUI-6231 [EUI-6231](https://webgate.ec.europa.eu/CITnet/jira/browse/EUI-6231) ([6d211c50](https://webgate.ec.europa.eu/CITnet/stash/scm/csdr/eui-tools.git/commits/6d211c50cd08ec43d1d129fca64ec0bf010dec1c))
20
+
21
+ * * *
22
+ * * *
23
+ ## 5.3.33 (2022-07-14)
24
+
25
+ ##### Chores
26
+
27
+ * **other:**
28
+ * support tsconfig.json usage in lib packages - EUI-6227 [EUI-6227](https://webgate.ec.europa.eu/CITnet/jira/browse/EUI-6227) ([72c220f8](https://webgate.ec.europa.eu/CITnet/stash/scm/csdr/eui-tools.git/commits/72c220f872f652b4f94359a74d89845d29b475a5))
29
+
30
+ * * *
31
+ * * *
1
32
  ## 5.3.32 (2022-07-13)
2
33
 
3
34
  ##### Chores
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eui/tools",
3
- "version": "5.3.32",
3
+ "version": "5.3.35",
4
4
  "tag": "latest",
5
5
  "license": "EUPL-1.1",
6
6
  "description": "eUI common tools and scripts",
@@ -1085,7 +1085,7 @@ const angularPackageDef = {
1085
1085
  "build": {
1086
1086
  "builder": "@angular-devkit/build-ng-packagr:build",
1087
1087
  "options": {
1088
- "tsConfig": "@path@/@module.name@/tsconfig.lib.json",
1088
+ "tsConfig": "@path@/@module.name@/@tsconfig@",
1089
1089
  "project": "@path@/@module.name@/ng-package.json"
1090
1090
  },
1091
1091
  "configurations": {
@@ -1114,12 +1114,12 @@ const angularPackageSubEntryDef = {
1114
1114
  "build": {
1115
1115
  "builder": "@angular-devkit/build-angular:ng-packagr",
1116
1116
  "options": {
1117
- "tsConfig": "packages/eui/packages/components/tsconfig.lib.json",
1117
+ "tsConfig": "packages/eui/packages/components/@tsconfig@",
1118
1118
  "project": "packages/eui/packages/components/@subEntry.path@/@subEntry.package.name@"
1119
1119
  },
1120
1120
  "configurations": {
1121
1121
  "production": {
1122
- "tsConfig": "packages/eui/packages/components/tsconfig.lib.json"
1122
+ "tsConfig": "packages/eui/packages/components/@tsconfig@"
1123
1123
  }
1124
1124
  }
1125
1125
  },
@@ -1154,7 +1154,7 @@ const angularPackageDefV13 = {
1154
1154
  "build": {
1155
1155
  "builder": "@angular-devkit/build-angular:ng-packagr",
1156
1156
  "options": {
1157
- "tsConfig": "@path@/@module.name@/tsconfig.lib.json",
1157
+ "tsConfig": "@path@/@module.name@/@tsconfig@",
1158
1158
  "project": "@path@/@module.name@/ng-package.json"
1159
1159
  },
1160
1160
  "configurations": {
@@ -1194,7 +1194,7 @@ const angularPackageDefV14 = {
1194
1194
  "build": {
1195
1195
  "builder": "@angular-devkit/build-angular:ng-packagr",
1196
1196
  "options": {
1197
- "tsConfig": "@path@/@module.name@/tsconfig.lib.json",
1197
+ "tsConfig": "@path@/@module.name@/@tsconfig@",
1198
1198
  "project": "@path@/@module.name@/ng-package.json"
1199
1199
  },
1200
1200
  "configurations": {
@@ -1385,14 +1385,15 @@ module.exports.registerAngularPackage = (pkg, isReset) => {
1385
1385
  const replacePath = tools.replaceAll(replaceModule, '@path@', pathBase);
1386
1386
  const replaceSrcRoot = tools.replaceAll(replacePath, '@srcRoot@', srcRoot);
1387
1387
  const replaceSrcRootTesting = tools.replaceAll(replaceSrcRoot, '@srcRootTesting@', srcRootTesting);
1388
+ const replaceTSConfig = tools.replaceAll(replaceSrcRootTesting, '@tsconfig@', pkg.tsConfigFileName);
1388
1389
 
1389
- jsonFile['projects'][pkg.name] = JSON.parse(replaceSrcRootTesting);
1390
+ jsonFile['projects'][pkg.name] = JSON.parse(replaceTSConfig);
1390
1391
 
1391
1392
  tools.writeJsonFileSync(file, jsonFile);
1392
1393
  }
1393
1394
 
1394
1395
 
1395
- module.exports.registerAngularPackageSubEntry = (subEntryName, subEntryPath) => {
1396
+ module.exports.registerAngularPackageSubEntry = (subEntryName, subEntryPath, pkg) => {
1396
1397
  const file = path.join(process.cwd(), 'angular.json');
1397
1398
  const jsonFile = require(file);
1398
1399
 
@@ -1400,6 +1401,7 @@ module.exports.registerAngularPackageSubEntry = (subEntryName, subEntryPath) =>
1400
1401
 
1401
1402
  let replacePath = tools.replaceAll(projectDef, '@subEntry.path@', subEntryName)
1402
1403
  replacePath = tools.replaceAll(replacePath, '@subEntry.package.name@', 'ng-package.json');
1404
+ replacePath = tools.replaceAll(replacePath, '@tsconfig@', pkg.tsConfigFileName);
1403
1405
 
1404
1406
  jsonFile['projects'][subEntryName] = JSON.parse(replacePath);
1405
1407
 
@@ -107,6 +107,7 @@ module.exports.getPackage = (pkgName, fromCsdrConfig, optional) => {
107
107
 
108
108
  // additional pkg infos
109
109
  pkg.paths = this.getPackagePaths(pkg);
110
+ pkg.tsConfigFileName = `${path.parse(pkg.paths.tsConfig).name}.json` ;
110
111
 
111
112
  // devops file location
112
113
  if (pkg.child) {
@@ -182,6 +183,7 @@ module.exports.getPackagePaths = (pkg) => {
182
183
  pkgJson: resolvePath(packagesPath + '/' + folder + '/package.json'),
183
184
  pkgSrc: resolvePath(packagesPath + '/' + folder + '/src'),
184
185
  pkgLibFolder: resolvePath(packagesPath + '/' + folder + '/src/lib'),
186
+ tsConfig: this.getTSConfigPath(resolvePath, packagesPath + '/' + folder),
185
187
  };
186
188
 
187
189
  return paths;
@@ -307,3 +309,13 @@ module.exports.getLocalPackagesEuiVersion = () => {
307
309
 
308
310
  return versionsFound;
309
311
  }
312
+
313
+ module.exports.getTSConfigPath = (resolvePath, packagePath) => {
314
+ const path = resolvePath(`${packagePath}/tsconfig.json`);
315
+ const oldPath = resolvePath(`${packagePath}/tsconfig.lib.json`);
316
+ return fs.existsSync(path) ? path : oldPath;
317
+ }
318
+
319
+ module.exports.getTSConfigFileName = (tsConfigPath) => {
320
+ return tsConfigPath.split('/')[tsConfigPath.split('/').length - 1];
321
+ }
@@ -58,6 +58,17 @@ const getProjectPaths = (prj) => {
58
58
  nodeModulesPath: nodeModulesPath,
59
59
  };
60
60
 
61
+ // locate and find the TSLint or ESLint configuration files
62
+ if(tools.isFileExists(path.join(rootPath, 'src', 'tslint.json'))) {
63
+ tools.logWarning('TSLint is deprecated and will be removed in the future. Consider migrating to ESLint')
64
+ paths.tslintPath = path.join(rootPath, 'src', 'tslint.json');
65
+ } else if(tools.isFileExists(path.join(rootPath, '.tslint.json'))) {
66
+ tools.logWarning('TSLint is deprecated and will be removed in the future. Consider migrating to ESLint')
67
+ paths.tslintPath = path.join(rootPath, '.tslint.json');
68
+ } else if(tools.isFileExists(path.join(rootPath, 'src', '.eslintrc.json'))) {
69
+ paths.eslintPath = path.join(rootPath, 'src', '.eslintrc.json');
70
+ }
71
+
61
72
  return { paths: paths };
62
73
  }
63
74
 
@@ -156,7 +167,6 @@ module.exports.getCsdrProjects = () => {
156
167
 
157
168
 
158
169
 
159
-
160
170
  module.exports.getTeamsProject = (projects, project) => {
161
171
  let teams = [];
162
172
 
@@ -83,15 +83,29 @@ module.exports.angular = (envTarget, isSnapshot, version, configEnvTargetIn) =>
83
83
  .then(() => {
84
84
  if (!skipLint) {
85
85
  tools.logInfo(`TS Linting application...`);
86
- const tsLintPath = path.join(currentProject.paths.angularPath, 'tslint.json');
87
- var tsConfigPath = path.join(currentProject.paths.angularPath, 'tsconfig.app.json');
88
- if (!tools.isFileExists(tsConfigPath)) {
89
- tsConfigPath = path.join(currentProject.paths.angularPath, 'src', 'tsconfig.app.json');
90
- }
91
- if (tools.isFileExists(tsConfigPath)) {
92
- tools.logInfo(`running tslint -c ${tsLintPath} -p ${tsConfigPath}`);
93
- return tools.runScript(`tslint -c ${tsLintPath} -p ${tsConfigPath}`);
86
+ let tsLintPath = currentProject.paths.tslintPath;
87
+ let esLintPath = currentProject.paths.eslintPath;
88
+
89
+ // TODO: remove TSLint since it's deprecated and should not be used by projects in the future
90
+ if(tsLintPath) {
91
+ tsLintPath = path.join(tsLintPath);
92
+ let tsConfigPath = path.join(currentProject.paths.angularPath, 'tsconfig.app.json');
93
+ tools.logWarning('TSLint is deprecated and will be removed in the future. Consider migrating to ESLint')
94
+ if (!tools.isFileExists(tsConfigPath)) {
95
+ tsConfigPath = path.join(currentProject.paths.angularPath, 'src', 'tsconfig.app.json');
96
+ }
97
+ if (tools.isFileExists(tsConfigPath)) {
98
+ tools.logInfo(`running tslint -c ${tsLintPath} -p ${tsConfigPath}`);
99
+ return tools.runScript(`tslint -c ${tsLintPath} -p ${tsConfigPath}`);
100
+ }
101
+ } else if (esLintPath) {
102
+ // the project path information are located inside the .eslintrc.json
103
+ tools.logInfo(`running ng lint ${currentProject.name}`);
104
+ return tools.runScript(`ng lint ${currentProject.name}`);
105
+ } else {
106
+ tools.logError(`No ESLint or TSLint configuration found for the project`);
94
107
  }
108
+
95
109
  }
96
110
  })
97
111
 
@@ -51,9 +51,9 @@ module.exports.build = (pkg, isMaster) => {
51
51
  if (tools.isFileExists(tsLintPath)) {
52
52
  // TODO: remove TSLint since it's deprecated and should not be used by projects in the future
53
53
  tools.logWarning('TSLint is deprecated and will be removed in the future. Consider migrating to ESLint')
54
- const tsConfigPath = path.join(pkg.paths.pkgRootDirectory, 'tsconfig.lib.json');
55
- tools.logInfo(`running tslint -c ${tsLintPath} -p ${tsConfigPath}`);
56
- return tools.runScript(`tslint -c ${tsLintPath} -p ${tsConfigPath} -t verbose`);
54
+ const script = `running tslint -c ${tsLintPath} -p ${pkg.paths.tsConfig} -t verbose`
55
+ tools.logInfo(script);
56
+ return tools.runScript(script);
57
57
  } else if(tools.isFileExists(esLintPath)) {
58
58
  // the project path information are located inside the .eslintrc.json
59
59
  tools.logInfo(`running ng lint ${pkg.name}`);
@@ -101,7 +101,7 @@ module.exports.build = (pkg, isMaster) => {
101
101
  return tools.rimraf(docDistPath);
102
102
  })
103
103
  .then(() => {
104
- return tools.runScript(`compodoc -p ${pkg.paths.pkgRootDirectory}/tsconfig.lib.json -d ${docDistPath} --theme material --disableGraph --disableCoverage --disableSourceCode --disableDomTree --disableProtected --disablePrivate --disableLifeCycleHooks --disableTemplateTab --disableStyleTab --hideGenerator --toggleMenuItems all`);
104
+ return tools.runScript(`compodoc -p ${pkg.paths.pkgRootDirectory}/${pkg.tsConfigFileName} -d ${docDistPath} --theme material --disableGraph --disableCoverage --disableSourceCode --disableDomTree --disableProtected --disablePrivate --disableLifeCycleHooks --disableTemplateTab --disableStyleTab --hideGenerator --toggleMenuItems all`);
105
105
  })
106
106
  .then(() => {
107
107
  tools.logSuccess();
@@ -217,7 +217,7 @@ module.exports.buildSubEntry = (pkg, subEntry) => {
217
217
  subEntryPath = subEntryPath.replace('/ng-package.json', '');
218
218
  tools.logInfo(`${subEntryPath} found... injecting angular.json for sub entry`);
219
219
 
220
- return configUtils.angular.registerAngularPackageSubEntry(subEntry, subEntryPath);
220
+ return configUtils.angular.registerAngularPackageSubEntry(subEntry, subEntryPath, pkg);
221
221
  };
222
222
  }
223
223
  })