@xyo-network/xl1-cli-lib 1.19.13 → 1.19.15

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.
@@ -1,42 +0,0 @@
1
- import { isDefined, isNull } from '@xylabs/sdk-js'
2
- import { ConfigZod } from '@xyo-network/xl1-sdk'
3
- import { cosmiconfigSync } from 'cosmiconfig'
4
-
5
- /**
6
- * The name of the configuration file to search for.
7
- */
8
- const configName = 'xyo'
9
-
10
- /**
11
- * The name of the section within the configuration file to parse.
12
- */
13
- const configSection = 'xl1' // Default section in the config file
14
-
15
- /**
16
- * Attempts to parse the configuration from a file using cosmiconfig.
17
- * @returns The parsed configuration object if found and valid, otherwise undefined.
18
- */
19
- export const tryParseConfig = () => {
20
- const explorer = cosmiconfigSync(
21
- configName,
22
- /* {
23
- searchPlaces: [
24
- 'package.json', // Looks under `xyo` key in package.json
25
- '.xyorc.json', // Supports common dotfile format
26
- 'xyo.config.json', // Supports custom-named config file
27
- ],
28
- loaders: {
29
- '.json': defaultLoaders['.json'],
30
- 'noExt': defaultLoaders['.json'],
31
- },
32
- }, */
33
- )
34
- const result = explorer.search()
35
- if (!isNull(result)) {
36
- const section = result?.config?.[configSection]
37
- if (isDefined(section) && typeof section === 'object') {
38
- return ConfigZod.parse(section)
39
- }
40
- }
41
- return ConfigZod.parse({})
42
- }