aicp-tracker 1.1.9 → 1.2.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/setup.js +8 -4
- package/package.json +1 -1
package/bin/setup.js
CHANGED
|
@@ -10,11 +10,15 @@ const path = require('path');
|
|
|
10
10
|
const isPostinstall = process.env.npm_lifecycle_event === 'postinstall';
|
|
11
11
|
if (isPostinstall) {
|
|
12
12
|
// Always record which project this package was installed into.
|
|
13
|
-
//
|
|
13
|
+
// INIT_CWD = the directory where `npm install` was run (the project root).
|
|
14
|
+
// process.cwd() in postinstall is the package's own directory — do NOT use it.
|
|
14
15
|
try {
|
|
15
|
-
const
|
|
16
|
-
|
|
17
|
-
|
|
16
|
+
const projectPath = process.env.INIT_CWD;
|
|
17
|
+
if (projectPath) {
|
|
18
|
+
const config = require('../src/config');
|
|
19
|
+
const existing = config.load() || {};
|
|
20
|
+
config.save({ ...existing, projectPath });
|
|
21
|
+
}
|
|
18
22
|
} catch {}
|
|
19
23
|
|
|
20
24
|
let existing = null;
|