@signageos/lib 10.4.0-master.1639 → 10.4.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/CHANGELOG.md CHANGED
@@ -4,10 +4,11 @@ All notable changes to this project will be documented in this file.
4
4
  The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
5
5
  and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
6
6
 
7
- ## [Unreleased]
7
+ ## [10.4.0] - 2022-10-24
8
8
  ### Added
9
9
  - Class decorator that facilitate debugging of all methods of the class
10
10
  - Word string helper with capitalize, uncapitalize, pascal and camel case conversions.
11
+ - Tool `check-deps` can check expected range of versions instead of just exact match.
11
12
 
12
13
  ## [10.3.0] - 2022-10-12
13
14
  ### Added
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@signageos/lib",
3
- "version": "10.4.0-master.1639",
3
+ "version": "10.4.0",
4
4
  "main": "./dist",
5
5
  "files": [
6
6
  "tools",
@@ -7,7 +7,7 @@ const packagePath = process.cwd() + '/package.json';
7
7
  const package = require(packagePath);
8
8
 
9
9
  const ignorePath = process.cwd() + '/.check-depsignore';
10
- let = ignore = [];
10
+ let ignore = [];
11
11
  try {
12
12
  ignore = fs.readFileSync(ignorePath).toString().split('\n');
13
13
  console.log(`Ignoring packages from ${ignorePath}`);
@@ -15,6 +15,18 @@ try {
15
15
  console.log('No ignore file found');
16
16
  }
17
17
 
18
+ const runControlPath = process.cwd() + '/.check-depsrc.json';
19
+ let runControl = {};
20
+ try {
21
+ runControl = require(runControlPath);
22
+ console.log(`Using run control from ${runControlPath}`);
23
+ if (runControl.ignore) {
24
+ ignore = ignore.concat(runControl.ignore);
25
+ }
26
+ } catch (error) {
27
+ console.log('No Run Control file found');
28
+ }
29
+
18
30
  const includeRegExp = new RegExp(process.argv[2] || '.+');
19
31
  const excludeRegExp = new RegExp(process.argv[3] || '^$');
20
32
 
@@ -26,6 +38,11 @@ const matchedDepNames = depNames.filter((depName) => includeRegExp.test(depName)
26
38
 
27
39
  const prereleaseDepNames = [];
28
40
  const inexactDepNames = [];
41
+ const expectedRangeDepNames = [];
42
+
43
+ function isExpectedRangeValid(depName, version) {
44
+ return version.startsWith(runControl.expectRanges[depName]);
45
+ }
29
46
 
30
47
  for (const depName of matchedDepNames) {
31
48
  if (ignore.includes(depName)) {
@@ -35,8 +52,15 @@ for (const depName of matchedDepNames) {
35
52
  if (semver.prerelease(depVersion) !== null) {
36
53
  prereleaseDepNames.push(depName);
37
54
  }
38
- if (!semver.valid(depVersion)) {
39
- inexactDepNames.push(depName);
55
+ if (depName in runControl.expectRanges) {
56
+ if (!isExpectedRangeValid(depName, depVersion)) {
57
+ expectedRangeDepNames.push(depName);
58
+ }
59
+ } else {
60
+ if (!semver.valid(depVersion)) {
61
+ // Check inexact only when not expected range
62
+ inexactDepNames.push(depName);
63
+ }
40
64
  }
41
65
  }
42
66
 
@@ -52,6 +76,18 @@ if (prereleaseDepNames.length > 0) {
52
76
  );
53
77
  }
54
78
 
79
+ if (expectedRangeDepNames.length > 0) {
80
+ const expectedRangeDeps = {};
81
+ expectedRangeDepNames.forEach((depName) => {
82
+ expectedRangeDeps[depName] = deps[depName];
83
+ });
84
+ console.error(
85
+ `Some packages has expectation of range of versions specified in package.json deps`,
86
+ expectedRangeDepNames.map((depName) => `${depName}->"${runControl.expectRanges[depName]}"`).join(', '),
87
+ expectedRangeDeps,
88
+ );
89
+ }
90
+
55
91
  if (inexactDepNames.length > 0) {
56
92
  const inexactDeps = {};
57
93
  inexactDepNames.forEach((depName) => {
@@ -64,6 +100,6 @@ if (inexactDepNames.length > 0) {
64
100
  );
65
101
  }
66
102
 
67
- if (prereleaseDepNames.length > 0 || inexactDepNames.length > 0) {
103
+ if (prereleaseDepNames.length > 0 || expectedRangeDepNames.length > 0 || inexactDepNames.length > 0) {
68
104
  process.exit(1);
69
105
  }