Skip to content
Snippets Groups Projects
Commit 2b1870f0 authored by jurgenhaas's avatar jurgenhaas
Browse files

#10 Determine theme name even for initial installation and write that back to composer.json

parent c913ec55
No related branches found
No related tags found
No related merge requests found
......@@ -63,6 +63,8 @@
"drupal/chosen": "^2.4",
"drupal/coder": "^8.2",
"harvesthq/chosen": "^1.8",
"lakedrops/composer-json-tools": "^0.1",
"lakedrops/dotenv": "^0.1",
"matthiasmullie/path-converter": "^1.0"
},
"minimum-stability": "dev",
......
......@@ -6,9 +6,11 @@ use Composer\Package\Package;
use Composer\Composer;
use Composer\IO\IOInterface;
use Composer\Script\Event;
use LakeDrops\Component\Composer\Utils;
use LakeDrops\Component\Dotenv\Dotenv;
use MatthiasMullie\PathConverter\Converter;
use Symfony\Component\Filesystem\Filesystem;
use Symfony\Component\Finder\Finder;
use MatthiasMullie\PathConverter\Converter;
/**
* Class Handler.
......@@ -182,7 +184,6 @@ class Handler {
$extra = $this->composer->getPackage()
->getExtra() + ['theme-d8-sass' => []];
$this->options = array_replace_recursive([
'project_name' => 'mytheme',
'base_theme' => [
'name' => 'bartik',
'import' => [],
......@@ -190,6 +191,19 @@ class Handler {
'bower_assets' => [],
], $extra['theme-d8-sass']);
// If we don't have a project name by now, lets get some magic at work.
if (empty($this->options['project_name'])) {
$defaultName = str_replace([' ', '-', '_', '.'], '', basename(getcwd())) . '_theme';
$env = new Dotenv('custom_theme', $this->io);
$this->options['project_name'] = $env->receive('name', 'Name of custom theme', $defaultName);
}
// Update composer.jon if necessary.
$composerUtils = new Utils($this->composer);
$composerUtils
->setSubSection('extra', 'theme-d8-sass', $this->options)
->write();
$fs = new Filesystem();
$dependencies = [];
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment