vovk-cli 0.0.1-draft.203 → 0.0.1-draft.205

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.
@@ -34,6 +34,7 @@ export async function bundle({ projectInfo, fullSchema, cliBundleOptions, }) {
34
34
  composedOnly: true,
35
35
  composedIncludeSegments: cliBundleOptions.includeSegments ?? bundleConfig.includeSegments,
36
36
  composedExcludeSegments: cliBundleOptions.excludeSegments ?? bundleConfig.excludeSegments,
37
+ forceTsStandalone: cliBundleOptions.forceTsStandalone,
37
38
  },
38
39
  });
39
40
  await build({
@@ -74,6 +74,7 @@ export async function generate({ isEnsuringClient = false, projectInfo, forceNot
74
74
  config,
75
75
  cwd,
76
76
  log,
77
+ isTsStandalone,
77
78
  cliGenerateOptions,
78
79
  configKey: 'composedClient',
79
80
  });
@@ -142,6 +143,7 @@ export async function generate({ isEnsuringClient = false, projectInfo, forceNot
142
143
  config,
143
144
  cwd,
144
145
  log,
146
+ isTsStandalone,
145
147
  cliGenerateOptions,
146
148
  configKey: 'segmentedClient',
147
149
  });
@@ -8,11 +8,12 @@ export interface ClientTemplateFile {
8
8
  outCwdRelativeDir: string;
9
9
  templateDef: VovkStrictConfig['clientTemplateDefs'][string];
10
10
  }
11
- export default function getClientTemplateFiles({ config, cwd, log, configKey, cliGenerateOptions, }: {
11
+ export default function getClientTemplateFiles({ config, cwd, log, configKey, isTsStandalone, cliGenerateOptions, }: {
12
12
  config: VovkStrictConfig;
13
13
  cwd: string;
14
14
  log: ProjectInfo['log'];
15
15
  configKey: 'composedClient' | 'segmentedClient';
16
+ isTsStandalone: boolean;
16
17
  cliGenerateOptions?: GenerateOptions;
17
18
  }): Promise<{
18
19
  fromTemplates: string[];
@@ -3,7 +3,8 @@ import { glob } from 'glob';
3
3
  import resolveAbsoluteModulePath from '../utils/resolveAbsoluteModulePath.mjs';
4
4
  import getFileSystemEntryType, { FileSystemEntryType } from '../utils/getFileSystemEntryType.mjs';
5
5
  import getPublicModuleNameFromPath from '../utils/getPublicModuleNameFromPath.mjs';
6
- export default async function getClientTemplateFiles({ config, cwd, log, configKey, cliGenerateOptions, }) {
6
+ import { BuiltInTemplateName } from '../getProjectInfo/getConfig/getTemplateDefs.mjs';
7
+ export default async function getClientTemplateFiles({ config, cwd, log, configKey, isTsStandalone, cliGenerateOptions, }) {
7
8
  const usedTemplateDefs = {};
8
9
  const fromTemplates = configKey === 'composedClient'
9
10
  ? cliGenerateOptions?.composedFrom || cliGenerateOptions?.segmentedFrom
@@ -18,7 +19,17 @@ export default async function getClientTemplateFiles({ config, cwd, log, configK
18
19
  if (!(templateName in config.clientTemplateDefs)) {
19
20
  throw new Error(`Unknown template name: ${templateName}`);
20
21
  }
21
- usedTemplateDefs[templateName] = config.clientTemplateDefs[templateName];
22
+ let usedDef = config.clientTemplateDefs[templateName];
23
+ if (usedDef.isTsClient && isTsStandalone) {
24
+ usedDef = {
25
+ ...usedDef,
26
+ requires: {
27
+ ...usedDef.requires,
28
+ [BuiltInTemplateName.standaloneTypesTs]: '.',
29
+ },
30
+ };
31
+ }
32
+ usedTemplateDefs[templateName] = usedDef;
22
33
  }
23
34
  const templateFiles = [];
24
35
  const entries = Object.entries(usedTemplateDefs);
@@ -23,14 +23,17 @@ export default function getTemplateDefs(userTemplateDefs = {}) {
23
23
  [BuiltInTemplateName.ts]: {
24
24
  templatePath: `vovk-cli/client-templates/${BuiltInTemplateName.ts}/`,
25
25
  requires: { [BuiltInTemplateName.schemaTs]: '.' },
26
+ isTsClient: true,
26
27
  },
27
28
  [BuiltInTemplateName.cjs]: {
28
29
  templatePath: `vovk-cli/client-templates/${BuiltInTemplateName.cjs}/`,
29
30
  requires: { [BuiltInTemplateName.schemaCjs]: '.' },
31
+ isTsClient: true,
30
32
  },
31
33
  [BuiltInTemplateName.mjs]: {
32
34
  templatePath: `vovk-cli/client-templates/${BuiltInTemplateName.mjs}/`,
33
35
  requires: { [BuiltInTemplateName.schemaCjs]: '.' },
36
+ isTsClient: true,
34
37
  },
35
38
  [BuiltInTemplateName.schemaTs]: {
36
39
  templatePath: `vovk-cli/client-templates/${BuiltInTemplateName.schemaTs}/`,
package/dist/index.mjs CHANGED
@@ -112,6 +112,7 @@ program
112
112
  .option('--schema <path>', 'path to schema folder (default: .vovk-schema)')
113
113
  .option('--sourcemap', 'generate sourcemaps')
114
114
  .option('--openapi, --openapi-spec <openapi_path_or_url>', 'use OpenAPI schema instead of Vovk schema')
115
+ .option('--force-ts-standalone', 'force TypeScript standalone mode (Next.js environment will be ignored, by default it\'s "true" for non-Next.js directories)')
115
116
  .action(async (cliBundleOptions) => {
116
117
  const projectInfo = await getProjectInfo({ configPath: cliBundleOptions.config, srcRootRequired: false });
117
118
  const { cwd, config, log } = projectInfo;
package/dist/types.d.mts CHANGED
@@ -34,6 +34,7 @@ export interface BundleOptions extends Partial<Omit<VovkStrictConfig['bundle'],
34
34
  config?: string;
35
35
  schema?: string;
36
36
  openapiSpec?: string;
37
+ forceTsStandalone?: boolean;
37
38
  }
38
39
  export interface InitOptions {
39
40
  yes?: boolean;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vovk-cli",
3
- "version": "0.0.1-draft.203",
3
+ "version": "0.0.1-draft.205",
4
4
  "bin": {
5
5
  "vovk": "./dist/index.mjs"
6
6
  },
@@ -35,7 +35,7 @@
35
35
  },
36
36
  "homepage": "https://vovk.dev",
37
37
  "peerDependencies": {
38
- "vovk": "^3.0.0-draft.181"
38
+ "vovk": "^3.0.0-draft.184"
39
39
  },
40
40
  "optionalDependencies": {
41
41
  "vovk-python-client": "^0.0.1-draft.37"