vovk-cli 0.0.1-draft.33 → 0.0.1-draft.35

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.
@@ -1,3 +1,4 @@
1
+ import { pathToFileURL } from 'node:url';
1
2
  import getConfigAbsolutePaths from './getConfigAbsolutePaths.mjs';
2
3
  import importUncachedModule from './importUncachedModule.mjs';
3
4
  async function getUserConfig({ cwd, }) {
@@ -14,7 +15,8 @@ async function getUserConfig({ cwd, }) {
14
15
  catch {
15
16
  try {
16
17
  const cacheBuster = Date.now();
17
- ({ default: userConfig } = (await import(`${configPath}?cache=${cacheBuster}`)));
18
+ const configPathUrl = pathToFileURL(configPath).href;
19
+ ({ default: userConfig } = (await import(`${configPathUrl}?cache=${cacheBuster}`)));
18
20
  }
19
21
  catch (e) {
20
22
  return { userConfig: null, configAbsolutePaths, error: e };
@@ -8,7 +8,7 @@ export default async function getProjectInfo({ port: givenPort, clientOutDir, cw
8
8
  const { config, srcRoot, configAbsolutePaths, userConfig, error } = await getConfig({ clientOutDir, cwd });
9
9
  const apiEntryPoint = `${config.origin ?? ''}/${config.rootEntry}`;
10
10
  const apiDir = path.join(srcRoot, 'app', config.rootEntry);
11
- const schemaOutImportPath = path.relative(config.clientOutDir, config.schemaOutDir);
11
+ const schemaOutImportPath = path.relative(config.clientOutDir, config.schemaOutDir).replace(/\\/g, '/'); // windows fix
12
12
  const fetcherClientImportPath = config.fetcher.startsWith('.')
13
13
  ? path.relative(config.clientOutDir, config.fetcher)
14
14
  : config.fetcher;
package/dist/index.mjs CHANGED
@@ -11,6 +11,7 @@ import { VovkDev } from './dev/index.mjs';
11
11
  import newComponents from './new/index.mjs';
12
12
  import 'dotenv/config';
13
13
  import initProgram from './initProgram.mjs';
14
+ import { pathToFileURL } from 'node:url';
14
15
  const program = new Command();
15
16
  const packageJSON = JSON.parse(readFileSync(path.join(import.meta.dirname, '../package.json'), 'utf-8'));
16
17
  program.name('vovk').description('Vovk CLI').version(packageJSON.version);
@@ -69,7 +70,8 @@ program
69
70
  const { cwd, config, apiDir } = projectInfo;
70
71
  const segments = await locateSegments(apiDir);
71
72
  const schemaOutAbsolutePath = path.join(cwd, config.schemaOutDir);
72
- const schema = (await import(path.join(schemaOutAbsolutePath, 'index.js')));
73
+ const schemaImportUrl = pathToFileURL(path.join(schemaOutAbsolutePath, 'index.js')).href;
74
+ const schema = await import(schemaImportUrl);
73
75
  await generateClient(projectInfo, segments, schema.default);
74
76
  });
75
77
  program
@@ -16,7 +16,7 @@ export default async function locateSegments(dir, rootDir = dir) {
16
16
  const routeFilePath = path.join(filePath, 'route.ts');
17
17
  if (await getFileSystemEntryType(routeFilePath)) {
18
18
  // Calculate the basePath relative to the root directory
19
- const segmentName = path.relative(rootDir, dir);
19
+ const segmentName = path.relative(rootDir, dir).replace(/\\/g, '/'); // windows fix
20
20
  results.push({ routeFilePath, segmentName });
21
21
  }
22
22
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vovk-cli",
3
- "version": "0.0.1-draft.33",
3
+ "version": "0.0.1-draft.35",
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.26"
39
+ "vovk": "^3.0.0-draft.31"
40
40
  },
41
41
  "dependencies": {
42
42
  "@inquirer/prompts": "^7.1.0",
@@ -3,6 +3,7 @@
3
3
  <% var controllerName = modulePascalName + 'Controller'; %>
4
4
  <% var compiledName = modulePascalName + 'RPC'; %>
5
5
  <% var serviceName = modulePascalName + 'Service'; %>
6
+ <% var prefix = pluralize(_.kebabCase(moduleName).toLowerCase()); %>
6
7
  ---
7
8
  dir: <%= getModuleDirName(segmentName, moduleName) %>
8
9
  fileName: <%= controllerName + '.ts' %>
@@ -15,7 +16,7 @@ import { prefix, get, put, post, del, type VovkRequest } from 'vovk';
15
16
  import <%= serviceName %> from './<%= serviceName %>';
16
17
  <% } %>
17
18
 
18
- @prefix('<%= _.kebabCase(moduleName).toLowerCase() %>')
19
+ @prefix('<%= prefix %>')
19
20
  export default class <%= controllerName %> {
20
21
  @get()
21
22
  static get<%= modulePascalNamePlural %> = async (req: VovkRequest<null, { search: string }>) => {