@platformatic/generators 1.26.0 → 1.27.0

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.
@@ -0,0 +1,16 @@
1
+ import { expectAssignable } from 'tsd'
2
+ import { BaseGenerator } from './lib/base-generator';
3
+
4
+ expectAssignable<BaseGenerator.ConfigFieldDefinition>({
5
+ label: 'PLT_TESTING',
6
+ var: 'testing',
7
+ default: 'hello world',
8
+ type: 'string',
9
+ configValue: 'someConfigValue'
10
+ })
11
+
12
+ expectAssignable<BaseGenerator.ConfigField>({
13
+ var: 'testing',
14
+ configValue: 'someConfigValue',
15
+ value: 'asd123'
16
+ })
@@ -61,13 +61,13 @@ export namespace BaseGenerator {
61
61
  var: string
62
62
  default: string
63
63
  type: 'number' | 'string' | 'boolean' | 'path'
64
- configValue?: 'string'
64
+ configValue?: string
65
65
  }
66
66
 
67
67
  type ConfigField = {
68
68
  var: string
69
- configValue?: 'string'
70
- value: 'string'
69
+ configValue?: string
70
+ value: string
71
71
  }
72
72
 
73
73
  type AddEnvVarOptions = {
@@ -364,6 +364,7 @@ class BaseGenerator extends FileGenerator {
364
364
 
365
365
  async generatePackageJson () {
366
366
  const template = {
367
+ name: `${this.config.serviceName}`,
367
368
  scripts: {
368
369
  start: 'platformatic start',
369
370
  test: 'node --test test/**'
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@platformatic/generators",
3
- "version": "1.26.0",
3
+ "version": "1.27.0",
4
4
  "description": "Main classes and utils for generators.",
5
5
  "main": "index.js",
6
6
  "keywords": [],
@@ -16,14 +16,15 @@
16
16
  },
17
17
  "devDependencies": {
18
18
  "@types/inquirer": "^9.0.7",
19
- "borp": "^0.9.0",
19
+ "borp": "^0.10.0",
20
20
  "c8": "^9.1.0",
21
21
  "snazzy": "^9.0.0",
22
22
  "standard": "^17.1.0",
23
+ "tsd": "^0.30.4",
23
24
  "typescript": "^5.3.3"
24
25
  },
25
26
  "scripts": {
26
27
  "lint": "standard | snazzy",
27
- "test": "pnpm run lint && borp -C -X fixtures -X test --concurrency=1"
28
+ "test": "pnpm run lint && borp -C -X fixtures -X test --concurrency=1 && tsd"
28
29
  }
29
30
  }
@@ -30,7 +30,8 @@ test('should write file and dirs', async (t) => {
30
30
  })
31
31
 
32
32
  gen.setConfig({
33
- targetDirectory: dir
33
+ targetDirectory: dir,
34
+ serviceName: 'test-service'
34
35
  })
35
36
 
36
37
  await gen.run()
@@ -40,6 +41,8 @@ test('should write file and dirs', async (t) => {
40
41
  assert.ok(packageJson.dependencies)
41
42
  assert.ok(packageJson.engines)
42
43
 
44
+ assert.equal(packageJson.name, 'test-service')
45
+
43
46
  const configFile = JSON.parse(await readFile(join(dir, 'platformatic.json'), 'utf8'))
44
47
  assert.deepEqual(configFile, {})
45
48