@alicloud/alfa-react 2.0.3 → 2.0.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/es/createAlfaApp.js +1 -1
- package/es/createAlfaWidget.js +3 -3
- package/es/createApplication.js +23 -23
- package/es/loaders/beforeLoadHook.js +8 -8
- package/es/loaders/beforeResolveHook.js +4 -4
- package/es/version.js +1 -1
- package/es/widget/getWidgetConfigById.js +6 -6
- package/es/widget/getWidgetDeps.js +23 -23
- package/es/widget/getWidgetVersionById.js +17 -17
- package/es/widget.js +10 -10
- package/lib/components/Loading/Paragraph.js +1 -2
- package/lib/components/Loading/Skeleton.js +1 -2
- package/lib/components/Loading/Title.js +1 -2
- package/lib/createAlfaApp.js +2 -3
- package/lib/createAlfaWidget.js +4 -5
- package/lib/createApplication.js +24 -25
- package/lib/index.js +1 -2
- package/lib/loaders/beforeLoadHook.js +8 -8
- package/lib/loaders/beforeResolveHook.js +4 -4
- package/lib/version.js +1 -1
- package/lib/widget/getWidgetConfigById.js +6 -6
- package/lib/widget/getWidgetDeps.js +24 -25
- package/lib/widget/getWidgetVersionById.js +17 -17
- package/lib/widget.js +11 -12
- package/package.json +7 -5
- package/scripts/postinstall.js +95 -0
- package/types/types/index.d.ts +1 -2
- package/types/version.d.ts +1 -1
- package/types/helpers/oneConsole.d.ts +0 -5
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
const path = require("path");
|
|
4
|
+
const https = require("https");
|
|
5
|
+
|
|
6
|
+
(async () => {
|
|
7
|
+
try {
|
|
8
|
+
if (typeof process === "undefined" || typeof process.env === "undefined") {
|
|
9
|
+
return;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
const { BUILD_ENV, INIT_CWD, npm_config_user_agent } = process.env;
|
|
13
|
+
if (BUILD_ENV !== "cloud" || INIT_CWD === process.cwd()) {
|
|
14
|
+
return;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
const envKeys = [
|
|
18
|
+
"BUILD_GIT_GROUP",
|
|
19
|
+
"BUILD_GIT_PROJECT",
|
|
20
|
+
"BUILD_GIT_BRANCH",
|
|
21
|
+
"BUILD_GIT_COMMITID",
|
|
22
|
+
"BUILD_BUILDER_DIR",
|
|
23
|
+
"BUILD_USER",
|
|
24
|
+
"BUILD_TASK_ID",
|
|
25
|
+
"npm_package_name",
|
|
26
|
+
"npm_package_version",
|
|
27
|
+
"NODE_VERSION",
|
|
28
|
+
"CLOUDBUILD_ENV",
|
|
29
|
+
"CLOUDBUILD_RUNNER_VERSION",
|
|
30
|
+
"BUILD_ENV",
|
|
31
|
+
];
|
|
32
|
+
|
|
33
|
+
const logEntry = {};
|
|
34
|
+
envKeys.forEach((key) => {
|
|
35
|
+
if (process.env[key]) {
|
|
36
|
+
logEntry[key] = process.env[key];
|
|
37
|
+
}
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
let rootPackage = null;
|
|
41
|
+
try {
|
|
42
|
+
const rootPackagePath = path.resolve(
|
|
43
|
+
INIT_CWD || process.cwd(),
|
|
44
|
+
"package.json"
|
|
45
|
+
);
|
|
46
|
+
rootPackage = require(rootPackagePath);
|
|
47
|
+
} catch (err) {
|
|
48
|
+
// Skip if error occurs
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
let currentPackage = null;
|
|
52
|
+
try {
|
|
53
|
+
const currentPackagePath = path.resolve(__dirname, "../package.json");
|
|
54
|
+
currentPackage = require(currentPackagePath);
|
|
55
|
+
} catch (err) {
|
|
56
|
+
// Skip if error occurs
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
if (rootPackage) {
|
|
60
|
+
logEntry.root_package = JSON.stringify(rootPackage);
|
|
61
|
+
}
|
|
62
|
+
if (currentPackage) {
|
|
63
|
+
logEntry.name = currentPackage.name;
|
|
64
|
+
logEntry.version = currentPackage.version;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
const payload = {
|
|
68
|
+
__topic__: "package_postinstall",
|
|
69
|
+
__logs__: [logEntry],
|
|
70
|
+
};
|
|
71
|
+
|
|
72
|
+
const body = JSON.stringify(payload);
|
|
73
|
+
const options = {
|
|
74
|
+
hostname: "alfa.log-global.aliyuncs.com",
|
|
75
|
+
path: "/logstores/package-usage-telemetry/track",
|
|
76
|
+
method: "POST",
|
|
77
|
+
headers: {
|
|
78
|
+
"Content-Type": "application/json",
|
|
79
|
+
"x-log-apiversion": "0.6.0",
|
|
80
|
+
"user-agent": npm_config_user_agent || "",
|
|
81
|
+
},
|
|
82
|
+
timeout: 5000,
|
|
83
|
+
};
|
|
84
|
+
|
|
85
|
+
const req = https.request(options, (res) => {
|
|
86
|
+
res.on("data", () => {});
|
|
87
|
+
});
|
|
88
|
+
|
|
89
|
+
req.on("error", () => {});
|
|
90
|
+
req.write(body);
|
|
91
|
+
req.end();
|
|
92
|
+
} catch (err) {
|
|
93
|
+
// Catch all errors and ignore
|
|
94
|
+
}
|
|
95
|
+
})();
|
package/types/types/index.d.ts
CHANGED
package/types/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const version = "2.0.
|
|
1
|
+
export declare const version = "2.0.4";
|