Update application rebuild commands to use new folder structure

Signed-off-by: Dillon-Brown <dillon.brown@salesagility.com>
This commit is contained in:
Dillon-Brown 2020-05-22 12:50:21 +01:00
parent 2d42d40ce7
commit e81e24a32d
2 changed files with 13 additions and 22 deletions

View file

@ -2,7 +2,9 @@
namespace App\Command;
use Exception;
use Psr\Log\LoggerInterface;
use RuntimeException;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputInterface;
@ -79,7 +81,7 @@ class AppRebuildCommand extends Command
* @param InputInterface $input
* @param OutputInterface $output
* @return bool|int|null
* @throws \Exception
* @throws Exception
*/
public function execute(InputInterface $input, OutputInterface $output)
{
@ -99,7 +101,7 @@ class AppRebuildCommand extends Command
echo 'An error occurred while creating your directory at ' . $exception->getPath();
}
$rebuildEnginePath = $rebuildPath . '/engine';
$rebuildEnginePath = $rebuildPath;
try {
$filesystem->mkdir($rebuildEnginePath);
@ -108,14 +110,14 @@ class AppRebuildCommand extends Command
}
$appPath = $this->projectDir . '/core/app/';
$enginePath = $appPath . '/engine';
$enginePath = $appPath;
$themesPath = $this->projectDir . '/core/app/themes';
$assetsPath = $rebuildPath . '/engine/src/assets/themes/';
$assetsPath = $rebuildPath . '/src/assets/themes/';
$appFilesPath = [
'fields' => $appPath . '/fields',
'ui' => $appPath . '/ui',
'ui' => $appPath . '/src',
'views' => $appPath . '/views'
];
@ -242,7 +244,7 @@ class AppRebuildCommand extends Command
$appManagerPath = '../../../../app-manager/app-manager.module';
$componentFileName = str_replace('.ts', '', $componentFileName);
$moduleImportList .= 'import { ' . $fullModuleName . " } from '../app-files/ui/components/" . $componentName . '/' . $componentName . ".module'; \n";
$moduleImportList .= 'import { ' . $fullModuleName . " } from '../app-files/src/components/" . $componentName . '/' . $componentName . ".module'; \n";
} elseif ($type === 'views') {
// Placeholder for view components
} else {
@ -339,7 +341,7 @@ EOT;
{
componentId: 'scrm-{component_name}-ui',
path: 'scrm-{component_name}-ui',
loadChildren: '../app-files/ui/components/{component_name}/{component_name}.module#{module_name}'
loadChildren: '../app-files/src/components/{component_name}/{component_name}.module#{module_name}'
},
";
@ -376,7 +378,7 @@ EOT;
if (!mkdir($concurrentDirectory = $rebuildEnginePath . '/src/app/app-manifest', 0755, true) && !is_dir(
$concurrentDirectory
)) {
throw new \RuntimeException(sprintf('Directory "%s" was not created', $concurrentDirectory));
throw new RuntimeException(sprintf('Directory "%s" was not created', $concurrentDirectory));
}
if (file_put_contents($rebuildEnginePath . '/src/app/app-manifest/manifest.module.ts', $manifestModule)) {

View file

@ -52,9 +52,9 @@ class AppThemeRebuildCommand extends Command
*/
public function execute(InputInterface $input, OutputInterface $output)
{
if (!file_exists($this->projectDir . '/cache/app/engine/')) {
if (!file_exists($this->projectDir . '/cache/app/')) {
throw new RuntimeException(
"Can't find application engine folder, Please run bin/console app:rebuild"
"Can't find application folder, Please run bin/console app:rebuild"
);
}
@ -66,22 +66,11 @@ class AppThemeRebuildCommand extends Command
$watchCompiler = '--watch';
}
chdir($this->projectDir . '/cache/app/engine/');
chdir($this->projectDir . '/cache/app/');
shell_exec(
$this->projectDir . "/node_modules/.bin/node-sass $watchCompiler --output-style compressed src/assets/themes/suite8/css/style.scss > src/assets/themes/suite8/css/style.min.css"
);
$compiledThemeDir = 'src/assets/themes/*/css/';
$compiledThemeFile = 'style.min.css';
$compiledFilesCheck = shell_exec("find $compiledThemeDir -name '$compiledThemeFile' -print");
if ($compiledFilesCheck === null) {
throw new RuntimeException(
'Compiled theme files have failed to create. Check that the SuiteCRM 8 source theme files exist.'
);
}
}
protected function configure(): void