prd-workflow-cli 1.1.25 → 1.1.26
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/package.json +1 -1
- package/scripts/postinstall.js +16 -3
package/package.json
CHANGED
package/scripts/postinstall.js
CHANGED
|
@@ -113,13 +113,26 @@ function getAllFiles(dirPath, basePath = dirPath) {
|
|
|
113
113
|
function main() {
|
|
114
114
|
try {
|
|
115
115
|
// 获取 npm 包的路径(当前脚本所在目录的上级)
|
|
116
|
+
// 脚本路径: node_modules/prd-workflow-cli/scripts/postinstall.js
|
|
117
|
+
// __dirname = node_modules/prd-workflow-cli/scripts
|
|
118
|
+
// packagePath = node_modules/prd-workflow-cli
|
|
116
119
|
const packagePath = path.join(__dirname, '..');
|
|
117
120
|
|
|
118
|
-
//
|
|
119
|
-
//
|
|
120
|
-
|
|
121
|
+
// 项目根目录的推断:
|
|
122
|
+
// packagePath = /project/node_modules/prd-workflow-cli
|
|
123
|
+
// node_modules = /project/node_modules
|
|
124
|
+
// projectRoot = /project
|
|
125
|
+
const nodeModulesPath = path.dirname(packagePath);
|
|
121
126
|
const potentialProjectRoot = path.dirname(nodeModulesPath);
|
|
122
127
|
|
|
128
|
+
// 调试信息(仅在非静默模式下显示)
|
|
129
|
+
if (!SILENT && process.env.PRD_DEBUG === 'true') {
|
|
130
|
+
console.log('DEBUG: __dirname =', __dirname);
|
|
131
|
+
console.log('DEBUG: packagePath =', packagePath);
|
|
132
|
+
console.log('DEBUG: nodeModulesPath =', nodeModulesPath);
|
|
133
|
+
console.log('DEBUG: potentialProjectRoot =', potentialProjectRoot);
|
|
134
|
+
}
|
|
135
|
+
|
|
123
136
|
// 检查是否是 PRD 项目
|
|
124
137
|
const projectRoot = findProjectRoot(potentialProjectRoot);
|
|
125
138
|
|