@uxf/scripts 11.11.3 → 11.14.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/bin/uxf-audit.js +9 -0
- package/package.json +2 -1
- package/src/GitLab.js +1 -1
- package/src/uxf-audit/index.js +72 -0
package/bin/uxf-audit.js
ADDED
package/package.json
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@uxf/scripts",
|
|
3
|
-
"version": "11.
|
|
3
|
+
"version": "11.14.0",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"bin": {
|
|
7
|
+
"uxf-audit": "bin/uxf-audit.js",
|
|
7
8
|
"uxf-lunch": "bin/uxf-lunch.js",
|
|
8
9
|
"uxf-release": "bin/uxf-release.js",
|
|
9
10
|
"uxf-sitemap-check": "bin/uxf-sitemap-check.js",
|
package/src/GitLab.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
const { env } = require("process");
|
|
2
2
|
const { create } = require("axios");
|
|
3
3
|
const dayjs = require("dayjs");
|
|
4
|
-
const parse =
|
|
4
|
+
const parse = import("@commitlint/parse");
|
|
5
5
|
|
|
6
6
|
const axios = create({
|
|
7
7
|
baseURL: `${env.CI_SERVER_URL}/api/v4`,
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
const exec = require("child_process").exec;
|
|
2
|
+
|
|
3
|
+
function execute(command) {
|
|
4
|
+
return new Promise((resolve) => {
|
|
5
|
+
exec(command, function (error, stdout, stderr) {
|
|
6
|
+
resolve(stdout);
|
|
7
|
+
});
|
|
8
|
+
});
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
function executeJson(command) {
|
|
12
|
+
return execute(command).then((output) => JSON.parse(output));
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
function parsePackageName(name) {
|
|
16
|
+
if (name.charAt(0) === "@") {
|
|
17
|
+
const [nameWithoutAt, version] = name.replace("@", "").split("@");
|
|
18
|
+
|
|
19
|
+
return [`@${nameWithoutAt}`, version];
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
return name.split("@");
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
function getUxfPackagesInfo() {
|
|
26
|
+
return executeJson('yarn list --pattern "@uxf" --depth=1 --json').then((output) => {
|
|
27
|
+
const result = {};
|
|
28
|
+
|
|
29
|
+
output.data.trees
|
|
30
|
+
.map((info) => {
|
|
31
|
+
const [name, version] = parsePackageName(info.name);
|
|
32
|
+
return {
|
|
33
|
+
name,
|
|
34
|
+
version,
|
|
35
|
+
isError: info.children.length > 0,
|
|
36
|
+
};
|
|
37
|
+
})
|
|
38
|
+
.forEach((item) => {
|
|
39
|
+
result[item.name] = item;
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
return result;
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
function getPackageVersion(packageName) {
|
|
47
|
+
return executeJson(`yarn list ${packageName} --depth=0 --json`).then((output) => {
|
|
48
|
+
return parsePackageName(output.data.trees[0].name)[1];
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
function getNodeVersion() {
|
|
53
|
+
return execute("node -v").then((output) => {
|
|
54
|
+
return output.replace("v", "").trim();
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
module.exports = async function run() {
|
|
59
|
+
console.log(
|
|
60
|
+
JSON.stringify(
|
|
61
|
+
{
|
|
62
|
+
node: await getNodeVersion(),
|
|
63
|
+
next: await getPackageVersion("next"),
|
|
64
|
+
react: await getPackageVersion("react"),
|
|
65
|
+
"react-dom": await getPackageVersion("react-dom"),
|
|
66
|
+
packages: await getUxfPackagesInfo(),
|
|
67
|
+
},
|
|
68
|
+
null,
|
|
69
|
+
" ",
|
|
70
|
+
),
|
|
71
|
+
);
|
|
72
|
+
};
|