Skip to content

Commit

Permalink
Pass tests again.
Browse files Browse the repository at this point in the history
  • Loading branch information
jesseleite committed Dec 24, 2024
1 parent f2413e1 commit 62bd6a9
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 5 deletions.
14 changes: 9 additions & 5 deletions src/StarterKits/InstallableModule.php
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,10 @@ protected function convertInstallableToDestinationPath(string $path): string
{
$package = $this->installer->package();

$path = str_replace("/vendor/{$package}/export", '', $path);
$path = preg_replace("#vendor/{$package}.*/export/#", '', $path);

// Older kits may not be using new `export` folder convention, so
// we'll convert from the kit root for backwards compatibility
$path = str_replace("/vendor/{$package}", '', $path);

return $path;
Expand Down Expand Up @@ -247,9 +250,10 @@ protected function installableFilesPath(?string $path = null): string
{
$package = $this->installer->package();

// Scope to new `export` folder if it exists, otherwise we'll
// look in starter kit root for backwards compatibility
$scope = $this->files->exists(base_path("vendor/{$package}/export"))
// Older kits may not be using new `export` folder convention at the top level,
// so for backwards compatibility we'll dynamically scope to `export` folder,
// but we don't need to worry about this with newer folder based modules.
$scope = $this->files->exists(base_path("vendor/{$package}/export")) && ! $this->isFolderBasedModule()
? 'export'
: null;

Expand All @@ -265,7 +269,7 @@ protected function relativePath(string $path): string
return $path;
}

return Str::ensureRight($this->relativePath, '/').$path;
return Str::ensureRight($this->relativePath, '/export/').$path;
}

/**
Expand Down
8 changes: 8 additions & 0 deletions src/StarterKits/Module.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,14 @@ public function setRelativePath(string $path): self
return $this;
}

/**
* Check if current module is folder based module.
*/
public function isFolderBasedModule(): bool
{
return (bool) $this->relativePath;
}

/**
* Get module key.
*/
Expand Down

0 comments on commit 62bd6a9

Please sign in to comment.