generator-razor 14.0.38 → 14.0.40

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,7 +507,7 @@ export default class extends Generator {
507
507
  )
508
508
 
509
509
  /*
510
- * Update TER.
510
+ * Update TER extension list.
511
511
  */
512
512
  this.log('→ Updating TER extension list...')
513
513
 
@@ -517,7 +517,9 @@ export default class extends Generator {
517
517
  )
518
518
 
519
519
  /*
520
- * Download all dependencies without activating them.
520
+ * Resolve and download all missing TER dependencies.
521
+ *
522
+ * Nothing is activated by this command.
521
523
  */
522
524
  this.log('→ Preparing razor dependencies...')
523
525
 
@@ -527,38 +529,47 @@ export default class extends Generator {
527
529
  )
528
530
 
529
531
  /*
530
- * IMPORTANT:
532
+ * Activate all Razor packages in PackageStates.php.
531
533
  *
532
- * Start installation from a fresh TYPO3 bootstrap so newly downloaded
533
- * extensions are available to dependency injection.
534
+ * This command must only update package states. It must not
535
+ * perform TCA loading or extension setup in this process.
534
536
  */
535
- this.log('→ Preparing TYPO3 for razor installation...')
536
-
537
- await fs.remove(
538
- this.destinationPath('typo3temp/var/cache')
539
- )
537
+ this.log('→ Activating razor packages...')
540
538
 
541
539
  await this._runCommand(
542
540
  typo3,
543
- ['cache:flush']
541
+ ['razorkickstart:install']
542
+ )
543
+
544
+ /*
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')
544
554
  )
545
555
 
546
556
  /*
547
- * This is a NEW PHP process.
557
+ * Fresh TYPO3 process.
548
558
  *
549
- * Container, News, Content Blocks, etc. now physically existed before
550
- * TYPO3 booted and can therefore participate in DI compilation.
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.
551
562
  */
552
- this.log('→ Installing razor framework...')
563
+ this.log('→ Setting up razor framework...')
553
564
 
554
565
  await this._runCommand(
555
566
  typo3,
556
- ['razorkickstart:install']
567
+ ['extension:setup']
557
568
  )
558
569
 
559
570
  /*
560
- * Razor's InstallService should have created razor.sh
561
- * during dependency installation / activation.
571
+ * Razor's InstallService should have run during extension setup
572
+ * and created razor.sh.
562
573
  */
563
574
  const razorScript = this.destinationPath(
564
575
  'razor.sh'
@@ -596,8 +607,8 @@ export default class extends Generator {
596
607
  }
597
608
 
598
609
  /*
599
- * Clear package / DI caches after removing the temporary
600
- * extensions.
610
+ * Clear package / DI caches once more after removing the
611
+ * temporary extensions.
601
612
  */
602
613
  this.log('→ Flushing TYPO3 caches...')
603
614
 
@@ -22,16 +22,21 @@ use Symfony\Component\Console\Command\Command;
22
22
  use Symfony\Component\Console\Input\InputInterface;
23
23
  use Symfony\Component\Console\Output\OutputInterface;
24
24
  use Symfony\Component\Console\Style\SymfonyStyle;
25
+ use TYPO3\CMS\Core\Core\ClassLoadingInformation;
26
+ use TYPO3\CMS\Core\Package\PackageManager;
27
+ use TYPO3\CMS\Extensionmanager\Domain\Model\DownloadQueue;
25
28
  use TYPO3\CMS\Extensionmanager\Service\ExtensionManagementService;
26
29
 
27
30
  #[AsCommand(
28
31
  name: 'razorkickstart:install',
29
- description: 'Installs the complete Razor framework'
32
+ description: 'Activates the complete Razor framework'
30
33
  )]
31
34
  final class InstallCommand extends Command
32
35
  {
33
36
  public function __construct(
34
- private readonly ExtensionManagementService $extensionManagementService
37
+ private readonly ExtensionManagementService $extensionManagementService,
38
+ private readonly DownloadQueue $downloadQueue,
39
+ private readonly PackageManager $packageManager
35
40
  ) {
36
41
  parent::__construct();
37
42
  }
@@ -42,29 +47,90 @@ final class InstallCommand extends Command
42
47
  ): int {
43
48
  $io = new SymfonyStyle($input, $output);
44
49
 
45
- $io->writeln('Installing razor dependencies...');
50
+ $io->writeln('Preparing Razor package states...');
46
51
 
47
- $extension = $this->extensionManagementService->getExtension(
52
+ /*
53
+ * Resolve the complete installation queue again.
54
+ *
55
+ * All TER dependencies have already been downloaded by
56
+ * razorkickstart:prepare.
57
+ */
58
+ $this->extensionManagementService->markExtensionForInstallation(
48
59
  'razorbootstrap'
49
60
  );
50
61
 
51
- $result = $this->extensionManagementService
52
- ->installExtension($extension);
62
+ $dependencyErrors = $this->extensionManagementService
63
+ ->getDependencyErrors();
53
64
 
54
- if ($result === false) {
65
+ if ($dependencyErrors !== []) {
55
66
  $io->error([
56
- 'razor dependencies could not be resolved.',
57
- print_r(
58
- $this->extensionManagementService->getDependencyErrors(),
59
- true
60
- ),
67
+ 'Razor dependencies could not be resolved.',
68
+ print_r($dependencyErrors, true),
61
69
  ]);
62
70
 
63
71
  return Command::FAILURE;
64
72
  }
65
73
 
74
+ /*
75
+ * Nothing should need downloading anymore.
76
+ */
77
+ if (
78
+ !$this->downloadQueue->isQueueEmpty('download')
79
+ || !$this->downloadQueue->isQueueEmpty('update')
80
+ ) {
81
+ $io->error(
82
+ 'Razor dependencies are not completely prepared.'
83
+ );
84
+
85
+ return Command::FAILURE;
86
+ }
87
+
88
+ $installQueue = $this->downloadQueue
89
+ ->resetExtensionInstallStorage();
90
+
91
+ if ($installQueue === []) {
92
+ $io->error(
93
+ 'No Razor extensions were found in the installation queue.'
94
+ );
95
+
96
+ return Command::FAILURE;
97
+ }
98
+
99
+ /*
100
+ * Only update PackageStates.php.
101
+ *
102
+ * Do not use PackageActivationService here because it would
103
+ * immediately rebuild DI/TCA in the current process.
104
+ */
105
+ foreach (array_keys($installQueue) as $extensionKey) {
106
+ $io->writeln(
107
+ sprintf(
108
+ 'Activating package %s...',
109
+ $extensionKey
110
+ )
111
+ );
112
+
113
+ $this->packageManager->activatePackage(
114
+ $extensionKey
115
+ );
116
+ }
117
+
118
+ /*
119
+ * Important for TYPO3 Classic mode:
120
+ *
121
+ * activatePackage() registers class-loading information only
122
+ * transiently for this process. Persist the complete class map
123
+ * and PSR-4 configuration so the next TYPO3 process knows all
124
+ * newly activated extensions.
125
+ */
126
+ $io->writeln(
127
+ 'Rebuilding TYPO3 class loading information...'
128
+ );
129
+
130
+ ClassLoadingInformation::dumpClassLoadingInformation();
131
+
66
132
  $io->success(
67
- 'razor framework successfully installed.'
133
+ 'Razor package states successfully prepared.'
68
134
  );
69
135
 
70
136
  return Command::SUCCESS;
@@ -42,7 +42,7 @@ final class PrepareCommand extends Command
42
42
  ): int {
43
43
  $io = new SymfonyStyle($input, $output);
44
44
 
45
- $io->writeln('Preparing Razor dependencies...');
45
+ $io->writeln('Preparing razor dependencies...');
46
46
 
47
47
  $extension = $this->extensionManagementService->getExtension(
48
48
  'razorbootstrap'
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "generator-razor",
3
- "version": "14.0.38",
3
+ "version": "14.0.40",
4
4
  "description": "Yeoman generator for razor TYPO3 distribution",
5
5
  "license": "MIT",
6
6
  "main": "app/index.js",