generator-razor 14.0.10 → 14.0.12
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 +63 -70
- package/package.json +1 -1
package/app/index.js
CHANGED
|
@@ -308,6 +308,17 @@ export default class extends Generator {
|
|
|
308
308
|
}]
|
|
309
309
|
|
|
310
310
|
this.props = await this.prompt(prompts)
|
|
311
|
+
|
|
312
|
+
const promptValues = Object.fromEntries(
|
|
313
|
+
prompts
|
|
314
|
+
.filter(({ store }) => store)
|
|
315
|
+
.filter(({ name }) => this.props[name] !== undefined)
|
|
316
|
+
.map(({ name }) => [name, this.props[name]])
|
|
317
|
+
)
|
|
318
|
+
|
|
319
|
+
this._globalConfig.set('promptValues', promptValues)
|
|
320
|
+
|
|
321
|
+
await this.fs.commit()
|
|
311
322
|
}
|
|
312
323
|
|
|
313
324
|
async writing () {
|
|
@@ -322,18 +333,13 @@ export default class extends Generator {
|
|
|
322
333
|
await this._ensureTypo3Source(sourcePath)
|
|
323
334
|
await this._createSymlinks(sourcePath)
|
|
324
335
|
|
|
325
|
-
await
|
|
336
|
+
await this._copyWithInheritedGroup(
|
|
326
337
|
this.templatePath(templateVersion),
|
|
327
|
-
this.destinationPath()
|
|
328
|
-
{
|
|
329
|
-
overwrite: true,
|
|
330
|
-
errorOnExist: false
|
|
331
|
-
}
|
|
338
|
+
this.destinationPath()
|
|
332
339
|
)
|
|
333
340
|
|
|
334
341
|
await this._writeSystemSettings()
|
|
335
342
|
await this._writeLocalSettings()
|
|
336
|
-
await this._chmodWritableDirectories()
|
|
337
343
|
await this._createDatabaseAndImportSql()
|
|
338
344
|
await this._setRazorConfig()
|
|
339
345
|
}
|
|
@@ -376,19 +382,13 @@ export default class extends Generator {
|
|
|
376
382
|
)
|
|
377
383
|
|
|
378
384
|
if (await fs.pathExists(extensionsSource)) {
|
|
379
|
-
await
|
|
385
|
+
await this._copyWithInheritedGroup(
|
|
380
386
|
extensionsSource,
|
|
381
|
-
this.destinationPath('typo3conf/ext')
|
|
382
|
-
{
|
|
383
|
-
overwrite: true,
|
|
384
|
-
errorOnExist: false
|
|
385
|
-
}
|
|
387
|
+
this.destinationPath('typo3conf/ext')
|
|
386
388
|
)
|
|
387
389
|
}
|
|
388
390
|
}
|
|
389
391
|
|
|
390
|
-
await this._fixPackageStatesPermissions()
|
|
391
|
-
|
|
392
392
|
const orange = chalk.hex('#ff8700').bold
|
|
393
393
|
const petrol = chalk.hex('#006792')
|
|
394
394
|
|
|
@@ -406,6 +406,54 @@ export default class extends Generator {
|
|
|
406
406
|
))
|
|
407
407
|
}
|
|
408
408
|
|
|
409
|
+
async _copyWithInheritedGroup (source, destination) {
|
|
410
|
+
const sourceStats = await fs.lstat(source)
|
|
411
|
+
|
|
412
|
+
if (sourceStats.isDirectory()) {
|
|
413
|
+
await fs.ensureDir(destination)
|
|
414
|
+
|
|
415
|
+
// Set setgid before creating anything inside this directory.
|
|
416
|
+
await fs.chmod(destination, 0o2775)
|
|
417
|
+
|
|
418
|
+
const entries = await fs.readdir(
|
|
419
|
+
source,
|
|
420
|
+
{
|
|
421
|
+
withFileTypes: true
|
|
422
|
+
}
|
|
423
|
+
)
|
|
424
|
+
|
|
425
|
+
for (const entry of entries) {
|
|
426
|
+
await this._copyWithInheritedGroup(
|
|
427
|
+
path.join(source, entry.name),
|
|
428
|
+
path.join(destination, entry.name)
|
|
429
|
+
)
|
|
430
|
+
}
|
|
431
|
+
|
|
432
|
+
return
|
|
433
|
+
}
|
|
434
|
+
|
|
435
|
+
if (sourceStats.isSymbolicLink()) {
|
|
436
|
+
const linkTarget = await fs.readlink(source)
|
|
437
|
+
|
|
438
|
+
await fs.remove(destination)
|
|
439
|
+
await fs.ensureSymlink(linkTarget, destination)
|
|
440
|
+
|
|
441
|
+
return
|
|
442
|
+
}
|
|
443
|
+
|
|
444
|
+
await fs.ensureDir(path.dirname(destination))
|
|
445
|
+
|
|
446
|
+
// The parent directory already has setgid, so a newly created file
|
|
447
|
+
// inherits its group.
|
|
448
|
+
await fs.copyFile(source, destination)
|
|
449
|
+
|
|
450
|
+
// Preserve the original file permissions without changing ownership.
|
|
451
|
+
await fs.chmod(
|
|
452
|
+
destination,
|
|
453
|
+
sourceStats.mode & 0o777
|
|
454
|
+
)
|
|
455
|
+
}
|
|
456
|
+
|
|
409
457
|
async _getTypo3Releases () {
|
|
410
458
|
const url = 'https://get.typo3.org/json'
|
|
411
459
|
|
|
@@ -770,46 +818,6 @@ export default class extends Generator {
|
|
|
770
818
|
)
|
|
771
819
|
}
|
|
772
820
|
|
|
773
|
-
async _chmodWritableDirectories () {
|
|
774
|
-
const writableDirectories = [
|
|
775
|
-
'fileadmin',
|
|
776
|
-
'typo3temp',
|
|
777
|
-
'typo3conf'
|
|
778
|
-
]
|
|
779
|
-
|
|
780
|
-
for (const directory of writableDirectories) {
|
|
781
|
-
await this._chmodDirectoriesRecursive(
|
|
782
|
-
this.destinationPath(directory)
|
|
783
|
-
)
|
|
784
|
-
}
|
|
785
|
-
}
|
|
786
|
-
|
|
787
|
-
async _chmodDirectoriesRecursive (directory) {
|
|
788
|
-
if (!await fs.pathExists(directory)) {
|
|
789
|
-
return
|
|
790
|
-
}
|
|
791
|
-
|
|
792
|
-
await fs.chmod(
|
|
793
|
-
directory,
|
|
794
|
-
0o2775
|
|
795
|
-
)
|
|
796
|
-
|
|
797
|
-
const entries = await fs.readdir(
|
|
798
|
-
directory,
|
|
799
|
-
{
|
|
800
|
-
withFileTypes: true
|
|
801
|
-
}
|
|
802
|
-
)
|
|
803
|
-
|
|
804
|
-
for (const entry of entries) {
|
|
805
|
-
if (entry.isDirectory()) {
|
|
806
|
-
await this._chmodDirectoriesRecursive(
|
|
807
|
-
path.join(directory, entry.name)
|
|
808
|
-
)
|
|
809
|
-
}
|
|
810
|
-
}
|
|
811
|
-
}
|
|
812
|
-
|
|
813
821
|
async _createDatabaseAndImportSql () {
|
|
814
822
|
const databaseName = this.props.DbNew.toLowerCase()
|
|
815
823
|
|
|
@@ -1013,21 +1021,6 @@ export default class extends Generator {
|
|
|
1013
1021
|
return `${packageName}@https://github.com/${owner}/${repository}/archive/refs/tags/${release.tag_name}.tar.gz`
|
|
1014
1022
|
}
|
|
1015
1023
|
|
|
1016
|
-
async _fixPackageStatesPermissions () {
|
|
1017
|
-
const file = this.destinationPath(
|
|
1018
|
-
'typo3conf/PackageStates.php'
|
|
1019
|
-
)
|
|
1020
|
-
|
|
1021
|
-
if (!await fs.pathExists(file)) {
|
|
1022
|
-
return
|
|
1023
|
-
}
|
|
1024
|
-
|
|
1025
|
-
await this._runCommand('chgrp', [
|
|
1026
|
-
'developers',
|
|
1027
|
-
file
|
|
1028
|
-
])
|
|
1029
|
-
}
|
|
1030
|
-
|
|
1031
1024
|
async _runCommand (command, argumentsList) {
|
|
1032
1025
|
await new Promise((resolve, reject) => {
|
|
1033
1026
|
const child = spawn(
|