vovk-cli 0.0.1-draft.52 → 0.0.1-draft.54

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,15 @@
1
+
2
+ <%- '// auto-generated\n/* eslint-disable */' %>
3
+ import type { VovkClientFetcher } from 'vovk';
4
+ import type fetcher from '<%= fetcherClientImportPath %>';
5
+ import type createRPC from '<%= createRPCImportPath %>';
6
+ <% segments.forEach((segment, i) => { if(Object.keys(segmentsSchema[segment.segmentName].controllers).length) { %>
7
+ import type { Controllers as Controllers<%= i %> } from "<%= segment.segmentImportPath %>";
8
+ <% }}) %>
9
+ type Options = typeof fetcher extends VovkClientFetcher<infer U> ? U : never;
10
+
11
+ <% segments.forEach((segment, i) => { %>
12
+ <% Object.keys(segmentsSchema[segment.segmentName].controllers).forEach((key) => { %>
13
+ export const <%= key %>: ReturnType<typeof createRPC<Controllers<%= i %>["<%= key %>"], Options>>;
14
+ <% }) %>
15
+ <% }) %>
@@ -0,0 +1,20 @@
1
+ <%- '// auto-generated\n/* eslint-disable */' %>
2
+ import fetcher from '<%= fetcherClientImportPath %>';
3
+ import createRPC from '<%= createRPCImportPath %>';
4
+ import schema from '<%= schemaOutImportPath %>';
5
+ <% if (validateOnClientImportPath) { %>
6
+ import validateOnClient from '<%= validateOnClientImportPath %>';
7
+ <% } else { %>
8
+ const validateOnClient = undefined;
9
+ <% } %>
10
+ const apiRoot = '<%= apiRoot %>';
11
+
12
+ <% segments.forEach((segment, i) => { %>
13
+ <% Object.keys(segmentsSchema[segment.segmentName].controllers).forEach((key) => { %>
14
+ export const <%= key %> = createRPC(
15
+ schema['<%= segment.segmentName %>'].controllers.<%= key %>,
16
+ '<%= segment.segmentName %>',
17
+ { fetcher, validateOnClient, defaultOptions: { apiRoot } }
18
+ );
19
+ <% }) %>
20
+ <% }) %>
@@ -8,7 +8,8 @@ export default function getClientTemplates({ config, cwd, templateNames = [], })
8
8
  });
9
9
  const builtInTemplatesMap = {
10
10
  ts: ['index.ts.ejs'].map(mapper('ts')),
11
- compiled: ['compiled.js.ejs', 'compiled.d.ts.ejs'].map(mapper('compiled')),
11
+ main: ['main.cjs.ejs', 'main.d.cts.ejs'].map(mapper('main')),
12
+ module: ['module.mjs.ejs', 'module.d.mts.ejs'].map(mapper('module')),
12
13
  python: ['__init__.py'].map(mapper('python')),
13
14
  };
14
15
  const templateFiles = (templateNames ?? config.experimental_clientGenerateTemplateNames).reduce((acc, template) => {
@@ -18,7 +18,7 @@ export default async function getConfig({ clientOutDir, cwd }) {
18
18
  logLevel: env.VOVK_LOG_LEVEL ?? conf.logLevel ?? 'info',
19
19
  prettifyClient: (env.VOVK_PRETTIFY_CLIENT ? !!env.VOVK_PRETTIFY_CLIENT : null) ?? conf.prettifyClient ?? false,
20
20
  devHttps: (env.VOVK_DEV_HTTPS ? !!env.VOVK_DEV_HTTPS : null) ?? conf.devHttps ?? false,
21
- experimental_clientGenerateTemplateNames: conf.experimental_clientGenerateTemplateNames ?? ['ts', 'compiled'],
21
+ experimental_clientGenerateTemplateNames: conf.experimental_clientGenerateTemplateNames ?? ['ts', 'module', 'main'],
22
22
  templates: {
23
23
  service: 'vovk-cli/templates/service.ejs',
24
24
  controller: 'vovk-cli/templates/controller.ejs',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vovk-cli",
3
- "version": "0.0.1-draft.52",
3
+ "version": "0.0.1-draft.54",
4
4
  "bin": {
5
5
  "vovk": "./dist/index.mjs"
6
6
  },
@@ -16,7 +16,7 @@
16
16
  "test-only": "npm run pre-test && node --test --test-only test_dist/test/**/*.mjs",
17
17
  "test": "npm run pre-test && node --test --test-concurrency=1 test_dist/test/**/*.mjs",
18
18
  "tsc": "tsc --noEmit",
19
- "ncu": "npm-check-updates -u",
19
+ "ncu": "npm-check-updates -u -x commander",
20
20
  "npm-publish": "npm publish"
21
21
  },
22
22
  "repository": {
@@ -36,7 +36,7 @@
36
36
  },
37
37
  "homepage": "https://vovk.dev",
38
38
  "peerDependencies": {
39
- "vovk": "^3.0.0-draft.57"
39
+ "vovk": "^3.0.0-draft.58"
40
40
  },
41
41
  "dependencies": {
42
42
  "@inquirer/prompts": "^7.3.1",