go-duck-cli 1.3.35 → 1.3.37

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.
@@ -2,6 +2,11 @@ import fs from 'fs-extra';
2
2
  import path from 'path';
3
3
  import chalk from 'chalk';
4
4
 
5
+ const toKebabCase = (str) => {
6
+ if (!str) return '';
7
+ return str.replace(/([a-z0-9])([A-Z])/g, '$1-$2').toLowerCase();
8
+ };
9
+
5
10
  export const generateConfigLoader = async (outputDir, configObj) => {
6
11
  const configDir = path.join(outputDir, 'config');
7
12
  await fs.ensureDir(configDir);
@@ -243,7 +248,7 @@ func LoadConfig() (*Config, error) {
243
248
  // Default values
244
249
  v.SetDefault("go-duck.server.rest.port", 8080)
245
250
  v.SetDefault("go-duck.server.rest.protocol", "json")
246
- v.SetDefault("go-duck.server.rest.api-path-prefix", "/${configObj.name || 'api'}/api")
251
+ v.SetDefault("go-duck.server.rest.api-path-prefix", "/${toKebabCase(configObj.name) || 'api'}/api")
247
252
  v.SetDefault("go-duck.security.rate-limit.rps", 100.0)
248
253
  v.SetDefault("go-duck.security.rate-limit.burst", 200)
249
254
  v.SetDefault("go-duck.logging.datadog.enabled", false)
@@ -18,7 +18,7 @@ export const generatePostmanCollection = async (config, entities, outputDir, ope
18
18
  item: [],
19
19
  variable: [
20
20
  { key: "host", value: "localhost", type: "string" },
21
- { key: "port", value: String(config.server?.port || 8080), type: "string" },
21
+ { key: "port", value: String(config.server?.rest?.port || 8080), type: "string" },
22
22
  { key: "tenant", value: "tenant_1", type: "string" },
23
23
  { key: "token", value: "", type: "string" },
24
24
  { key: "keycloak_url", value: config.security?.['keycloak-host'] || "http://localhost:8180", type: "string" },
@@ -17,7 +17,7 @@ export const generateSwaggerDocs = async (config, entities, outputDir, openEntit
17
17
  description: `Generated documentation for ${config.name} microservice`
18
18
  },
19
19
  servers: [
20
- { url: `http://localhost:${config.server?.port || 8080}`, description: 'Local Development Server' }
20
+ { url: `http://localhost:${config.server?.rest?.port || 8080}`, description: 'Local Development Server' }
21
21
  ],
22
22
  paths: {},
23
23
  components: {
package/index.js CHANGED
@@ -875,13 +875,21 @@ const generateYAMLConfigs = async (config, outputDir) => {
875
875
  delete cleanConfig.datasource['multitenancy-databases'];
876
876
  }
877
877
 
878
+ const toKebabCase = (str) => {
879
+ if (!str) return '';
880
+ return str.replace(/([a-z0-9])([A-Z])/g, '$1-$2').toLowerCase();
881
+ };
882
+
883
+ const rawApiPrefix = cleanConfig.server?.rest?.['api-path-prefix'] || `/${cleanConfig.name || 'api'}/api`;
884
+ const kebabApiPrefix = rawApiPrefix.split('/').map(segment => toKebabCase(segment)).join('/');
885
+
878
886
  const extendedConfig = {
879
887
  ...cleanConfig,
880
888
  server: {
881
889
  rest: {
882
890
  port: cleanConfig.server?.rest?.port || cleanConfig.server?.port || 8080,
883
891
  protocol: cleanConfig.server?.rest?.protocol || 'json',
884
- 'api-path-prefix': cleanConfig.server?.rest?.['api-path-prefix'] || `/${cleanConfig.name || 'api'}/api`
892
+ 'api-path-prefix': kebabApiPrefix
885
893
  },
886
894
  'read-timeout': cleanConfig.server?.['read-timeout'] || '30s',
887
895
  'write-timeout': cleanConfig.server?.['write-timeout'] || '30s',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "go-duck-cli",
3
- "version": "1.3.35",
3
+ "version": "1.3.37",
4
4
  "description": "The Ultimate Evolutionary Go Microservice Scaffolder.",
5
5
  "main": "index.js",
6
6
  "type": "module",
@@ -10,6 +10,9 @@
10
10
  "scripts": {
11
11
  "test": "echo \"Error: no test specified\" && exit 1"
12
12
  },
13
+ "engines": {
14
+ "node": ">=18.0.0"
15
+ },
13
16
  "author": "heavenscode",
14
17
  "license": "ISC",
15
18
  "dependencies": {
@@ -21,5 +24,23 @@
21
24
  "inquirer": "^8.2.7",
22
25
  "js-yaml": "^4.1.1",
23
26
  "open": "^11.0.0"
27
+ },
28
+ "keywords": [
29
+ "go",
30
+ "golang",
31
+ "microservice",
32
+ "scaffold",
33
+ "cli",
34
+ "generator",
35
+ "go-duck"
36
+ ],
37
+
38
+ "repository": {
39
+ "type": "git",
40
+ "url": "git+https://github.com/heavenscode/go-duck.git"
41
+ },
42
+ "homepage": "https://goduck.theheavenscode.com",
43
+ "bugs": {
44
+ "url": "https://github.com/heavenscode/go-duck/issues"
24
45
  }
25
46
  }