Skip to content

Commit

Permalink
Configurable composer vendor name
Browse files Browse the repository at this point in the history
  • Loading branch information
inxilpro committed Jul 8, 2020
1 parent 75dad9f commit bf7ec3f
Show file tree
Hide file tree
Showing 2 changed files with 57 additions and 3 deletions.
56 changes: 55 additions & 1 deletion config.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,61 @@
<?php

return [
'modules_directory' => 'app-modules',
/*
|--------------------------------------------------------------------------
| Modules Namespace
|--------------------------------------------------------------------------
|
| This is the PHP namespace that your modules will be created in. For
| example, a module called "Helpers" will be placed in \Modules\Helpers
| by default.
|
| It his *highly recommended* that you configure this to your organization
| name to make extracting modules to their own package easier (should you
| choose to ever do so).
|
| If you set the namespace, you should also set the vendor name to match.
|
*/

'modules_namespace' => 'Modules',

/*
|--------------------------------------------------------------------------
| Composer "Vendor" Name
|--------------------------------------------------------------------------
|
| This is the prefix used for your composer.json file. This should be the
| kebab-case version of your module namespace (if left null, we will
| generate the kebab-case version for you).
|
*/

'modules_vendor' => null,

/*
|--------------------------------------------------------------------------
| Modules Directory
|--------------------------------------------------------------------------
|
| If you want to install modules in a custom directory, you can do so here.
| Keeping the default `app-modules/` directory is highly recommended,
| though, as it keeps your modules near the rest of your application code
| in an alpha-sorted directory listing.
|
*/

'modules_directory' => 'app-modules',

/*
|--------------------------------------------------------------------------
| Base Test Case
|--------------------------------------------------------------------------
|
| This is the base TestCase class name that auto-generated Tests should
| extend. By default it assumes the default \Tests\TestCase exists.
|
*/

'tests_base' => 'Tests\TestCase',
];
4 changes: 2 additions & 2 deletions src/Console/Commands/Make/MakeModule.php
Original file line number Diff line number Diff line change
Expand Up @@ -84,10 +84,10 @@ public function __construct(Filesystem $filesystem, ModuleRegistry $module_regis

public function handle()
{
$this->module_name = strtolower($this->argument('name'));
$this->module_name = Str::kebab($this->argument('name'));
$this->class_name_prefix = Str::studly($this->argument('name'));
$this->module_namespace = config('app-modules.modules_namespace', 'Modules');
$this->composer_namespace = strtolower($this->module_namespace);
$this->composer_namespace = config('app-modules.modules_vendor') ?? Str::kebab($this->module_namespace);
$this->composer_name = "{$this->composer_namespace}/{$this->module_name}";
$this->base_path = $this->module_registry->getModulesPath().DIRECTORY_SEPARATOR.$this->module_name;

Expand Down

0 comments on commit bf7ec3f

Please sign in to comment.