@signageos/lib 12.1.1 → 12.1.2-master.2135
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 +4 -0
- package/package.json +4 -2
- package/tools/check-deps.js +3 -11
- package/tools/detect-semver-level.js +1 -9
- package/tools/es6-mocha.js +15 -20
- package/tools/get-release-log.js +2 -9
- package/tools/helper.js +8 -6
- package/tools/nodeModulesHelper.js +3 -4
- package/tools/test.js +4 -5
- package/tools/version-upgrade.js +2 -3
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,10 @@ 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]
|
|
8
|
+
### Fixed
|
|
9
|
+
- `retryAsyncUntil` function. It should wait in each recursion call if the callback promise is resolved successfully but the predicate is not met.
|
|
10
|
+
|
|
7
11
|
## [12.1.1] - 2023-09-14
|
|
8
12
|
### Fixed
|
|
9
13
|
- Service factory doesn't require uid
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@signageos/lib",
|
|
3
|
-
"version": "12.1.
|
|
3
|
+
"version": "12.1.2-master.2135",
|
|
4
4
|
"main": "./dist",
|
|
5
5
|
"files": [
|
|
6
6
|
"tools",
|
|
@@ -18,7 +18,9 @@
|
|
|
18
18
|
"build": "npm run build-es5 && npm run build-es6",
|
|
19
19
|
"build-es5": "tsc --target es5 --outDir dist",
|
|
20
20
|
"build-es6": "tsc --target es6 --outDir es6",
|
|
21
|
-
"lint": "tslint --
|
|
21
|
+
"lint": "tsc --noEmit -p tsconfig.json && tslint --project tsconfig.json",
|
|
22
|
+
"lint:prettier": "prettier \"**/*.+(ts|tsx|json|js)\" --check",
|
|
23
|
+
"lint:prettier:fix": "prettier \"**/*.+(ts|tsx|json|js)\" --write",
|
|
22
24
|
"prebuild": "rm -rf dist/*",
|
|
23
25
|
"prepare": "npm run prebuild && npm run build",
|
|
24
26
|
"test": "NODE_ENV=test mocha --opts mocha.opts",
|
package/tools/check-deps.js
CHANGED
|
@@ -30,7 +30,7 @@ try {
|
|
|
30
30
|
const includeRegExp = new RegExp(process.argv[2] || '.+');
|
|
31
31
|
const excludeRegExp = new RegExp(process.argv[3] || '^$');
|
|
32
32
|
|
|
33
|
-
const deps = { ...package.dependencies || {}, ...package.devDependencies || {} };
|
|
33
|
+
const deps = { ...(package.dependencies || {}), ...(package.devDependencies || {}) };
|
|
34
34
|
|
|
35
35
|
const depNames = Object.keys(deps);
|
|
36
36
|
|
|
@@ -69,11 +69,7 @@ if (prereleaseDepNames.length > 0) {
|
|
|
69
69
|
prereleaseDepNames.forEach((depName) => {
|
|
70
70
|
prereleaseDeps[depName] = deps[depName];
|
|
71
71
|
});
|
|
72
|
-
console.error(
|
|
73
|
-
`Some packages has prerelease tags in version in package.json deps`,
|
|
74
|
-
prereleaseDepNames.join(', '),
|
|
75
|
-
prereleaseDeps,
|
|
76
|
-
);
|
|
72
|
+
console.error(`Some packages has prerelease tags in version in package.json deps`, prereleaseDepNames.join(', '), prereleaseDeps);
|
|
77
73
|
}
|
|
78
74
|
|
|
79
75
|
if (expectedRangeDepNames.length > 0) {
|
|
@@ -93,11 +89,7 @@ if (inexactDepNames.length > 0) {
|
|
|
93
89
|
inexactDepNames.forEach((depName) => {
|
|
94
90
|
inexactDeps[depName] = deps[depName];
|
|
95
91
|
});
|
|
96
|
-
console.error(
|
|
97
|
-
`Some packages has not exact version specified in package.json deps`,
|
|
98
|
-
inexactDepNames.join(', '),
|
|
99
|
-
inexactDeps,
|
|
100
|
-
);
|
|
92
|
+
console.error(`Some packages has not exact version specified in package.json deps`, inexactDepNames.join(', '), inexactDeps);
|
|
101
93
|
}
|
|
102
94
|
|
|
103
95
|
if (prereleaseDepNames.length > 0 || expectedRangeDepNames.length > 0 || inexactDepNames.length > 0) {
|
|
@@ -1,14 +1,6 @@
|
|
|
1
|
-
|
|
2
1
|
const { getPipedInput, getGroupedChangeLog } = require('./helper');
|
|
3
2
|
|
|
4
|
-
const allChangeTypes = [
|
|
5
|
-
'Changed',
|
|
6
|
-
'Removed',
|
|
7
|
-
'Added',
|
|
8
|
-
'Fixed',
|
|
9
|
-
'Security',
|
|
10
|
-
'Deprecated',
|
|
11
|
-
];
|
|
3
|
+
const allChangeTypes = ['Changed', 'Removed', 'Added', 'Fixed', 'Security', 'Deprecated'];
|
|
12
4
|
|
|
13
5
|
(async function () {
|
|
14
6
|
const changeLog = await getPipedInput();
|
package/tools/es6-mocha.js
CHANGED
|
@@ -1,11 +1,10 @@
|
|
|
1
|
-
|
|
2
1
|
module.exports = exports = function (Mocha, co) {
|
|
3
2
|
Mocha.Runnable.prototype.run = function (fn) {
|
|
4
|
-
const self = this
|
|
5
|
-
const ms = this.timeout()
|
|
6
|
-
const start = new Date().valueOf()
|
|
7
|
-
const ctx = this.ctx
|
|
8
|
-
let finished
|
|
3
|
+
const self = this;
|
|
4
|
+
const ms = this.timeout();
|
|
5
|
+
const start = new Date().valueOf();
|
|
6
|
+
const ctx = this.ctx;
|
|
7
|
+
let finished;
|
|
9
8
|
let emitted;
|
|
10
9
|
|
|
11
10
|
if (ctx) ctx.runnable(this);
|
|
@@ -13,13 +12,10 @@ module.exports = exports = function (Mocha, co) {
|
|
|
13
12
|
// timeout
|
|
14
13
|
if (this.async) {
|
|
15
14
|
if (ms) {
|
|
16
|
-
this.timer = setTimeout(
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
},
|
|
21
|
-
ms
|
|
22
|
-
);
|
|
15
|
+
this.timer = setTimeout(function () {
|
|
16
|
+
done(new Error('timeout of ' + ms + 'ms exceeded'));
|
|
17
|
+
self.timedOut = true;
|
|
18
|
+
}, ms);
|
|
23
19
|
}
|
|
24
20
|
}
|
|
25
21
|
|
|
@@ -47,7 +43,7 @@ module.exports = exports = function (Mocha, co) {
|
|
|
47
43
|
if (this.async) {
|
|
48
44
|
try {
|
|
49
45
|
this.fn.call(ctx, function (err) {
|
|
50
|
-
if (err instanceof Error || toString.call(err) ===
|
|
46
|
+
if (err instanceof Error || toString.call(err) === '[object Error]') return done(err);
|
|
51
47
|
if (null != err) return done(new Error('done() invoked with non-Error: ' + err));
|
|
52
48
|
done();
|
|
53
49
|
});
|
|
@@ -65,7 +61,7 @@ module.exports = exports = function (Mocha, co) {
|
|
|
65
61
|
if (!this.pending) {
|
|
66
62
|
var result = this.fn.call(ctx);
|
|
67
63
|
// This is where we determine if the result is a generator
|
|
68
|
-
if (result && typeof
|
|
64
|
+
if (result && typeof result.next == 'function' && typeof result.throw == 'function') {
|
|
69
65
|
// Mocha timeout for async function
|
|
70
66
|
if (ms) {
|
|
71
67
|
this.timer = setTimeout(function () {
|
|
@@ -74,8 +70,7 @@ module.exports = exports = function (Mocha, co) {
|
|
|
74
70
|
}, ms);
|
|
75
71
|
}
|
|
76
72
|
// Use co to run generator to completion
|
|
77
|
-
co(result)
|
|
78
|
-
.then(
|
|
73
|
+
co(result).then(
|
|
79
74
|
function () {
|
|
80
75
|
this.duration = new Date().valueOf() - start;
|
|
81
76
|
done();
|
|
@@ -83,7 +78,7 @@ module.exports = exports = function (Mocha, co) {
|
|
|
83
78
|
function (err) {
|
|
84
79
|
this.duration = new Date().valueOf() - start;
|
|
85
80
|
done(err);
|
|
86
|
-
}
|
|
81
|
+
},
|
|
87
82
|
);
|
|
88
83
|
} else {
|
|
89
84
|
// Default Mocha handling of sync function
|
|
@@ -94,5 +89,5 @@ module.exports = exports = function (Mocha, co) {
|
|
|
94
89
|
} catch (err) {
|
|
95
90
|
fn(err);
|
|
96
91
|
}
|
|
97
|
-
}
|
|
98
|
-
}
|
|
92
|
+
};
|
|
93
|
+
};
|
package/tools/get-release-log.js
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
|
|
2
1
|
const { getPipedInput, getGroupedChangeLog } = require('./helper');
|
|
3
2
|
|
|
4
3
|
const version = process.argv[2] || 'Unreleased';
|
|
@@ -11,17 +10,11 @@ const outputType = process.argv[3] || 'text';
|
|
|
11
10
|
if (outputType === 'text') {
|
|
12
11
|
const changedTypes = Object.keys(groupedLog[version] || {});
|
|
13
12
|
const releaseNotes = changedTypes.reduce(
|
|
14
|
-
(notes, changeType) => [
|
|
15
|
-
...notes,
|
|
16
|
-
`${changeType}:`,
|
|
17
|
-
...groupedLog[version][changeType].map((note) => `- ${note}`),
|
|
18
|
-
'',
|
|
19
|
-
],
|
|
13
|
+
(notes, changeType) => [...notes, `${changeType}:`, ...groupedLog[version][changeType].map((note) => `- ${note}`), ''],
|
|
20
14
|
[],
|
|
21
15
|
);
|
|
22
16
|
output = releaseNotes.join('\n');
|
|
23
|
-
} else
|
|
24
|
-
if (outputType === 'groups') {
|
|
17
|
+
} else if (outputType === 'groups') {
|
|
25
18
|
output = typeof groupedLog[version] !== 'undefined' ? groupedLog[version] : {};
|
|
26
19
|
}
|
|
27
20
|
process.stdout.write(JSON.stringify(output));
|
package/tools/helper.js
CHANGED
|
@@ -7,11 +7,11 @@ exports.getPipedInput = function () {
|
|
|
7
7
|
let inputData;
|
|
8
8
|
process.stdin.resume();
|
|
9
9
|
process.stdin.setEncoding('utf8');
|
|
10
|
-
process.stdin.on('data', (chunk) => inputData += chunk);
|
|
10
|
+
process.stdin.on('data', (chunk) => (inputData += chunk));
|
|
11
11
|
process.stdin.on('end', () => resolve(inputData));
|
|
12
12
|
process.stdin.on('error', (error) => reject(error));
|
|
13
13
|
});
|
|
14
|
-
}
|
|
14
|
+
};
|
|
15
15
|
|
|
16
16
|
exports.getGroupedChangeLog = function (changeLog) {
|
|
17
17
|
const newLines = changeLog
|
|
@@ -20,7 +20,10 @@ exports.getGroupedChangeLog = function (changeLog) {
|
|
|
20
20
|
const { groupedLog } = newLines.reduce(
|
|
21
21
|
(reduction, line) => {
|
|
22
22
|
if (line.startsWith(VERSION_HEADER)) {
|
|
23
|
-
const version = line
|
|
23
|
+
const version = line
|
|
24
|
+
.substring(VERSION_HEADER.length)
|
|
25
|
+
.match(/^\[?(([\d\w\.\-\+])+)\]?/)[1]
|
|
26
|
+
.trim();
|
|
24
27
|
if (reduction.groupedLog[version] !== undefined) {
|
|
25
28
|
throw new Error(`The version "${version}" is duplicated in CHANGELOG`);
|
|
26
29
|
}
|
|
@@ -32,8 +35,7 @@ exports.getGroupedChangeLog = function (changeLog) {
|
|
|
32
35
|
[version]: reduction.groupedLog[version] || {},
|
|
33
36
|
},
|
|
34
37
|
};
|
|
35
|
-
} else
|
|
36
|
-
if (line.startsWith(CHANGES_HEADER)) {
|
|
38
|
+
} else if (line.startsWith(CHANGES_HEADER)) {
|
|
37
39
|
const type = line.substring(CHANGES_HEADER.length).trim();
|
|
38
40
|
if (reduction.groupedLog[reduction.lastVersion] === undefined) {
|
|
39
41
|
throw new Error(`The type "${type}" is not under any version section in CHANGELOG`);
|
|
@@ -68,4 +70,4 @@ exports.getGroupedChangeLog = function (changeLog) {
|
|
|
68
70
|
{ groupedLog: {}, lastType: null, lastVersion: null },
|
|
69
71
|
);
|
|
70
72
|
return groupedLog;
|
|
71
|
-
}
|
|
73
|
+
};
|
|
@@ -1,13 +1,12 @@
|
|
|
1
|
-
|
|
2
1
|
const fs = require('fs');
|
|
3
2
|
|
|
4
3
|
function getNodeModulesExternals(rootDir) {
|
|
5
4
|
const nodeModules = {};
|
|
6
5
|
fs.readdirSync(rootDir + '/node_modules')
|
|
7
|
-
.filter(function(dirName) {
|
|
6
|
+
.filter(function (dirName) {
|
|
8
7
|
return ['.bin'].indexOf(dirName) === -1;
|
|
9
8
|
})
|
|
10
|
-
.forEach(function(moduleName) {
|
|
9
|
+
.forEach(function (moduleName) {
|
|
11
10
|
nodeModules[moduleName] = 'commonjs ' + moduleName;
|
|
12
11
|
});
|
|
13
12
|
return nodeModules;
|
|
@@ -19,5 +18,5 @@ function getNodeModulesNames() {
|
|
|
19
18
|
|
|
20
19
|
exports = module.exports = {
|
|
21
20
|
getNodeModulesExternals,
|
|
22
|
-
getNodeModulesNames
|
|
21
|
+
getNodeModulesNames,
|
|
23
22
|
};
|
package/tools/test.js
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
|
|
2
1
|
const co = require('co');
|
|
3
2
|
const Mocha = require('mocha');
|
|
4
3
|
require('./es6-mocha')(Mocha, co);
|
|
@@ -17,10 +16,10 @@ const testPostfix = testType ? '-' + testType : '';
|
|
|
17
16
|
const mocha = new Mocha({
|
|
18
17
|
fullTrace: true,
|
|
19
18
|
reporterOptions: {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
}
|
|
19
|
+
junit_report_name: 'tests',
|
|
20
|
+
junit_report_path: 'dist/test' + testPostfix + '-report.xml',
|
|
21
|
+
junit_report_stack: 1,
|
|
22
|
+
},
|
|
24
23
|
});
|
|
25
24
|
mocha.addFile(testPath + '/test' + testPostfix + '.js');
|
|
26
25
|
mocha.run((failures) => {
|
package/tools/version-upgrade.js
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
|
|
2
1
|
const fs = require('fs');
|
|
3
2
|
|
|
4
3
|
const packagePath = process.cwd() + '/package.json';
|
|
@@ -23,7 +22,7 @@ if (packageLock) {
|
|
|
23
22
|
}
|
|
24
23
|
}
|
|
25
24
|
|
|
26
|
-
fs.writeFileSync(packagePath, JSON.stringify(package, null, 2) +
|
|
25
|
+
fs.writeFileSync(packagePath, JSON.stringify(package, null, 2) + '\n');
|
|
27
26
|
if (packageLock) {
|
|
28
|
-
fs.writeFileSync(packageLockPath, JSON.stringify(packageLock, null, 2) +
|
|
27
|
+
fs.writeFileSync(packageLockPath, JSON.stringify(packageLock, null, 2) + '\n');
|
|
29
28
|
}
|