vovk 0.2.3-beta.31 → 0.2.3-beta.33
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/cli/generateClient.js +5 -15
- package/package.json +1 -1
package/cli/generateClient.js
CHANGED
|
@@ -13,15 +13,17 @@ function canRequire(moduleName) {
|
|
|
13
13
|
|
|
14
14
|
/**
|
|
15
15
|
* Generates client code with string concatenation so it should be much faster than using AST
|
|
16
|
-
* TODO: Check
|
|
16
|
+
* TODO: Check fetcher and streamFetcher for existence
|
|
17
17
|
* @type {(rcPath: string) => Promise<void>}
|
|
18
18
|
*/
|
|
19
19
|
async function generateClient(rcPath) {
|
|
20
20
|
const vovkrc = getVovkrc(rcPath);
|
|
21
21
|
const jsonPath = '../../.vovk.json';
|
|
22
|
-
const fetcherPath = vovkrc.fetcher.startsWith('.')
|
|
22
|
+
const fetcherPath = vovkrc.fetcher.startsWith('.')
|
|
23
|
+
? path.join(__dirname, '../../..', vovkrc.fetcher)
|
|
24
|
+
: vovkrc.fetcher;
|
|
23
25
|
const streamFetcherPath = vovkrc.streamFetcher.startsWith('.')
|
|
24
|
-
? path.join(
|
|
26
|
+
? path.join(__dirname, '../../..', vovkrc.streamFetcher)
|
|
25
27
|
: vovkrc.streamFetcher;
|
|
26
28
|
|
|
27
29
|
if (typeof vovkrc.validateOnClient === 'undefined') {
|
|
@@ -32,18 +34,6 @@ async function generateClient(rcPath) {
|
|
|
32
34
|
);
|
|
33
35
|
}
|
|
34
36
|
|
|
35
|
-
if (!canRequire(fetcherPath)) {
|
|
36
|
-
throw new Error(
|
|
37
|
-
`Unble to generate Vovk Client: cannot find "fetcher" module '${fetcherPath}'. Check your .vovkrc.js file`
|
|
38
|
-
);
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
if (!canRequire(streamFetcherPath)) {
|
|
42
|
-
throw new Error(
|
|
43
|
-
`Unble to generate Vovk Client: cannot find "streamFetcher" module '${streamFetcherPath}'. Check your .vovkrc.js file`
|
|
44
|
-
);
|
|
45
|
-
}
|
|
46
|
-
|
|
47
37
|
if (!canRequire(jsonPath)) {
|
|
48
38
|
throw new Error(`Unble to generate Vovk Client: cannot find ".vovk.json" file '${jsonPath}'.`);
|
|
49
39
|
}
|