generator-razor 14.0.12 → 14.0.14

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.
Files changed (2) hide show
  1. package/app/index.js +39 -40
  2. package/package.json +1 -1
package/app/index.js CHANGED
@@ -333,9 +333,13 @@ export default class extends Generator {
333
333
  await this._ensureTypo3Source(sourcePath)
334
334
  await this._createSymlinks(sourcePath)
335
335
 
336
- await this._copyWithInheritedGroup(
336
+ await fs.copy(
337
337
  this.templatePath(templateVersion),
338
- this.destinationPath()
338
+ this.destinationPath(),
339
+ {
340
+ overwrite: true,
341
+ errorOnExist: false
342
+ }
339
343
  )
340
344
 
341
345
  await this._writeSystemSettings()
@@ -382,13 +386,20 @@ export default class extends Generator {
382
386
  )
383
387
 
384
388
  if (await fs.pathExists(extensionsSource)) {
385
- await this._copyWithInheritedGroup(
389
+ await fs.copy(
386
390
  extensionsSource,
387
- this.destinationPath('typo3conf/ext')
391
+ this.destinationPath('typo3conf/ext'),
392
+ {
393
+ overwrite: true,
394
+ errorOnExist: false,
395
+ dereference: false
396
+ }
388
397
  )
389
398
  }
390
399
  }
391
400
 
401
+ await this._fixProjectGroup()
402
+
392
403
  const orange = chalk.hex('#ff8700').bold
393
404
  const petrol = chalk.hex('#006792')
394
405
 
@@ -406,52 +417,40 @@ export default class extends Generator {
406
417
  ))
407
418
  }
408
419
 
409
- async _copyWithInheritedGroup (source, destination) {
410
- const sourceStats = await fs.lstat(source)
420
+ async _fixProjectGroup () {
421
+ const destination = this.destinationPath()
422
+ const destinationStats = await fs.stat(destination)
423
+ const targetGid = destinationStats.gid
411
424
 
412
- if (sourceStats.isDirectory()) {
413
- await fs.ensureDir(destination)
425
+ const processPath = async filePath => {
426
+ const stats = await fs.lstat(filePath)
414
427
 
415
- // Set setgid before creating anything inside this directory.
416
- await fs.chmod(destination, 0o2775)
428
+ if (stats.isSymbolicLink()) {
429
+ await fs.lchown(filePath, stats.uid, targetGid)
430
+ return
431
+ }
417
432
 
418
- const entries = await fs.readdir(
419
- source,
420
- {
421
- withFileTypes: true
422
- }
423
- )
433
+ await fs.chown(filePath, stats.uid, targetGid)
424
434
 
425
- for (const entry of entries) {
426
- await this._copyWithInheritedGroup(
427
- path.join(source, entry.name),
428
- path.join(destination, entry.name)
429
- )
435
+ if (!stats.isDirectory()) {
436
+ return
430
437
  }
431
438
 
432
- return
433
- }
434
-
435
- if (sourceStats.isSymbolicLink()) {
436
- const linkTarget = await fs.readlink(source)
439
+ await fs.chmod(
440
+ filePath,
441
+ stats.mode | 0o2070
442
+ )
437
443
 
438
- await fs.remove(destination)
439
- await fs.ensureSymlink(linkTarget, destination)
444
+ const entries = await fs.readdir(filePath)
440
445
 
441
- return
446
+ for (const entry of entries) {
447
+ await processPath(
448
+ path.join(filePath, entry)
449
+ )
450
+ }
442
451
  }
443
452
 
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
- )
453
+ await processPath(destination)
455
454
  }
456
455
 
457
456
  async _getTypo3Releases () {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "generator-razor",
3
- "version": "14.0.12",
3
+ "version": "14.0.14",
4
4
  "description": "Yeoman generator for razor TYPO3 distribution",
5
5
  "license": "MIT",
6
6
  "main": "app/index.js",