@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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/scripts/install.js +17 -3
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sociallane/elements",
3
- "version": "1.0.6",
3
+ "version": "1.0.7",
4
4
  "description": "Elementor widgets and elements with Tailwind CSS for SocialLane. WordPress plugin.",
5
5
  "type": "module",
6
6
  "private": false,
@@ -107,9 +107,23 @@ function copyPackage(toDir, filter) {
107
107
  }
108
108
 
109
109
  function install(targetPath, minimal) {
110
- const target = targetPath
111
- ? path.resolve(process.cwd(), targetPath)
112
- : path.join(process.cwd(), 'wp-content', 'plugins', 'sociallane-elements');
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);