@platformatic/generators 2.0.0-alpha.13 → 2.0.0-alpha.15

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.
@@ -7,6 +7,7 @@ const {
7
7
  getPackageConfigurationObject,
8
8
  PLT_ROOT,
9
9
  getLatestNpmVersion,
10
+ stripVersion,
10
11
  } = require('./utils')
11
12
  const { join } = require('node:path')
12
13
  const { FileGenerator } = require('./file-generator')
@@ -367,7 +368,7 @@ class BaseGenerator extends FileGenerator {
367
368
 
368
369
  async getFastifyVersion () {
369
370
  const pkgData = await this.readPackageJsonFile()
370
- this.fastifyVersion = pkgData.dependencies.fastify
371
+ this.fastifyVersion = stripVersion(pkgData.dependencies.fastify)
371
372
  }
372
373
 
373
374
  async getPlatformaticVersion () {
package/lib/utils.js CHANGED
@@ -8,6 +8,19 @@ const PLT_ROOT = 'PLT_ROOT'
8
8
  const { EOL } = require('node:os')
9
9
  const { createDirectory } = require('@platformatic/utils')
10
10
 
11
+ /**
12
+ * Strip all extra characters from a simple semver version string
13
+ * @param {string} version
14
+ * @returns string
15
+ */
16
+ function stripVersion (version) {
17
+ const match = version.match(/(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)/)
18
+ if (match) {
19
+ return match[0]
20
+ }
21
+ return version
22
+ }
23
+
11
24
  function convertServiceNameToPrefix (serviceName) {
12
25
  return serviceName.replace(/-/g, '_').toUpperCase()
13
26
  }
@@ -175,6 +188,7 @@ module.exports = {
175
188
  flattenObject,
176
189
  getServiceTemplateFromSchemaUrl,
177
190
  createDirectory,
191
+ stripVersion,
178
192
  PLT_ROOT,
179
193
  getLatestNpmVersion,
180
194
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@platformatic/generators",
3
- "version": "2.0.0-alpha.13",
3
+ "version": "2.0.0-alpha.15",
4
4
  "description": "Main classes and utils for generators.",
5
5
  "main": "index.js",
6
6
  "keywords": [],
@@ -10,10 +10,10 @@
10
10
  "@fastify/error": "^4.0.0",
11
11
  "boring-name-generator": "^1.0.3",
12
12
  "change-case-all": "^2.1.0",
13
- "fastify": "5.0.0-alpha.4",
13
+ "fastify": "^5.0.0",
14
14
  "pino": "^9.0.0",
15
15
  "undici": "^6.9.0",
16
- "@platformatic/utils": "2.0.0-alpha.13"
16
+ "@platformatic/utils": "2.0.0-alpha.15"
17
17
  },
18
18
  "devDependencies": {
19
19
  "@types/inquirer": "^9.0.7",