generator-razor 14.0.37 → 14.0.39

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.
package/app/index.js CHANGED
@@ -429,7 +429,7 @@ export default class extends Generator {
429
429
  }
430
430
 
431
431
  /*
432
- * Restore temporary extensions from the generator templates.
432
+ * Restore temporary extensions from generator templates.
433
433
  *
434
434
  * Yarn and Razor's Initialisation/Extensions may have modified
435
435
  * typo3conf/ext before this point.
@@ -497,7 +497,7 @@ export default class extends Generator {
497
497
  * Activate Razor Kickstart.
498
498
  *
499
499
  * This extension has no external dependencies and provides
500
- * the TER update and Razor installation commands.
500
+ * the TER update and installation commands.
501
501
  */
502
502
  this.log('→ Activating razor kickstart...')
503
503
 
@@ -507,8 +507,7 @@ export default class extends Generator {
507
507
  )
508
508
 
509
509
  /*
510
- * Update the TER extension list before resolving any
511
- * Razor dependencies.
510
+ * Update TER extension list.
512
511
  */
513
512
  this.log('→ Updating TER extension list...')
514
513
 
@@ -518,13 +517,24 @@ export default class extends Generator {
518
517
  )
519
518
 
520
519
  /*
521
- * Install the complete Razor framework through
522
- * ExtensionManagementService.
520
+ * Resolve and download all missing TER dependencies.
523
521
  *
524
- * This resolves and installs Razor's TER dependencies,
525
- * Razor itself, the Razor extensions and Razor Bootstrap.
522
+ * Nothing is activated by this command.
526
523
  */
527
- this.log('→ Installing razor framework...')
524
+ this.log('→ Preparing razor dependencies...')
525
+
526
+ await this._runCommand(
527
+ typo3,
528
+ ['razorkickstart:prepare']
529
+ )
530
+
531
+ /*
532
+ * Activate all Razor packages in PackageStates.php.
533
+ *
534
+ * This command must only update package states. It must not
535
+ * perform TCA loading or extension setup in this process.
536
+ */
537
+ this.log('→ Activating razor packages...')
528
538
 
529
539
  await this._runCommand(
530
540
  typo3,
@@ -532,8 +542,34 @@ export default class extends Generator {
532
542
  )
533
543
 
534
544
  /*
535
- * Razor's InstallService should have created razor.sh
536
- * during dependency installation / activation.
545
+ * All dependencies now exist physically and are active in
546
+ * PackageStates.php.
547
+ *
548
+ * Remove the old DI/cache state before starting TYPO3 again.
549
+ */
550
+ this.log('→ Preparing TYPO3 for razor setup...')
551
+
552
+ await fs.remove(
553
+ this.destinationPath('typo3temp/var/cache')
554
+ )
555
+
556
+ /*
557
+ * Fresh TYPO3 process.
558
+ *
559
+ * All Razor dependencies are already active when TYPO3 boots,
560
+ * so their services can participate in DI compilation before
561
+ * extension initialization and TCA loading starts.
562
+ */
563
+ this.log('→ Setting up razor framework...')
564
+
565
+ await this._runCommand(
566
+ typo3,
567
+ ['extension:setup']
568
+ )
569
+
570
+ /*
571
+ * Razor's InstallService should have run during extension setup
572
+ * and created razor.sh.
537
573
  */
538
574
  const razorScript = this.destinationPath(
539
575
  'razor.sh'
@@ -571,8 +607,8 @@ export default class extends Generator {
571
607
  }
572
608
 
573
609
  /*
574
- * Clear package / DI caches after removing the temporary
575
- * extensions.
610
+ * Clear package / DI caches once more after removing the
611
+ * temporary extensions.
576
612
  */
577
613
  this.log('→ Flushing TYPO3 caches...')
578
614
 
@@ -2,19 +2,6 @@
2
2
 
3
3
  declare(strict_types=1);
4
4
 
5
- /*
6
- * This file is part of the TYPO3 CMS project.
7
- *
8
- * It is free software; you can redistribute it and/or modify it under
9
- * the terms of the GNU General Public License, either version 2
10
- * of the License, or any later version.
11
- *
12
- * For the full copyright and license information, please read the
13
- * LICENSE.txt file that was distributed with this source code.
14
- *
15
- * The TYPO3 project - inspiring people to share!
16
- */
17
-
18
5
  namespace RZ\Razorkickstart\Command;
19
6
 
20
7
  use Symfony\Component\Console\Attribute\AsCommand;
@@ -22,16 +9,20 @@ use Symfony\Component\Console\Command\Command;
22
9
  use Symfony\Component\Console\Input\InputInterface;
23
10
  use Symfony\Component\Console\Output\OutputInterface;
24
11
  use Symfony\Component\Console\Style\SymfonyStyle;
12
+ use TYPO3\CMS\Core\Package\PackageManager;
13
+ use TYPO3\CMS\Extensionmanager\Domain\Model\DownloadQueue;
25
14
  use TYPO3\CMS\Extensionmanager\Service\ExtensionManagementService;
26
15
 
27
16
  #[AsCommand(
28
17
  name: 'razorkickstart:install',
29
- description: 'Installs Razor and all required dependencies'
18
+ description: 'Activates the complete Razor framework'
30
19
  )]
31
20
  final class InstallCommand extends Command
32
21
  {
33
22
  public function __construct(
34
- private readonly ExtensionManagementService $extensionManagementService
23
+ private readonly ExtensionManagementService $extensionManagementService,
24
+ private readonly DownloadQueue $downloadQueue,
25
+ private readonly PackageManager $packageManager
35
26
  ) {
36
27
  parent::__construct();
37
28
  }
@@ -42,32 +33,79 @@ final class InstallCommand extends Command
42
33
  ): int {
43
34
  $io = new SymfonyStyle($input, $output);
44
35
 
45
- $io->writeln('Installing razor dependencies...');
36
+ $io->writeln('Preparing Razor package states...');
46
37
 
47
- $extension = $this->extensionManagementService->getExtension(
38
+ /*
39
+ * All TER dependencies have already been downloaded by
40
+ * razorkickstart:prepare.
41
+ *
42
+ * Resolve the complete installation queue again now that
43
+ * every extension is physically available.
44
+ */
45
+ $this->extensionManagementService->markExtensionForInstallation(
48
46
  'razorbootstrap'
49
47
  );
50
48
 
51
- $result = $this->extensionManagementService->installExtension(
52
- $extension
53
- );
54
-
55
- if ($result === false) {
56
- $errors = $this->extensionManagementService
57
- ->getDependencyErrors();
49
+ $dependencyErrors = $this->extensionManagementService
50
+ ->getDependencyErrors();
58
51
 
52
+ if ($dependencyErrors !== []) {
59
53
  $io->error([
60
- 'razor dependencies could not be resolved.',
61
- print_r($errors, true),
54
+ 'Razor dependencies could not be resolved.',
55
+ print_r($dependencyErrors, true),
62
56
  ]);
63
57
 
64
58
  return Command::FAILURE;
65
59
  }
66
60
 
61
+ /*
62
+ * Nothing should need downloading anymore.
63
+ */
64
+ if (
65
+ !$this->downloadQueue->isQueueEmpty('download')
66
+ || !$this->downloadQueue->isQueueEmpty('update')
67
+ ) {
68
+ $io->error(
69
+ 'Razor dependencies are not completely prepared.'
70
+ );
71
+
72
+ return Command::FAILURE;
73
+ }
74
+
75
+ $installQueue = $this->downloadQueue
76
+ ->resetExtensionInstallStorage();
77
+
78
+ if ($installQueue === []) {
79
+ $io->error(
80
+ 'No Razor extensions were found in the installation queue.'
81
+ );
82
+
83
+ return Command::FAILURE;
84
+ }
85
+
86
+ /*
87
+ * IMPORTANT:
88
+ *
89
+ * Do NOT use InstallUtility or PackageActivationService here.
90
+ *
91
+ * activatePackage() only updates PackageStates.php and does
92
+ * not immediately rebuild TCA. The actual TYPO3 setup happens
93
+ * in a fresh process afterwards.
94
+ */
95
+ foreach (array_keys($installQueue) as $extensionKey) {
96
+ $io->writeln(
97
+ sprintf('Activating package %s...', $extensionKey)
98
+ );
99
+
100
+ $this->packageManager->activatePackage(
101
+ $extensionKey
102
+ );
103
+ }
104
+
67
105
  $io->success(
68
- 'razor and all dependencies installed successfully.'
106
+ 'Razor package states successfully prepared.'
69
107
  );
70
108
 
71
109
  return Command::SUCCESS;
72
110
  }
73
- }
111
+ }
@@ -0,0 +1,81 @@
1
+ <?php
2
+
3
+ declare(strict_types=1);
4
+
5
+ /*
6
+ * This file is part of the TYPO3 CMS project.
7
+ *
8
+ * It is free software; you can redistribute it and/or modify it under
9
+ * the terms of the GNU General Public License, either version 2
10
+ * of the License, or any later version.
11
+ *
12
+ * For the full copyright and license information, please read the
13
+ * LICENSE.txt file that was distributed with this source code.
14
+ *
15
+ * The TYPO3 project - inspiring people to share!
16
+ */
17
+
18
+ namespace RZ\Razorkickstart\Command;
19
+
20
+ use Symfony\Component\Console\Attribute\AsCommand;
21
+ use Symfony\Component\Console\Command\Command;
22
+ use Symfony\Component\Console\Input\InputInterface;
23
+ use Symfony\Component\Console\Output\OutputInterface;
24
+ use Symfony\Component\Console\Style\SymfonyStyle;
25
+ use TYPO3\CMS\Extensionmanager\Service\ExtensionManagementService;
26
+
27
+ #[AsCommand(
28
+ name: 'razorkickstart:prepare',
29
+ description: 'Downloads all required Razor dependencies'
30
+ )]
31
+ final class PrepareCommand extends Command
32
+ {
33
+ public function __construct(
34
+ private readonly ExtensionManagementService $extensionManagementService
35
+ ) {
36
+ parent::__construct();
37
+ }
38
+
39
+ protected function execute(
40
+ InputInterface $input,
41
+ OutputInterface $output
42
+ ): int {
43
+ $io = new SymfonyStyle($input, $output);
44
+
45
+ $io->writeln('Preparing razor dependencies...');
46
+
47
+ $extension = $this->extensionManagementService->getExtension(
48
+ 'razorbootstrap'
49
+ );
50
+
51
+ /*
52
+ * Resolve and download dependencies, but do NOT activate them.
53
+ *
54
+ * Activation must happen in a fresh TYPO3 process so the
55
+ * newly downloaded extensions are part of the DI container.
56
+ */
57
+ $this->extensionManagementService
58
+ ->setAutomaticInstallationEnabled(false);
59
+
60
+ $result = $this->extensionManagementService
61
+ ->installExtension($extension);
62
+
63
+ if ($result === false) {
64
+ $io->error([
65
+ 'Razor dependencies could not be resolved.',
66
+ print_r(
67
+ $this->extensionManagementService->getDependencyErrors(),
68
+ true
69
+ ),
70
+ ]);
71
+
72
+ return Command::FAILURE;
73
+ }
74
+
75
+ $io->success(
76
+ 'Razor dependencies successfully prepared.'
77
+ );
78
+
79
+ return Command::SUCCESS;
80
+ }
81
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "generator-razor",
3
- "version": "14.0.37",
3
+ "version": "14.0.39",
4
4
  "description": "Yeoman generator for razor TYPO3 distribution",
5
5
  "license": "MIT",
6
6
  "main": "app/index.js",