@platformatic/generators 1.28.0 → 1.28.1

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.
@@ -45,7 +45,7 @@ async function execute () {
45
45
  },
46
46
  port: { type: 'string', default: '3042' },
47
47
  hostname: { type: 'string', default: '0.0.0.0' },
48
- plugins: { type: 'boolean', default: true },
48
+ plugin: { type: 'boolean', default: true },
49
49
  tests: { type: 'boolean', default: true },
50
50
  typescript: { type: 'boolean', default: false },
51
51
  git: { type: 'boolean', default: false },
@@ -58,7 +58,7 @@ async function execute () {
58
58
  generator.setConfig({
59
59
  port: parseInt(args.values.port),
60
60
  hostname: args.values.hostname,
61
- plugins: args.values.plugins,
61
+ plugin: args.values.plugin,
62
62
  tests: args.values.tests,
63
63
  typescript: args.values.typescript,
64
64
  initGitRepository: args.values.git,
@@ -81,7 +81,7 @@ import { join } from 'node:path'
81
81
  import { parseArgs } from 'node:util'
82
82
  import { Generator } from '../lib/generator'
83
83
 
84
- async function execute () {
84
+ async function execute (): Promise<void> {
85
85
  const args = parseArgs({
86
86
  args: process.argv.slice(2),
87
87
  options: {
@@ -91,7 +91,7 @@ async function execute () {
91
91
  },
92
92
  port: { type: 'string', default: '3042' },
93
93
  hostname: { type: 'string', default: '0.0.0.0' },
94
- plugins: { type: 'boolean', default: true },
94
+ plugin: { type: 'boolean', default: true },
95
95
  tests: { type: 'boolean', default: true },
96
96
  typescript: { type: 'boolean', default: false },
97
97
  git: { type: 'boolean', default: false },
@@ -104,7 +104,7 @@ async function execute () {
104
104
  generator.setConfig({
105
105
  port: parseInt(args.values.port as string),
106
106
  hostname: args.values.hostname,
107
- plugins: args.values.plugins,
107
+ plugin: args.values.plugin,
108
108
  tests: args.values.tests,
109
109
  typescript: args.values.typescript,
110
110
  initGitRepository: args.values.git,
@@ -116,7 +116,9 @@ async function execute () {
116
116
  console.log('Application created successfully! Run \`npm run start\` to start an application.')
117
117
  }
118
118
 
119
- execute()
119
+ execute().catch(err => {
120
+ throw err
121
+ })
120
122
  `
121
123
  }
122
124
 
@@ -300,8 +300,8 @@ class ${stackableGeneratorType} extends ServiceGenerator {
300
300
  return Object.assign({}, baseConfig, config)
301
301
  }
302
302
 
303
- async _beforePrepare () {
304
- super._beforePrepare()
303
+ async _beforePrepare (): Promise<void> {
304
+ await super._beforePrepare()
305
305
 
306
306
  this.addEnvVars({
307
307
  PLT_GREETING_TEXT: this.config.greeting ?? 'Hello world!'
@@ -314,7 +314,7 @@ class ${stackableGeneratorType} extends ServiceGenerator {
314
314
  }
315
315
  }
316
316
 
317
- async _afterPrepare () {
317
+ async _afterPrepare (): Promise<void> {
318
318
  const packageJson = await this.getStackablePackageJson()
319
319
  this.addFile({
320
320
  path: '',
@@ -333,18 +333,18 @@ class ${stackableGeneratorType} extends ServiceGenerator {
333
333
  if (!this._packageJson) {
334
334
  const packageJsonPath = join(__dirname, '..', '..', 'package.json')
335
335
  const packageJsonFile = await readFile(packageJsonPath, 'utf8')
336
- const packageJson = JSON.parse(packageJsonFile)
336
+ const packageJson: Partial<PackageJson> = JSON.parse(packageJsonFile)
337
337
 
338
- if (!packageJson.name) {
338
+ if (packageJson.name === undefined || packageJson.name === null) {
339
339
  throw new Error('Missing package name in package.json')
340
340
  }
341
341
 
342
- if (!packageJson.version) {
342
+ if (packageJson.version === undefined || packageJson.version === null) {
343
343
  throw new Error('Missing package version in package.json')
344
344
  }
345
345
 
346
- this._packageJson = packageJson
347
- return packageJson
346
+ this._packageJson = packageJson as PackageJson
347
+ return packageJson as PackageJson
348
348
  }
349
349
  return this._packageJson
350
350
  }
@@ -16,6 +16,7 @@ module.exports = async function (fastify, opts) {
16
16
 
17
17
  function getTsStackablePluginFile () {
18
18
  return `\
19
+ // eslint-disable-next-line
19
20
  /// <reference path="../index.d.ts" />
20
21
  import { FastifyInstance, FastifyPluginOptions } from 'fastify'
21
22
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@platformatic/generators",
3
- "version": "1.28.0",
3
+ "version": "1.28.1",
4
4
  "description": "Main classes and utils for generators.",
5
5
  "main": "index.js",
6
6
  "keywords": [],