vovk-cli 0.0.5 → 0.1.0

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
@@ -9,6 +9,8 @@
9
9
  <br>
10
10
  <strong>Back-end Framework for Next.js App Router</strong>
11
11
  <br />
12
+ <em>One codebase → type-safe clients, OpenAPI, and AI tools</em>
13
+ <br />
12
14
  <a href="https://vovk.dev/">Documentation</a>
13
15
  &nbsp;&nbsp;
14
16
  <a href="https://vovk.dev/quick-install">Quick Start</a>
@@ -28,8 +30,8 @@ npm install -D vovk-cli
28
30
 
29
31
  - [vovk dev](https://vovk.dev/dev) - starts the development script that watches the changes in [controllers](https://vovk.dev/controller) and regenerates the [schema](https://vovk.dev/schema) and [client](https://vovk.dev/typescript)
30
32
  - [vovk generate](https://vovk.dev/generate) - generates the client based on the schema
31
- - [vovk bundle](https://vovk.dev/bundle) - bundles the client with [tsdown](https://tsdown.dev/)
32
- - [vovk init](https://vovk.dev/init) - initializes a new Vovk.ts project
33
+ - [vovk bundle](https://vovk.dev/bundle) - bundles the client (requires `bundle.build` config to be set)
34
+ - [vovk init](https://vovk.dev/init) - initializes a new Vovk.ts project in an existing Next.js app
33
35
  - [vovk new](https://vovk.dev/new) - generates a new controller, service or a custom module
34
36
 
35
37
  ```sh
package/dist/index.mjs CHANGED
@@ -177,7 +177,6 @@ program
177
177
  .option('--use-pnpm', 'use pnpm as package manager')
178
178
  .option('--use-bun', 'use bun as package manager')
179
179
  .option('--skip-install', 'skip installing dependencies')
180
- .option('--update-ts-config', 'update tsconfig.json')
181
180
  .option('--update-scripts <mode>', 'update package.json scripts ("implicit" or "explicit")')
182
181
  .option('--bundle', 'set up "tsdown" bundler')
183
182
  .option('--lang <languages...>', 'generate client for other programming languages by default ("py" for Python and "rs" for Rust are supported)')
@@ -4,5 +4,5 @@ export declare class Init {
4
4
  #private;
5
5
  root: string;
6
6
  log: ReturnType<typeof getLogger>;
7
- main({ prefix, yes, logLevel, useNpm, useYarn, usePnpm, useBun, skipInstall, updateTsConfig, updateScripts, validationLibrary, bundle, lang, dryRun, channel, }: InitOptions): Promise<void>;
7
+ main({ prefix, yes, logLevel, useNpm, useYarn, usePnpm, useBun, skipInstall, updateScripts, validationLibrary, bundle, lang, dryRun, channel, }: InitOptions): Promise<void>;
8
8
  }
@@ -9,15 +9,13 @@ import { installDependencies, getPackageManager } from './installDependencies.mj
9
9
  import { getLogger } from '../utils/getLogger.mjs';
10
10
  import { createConfig } from './createConfig.mjs';
11
11
  import { updateNPMScripts, getDevScript } from './updateNPMScripts.mjs';
12
- import { checkTSConfigForExperimentalDecorators } from './checkTSConfigForExperimentalDecorators.mjs';
13
- import { updateTypeScriptConfig } from './updateTypeScriptConfig.mjs';
14
12
  import { updateDependenciesWithoutInstalling } from './updateDependenciesWithoutInstalling.mjs';
15
13
  import { logUpdateDependenciesError } from './logUpdateDependenciesError.mjs';
16
14
  import { chalkHighlightThing } from '../utils/chalkHighlightThing.mjs';
17
15
  export class Init {
18
16
  root;
19
17
  log;
20
- async #init({ configPaths, pkgJson, }, { useNpm, useYarn, usePnpm, useBun, skipInstall, updateTsConfig, updateScripts, validationLibrary, bundle, lang, dryRun, channel, }) {
18
+ async #init({ configPaths, pkgJson, }, { useNpm, useYarn, usePnpm, useBun, skipInstall, updateScripts, validationLibrary, bundle, lang, dryRun, channel, }) {
21
19
  const { log, root } = this;
22
20
  const dependencies = ['vovk', 'vovk-client', 'vovk-ajv', 'openapi3-ts'];
23
21
  const devDependencies = ['vovk-cli'];
@@ -56,21 +54,6 @@ export class Init {
56
54
  devDependencies.push('concurrently');
57
55
  }
58
56
  }
59
- if (updateTsConfig) {
60
- try {
61
- const compilerOptions = {
62
- experimentalDecorators: true,
63
- };
64
- if (!dryRun)
65
- await updateTypeScriptConfig(root, compilerOptions);
66
- log.info(`Added ${Object.keys(compilerOptions)
67
- .map((k) => `"${k}"`)
68
- .join(' and ')} to tsconfig.json`);
69
- }
70
- catch (error) {
71
- log.error(`Failed to update tsconfig.json: ${error.message}`);
72
- }
73
- }
74
57
  if (!dryRun && pkgJson) {
75
58
  let depsUpdated = false;
76
59
  const packageManager = getPackageManager({ useNpm, useYarn, usePnpm, useBun, pkgJson });
@@ -127,7 +110,7 @@ export class Init {
127
110
  log.error(`Failed to create config: ${error.message}. Please, refer to the documentation at https://vovk.dev/config`);
128
111
  }
129
112
  }
130
- async main({ prefix, yes, logLevel, useNpm, useYarn, usePnpm, useBun, skipInstall, updateTsConfig, updateScripts, validationLibrary, bundle, lang, dryRun, channel, }) {
113
+ async main({ prefix, yes, logLevel, useNpm, useYarn, usePnpm, useBun, skipInstall, updateScripts, validationLibrary, bundle, lang, dryRun, channel, }) {
131
114
  const cwd = process.cwd();
132
115
  const root = path.resolve(cwd, prefix ?? '.');
133
116
  const log = getLogger(logLevel ?? 'info');
@@ -143,7 +126,6 @@ export class Init {
143
126
  usePnpm: usePnpm ?? false,
144
127
  useBun: useBun ?? false,
145
128
  skipInstall: skipInstall ?? false,
146
- updateTsConfig: updateTsConfig ?? true,
147
129
  updateScripts: updateScripts ?? 'implicit',
148
130
  validationLibrary: validationLibrary?.toLocaleLowerCase() === 'none' ? null : (validationLibrary ?? 'zod'),
149
131
  bundle: bundle ?? true,
@@ -170,7 +152,7 @@ export class Init {
170
152
  ? null
171
153
  : (validationLibrary ??
172
154
  (await select({
173
- message: 'Choose validation library',
155
+ message: 'Which validation library would you like to use?',
174
156
  default: 'zod',
175
157
  choices: [
176
158
  {
@@ -191,23 +173,8 @@ export class Init {
191
173
  { name: 'None', value: null, description: 'Install validation library later' },
192
174
  ],
193
175
  })));
194
- if (typeof updateTsConfig === 'undefined' && pkgJson) {
195
- let shouldAsk = false;
196
- try {
197
- shouldAsk = !(await checkTSConfigForExperimentalDecorators(root));
198
- }
199
- catch (error) {
200
- log.error(`Failed to check tsconfig.json for "experimentalDecorators": ${error.message}`);
201
- }
202
- if (shouldAsk) {
203
- const keys = ['experimentalDecorators'];
204
- updateTsConfig = await confirm({
205
- message: `Do you want to add ${keys.map((k) => `"${k}"`).join(' and ')} to tsconfig.json? (recommended)`,
206
- });
207
- }
208
- }
209
176
  bundle ??= await confirm({
210
- message: 'Do you want to set up "tsdown" to bundle TypeScript client?',
177
+ message: 'Do you want to set up "tsdown" to bundle TypeScript client (experimental)?',
211
178
  default: true,
212
179
  });
213
180
  updateScripts ??= !pkgJson
@@ -246,7 +213,6 @@ export class Init {
246
213
  usePnpm: usePnpm ?? false,
247
214
  useBun: useBun ?? false,
248
215
  skipInstall: skipInstall ?? false,
249
- updateTsConfig,
250
216
  updateScripts,
251
217
  validationLibrary,
252
218
  bundle,
package/dist/types.d.mts CHANGED
@@ -61,7 +61,6 @@ export interface InitOptions {
61
61
  usePnpm?: boolean;
62
62
  useBun?: boolean;
63
63
  skipInstall?: boolean;
64
- updateTsConfig?: boolean;
65
64
  updateScripts?: 'implicit' | 'explicit';
66
65
  bundle?: boolean;
67
66
  validationLibrary?: 'zod' | 'valibot' | 'arktype' | null;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vovk-cli",
3
- "version": "0.0.5",
3
+ "version": "0.1.0",
4
4
  "description": "CLI tool for managing Vovk.ts projects",
5
5
  "files": [
6
6
  "dist",