vovk-cli 0.0.1-draft.46 → 0.0.1-draft.47

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/README.md CHANGED
@@ -1 +1,29 @@
1
- Description is coming soon.
1
+ <p align="center">
2
+ <picture>
3
+ <source width="300" media="(prefers-color-scheme: dark)" srcset="https://vovk.dev/vovk-logo-white.svg">
4
+ <source width="300" media="(prefers-color-scheme: light)" srcset="https://vovk.dev/vovk-logo.svg">
5
+ <img width="300" alt="vovk" src="https://vovk.dev/vovk-logo.svg">
6
+ </picture><br>
7
+ <strong>REST + RPC = ♥️</strong>
8
+ </p>
9
+
10
+ <p align="center">
11
+ Back-end meta-framework for <a href="https://nextjs.org/docs/app">Next.js</a>
12
+ </p>
13
+
14
+ ---
15
+
16
+ ## vovk-cli [![npm version](https://badge.fury.io/js/vovk-cli.svg)](https://www.npmjs.com/package/vovk-cli)
17
+
18
+ The Vovk.ts CLI that generates schema and client but also provides some useful utilities for the development process.
19
+
20
+ ```sh
21
+ npm install -D vovk-cli
22
+ ```
23
+
24
+ - [vovk dev](https://vovk.dev/cli/vovk-dev) - starts the development script that watches the changes in controllers and regenerates the schema and client.
25
+ - [vovk generate](https://vovk.dev/cli/vovk-generate) - generates the client based on the schema.
26
+ - [vovk init](https://vovk.dev/cli/vovk-init) - initializes the Vovk.ts project.
27
+ - [vovk new](https://vovk.dev/cli/vovk-new) - generates a new controller, service, worker or a custom module.
28
+
29
+ For more information, please visit the [CLI documentation](https://vovk.dev/cli) or use `npx vovk-cli --help` to get the list of available commands and options.
@@ -20,6 +20,6 @@ exports.<%= key %> = createRPC(
20
20
  );
21
21
  <% }) %>
22
22
  <% workers.forEach((key) => { %>
23
- exports.<%= key %> = createWPC(null, schema['<%= segment.segmentName %>'].workers.<%= key %>);
23
+ exports.<%= key %> = createWPC(schema['<%= segment.segmentName %>'].workers.<%= key %>);
24
24
  <% }) %>
25
25
  <% }) %>
@@ -2,6 +2,11 @@
2
2
  import { createRPC, createWPC, type VovkClientFetcher } from 'vovk';
3
3
  import fetcher from '<%= fetcherClientImportPath %>';
4
4
  import schema from '<%= schemaOutImportPath %>';
5
+ <% segments.forEach((segment, i) => {
6
+ const hasWorkers = !!Object.keys(segmentsSchema[segment.segmentName].workers).length;
7
+ %>
8
+ import type { Controllers as Controllers<%= i %><% if(hasWorkers) { %>, Workers as Workers<%= i %> <% } %> } from "<%= segment.segmentImportPath %>";
9
+ <% }) %>
5
10
  <% if (validateOnClientImportPath) { %>
6
11
  import validateOnClient from '<%= validateOnClientImportPath %>';
7
12
  <% } else { %>
@@ -15,8 +20,6 @@ const apiRoot = '<%= apiRoot %>';
15
20
  if (!segSchema || !segSchema.emitSchema) return;
16
21
  const hasWorkers = !!Object.keys(segmentsSchema[segment.segmentName].workers).length;
17
22
  %>
18
- import type { Controllers as Controllers<%= i %><% if(hasWorkers) { %>, Workers as Workers<%= i %> <% } %>} from "<%= segment.segmentImportPath %>";
19
-
20
23
  <% Object.keys(segSchema.controllers).forEach((key) => { %>
21
24
  export const <%= key %> = createRPC<Controllers<%= i %>["<%= key %>"], Options>(
22
25
  schema['<%= segment.segmentName %>'].controllers.<%= key %>,
@@ -27,7 +30,6 @@ export const <%= key %> = createRPC<Controllers<%= i %>["<%= key %>"], Options>(
27
30
 
28
31
  <% Object.keys(segSchema.workers).forEach((key) => { %>
29
32
  export const <%= key %> = createWPC<Workers<%= i %>["<%= key %>"]>(
30
- null,
31
33
  schema['<%= segment.segmentName %>'].workers.<%= key %>
32
34
  );
33
35
  <% }) %>
@@ -1,7 +1,6 @@
1
1
  import path from 'node:path';
2
2
  export default function getClientTemplates({ config, cwd, templateNames = [], }) {
3
- const __dirname = path.dirname(new URL(import.meta.url).pathname);
4
- const templatesDir = path.join(__dirname, '../..', 'client-templates');
3
+ const templatesDir = path.join(import.meta.dirname, '../..', 'client-templates');
5
4
  const clientOutDirAbsolutePath = path.resolve(cwd, config.clientOutDir);
6
5
  const mapper = (dir) => (name) => ({
7
6
  templatePath: path.resolve(templatesDir, dir, name),
package/dist/index.mjs CHANGED
@@ -18,6 +18,7 @@ program.name('vovk').description('Vovk CLI').version(packageJSON.version);
18
18
  initProgram(program.command('init'));
19
19
  program
20
20
  .command('dev')
21
+ .alias('d')
21
22
  .description('Start schema watcher (optional flag --next-dev to start it with Next.js)')
22
23
  .option('--next-dev', 'Start schema watcher and Next.js with automatic port allocation')
23
24
  .option('--exit', 'Kill the processe when schema and client is generated')
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vovk-cli",
3
- "version": "0.0.1-draft.46",
3
+ "version": "0.0.1-draft.47",
4
4
  "bin": {
5
5
  "vovk": "./dist/index.mjs"
6
6
  },
@@ -36,7 +36,7 @@
36
36
  },
37
37
  "homepage": "https://vovk.dev",
38
38
  "peerDependencies": {
39
- "vovk": "^3.0.0-draft.52"
39
+ "vovk": "^3.0.0-draft.53"
40
40
  },
41
41
  "dependencies": {
42
42
  "@inquirer/prompts": "^7.2.3",