@sociallane/elements 1.0.6 → 1.0.7
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/install.js +17 -3
package/package.json
CHANGED
package/scripts/install.js
CHANGED
|
@@ -107,9 +107,23 @@ function copyPackage(toDir, filter) {
|
|
|
107
107
|
}
|
|
108
108
|
|
|
109
109
|
function install(targetPath, minimal) {
|
|
110
|
-
const
|
|
111
|
-
|
|
112
|
-
|
|
110
|
+
const cwd = process.cwd();
|
|
111
|
+
const resolveDefaultTarget = () => {
|
|
112
|
+
if (existsSync(path.join(cwd, 'sociallane-elements.php'))) {
|
|
113
|
+
return cwd;
|
|
114
|
+
}
|
|
115
|
+
if (path.basename(cwd) === 'plugins' && path.basename(path.dirname(cwd)) === 'wp-content') {
|
|
116
|
+
return path.join(cwd, 'sociallane-elements');
|
|
117
|
+
}
|
|
118
|
+
if (path.basename(cwd) === 'wp-content') {
|
|
119
|
+
return path.join(cwd, 'plugins', 'sociallane-elements');
|
|
120
|
+
}
|
|
121
|
+
if (existsSync(path.join(cwd, 'wp-content', 'plugins'))) {
|
|
122
|
+
return path.join(cwd, 'wp-content', 'plugins', 'sociallane-elements');
|
|
123
|
+
}
|
|
124
|
+
return path.join(cwd, 'wp-content', 'plugins', 'sociallane-elements');
|
|
125
|
+
};
|
|
126
|
+
const target = targetPath ? path.resolve(cwd, targetPath) : resolveDefaultTarget();
|
|
113
127
|
|
|
114
128
|
const targetResolved = path.resolve(target);
|
|
115
129
|
const isSelf = targetResolved === path.resolve(packageRoot) || targetResolved.startsWith(packageRoot + path.sep);
|