@pikku/cli 0.6.12 → 0.6.13

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 (45) hide show
  1. package/CHANGELOG.md +11 -0
  2. package/bin/pikku-all.ts +15 -6
  3. package/bin/pikku-channels-map.ts +8 -6
  4. package/bin/pikku-channels.ts +7 -6
  5. package/bin/pikku-fetch.ts +1 -0
  6. package/bin/pikku-function-types.ts +18 -10
  7. package/bin/{pikku-routes.ts → pikku-http.ts} +11 -10
  8. package/bin/pikku-nextjs.ts +7 -2
  9. package/bin/pikku-openapi.ts +8 -9
  10. package/bin/pikku-routes-map.ts +7 -6
  11. package/bin/pikku-scheduler.ts +8 -7
  12. package/bin/pikku-schemas.ts +2 -1
  13. package/bin/pikku-websocket.ts +1 -0
  14. package/bin/pikku.ts +1 -1
  15. package/dist/bin/pikku-all.js +7 -6
  16. package/dist/bin/pikku-channels-map.js +2 -6
  17. package/dist/bin/pikku-channels.js +2 -6
  18. package/dist/bin/pikku-fetch.js +1 -1
  19. package/dist/bin/pikku-function-types.js +10 -10
  20. package/dist/bin/{pikku-routes.d.ts → pikku-http.d.ts} +1 -1
  21. package/dist/bin/{pikku-routes.js → pikku-http.js} +5 -9
  22. package/dist/bin/pikku-nextjs.js +5 -4
  23. package/dist/bin/pikku-openapi.js +3 -9
  24. package/dist/bin/pikku-routes-map.js +2 -6
  25. package/dist/bin/pikku-scheduler.js +3 -7
  26. package/dist/bin/pikku-schemas.js +1 -1
  27. package/dist/bin/pikku-websocket.js +1 -1
  28. package/dist/bin/pikku.js +1 -1
  29. package/dist/src/core/serialize-pikku-types.d.ts +1 -1
  30. package/dist/src/core/serialize-pikku-types.js +11 -9
  31. package/dist/src/inspector-glob.d.ts +2 -2
  32. package/dist/src/inspector-glob.js +2 -2
  33. package/dist/src/nextjs/serialize-nextjs-wrapper.d.ts +1 -1
  34. package/dist/src/nextjs/serialize-nextjs-wrapper.js +60 -12
  35. package/dist/src/pikku-cli-config.d.ts +3 -1
  36. package/dist/src/pikku-cli-config.js +8 -4
  37. package/dist/src/utils.d.ts +4 -1
  38. package/dist/src/utils.js +5 -3
  39. package/dist/tsconfig.tsbuildinfo +1 -1
  40. package/package.json +3 -3
  41. package/src/core/serialize-pikku-types.ts +12 -8
  42. package/src/inspector-glob.ts +4 -3
  43. package/src/nextjs/serialize-nextjs-wrapper.ts +61 -12
  44. package/src/pikku-cli-config.ts +12 -0
  45. package/src/utils.ts +15 -3
@@ -1,6 +1,7 @@
1
1
  import { join, dirname, resolve, isAbsolute } from 'path'
2
2
  import { readdir, readFile } from 'fs/promises'
3
3
  import { OpenAPISpecInfo } from './openapi/openapi-spec-generator.js'
4
+ import { InspectorFilters } from '@pikku/inspector'
4
5
 
5
6
  export interface PikkuCLICoreOutputFiles {
6
7
  outDir?: string
@@ -35,6 +36,8 @@ export type PikkuCLIConfig = {
35
36
  outputFile: string
36
37
  additionalInfo: OpenAPISpecInfo
37
38
  }
39
+
40
+ filters: InspectorFilters
38
41
  } & PikkuCLICoreOutputFiles
39
42
 
40
43
  const CONFIG_DIR_FILES = ['nextJSfile', 'fetchFile', 'websocketFile']
@@ -42,11 +45,13 @@ const CONFIG_DIR_FILES = ['nextJSfile', 'fetchFile', 'websocketFile']
42
45
  export const getPikkuCLIConfig = async (
43
46
  configFile: string | undefined = undefined,
44
47
  requiredFields: Array<keyof PikkuCLIConfig>,
48
+ tags: string[] = [],
45
49
  exitProcess: boolean = false
46
50
  ): Promise<PikkuCLIConfig> => {
47
51
  const config = await _getPikkuCLIConfig(
48
52
  configFile,
49
53
  requiredFields,
54
+ tags,
50
55
  exitProcess
51
56
  )
52
57
  return config
@@ -55,6 +60,7 @@ export const getPikkuCLIConfig = async (
55
60
  const _getPikkuCLIConfig = async (
56
61
  configFile: string | undefined = undefined,
57
62
  requiredFields: Array<keyof PikkuCLIConfig>,
63
+ tags: string[] = [],
58
64
  exitProcess: boolean = false
59
65
  ): Promise<PikkuCLIConfig> => {
60
66
  if (!configFile) {
@@ -82,6 +88,7 @@ const _getPikkuCLIConfig = async (
82
88
  const extendedConfig = await getPikkuCLIConfig(
83
89
  resolve(configDir, config.extends),
84
90
  [],
91
+ tags,
85
92
  exitProcess
86
93
  )
87
94
  result = {
@@ -154,6 +161,11 @@ const _getPikkuCLIConfig = async (
154
161
  }
155
162
  }
156
163
 
164
+ result.filters = result.filters || {}
165
+ if (tags.length > 0) {
166
+ result.filters.tags = tags
167
+ }
168
+
157
169
  if (!isAbsolute(result.tsconfig)) {
158
170
  result.tsconfig = join(result.rootDir, result.tsconfig)
159
171
  }
package/src/utils.ts CHANGED
@@ -52,6 +52,7 @@ interface Meta {
52
52
  export type FilesAndMethods = {
53
53
  userSessionType: Meta
54
54
  sessionServicesType: Meta
55
+ singletonServicesType: Meta
55
56
  pikkuConfigFactory: Meta
56
57
  singletonServicesFactory: Meta
57
58
  sessionServicesFactory: Meta
@@ -63,6 +64,7 @@ export interface PikkuCLIOptions {
63
64
  userSessionType?: string
64
65
  singletonServicesFactoryType?: string
65
66
  sessionServicesFactoryType?: string
67
+ tags?: string[]
66
68
  }
67
69
 
68
70
  const getMetaTypes = (
@@ -102,7 +104,8 @@ const getMetaTypes = (
102
104
 
103
105
  export const getPikkuFilesAndMethods = async (
104
106
  {
105
- sessionServicesTypeImportMap: httpSessionServicesTypeImportMap,
107
+ singletonServicesTypeImportMap,
108
+ sessionServicesTypeImportMap,
106
109
  userSessionTypeImportMap,
107
110
  sessionServicesFactories,
108
111
  singletonServicesFactories,
@@ -118,11 +121,13 @@ export const getPikkuFilesAndMethods = async (
118
121
  requires: Partial<{
119
122
  config: boolean
120
123
  sessionServiceType: boolean
124
+ singletonServicesType: boolean
121
125
  userSessionType: boolean
122
126
  singletonServicesFactory: boolean
123
127
  sessionServicesFactory: boolean
124
128
  }> = {
125
129
  config: false,
130
+ singletonServicesType: false,
126
131
  sessionServiceType: false,
127
132
  userSessionType: false,
128
133
  singletonServicesFactory: false,
@@ -138,10 +143,15 @@ export const getPikkuFilesAndMethods = async (
138
143
  userSessionTypeImportMap,
139
144
  configFileType
140
145
  ),
146
+ singletonServicesType: getMetaTypes(
147
+ 'CoreSingletonServices',
148
+ requires.singletonServicesType ? errors : new Map(),
149
+ singletonServicesTypeImportMap
150
+ ),
141
151
  sessionServicesType: getMetaTypes(
142
152
  'CoreServices',
143
153
  requires.sessionServiceType ? errors : new Map(),
144
- httpSessionServicesTypeImportMap
154
+ sessionServicesTypeImportMap
145
155
  ),
146
156
  pikkuConfigFactory: getMetaTypes(
147
157
  'CoreConfig',
@@ -210,7 +220,9 @@ export const logCommandInfoAndTime = async (
210
220
  callback: (...args: any[]) => Promise<unknown>
211
221
  ): Promise<boolean> => {
212
222
  if (skipCondition === true) {
213
- logInfo(`• Skipping ${commandStart} since ${skipMessage}.`)
223
+ logInfo(
224
+ `• Skipping ${commandStart.charAt(0).toLocaleLowerCase()}${commandStart.slice(1)} since ${skipMessage}.`
225
+ )
214
226
  return false
215
227
  }
216
228