vovk-cli 0.0.1-draft.29 → 0.0.1-draft.30

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,6 +1,4 @@
1
1
  export declare class VovkDev {
2
2
  #private;
3
- start({ clientOutDir }?: {
4
- clientOutDir?: string;
5
- }): Promise<void>;
3
+ start(): Promise<void>;
6
4
  }
@@ -181,8 +181,8 @@ export class VovkDev {
181
181
  const schema = this.#schemas[s.segmentName];
182
182
  if (!schema)
183
183
  return false;
184
- const controllersByOriginalName = keyBy(schema.controllers, '_originalControllerName');
185
- const workersByOriginalName = keyBy(schema.workers, '_originalWorkerName');
184
+ const controllersByOriginalName = keyBy(schema.controllers, 'originalControllerName');
185
+ const workersByOriginalName = keyBy(schema.workers, 'originalWorkerName');
186
186
  return namesOfClasses.some((name) => schema.controllers[name] ||
187
187
  schema.workers[name] ||
188
188
  controllersByOriginalName[name] ||
@@ -194,6 +194,9 @@ export class VovkDev {
194
194
  await this.#requestSchema(segment.segmentName);
195
195
  }
196
196
  }
197
+ else {
198
+ log.debug(`The class ${namesOfClasses.join(', ')} does not belong to any segment`);
199
+ }
197
200
  }
198
201
  else {
199
202
  log.debug(`The file does not contain any controller or worker`);
@@ -256,8 +259,8 @@ export class VovkDev {
256
259
  await generateClient(this.#projectInfo, this.#segments, this.#schemas);
257
260
  }
258
261
  }
259
- async start({ clientOutDir } = {}) {
260
- this.#projectInfo = await getProjectInfo({ clientOutDir });
262
+ async start() {
263
+ this.#projectInfo = await getProjectInfo();
261
264
  const { log, config, cwd, apiDir } = this.#projectInfo;
262
265
  if (config.devHttps) {
263
266
  const agent = new Agent({
package/dist/index.mjs CHANGED
@@ -18,7 +18,6 @@ initProgram(program.command('init'));
18
18
  program
19
19
  .command('dev')
20
20
  .description('Start schema watcher (optional flag --next-dev to start it with Next.js)')
21
- .option('--client-out <path>', 'Path to client output directory')
22
21
  .option('--next-dev', 'Start schema watcher and Next.js with automatic port allocation', false)
23
22
  .allowUnknownOption(true)
24
23
  .action(async (options, command) => {
@@ -36,16 +35,16 @@ program
36
35
  }
37
36
  if (options.nextDev) {
38
37
  const { result } = concurrently([
39
- {
40
- command: `node ${import.meta.dirname}/dev/index.mjs`,
41
- name: 'Vovk Dev Command',
42
- env: Object.assign({ PORT, __VOVK_START_WATCHER_IN_STANDALONE_MODE__: 'true' }, options.clientOut ? { VOVK_CLIENT_OUT_DIR: options.clientOut } : {}),
43
- },
44
38
  {
45
39
  command: `npx next dev ${command.args.join(' ')}`,
46
40
  name: 'Next.js Development Server',
47
41
  env: { PORT },
48
42
  },
43
+ {
44
+ command: `node ${import.meta.dirname}/dev/index.mjs`,
45
+ name: 'Vovk Dev Command',
46
+ env: { PORT, __VOVK_START_WATCHER_IN_STANDALONE_MODE__: 'true' },
47
+ },
49
48
  ], {
50
49
  killOthers: ['failure', 'success'],
51
50
  prefix: 'none',
@@ -58,7 +57,7 @@ program
58
57
  }
59
58
  }
60
59
  else {
61
- void new VovkDev().start({ clientOutDir: options.clientOut });
60
+ void new VovkDev().start();
62
61
  }
63
62
  });
64
63
  program
@@ -3,6 +3,7 @@ export default async function updateNPMScripts(root, updateScriptsMode) {
3
3
  const pkgJson = await NPMCliPackageJson.load(root);
4
4
  pkgJson.update({
5
5
  scripts: {
6
+ ...pkgJson.content.scripts,
6
7
  generate: 'vovk generate',
7
8
  dev: updateScriptsMode === 'explicit'
8
9
  ? "PORT=3000 concurrently 'next dev' 'vovk dev' --kill-others"
package/dist/types.d.mts CHANGED
@@ -45,7 +45,6 @@ export type VovkModuleRenderResult = {
45
45
  code: string;
46
46
  };
47
47
  export interface DevOptions {
48
- clientOut?: string;
49
48
  nextDev?: boolean;
50
49
  }
51
50
  export interface GenerateOptions {
@@ -6,9 +6,6 @@ export default function debounceWithArgs(fn, wait) {
6
6
  if (!debouncedFunctions.has(key)) {
7
7
  debouncedFunctions.set(key, debounce(fn, wait));
8
8
  }
9
- const debouncedFn = debouncedFunctions.get(key);
10
- if (debouncedFn) {
11
- debouncedFn(...args);
12
- }
9
+ return debouncedFunctions.get(key)(...args);
13
10
  };
14
11
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vovk-cli",
3
- "version": "0.0.1-draft.29",
3
+ "version": "0.0.1-draft.30",
4
4
  "bin": {
5
5
  "vovk": "./dist/index.mjs"
6
6
  },