vovk-cli 0.0.1-draft.330 → 0.0.1-draft.332
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.
|
@@ -3,6 +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
|
+
import omit from 'lodash/omit.js';
|
|
7
|
+
import merge from 'lodash/merge.js';
|
|
6
8
|
export default async function getClientTemplateFiles({ config, cwd, log, configKey, cliGenerateOptions, }) {
|
|
7
9
|
const usedTemplateDefs = {};
|
|
8
10
|
const fromTemplates = configKey === 'composedClient'
|
|
@@ -72,6 +74,8 @@ export default async function getClientTemplateFiles({ config, cwd, log, configK
|
|
|
72
74
|
def = {
|
|
73
75
|
...def,
|
|
74
76
|
origin: templateDef.origin ?? def.origin,
|
|
77
|
+
composedClient: merge(omit(templateDef?.composedClient ?? {}, ['outDir']), def.composedClient),
|
|
78
|
+
segmentedClient: merge(omit(templateDef?.segmentedClient ?? {}, ['outDir']), def.segmentedClient),
|
|
75
79
|
};
|
|
76
80
|
entries.push([tName, def, path.join(outCwdRelativeDir, reqRelativeDir)]);
|
|
77
81
|
}
|
package/dist/index.mjs
CHANGED
|
@@ -19,10 +19,10 @@ initProgram(program.command('init'));
|
|
|
19
19
|
program
|
|
20
20
|
.command('dev')
|
|
21
21
|
.alias('d')
|
|
22
|
-
.description('
|
|
22
|
+
.description('Start schema watcher (optional flag --next-dev to start it with Next.js)')
|
|
23
23
|
.argument('[nextArgs...]', 'extra arguments for the dev command')
|
|
24
24
|
.option('--next-dev', 'start schema watcher and Next.js with automatic port allocation')
|
|
25
|
-
.option('--exit', 'kill the
|
|
25
|
+
.option('--exit', 'kill the processes when schema and client is generated')
|
|
26
26
|
.option('--schema-out <path>', 'path to schema output directory (default: .vovk-schema)')
|
|
27
27
|
.option('--https, --dev-https', 'use HTTPS for the dev server (default: false)')
|
|
28
28
|
.action(async (nextArgs, options) => {
|
|
@@ -76,7 +76,7 @@ program
|
|
|
76
76
|
program
|
|
77
77
|
.command('generate')
|
|
78
78
|
.alias('g')
|
|
79
|
-
.description('
|
|
79
|
+
.description('Generate RPC client from schema')
|
|
80
80
|
.option('--composed-only', 'generate only composed client even if segmented client is enabled')
|
|
81
81
|
.option('--out, --composed-out <path>', 'path to output directory for composed client')
|
|
82
82
|
.option('--from, --composed-from <templates...>', 'client template names for composed client')
|
|
@@ -109,7 +109,7 @@ program
|
|
|
109
109
|
program
|
|
110
110
|
.command('bundle')
|
|
111
111
|
.alias('b')
|
|
112
|
-
.description('
|
|
112
|
+
.description('Generate TypeScript RPC and bundle it')
|
|
113
113
|
.option('--out, --out-dir <path>', 'path to output directory for bundle')
|
|
114
114
|
.option('--include, --include-segments <segments...>', 'include segments')
|
|
115
115
|
.option('--exclude, --exclude-segments <segments...>', 'exclude segments')
|
|
@@ -139,7 +139,7 @@ program
|
|
|
139
139
|
program
|
|
140
140
|
.command('new [components...]')
|
|
141
141
|
.alias('n')
|
|
142
|
-
.description('
|
|
142
|
+
.description('Create new components. "vovk new [...components] [segmentName/]moduleName" to create a new module or "vovk new segment [segmentName]" to create a new segment')
|
|
143
143
|
.option('-o, --overwrite', 'overwrite existing files')
|
|
144
144
|
.option('--template, --templates <templates...>', 'override config template; accepts an array of strings that correspond the order of the components')
|
|
145
145
|
.option('--dir <dirname>', 'override dirName in template file; relative to the root of the project')
|
package/dist/init/index.d.mts
CHANGED
|
@@ -4,5 +4,5 @@ export declare class Init {
|
|
|
4
4
|
#private;
|
|
5
5
|
root: string;
|
|
6
6
|
log: ReturnType<typeof getLogger>;
|
|
7
|
-
main(prefix
|
|
7
|
+
main({ prefix, yes, logLevel, useNpm, useYarn, usePnpm, useBun, skipInstall, updateTsConfig, updateScripts, validationLibrary, lang, dryRun, channel, }: InitOptions): Promise<void>;
|
|
8
8
|
}
|
package/dist/init/index.mjs
CHANGED
|
@@ -132,9 +132,9 @@ export class Init {
|
|
|
132
132
|
log.error(`Failed to create config: ${error.message}`);
|
|
133
133
|
}
|
|
134
134
|
}
|
|
135
|
-
async main(prefix,
|
|
135
|
+
async main({ prefix, yes, logLevel, useNpm, useYarn, usePnpm, useBun, skipInstall, updateTsConfig, updateScripts, validationLibrary, lang, dryRun, channel, }) {
|
|
136
136
|
const cwd = process.cwd();
|
|
137
|
-
const root = path.resolve(cwd, prefix);
|
|
137
|
+
const root = path.resolve(cwd, prefix ?? '.');
|
|
138
138
|
const log = getLogger(logLevel);
|
|
139
139
|
const pkgJson = await NPMCliPackageJson.load(root);
|
|
140
140
|
this.root = root;
|
|
@@ -142,6 +142,7 @@ export class Init {
|
|
|
142
142
|
const configPaths = await getConfigPaths({ cwd, relativePath: prefix });
|
|
143
143
|
if (yes) {
|
|
144
144
|
return this.#init({ configPaths, pkgJson }, {
|
|
145
|
+
prefix: prefix ?? '.',
|
|
145
146
|
useNpm: useNpm ?? (!useYarn && !usePnpm && !useBun),
|
|
146
147
|
useYarn: useYarn ?? false,
|
|
147
148
|
usePnpm: usePnpm ?? false,
|
package/dist/initProgram.mjs
CHANGED
|
@@ -2,8 +2,8 @@ import { Init } from './init/index.mjs';
|
|
|
2
2
|
// reused at vovk-init
|
|
3
3
|
export function initProgram(program) {
|
|
4
4
|
return program
|
|
5
|
-
.
|
|
6
|
-
.
|
|
5
|
+
.description('Initialize Vovk.ts at existing Next.js project')
|
|
6
|
+
.option('--prefix <prefix>', 'directory to initialize project in')
|
|
7
7
|
.option('-y, --yes', 'skip all prompts and use default values')
|
|
8
8
|
.option('--log-level <level>', 'set log level', 'info')
|
|
9
9
|
.option('--use-npm', 'use npm as package manager')
|
|
@@ -17,5 +17,5 @@ export function initProgram(program) {
|
|
|
17
17
|
.option('--validation-library <library>', 'validation library to use ("vovk-zod", "vovk-dto" or another); set to "none" to skip')
|
|
18
18
|
.option('--channel <channel>', 'channel to use for fetching packages', 'latest')
|
|
19
19
|
.option('--dry-run', 'do not write files to disk')
|
|
20
|
-
.action((
|
|
20
|
+
.action((options) => new Init().main(options));
|
|
21
21
|
}
|
package/dist/types.d.mts
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vovk-cli",
|
|
3
|
-
"version": "0.0.1-draft.
|
|
3
|
+
"version": "0.0.1-draft.332",
|
|
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.
|
|
38
|
+
"vovk": "^3.0.0-draft.366"
|
|
39
39
|
},
|
|
40
40
|
"optionalDependencies": {
|
|
41
41
|
"@rolldown/binding-linux-x64-gnu": "1.0.0-beta.31"
|