generator-razor 14.1.8 → 14.1.10

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 +51 -3
  2. package/package.json +1 -1
package/app/index.js CHANGED
@@ -20,6 +20,48 @@ export default class extends Generator {
20
20
  this.props = {}
21
21
  }
22
22
 
23
+ /**
24
+ * Yeoman stores global prompt answers in ~/.yo-rc-global.json under
25
+ * "<generator>:<version>", so every release starts with empty defaults.
26
+ * Use a version-independent key instead and migrate the answers from the
27
+ * newest versioned entry once, then drop the obsolete versioned entries.
28
+ */
29
+ _getGlobalStorage () {
30
+ const storageDir = this.options.localConfigOnly ? this.destinationRoot() : os.homedir()
31
+ const storePath = path.join(storageDir, '.yo-rc-global.json')
32
+ const name = this.rootGeneratorName()
33
+
34
+ const rootStorage = this.createStorage(storePath, { allowOutsideRoot: true })
35
+ const storage = this.createStorage(storePath, { name, allowOutsideRoot: true })
36
+
37
+ const compareVersions = (a, b) => {
38
+ const pa = a.split('.').map(Number)
39
+ const pb = b.split('.').map(Number)
40
+ for (let i = 0; i < Math.max(pa.length, pb.length); i++) {
41
+ const diff = (pa[i] || 0) - (pb[i] || 0)
42
+ if (diff !== 0) return diff
43
+ }
44
+ return 0
45
+ }
46
+
47
+ const versionedKeys = Object.keys(rootStorage.getAll())
48
+ .filter(key => key.startsWith(`${name}:`))
49
+ .sort((a, b) => compareVersions(a.slice(name.length + 1), b.slice(name.length + 1)))
50
+
51
+ if (versionedKeys.length > 0) {
52
+ if (!storage.get('promptValues')) {
53
+ const latest = rootStorage.get(versionedKeys[versionedKeys.length - 1])
54
+ if (latest?.promptValues) {
55
+ storage.set('promptValues', latest.promptValues)
56
+ }
57
+ }
58
+
59
+ versionedKeys.forEach(key => rootStorage.delete(key))
60
+ }
61
+
62
+ return storage
63
+ }
64
+
23
65
  async prompting () {
24
66
  const orange = chalk.ansi256(208)
25
67
  const petrol = chalk.ansi256(24)
@@ -104,9 +146,15 @@ export default class extends Generator {
104
146
  }, {
105
147
  name: 'mysql8',
106
148
  value: 'mysql8'
149
+ }, {
150
+ name: 'mysql84',
151
+ value: 'mysql84'
107
152
  }, {
108
153
  name: 'mariadb',
109
154
  value: 'mariadb'
155
+ }, {
156
+ name: 'mariadb11',
157
+ value: 'mariadb11'
110
158
  }, {
111
159
  name: 'Custom',
112
160
  value: 'custom'
@@ -1060,15 +1108,15 @@ export default class extends Generator {
1060
1108
 
1061
1109
  _getrazorBranch () {
1062
1110
  if (this.props.Version.startsWith('14.3.')) {
1063
- return 'razor14-dev'
1111
+ return 'main'
1064
1112
  }
1065
1113
 
1066
1114
  if (this.props.Version.startsWith('13.4.')) {
1067
- return 'razor13-dev'
1115
+ return 'razor13'
1068
1116
  }
1069
1117
 
1070
1118
  if (this.props.Version.startsWith('12.4.')) {
1071
- return 'razor12-dev'
1119
+ return 'razor12'
1072
1120
  }
1073
1121
 
1074
1122
  throw new Error(
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "generator-razor",
3
- "version": "14.1.8",
3
+ "version": "14.1.10",
4
4
  "description": "Yeoman generator for razor TYPO3 distribution",
5
5
  "license": "MIT",
6
6
  "main": "app/index.js",