generator-razor 14.0.36 → 14.0.38

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
@@ -407,6 +407,9 @@ export default class extends Generator {
407
407
  this.destinationPath('typo3conf/ext/.yarn-integrity')
408
408
  )
409
409
 
410
+ /*
411
+ * Copy Razor extensions provided by the Razor repository.
412
+ */
410
413
  if (this._usesModernTypo3Structure()) {
411
414
  const extensionsSource = this.destinationPath(
412
415
  'typo3conf/ext/razor/Initialisation/Extensions'
@@ -426,10 +429,10 @@ export default class extends Generator {
426
429
  }
427
430
 
428
431
  /*
429
- * Restore temporary extensions from generator templates.
432
+ * Restore temporary extensions from the generator templates.
430
433
  *
431
- * They are copied here because Yarn and Razor's
432
- * Initialisation/Extensions may have modified typo3conf/ext.
434
+ * Yarn and Razor's Initialisation/Extensions may have modified
435
+ * typo3conf/ext before this point.
433
436
  */
434
437
  const templateVersion = this._getTemplateVersion()
435
438
 
@@ -478,10 +481,6 @@ export default class extends Generator {
478
481
 
479
482
  /*
480
483
  * Start TYPO3 with completely fresh caches.
481
- *
482
- * Important before activating the first temporary extension,
483
- * otherwise stale configuration may still reference caches
484
- * removed in newer TYPO3 versions.
485
484
  */
486
485
  this.log('→ Preparing TYPO3 caches...')
487
486
 
@@ -495,15 +494,21 @@ export default class extends Generator {
495
494
  )
496
495
 
497
496
  /*
498
- * Razor Kickstart
497
+ * Activate Razor Kickstart.
498
+ *
499
+ * This extension has no external dependencies and provides
500
+ * the TER update and Razor installation commands.
499
501
  */
500
- this.log('→ Activating Razor kickstart...')
502
+ this.log('→ Activating razor kickstart...')
501
503
 
502
504
  await this._runCommand(
503
505
  typo3,
504
506
  ['extension:activate', 'razorkickstart']
505
507
  )
506
508
 
509
+ /*
510
+ * Update TER.
511
+ */
507
512
  this.log('→ Updating TER extension list...')
508
513
 
509
514
  await this._runCommand(
@@ -512,29 +517,70 @@ export default class extends Generator {
512
517
  )
513
518
 
514
519
  /*
515
- * Razor Bootstrap
520
+ * Download all dependencies without activating them.
521
+ */
522
+ this.log('→ Preparing razor dependencies...')
523
+
524
+ await this._runCommand(
525
+ typo3,
526
+ ['razorkickstart:prepare']
527
+ )
528
+
529
+ /*
530
+ * IMPORTANT:
531
+ *
532
+ * Start installation from a fresh TYPO3 bootstrap so newly downloaded
533
+ * extensions are available to dependency injection.
534
+ */
535
+ this.log('→ Preparing TYPO3 for razor installation...')
536
+
537
+ await fs.remove(
538
+ this.destinationPath('typo3temp/var/cache')
539
+ )
540
+
541
+ await this._runCommand(
542
+ typo3,
543
+ ['cache:flush']
544
+ )
545
+
546
+ /*
547
+ * This is a NEW PHP process.
516
548
  *
517
- * Now that the TER extension list is current, TYPO3 can safely
518
- * resolve and download Razor's dependencies.
549
+ * Container, News, Content Blocks, etc. now physically existed before
550
+ * TYPO3 booted and can therefore participate in DI compilation.
519
551
  */
520
- this.log('→ Activating Razor bootstrap...')
552
+ this.log('→ Installing razor framework...')
521
553
 
522
554
  await this._runCommand(
523
555
  typo3,
524
- ['extension:activate', 'razorbootstrap']
556
+ ['razorkickstart:install']
557
+ )
558
+
559
+ /*
560
+ * Razor's InstallService should have created razor.sh
561
+ * during dependency installation / activation.
562
+ */
563
+ const razorScript = this.destinationPath(
564
+ 'razor.sh'
525
565
  )
526
566
 
567
+ if (!await fs.pathExists(razorScript)) {
568
+ throw new Error(
569
+ 'razor.sh was not created during Razor installation.'
570
+ )
571
+ }
572
+
527
573
  /*
528
- * Remove temporary extensions.
574
+ * Remove temporary helper extensions.
529
575
  */
530
- this.log('→ Removing Razor bootstrap...')
576
+ this.log('→ Removing razor bootstrap...')
531
577
 
532
578
  await this._runCommand(
533
579
  typo3,
534
580
  ['extension:deactivate', 'razorbootstrap']
535
581
  )
536
582
 
537
- this.log('→ Removing Razor kickstart...')
583
+ this.log('→ Removing razor kickstart...')
538
584
 
539
585
  await this._runCommand(
540
586
  typo3,
@@ -550,8 +596,8 @@ export default class extends Generator {
550
596
  }
551
597
 
552
598
  /*
553
- * Clear stale package / DI caches after removing the
554
- * temporary extensions.
599
+ * Clear package / DI caches after removing the temporary
600
+ * extensions.
555
601
  */
556
602
  this.log('→ Flushing TYPO3 caches...')
557
603
 
@@ -564,28 +610,6 @@ export default class extends Generator {
564
610
  ['cache:flush']
565
611
  )
566
612
 
567
- /*
568
- * Activate Razor.
569
- *
570
- * Razor's InstallService should create razor.sh.
571
- */
572
- this.log('→ Activating Razor...')
573
-
574
- await this._runCommand(
575
- typo3,
576
- ['extension:activate', 'razor']
577
- )
578
-
579
- const razorScript = this.destinationPath(
580
- 'razor.sh'
581
- )
582
-
583
- if (!await fs.pathExists(razorScript)) {
584
- throw new Error(
585
- 'razor.sh was not created during Razor installation.'
586
- )
587
- }
588
-
589
613
  /*
590
614
  * Hand over to the Razor installer.
591
615
  */
@@ -0,0 +1,72 @@
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:install',
29
+ description: 'Installs the complete Razor framework'
30
+ )]
31
+ final class InstallCommand 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('Installing razor dependencies...');
46
+
47
+ $extension = $this->extensionManagementService->getExtension(
48
+ 'razorbootstrap'
49
+ );
50
+
51
+ $result = $this->extensionManagementService
52
+ ->installExtension($extension);
53
+
54
+ if ($result === false) {
55
+ $io->error([
56
+ 'razor dependencies could not be resolved.',
57
+ print_r(
58
+ $this->extensionManagementService->getDependencyErrors(),
59
+ true
60
+ ),
61
+ ]);
62
+
63
+ return Command::FAILURE;
64
+ }
65
+
66
+ $io->success(
67
+ 'razor framework successfully installed.'
68
+ );
69
+
70
+ return Command::SUCCESS;
71
+ }
72
+ }
@@ -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.36",
3
+ "version": "14.0.38",
4
4
  "description": "Yeoman generator for razor TYPO3 distribution",
5
5
  "license": "MIT",
6
6
  "main": "app/index.js",