@alicloud/alfa-react 2.0.3-alpha.5 → 2.0.4-beta.1

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.
@@ -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
+ })();
@@ -1,5 +1,4 @@
1
- /// <reference types="react" />
2
- import React from 'React';
1
+ import React from 'react';
3
2
  import { createMicroApp, IAppConfig } from '@alicloud/alfa-core';
4
3
  export interface AlfaVersion {
5
4
  entry: string;
@@ -1 +1 @@
1
- export declare const version = "2.0.3-alpha.5";
1
+ export declare const version = "2.0.4-beta.1";
@@ -1,5 +0,0 @@
1
- /**
2
- * 是否是 oneConsole 环境
3
- * @returns
4
- */
5
- export declare function isOneConsole(): boolean;