@graphql-mesh/cli 0.96.2 → 0.96.3-alpha-20240905175435-d668e90c8f7041cbf2f6ef50ff6b140fcc80e583
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/cjs/config.js +32 -0
- package/cjs/index.js +3 -1
- package/esm/config.js +31 -0
- package/esm/index.js +1 -0
- package/package.json +1 -1
- package/typings/config.d.cts +10 -0
- package/typings/config.d.ts +10 -0
- package/typings/index.d.cts +1 -0
- package/typings/index.d.ts +1 -0
package/cjs/config.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.validateConfig = validateConfig;
|
|
4
|
+
exports.findConfig = findConfig;
|
|
4
5
|
exports.findAndParseConfig = findAndParseConfig;
|
|
5
6
|
const tslib_1 = require("tslib");
|
|
6
7
|
const ajv_1 = tslib_1.__importDefault(require("ajv"));
|
|
@@ -43,6 +44,37 @@ function validateConfig(config, filepath, initialLoggerPrefix, throwOnInvalidCon
|
|
|
43
44
|
}
|
|
44
45
|
}
|
|
45
46
|
}
|
|
47
|
+
async function findConfig(options) {
|
|
48
|
+
const { configName = 'mesh', dir: configDir = '', initialLoggerPrefix = '🕸️ Mesh', importFn, } = options || {};
|
|
49
|
+
const dir = cross_helpers_1.path.isAbsolute(configDir) ? configDir : cross_helpers_1.path.join(cross_helpers_1.process.cwd(), configDir);
|
|
50
|
+
const explorer = (0, cosmiconfig_1.cosmiconfig)(configName, {
|
|
51
|
+
searchPlaces: [
|
|
52
|
+
'package.json',
|
|
53
|
+
`.${configName}rc`,
|
|
54
|
+
`.${configName}rc.json`,
|
|
55
|
+
`.${configName}rc.yaml`,
|
|
56
|
+
`.${configName}rc.yml`,
|
|
57
|
+
`.${configName}rc.js`,
|
|
58
|
+
`.${configName}rc.ts`,
|
|
59
|
+
`.${configName}rc.cjs`,
|
|
60
|
+
`${configName}.config.js`,
|
|
61
|
+
`${configName}.config.cjs`,
|
|
62
|
+
],
|
|
63
|
+
loaders: {
|
|
64
|
+
'.json': customLoader('json', importFn, initialLoggerPrefix),
|
|
65
|
+
'.yaml': customLoader('yaml', importFn, initialLoggerPrefix),
|
|
66
|
+
'.yml': customLoader('yaml', importFn, initialLoggerPrefix),
|
|
67
|
+
'.js': customLoader('js', importFn, initialLoggerPrefix),
|
|
68
|
+
'.ts': customLoader('js', importFn, initialLoggerPrefix),
|
|
69
|
+
noExt: customLoader('yaml', importFn, initialLoggerPrefix),
|
|
70
|
+
},
|
|
71
|
+
});
|
|
72
|
+
const results = await explorer.search(dir);
|
|
73
|
+
if (!results) {
|
|
74
|
+
throw new Error(`No ${configName} config file found in "${dir}"!`);
|
|
75
|
+
}
|
|
76
|
+
return results;
|
|
77
|
+
}
|
|
46
78
|
async function findAndParseConfig(options) {
|
|
47
79
|
const { configName = 'mesh', dir: configDir = '', initialLoggerPrefix = '🕸️ Mesh', importFn, ...restOptions } = options || {};
|
|
48
80
|
const dir = cross_helpers_1.path.isAbsolute(configDir) ? configDir : cross_helpers_1.path.join(cross_helpers_1.process.cwd(), configDir);
|
package/cjs/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.DEFAULT_CLI_PARAMS = exports.handleFatalError = exports.findAndParseConfig = exports.serveMesh = exports.generateTsArtifacts = void 0;
|
|
3
|
+
exports.DEFAULT_CLI_PARAMS = exports.handleFatalError = exports.findAndParseConfig = exports.serveMesh = exports.generateTsArtifacts = exports.findConfig = void 0;
|
|
4
4
|
exports.graphqlMesh = graphqlMesh;
|
|
5
5
|
const tslib_1 = require("tslib");
|
|
6
6
|
const dotenv_1 = require("dotenv");
|
|
@@ -20,6 +20,8 @@ const config_js_1 = require("./config.js");
|
|
|
20
20
|
Object.defineProperty(exports, "findAndParseConfig", { enumerable: true, get: function () { return config_js_1.findAndParseConfig; } });
|
|
21
21
|
const handleFatalError_js_1 = require("./handleFatalError.js");
|
|
22
22
|
Object.defineProperty(exports, "handleFatalError", { enumerable: true, get: function () { return handleFatalError_js_1.handleFatalError; } });
|
|
23
|
+
var config_js_2 = require("./config.js");
|
|
24
|
+
Object.defineProperty(exports, "findConfig", { enumerable: true, get: function () { return config_js_2.findConfig; } });
|
|
23
25
|
exports.DEFAULT_CLI_PARAMS = {
|
|
24
26
|
commandName: 'mesh',
|
|
25
27
|
initialLoggerPrefix: '🕸️ Mesh',
|
package/esm/config.js
CHANGED
|
@@ -38,6 +38,37 @@ export function validateConfig(config, filepath, initialLoggerPrefix, throwOnInv
|
|
|
38
38
|
}
|
|
39
39
|
}
|
|
40
40
|
}
|
|
41
|
+
export async function findConfig(options) {
|
|
42
|
+
const { configName = 'mesh', dir: configDir = '', initialLoggerPrefix = '🕸️ Mesh', importFn, } = options || {};
|
|
43
|
+
const dir = path.isAbsolute(configDir) ? configDir : path.join(process.cwd(), configDir);
|
|
44
|
+
const explorer = cosmiconfig(configName, {
|
|
45
|
+
searchPlaces: [
|
|
46
|
+
'package.json',
|
|
47
|
+
`.${configName}rc`,
|
|
48
|
+
`.${configName}rc.json`,
|
|
49
|
+
`.${configName}rc.yaml`,
|
|
50
|
+
`.${configName}rc.yml`,
|
|
51
|
+
`.${configName}rc.js`,
|
|
52
|
+
`.${configName}rc.ts`,
|
|
53
|
+
`.${configName}rc.cjs`,
|
|
54
|
+
`${configName}.config.js`,
|
|
55
|
+
`${configName}.config.cjs`,
|
|
56
|
+
],
|
|
57
|
+
loaders: {
|
|
58
|
+
'.json': customLoader('json', importFn, initialLoggerPrefix),
|
|
59
|
+
'.yaml': customLoader('yaml', importFn, initialLoggerPrefix),
|
|
60
|
+
'.yml': customLoader('yaml', importFn, initialLoggerPrefix),
|
|
61
|
+
'.js': customLoader('js', importFn, initialLoggerPrefix),
|
|
62
|
+
'.ts': customLoader('js', importFn, initialLoggerPrefix),
|
|
63
|
+
noExt: customLoader('yaml', importFn, initialLoggerPrefix),
|
|
64
|
+
},
|
|
65
|
+
});
|
|
66
|
+
const results = await explorer.search(dir);
|
|
67
|
+
if (!results) {
|
|
68
|
+
throw new Error(`No ${configName} config file found in "${dir}"!`);
|
|
69
|
+
}
|
|
70
|
+
return results;
|
|
71
|
+
}
|
|
41
72
|
export async function findAndParseConfig(options) {
|
|
42
73
|
const { configName = 'mesh', dir: configDir = '', initialLoggerPrefix = '🕸️ Mesh', importFn, ...restOptions } = options || {};
|
|
43
74
|
const dir = path.isAbsolute(configDir) ? configDir : path.join(process.cwd(), configDir);
|
package/esm/index.js
CHANGED
|
@@ -11,6 +11,7 @@ import { serveMesh } from './commands/serve/serve.js';
|
|
|
11
11
|
import { generateTsArtifacts } from './commands/ts-artifacts.js';
|
|
12
12
|
import { findAndParseConfig } from './config.js';
|
|
13
13
|
import { handleFatalError } from './handleFatalError.js';
|
|
14
|
+
export { findConfig } from './config.js';
|
|
14
15
|
export { generateTsArtifacts, serveMesh, findAndParseConfig, handleFatalError };
|
|
15
16
|
export const DEFAULT_CLI_PARAMS = {
|
|
16
17
|
commandName: 'mesh',
|
package/package.json
CHANGED
package/typings/config.d.cts
CHANGED
|
@@ -1,4 +1,14 @@
|
|
|
1
1
|
import type { ConfigProcessOptions } from '@graphql-mesh/config';
|
|
2
2
|
import type { YamlConfig } from '@graphql-mesh/types';
|
|
3
3
|
export declare function validateConfig(config: any, filepath: string, initialLoggerPrefix: string, throwOnInvalidConfig?: boolean): asserts config is YamlConfig.Config;
|
|
4
|
+
export declare function findConfig(options?: {
|
|
5
|
+
configName?: string;
|
|
6
|
+
dir?: string;
|
|
7
|
+
initialLoggerPrefix?: string;
|
|
8
|
+
importFn?: (moduleId: string) => any;
|
|
9
|
+
}): Promise<{
|
|
10
|
+
config: import("cosmiconfig").Config;
|
|
11
|
+
filepath: string;
|
|
12
|
+
isEmpty?: boolean;
|
|
13
|
+
}>;
|
|
4
14
|
export declare function findAndParseConfig(options?: ConfigProcessOptions): Promise<import("@graphql-mesh/config").ProcessedConfig>;
|
package/typings/config.d.ts
CHANGED
|
@@ -1,4 +1,14 @@
|
|
|
1
1
|
import type { ConfigProcessOptions } from '@graphql-mesh/config';
|
|
2
2
|
import type { YamlConfig } from '@graphql-mesh/types';
|
|
3
3
|
export declare function validateConfig(config: any, filepath: string, initialLoggerPrefix: string, throwOnInvalidConfig?: boolean): asserts config is YamlConfig.Config;
|
|
4
|
+
export declare function findConfig(options?: {
|
|
5
|
+
configName?: string;
|
|
6
|
+
dir?: string;
|
|
7
|
+
initialLoggerPrefix?: string;
|
|
8
|
+
importFn?: (moduleId: string) => any;
|
|
9
|
+
}): Promise<{
|
|
10
|
+
config: import("cosmiconfig").Config;
|
|
11
|
+
filepath: string;
|
|
12
|
+
isEmpty?: boolean;
|
|
13
|
+
}>;
|
|
4
14
|
export declare function findAndParseConfig(options?: ConfigProcessOptions): Promise<import("@graphql-mesh/config").ProcessedConfig>;
|
package/typings/index.d.cts
CHANGED
|
@@ -2,6 +2,7 @@ import { serveMesh } from './commands/serve/serve.cjs';
|
|
|
2
2
|
import { generateTsArtifacts } from './commands/ts-artifacts.cjs';
|
|
3
3
|
import { findAndParseConfig } from './config.cjs';
|
|
4
4
|
import { handleFatalError } from './handleFatalError.cjs';
|
|
5
|
+
export { findConfig } from './config.cjs';
|
|
5
6
|
export { generateTsArtifacts, serveMesh, findAndParseConfig, handleFatalError };
|
|
6
7
|
export interface GraphQLMeshCLIParams {
|
|
7
8
|
commandName: string;
|
package/typings/index.d.ts
CHANGED
|
@@ -2,6 +2,7 @@ import { serveMesh } from './commands/serve/serve.js';
|
|
|
2
2
|
import { generateTsArtifacts } from './commands/ts-artifacts.js';
|
|
3
3
|
import { findAndParseConfig } from './config.js';
|
|
4
4
|
import { handleFatalError } from './handleFatalError.js';
|
|
5
|
+
export { findConfig } from './config.js';
|
|
5
6
|
export { generateTsArtifacts, serveMesh, findAndParseConfig, handleFatalError };
|
|
6
7
|
export interface GraphQLMeshCLIParams {
|
|
7
8
|
commandName: string;
|