@pikku/cli 0.6.9 → 0.6.11

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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,20 @@
1
1
  # @pikku/cli
2
2
 
3
+ ## 0.6.11
4
+
5
+ ### Patch Changes
6
+
7
+ - 3062086: fix: renaming AbstractFetch/Websocket to core
8
+ - eb8a8b4: fix: updating schema and cli build issue due to tsconfig settings
9
+ - Updated dependencies [eb8a8b4]
10
+ - @pikku/core@0.6.13
11
+
12
+ ## 0.6.10
13
+
14
+ ### Patch Changes
15
+
16
+ - 06e71be: fix: use readFile instead of import for json file
17
+
3
18
  ## 0.6.9
4
19
 
5
20
  ### Patch Changes
package/cli.schema.json CHANGED
@@ -184,11 +184,17 @@
184
184
  "schemaDirectory": {
185
185
  "type": "string"
186
186
  },
187
+ "supportsImportAttributes": {
188
+ "type": "boolean"
189
+ },
187
190
  "tsconfig": {
188
191
  "type": "string"
189
192
  },
190
193
  "typesDeclarationFile": {
191
194
  "type": "string"
195
+ },
196
+ "websocketFile": {
197
+ "type": "string"
192
198
  }
193
199
  },
194
200
  "required": [
@@ -203,6 +209,7 @@
203
209
  "routesMapDeclarationFile",
204
210
  "schedulersFile",
205
211
  "schemaDirectory",
212
+ "supportsImportAttributes",
206
213
  "tsconfig",
207
214
  "typesDeclarationFile"
208
215
  ],
@@ -1,8 +1,8 @@
1
1
  export const serializeWebsocketWrapper = (channelsMapPath) => {
2
- return `import { AbstractPikkuWebsocket, AbstractPikkuRouteHandler } from '@pikku/websocket'
2
+ return `import { CorePikkuWebsocket, CorePikkuRouteHandler } from '@pikku/websocket'
3
3
  import { ChannelDefaultHandlerOf, ChannelRouteHandlerOf, ChannelsMap } from '${channelsMapPath}';
4
4
 
5
- class PikkuWebSocketRoute<Channel extends keyof ChannelsMap, Route extends keyof ChannelsMap[Channel]['routes']> extends AbstractPikkuRouteHandler {
5
+ class PikkuWebSocketRoute<Channel extends keyof ChannelsMap, Route extends keyof ChannelsMap[Channel]['routes']> extends CorePikkuRouteHandler {
6
6
  public subscribe<
7
7
  Method extends keyof ChannelsMap[Channel]['routes'][Route],
8
8
  Data extends ChannelRouteHandlerOf<Channel, Route, Method>['output']
@@ -26,7 +26,7 @@ class PikkuWebSocketRoute<Channel extends keyof ChannelsMap, Route extends keyof
26
26
  }
27
27
  }
28
28
 
29
- export class PikkuWebSocket<Channel extends keyof ChannelsMap> extends AbstractPikkuWebsocket {
29
+ export class PikkuWebSocket<Channel extends keyof ChannelsMap> extends CorePikkuWebsocket {
30
30
  /**
31
31
  * Send a message to a specific route and method.
32
32
  * Validates the input data type.
@@ -3,7 +3,7 @@ export const serializeFetchWrapper = (routesMapPath) => {
3
3
  import { CorePikkuFetch, HTTPMethod } from '@pikku/fetch'
4
4
  import type { RoutesMap, RouteHandlerOf, RoutesWithMethod } from '${routesMapPath}'
5
5
 
6
- export class PikkuFetch extends AbstractPikkuFetch {
6
+ export class PikkuFetch extends CorePikkuFetch {
7
7
  public async post<Route extends RoutesWithMethod<'POST'>>(
8
8
  route: Route,
9
9
  data: RouteHandlerOf<Route, 'POST'>['input'] = null,
@@ -1,4 +1,4 @@
1
- import { HTTPRoutesMeta } from '@pikku/core/http';
1
+ import { HTTPRoutesMeta } from '@pikku/core';
2
2
  interface OpenAPISpec {
3
3
  openapi: string;
4
4
  info: {
@@ -1,4 +1,4 @@
1
- import { getErrors } from '@pikku/core/errors';
1
+ import { getErrors } from '@pikku/core';
2
2
  import _convertSchema from '@openapi-contrib/json-schema-to-openapi-schema';
3
3
  const convertSchema = 'default' in _convertSchema ? _convertSchema.default : _convertSchema;
4
4
  const getErrorResponseForConstructorName = (constructorName) => {
package/dist/src/utils.js CHANGED
@@ -1,8 +1,9 @@
1
- // import packageInfo from '../package.json'
2
1
  import { relative, dirname } from 'path';
3
2
  import { mkdir, writeFile } from 'fs/promises';
4
3
  import chalk from 'chalk';
5
- import packageJson from '../package.json';
4
+ import { fileURLToPath } from 'url';
5
+ import { readFileSync } from 'fs';
6
+ const __filename = fileURLToPath(import.meta.url);
6
7
  export const logPrimary = (message) => {
7
8
  console.log(chalk.green(message));
8
9
  };
@@ -120,7 +121,8 @@ const logo = `
120
121
  `;
121
122
  export const logPikkuLogo = () => {
122
123
  logPrimary(logo);
123
- logPrimary(`⚙️ Welcome to the Pikku CLI (v${packageJson})\n`);
124
+ const packageJson = JSON.parse(readFileSync(`${dirname(__filename)}/../../package.json`, 'utf-8'));
125
+ logPrimary(`⚙️ Welcome to the Pikku CLI (v${packageJson.version})\n`);
124
126
  };
125
127
  // TODO: add version back in once the ESM dust settles
126
128
  export const DO_NOT_MODIFY_COMMENT = `/**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pikku/cli",
3
- "version": "0.6.9",
3
+ "version": "0.6.11",
4
4
  "author": "yasser.fadl@gmail.com",
5
5
  "license": "MIT",
6
6
  "bin": {
@@ -22,7 +22,7 @@
22
22
  },
23
23
  "dependencies": {
24
24
  "@openapi-contrib/json-schema-to-openapi-schema": "^3.0.2",
25
- "@pikku/core": "^0.6.11",
25
+ "@pikku/core": "^0.6.13",
26
26
  "@pikku/inspector": "^0.6.2",
27
27
  "@types/cookie": "^0.6.0",
28
28
  "@types/uuid": "^10.0.0",
@@ -1,8 +1,8 @@
1
1
  export const serializeWebsocketWrapper = (channelsMapPath: string) => {
2
- return `import { AbstractPikkuWebsocket, AbstractPikkuRouteHandler } from '@pikku/websocket'
2
+ return `import { CorePikkuWebsocket, CorePikkuRouteHandler } from '@pikku/websocket'
3
3
  import { ChannelDefaultHandlerOf, ChannelRouteHandlerOf, ChannelsMap } from '${channelsMapPath}';
4
4
 
5
- class PikkuWebSocketRoute<Channel extends keyof ChannelsMap, Route extends keyof ChannelsMap[Channel]['routes']> extends AbstractPikkuRouteHandler {
5
+ class PikkuWebSocketRoute<Channel extends keyof ChannelsMap, Route extends keyof ChannelsMap[Channel]['routes']> extends CorePikkuRouteHandler {
6
6
  public subscribe<
7
7
  Method extends keyof ChannelsMap[Channel]['routes'][Route],
8
8
  Data extends ChannelRouteHandlerOf<Channel, Route, Method>['output']
@@ -26,7 +26,7 @@ class PikkuWebSocketRoute<Channel extends keyof ChannelsMap, Route extends keyof
26
26
  }
27
27
  }
28
28
 
29
- export class PikkuWebSocket<Channel extends keyof ChannelsMap> extends AbstractPikkuWebsocket {
29
+ export class PikkuWebSocket<Channel extends keyof ChannelsMap> extends CorePikkuWebsocket {
30
30
  /**
31
31
  * Send a message to a specific route and method.
32
32
  * Validates the input data type.
@@ -3,7 +3,7 @@ export const serializeFetchWrapper = (routesMapPath: string) => {
3
3
  import { CorePikkuFetch, HTTPMethod } from '@pikku/fetch'
4
4
  import type { RoutesMap, RouteHandlerOf, RoutesWithMethod } from '${routesMapPath}'
5
5
 
6
- export class PikkuFetch extends AbstractPikkuFetch {
6
+ export class PikkuFetch extends CorePikkuFetch {
7
7
  public async post<Route extends RoutesWithMethod<'POST'>>(
8
8
  route: Route,
9
9
  data: RouteHandlerOf<Route, 'POST'>['input'] = null,
@@ -1,5 +1,4 @@
1
- import { getErrors } from '@pikku/core/errors'
2
- import { HTTPRoutesMeta } from '@pikku/core/http'
1
+ import { getErrors, HTTPRoutesMeta } from '@pikku/core'
3
2
  import _convertSchema from '@openapi-contrib/json-schema-to-openapi-schema'
4
3
  const convertSchema =
5
4
  'default' in _convertSchema ? (_convertSchema.default as any) : _convertSchema
package/src/utils.ts CHANGED
@@ -1,9 +1,11 @@
1
- // import packageInfo from '../package.json'
2
1
  import { relative, dirname } from 'path'
3
2
  import { PathToNameAndType, InspectorState } from '@pikku/inspector'
4
3
  import { mkdir, writeFile } from 'fs/promises'
5
4
  import chalk from 'chalk'
6
- import packageJson from '../package.json'
5
+ import { fileURLToPath } from 'url'
6
+ import { readFileSync } from 'fs'
7
+
8
+ const __filename = fileURLToPath(import.meta.url)
7
9
 
8
10
  export const logPrimary = (message: string) => {
9
11
  console.log(chalk.green(message))
@@ -231,7 +233,11 @@ const logo = `
231
233
 
232
234
  export const logPikkuLogo = () => {
233
235
  logPrimary(logo)
234
- logPrimary(`⚙️ Welcome to the Pikku CLI (v${packageJson})\n`)
236
+
237
+ const packageJson = JSON.parse(
238
+ readFileSync(`${dirname(__filename)}/../../package.json`, 'utf-8')
239
+ )
240
+ logPrimary(`⚙️ Welcome to the Pikku CLI (v${packageJson.version})\n`)
235
241
  }
236
242
 
237
243
  // TODO: add version back in once the ESM dust settles
package/dist/package.json DELETED
@@ -1,43 +0,0 @@
1
- {
2
- "name": "@pikku/cli",
3
- "version": "0.6.9",
4
- "author": "yasser.fadl@gmail.com",
5
- "license": "MIT",
6
- "bin": {
7
- "pikku": "dist/bin/pikku.js"
8
- },
9
- "type": "module",
10
- "main": "dist/bin/pikku.js",
11
- "module": "dist/bin/pikku.js",
12
- "scripts": {
13
- "tsc": "tsc",
14
- "build:esm": "tsc -b",
15
- "schema": "ts-json-schema-generator -o cli.schema.json --path 'src/pikku-cli-config.ts' --type 'PikkuCLIConfig'",
16
- "build": "yarn build:esm && yarn schema",
17
- "ncu": "npx npm-check-updates -x '/.*glob.*/'",
18
- "release": "yarn build && npm test",
19
- "test": "bash run-tests.sh",
20
- "test:watch": "bash run-tests.sh --watch",
21
- "test:coverage": "bash run-tests.sh --coverage"
22
- },
23
- "dependencies": {
24
- "@openapi-contrib/json-schema-to-openapi-schema": "^3.0.2",
25
- "@pikku/core": "^0.6.11",
26
- "@pikku/inspector": "^0.6.2",
27
- "@types/cookie": "^0.6.0",
28
- "@types/uuid": "^10.0.0",
29
- "chalk": "^5.4.1",
30
- "commander": "^12",
31
- "glob": "^10",
32
- "path-to-regexp": "^8.2.0",
33
- "ts-json-schema-generator": "^2.3.0",
34
- "typescript": "^5.6",
35
- "yaml": "^2.6.0"
36
- },
37
- "devDependencies": {
38
- "@types/node": "^22.7.8"
39
- },
40
- "engines": {
41
- "node": ">=18"
42
- }
43
- }