generator-razor 14.0.0 → 14.0.2

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 +77 -7
  2. package/package.json +1 -1
package/app/index.js CHANGED
@@ -68,7 +68,7 @@ export default class extends Generator {
68
68
  default: 'root',
69
69
  store: true
70
70
  }, {
71
- type: 'password',
71
+ type: 'input',
72
72
  name: 'DbPassword',
73
73
  message: 'Database password?',
74
74
  default: 'root',
@@ -83,7 +83,6 @@ export default class extends Generator {
83
83
  type: 'input',
84
84
  name: 'DbPort',
85
85
  message: 'Database port?',
86
- default: 3306,
87
86
  store: true,
88
87
  validate: value => {
89
88
  const port = Number(value)
@@ -125,7 +124,7 @@ export default class extends Generator {
125
124
  default: 'admin',
126
125
  store: true
127
126
  }, {
128
- type: 'password',
127
+ type: 'input',
129
128
  name: 'Pass',
130
129
  message: 'TYPO3 install tool & admin user password?',
131
130
  default: 'joh316'
@@ -183,7 +182,7 @@ export default class extends Generator {
183
182
  store: true
184
183
  }, {
185
184
  when: answers => answers.Transport === 'smtp',
186
- type: 'password',
185
+ type: 'input',
187
186
  name: 'SmtpPass',
188
187
  message: 'SMTP password?',
189
188
  default: '',
@@ -350,7 +349,15 @@ export default class extends Generator {
350
349
 
351
350
  async install () {
352
351
  const branch = this._getRazorBranch()
353
- const packageName = `ssh://git@github.com/rafu1987/razor.git#${branch}`
352
+
353
+ const razorPackage =
354
+ `ssh://git@github.com/rafu1987/razor.git#${branch}`
355
+
356
+ const picturePackage = await this._getLatestGithubReleasePackage(
357
+ 'b13',
358
+ 'picture',
359
+ 'picture'
360
+ )
354
361
 
355
362
  await this._runCommand('yarn', [
356
363
  'add',
@@ -358,7 +365,8 @@ export default class extends Generator {
358
365
  '--no-lockfile',
359
366
  '--modules-folder',
360
367
  'typo3conf/ext/',
361
- packageName
368
+ razorPackage,
369
+ picturePackage
362
370
  ])
363
371
  }
364
372
 
@@ -387,6 +395,25 @@ export default class extends Generator {
387
395
  )
388
396
  }
389
397
  }
398
+
399
+ const orange = chalk.hex('#ff8700').bold
400
+ const petrol = chalk.hex('#006792')
401
+
402
+ this.log(orange(`
403
+ ██████╗ ██████╗ ███╗ ██╗███████╗
404
+ ██╔══██╗██╔═══██╗████╗ ██║██╔════╝
405
+ ██║ ██║██║ ██║██╔██╗ ██║█████╗
406
+ ██║ ██║██║ ██║██║╚██╗██║██╔══╝
407
+ ██████╔╝╚██████╔╝██║ ╚████║███████╗
408
+ ╚═════╝ ╚═════╝ ╚═╝ ╚═══╝╚══════╝
409
+ `))
410
+
411
+ this.log(petrol(
412
+ ` ${this.props.ProjectName} was generated successfully.\n`
413
+ ))
414
+ }
415
+
416
+ async
390
417
  }
391
418
 
392
419
  async _getTypo3Releases () {
@@ -797,12 +824,15 @@ export default class extends Generator {
797
824
 
798
825
  const connectionOptions = {
799
826
  host: this.props.DbHostname,
800
- port: Number(this.props.DbPort),
801
827
  user: this.props.DbUsername,
802
828
  password: this.props.DbPassword,
803
829
  multipleStatements: true
804
830
  }
805
831
 
832
+ if (this.props.DbPort) {
833
+ connectionOptions.port = Number(this.props.DbPort)
834
+ }
835
+
806
836
  if (this.props.DbSocket) {
807
837
  connectionOptions.socketPath = this.props.DbSocket
808
838
  }
@@ -949,6 +979,46 @@ export default class extends Generator {
949
979
  )
950
980
  }
951
981
 
982
+ async _getLatestGithubReleasePackage (owner, repository, packageName) {
983
+ const url =
984
+ `https://api.github.com/repos/${owner}/${repository}/releases/latest`
985
+
986
+ let response
987
+
988
+ try {
989
+ response = await fetch(url, {
990
+ headers: {
991
+ accept: 'application/vnd.github+json',
992
+ 'user-agent': 'generator-razor'
993
+ },
994
+ redirect: 'follow',
995
+ signal: AbortSignal.timeout(30000)
996
+ })
997
+ } catch (error) {
998
+ throw new Error(
999
+ `Could not retrieve the latest release of ${owner}/${repository}.`,
1000
+ { cause: error }
1001
+ )
1002
+ }
1003
+
1004
+ if (!response.ok) {
1005
+ throw new Error(
1006
+ `Could not retrieve the latest release of ${owner}/${repository}: ` +
1007
+ `${response.status} ${response.statusText}`
1008
+ )
1009
+ }
1010
+
1011
+ const release = await response.json()
1012
+
1013
+ if (!release.tag_name) {
1014
+ throw new Error(
1015
+ `${owner}/${repository} has no published release.`
1016
+ )
1017
+ }
1018
+
1019
+ return `${packageName}@https://github.com/${owner}/${repository}/archive/refs/tags/${release.tag_name}.tar.gz`
1020
+ }
1021
+
952
1022
  async _runCommand (command, argumentsList) {
953
1023
  await new Promise((resolve, reject) => {
954
1024
  const child = spawn(
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "generator-razor",
3
- "version": "14.0.0",
3
+ "version": "14.0.2",
4
4
  "description": "Yeoman generator for razor TYPO3 distribution",
5
5
  "license": "MIT",
6
6
  "main": "app/index.js",