@storm-software/config-tools 1.75.0 → 1.77.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/CHANGELOG.md +47 -29
- package/README.md +1 -1
- package/declarations.d.ts +3 -3
- package/index.cjs +117 -103
- package/index.js +114 -100
- package/meta.cjs.json +1 -1
- package/meta.esm.json +1 -1
- package/package.json +1 -1
- package/src/config-file/get-config-file.d.ts +16 -0
- package/src/config-file/index.d.ts +1 -0
- package/src/create-storm-config.d.ts +26 -0
- package/src/env/get-env.d.ts +15 -0
- package/src/env/index.d.ts +2 -0
- package/src/env/set-env.d.ts +14 -0
- package/src/index.d.ts +13 -0
- package/src/types.d.ts +33 -0
- package/src/utilities/apply-workspace-tokens.d.ts +4 -0
- package/src/utilities/chalk.d.ts +23 -0
- package/src/utilities/correct-paths.d.ts +1 -0
- package/src/utilities/file-path-utils.d.ts +2 -0
- package/src/utilities/find-up.d.ts +4 -0
- package/src/utilities/find-workspace-root.d.ts +14 -0
- package/src/utilities/get-default-config.d.ts +15 -0
- package/src/utilities/get-log-level.d.ts +15 -0
- package/src/utilities/index.d.ts +10 -0
- package/src/utilities/logger.d.ts +74 -0
- package/src/utilities/process-handler.d.ts +4 -0
- package/src/utilities/run.d.ts +18 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@storm-software/config-tools",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.77.0",
|
|
4
4
|
"description": "⚡The Storm-Ops monorepo contains utility applications, tools, and various libraries to create modern and scalable web applications.",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "github",
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { StormConfigInput } from "@storm-software/config";
|
|
2
|
+
import { ResolvedConfig, type LoadConfigOptions } from "c12";
|
|
3
|
+
/**
|
|
4
|
+
* Get the config file for the current Storm workspace
|
|
5
|
+
*
|
|
6
|
+
* @param fileName - The name of the config file to search for
|
|
7
|
+
* @param filePath - The path to search for the config file in
|
|
8
|
+
* @returns The config file for the current Storm workspace
|
|
9
|
+
*/
|
|
10
|
+
export declare const getConfigFileByName: (fileName: string, filePath?: string, options?: LoadConfigOptions<Partial<StormConfigInput>>) => Promise<ResolvedConfig<Partial<StormConfigInput>>>;
|
|
11
|
+
/**
|
|
12
|
+
* Get the config file for the current Storm workspace
|
|
13
|
+
*
|
|
14
|
+
* @returns The config file for the current Storm workspace
|
|
15
|
+
*/
|
|
16
|
+
export declare const getConfigFile: (filePath?: string, additionalFileNames?: string[]) => Promise<Partial<StormConfigInput> | undefined>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./get-config-file";
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { StormConfig } from "@storm-software/config";
|
|
2
|
+
import type { ZodTypeAny } from "zod";
|
|
3
|
+
/**
|
|
4
|
+
* Get the config for the current Storm workspace
|
|
5
|
+
*
|
|
6
|
+
* @returns The config for the current Storm workspace
|
|
7
|
+
*/
|
|
8
|
+
export declare const createConfig: (workspaceRoot?: string) => StormConfig;
|
|
9
|
+
/**
|
|
10
|
+
* Get the config for the current Storm workspace
|
|
11
|
+
*
|
|
12
|
+
* @returns The config for the current Storm workspace
|
|
13
|
+
*/
|
|
14
|
+
export declare const createStormConfig: <TExtensionName extends keyof StormConfig["extensions"] = string, TExtensionConfig = any, TExtensionSchema extends ZodTypeAny = ZodTypeAny>(extensionName?: TExtensionName, schema?: TExtensionSchema, workspaceRoot?: string) => StormConfig<TExtensionName, TExtensionConfig>;
|
|
15
|
+
/**
|
|
16
|
+
* Get the config for a specific Storm config Extension
|
|
17
|
+
*
|
|
18
|
+
* @param extensionName - The name of the config extension
|
|
19
|
+
* @param options - The options for the config extension
|
|
20
|
+
* @returns The config for the specified Storm config extension. If the extension does not exist, `undefined` is returned.
|
|
21
|
+
*/
|
|
22
|
+
export declare const createConfigExtension: <TExtensionName extends keyof StormConfig["extensions"] = string, TExtensionConfig = any, TExtensionSchema extends ZodTypeAny = ZodTypeAny>(extensionName: TExtensionName, schema: TExtensionSchema) => TExtensionConfig;
|
|
23
|
+
/**
|
|
24
|
+
* Load the config file values for the current Storm workspace into environment variables
|
|
25
|
+
*/
|
|
26
|
+
export declare const loadStormConfig: (workspaceRoot?: string) => Promise<StormConfig>;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { type StormConfig } from "@storm-software/config";
|
|
2
|
+
import type { DeepPartial } from "../../declarations.d";
|
|
3
|
+
/**
|
|
4
|
+
* Get the config for an extension module of Storm workspace from environment variables
|
|
5
|
+
*
|
|
6
|
+
* @param extensionName - The name of the extension module
|
|
7
|
+
* @returns The config for the specified Storm extension module. If the module does not exist, `undefined` is returned.
|
|
8
|
+
*/
|
|
9
|
+
export declare const getExtensionEnv: <TConfig extends Record<string, any> = Record<string, any>>(extensionName: string) => TConfig | undefined;
|
|
10
|
+
/**
|
|
11
|
+
* Get the config for the current Storm workspace
|
|
12
|
+
*
|
|
13
|
+
* @returns The config for the current Storm workspace from environment variables
|
|
14
|
+
*/
|
|
15
|
+
export declare const getConfigEnv: () => DeepPartial<StormConfig>;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { StormConfig } from "@storm-software/config";
|
|
2
|
+
/**
|
|
3
|
+
* Get the config for an extension module of Storm workspace from environment variables
|
|
4
|
+
*
|
|
5
|
+
* @param extensionName - The name of the extension module
|
|
6
|
+
* @returns The config for the specified Storm extension module. If the module does not exist, `undefined` is returned.
|
|
7
|
+
*/
|
|
8
|
+
export declare const setExtensionEnv: <TConfig extends Record<string, any> = Record<string, any>>(extensionName: string, extension: TConfig) => void;
|
|
9
|
+
/**
|
|
10
|
+
* Get the config for the current Storm workspace
|
|
11
|
+
*
|
|
12
|
+
* @returns The config for the current Storm workspace from environment variables
|
|
13
|
+
*/
|
|
14
|
+
export declare const setConfigEnv: (config: StormConfig) => void;
|
package/src/index.d.ts
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The config-tools library used by Storm Software for building TypeScript applications.
|
|
3
|
+
*
|
|
4
|
+
* @remarks
|
|
5
|
+
* A package containing various utilities to support custom workspace configurations
|
|
6
|
+
*
|
|
7
|
+
* @packageDocumentation
|
|
8
|
+
*/
|
|
9
|
+
export * from "./config-file";
|
|
10
|
+
export * from "./create-storm-config";
|
|
11
|
+
export * from "./env";
|
|
12
|
+
export * from "./types";
|
|
13
|
+
export * from "./utilities";
|
package/src/types.d.ts
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import type { StormConfig } from "@storm-software/config";
|
|
2
|
+
export type LogLevel = 0 | 10 | 20 | 30 | 35 | 40 | 60 | 70 | 100;
|
|
3
|
+
export declare const LogLevel: {
|
|
4
|
+
readonly SILENT: LogLevel;
|
|
5
|
+
readonly FATAL: LogLevel;
|
|
6
|
+
readonly ERROR: LogLevel;
|
|
7
|
+
readonly WARN: LogLevel;
|
|
8
|
+
readonly SUCCESS: LogLevel;
|
|
9
|
+
readonly INFO: LogLevel;
|
|
10
|
+
readonly DEBUG: LogLevel;
|
|
11
|
+
readonly TRACE: LogLevel;
|
|
12
|
+
readonly ALL: LogLevel;
|
|
13
|
+
};
|
|
14
|
+
export type LogLevelLabel = "silent" | "fatal" | "error" | "warn" | "info" | "debug" | "trace" | "all";
|
|
15
|
+
export declare const LogLevelLabel: {
|
|
16
|
+
readonly SILENT: LogLevelLabel;
|
|
17
|
+
readonly FATAL: LogLevelLabel;
|
|
18
|
+
readonly ERROR: LogLevelLabel;
|
|
19
|
+
readonly WARN: LogLevelLabel;
|
|
20
|
+
readonly INFO: LogLevelLabel;
|
|
21
|
+
readonly DEBUG: LogLevelLabel;
|
|
22
|
+
readonly TRACE: LogLevelLabel;
|
|
23
|
+
readonly ALL: LogLevelLabel;
|
|
24
|
+
};
|
|
25
|
+
export interface BaseTokenizerOptions {
|
|
26
|
+
workspaceRoot?: string;
|
|
27
|
+
config?: StormConfig;
|
|
28
|
+
}
|
|
29
|
+
export interface ProjectTokenizerOptions extends BaseTokenizerOptions {
|
|
30
|
+
projectRoot?: string;
|
|
31
|
+
projectName?: string;
|
|
32
|
+
sourceRoot?: string;
|
|
33
|
+
}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { BaseTokenizerOptions, ProjectTokenizerOptions } from "../../declarations";
|
|
2
|
+
export declare const applyWorkspaceBaseTokens: (option: string, tokenizerOptions: BaseTokenizerOptions) => Promise<string>;
|
|
3
|
+
export declare const applyWorkspaceProjectTokens: (option: string, tokenizerOptions: ProjectTokenizerOptions) => Promise<string>;
|
|
4
|
+
export declare const applyWorkspaceTokens: <TConfig extends BaseTokenizerOptions = BaseTokenizerOptions>(options: Record<string, any>, config: TConfig, tokenizerFn: (option: string, config: TConfig) => string | Promise<string>) => Promise<Record<string, any>>;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
export type GetChalkReturn = {
|
|
2
|
+
hex: (_: string) => (message?: string) => string | undefined;
|
|
3
|
+
bgHex: (_: string) => {
|
|
4
|
+
whiteBright: (message?: string) => string | undefined;
|
|
5
|
+
};
|
|
6
|
+
whiteBright: (message?: string) => string | undefined;
|
|
7
|
+
bold: {
|
|
8
|
+
hex: (_: string) => (message?: string) => string | undefined;
|
|
9
|
+
bgHex: (_: string) => {
|
|
10
|
+
whiteBright: (message?: string) => string | undefined;
|
|
11
|
+
};
|
|
12
|
+
whiteBright: (message?: string) => string | undefined;
|
|
13
|
+
};
|
|
14
|
+
};
|
|
15
|
+
/**
|
|
16
|
+
* Get the chalk instance
|
|
17
|
+
*
|
|
18
|
+
* @remarks
|
|
19
|
+
* Annoying polyfill to temporarily fix the issue with the `chalk` import
|
|
20
|
+
*
|
|
21
|
+
* @returns The chalk instance
|
|
22
|
+
*/
|
|
23
|
+
export declare const getChalk: () => GetChalkReturn;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const correctPaths: (path?: string) => string;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Find the monorepo root directory, searching upwards from `path`.
|
|
3
|
+
*
|
|
4
|
+
* @param pathInsideMonorepo - The path inside the monorepo to start searching from
|
|
5
|
+
* @returns The monorepo root directory
|
|
6
|
+
*/
|
|
7
|
+
export declare function findWorkspaceRootSafe(pathInsideMonorepo?: string): string | undefined;
|
|
8
|
+
/**
|
|
9
|
+
* Find the monorepo root directory, searching upwards from `path`.
|
|
10
|
+
*
|
|
11
|
+
* @param pathInsideMonorepo - The path inside the monorepo to start searching from
|
|
12
|
+
* @returns The monorepo root directory
|
|
13
|
+
*/
|
|
14
|
+
export declare function findWorkspaceRoot(pathInsideMonorepo?: string): string;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { type ColorConfig, type StormConfig } from "@storm-software/config";
|
|
2
|
+
/**
|
|
3
|
+
* Storm theme config values used for styling various workspace elements
|
|
4
|
+
*/
|
|
5
|
+
export declare const DEFAULT_COLOR_CONFIG: ColorConfig;
|
|
6
|
+
/**
|
|
7
|
+
* Storm Workspace config values used during various dev-ops processes
|
|
8
|
+
*/
|
|
9
|
+
export declare const DEFAULT_STORM_CONFIG: any;
|
|
10
|
+
/**
|
|
11
|
+
* Get the default Storm config values used during various dev-ops processes
|
|
12
|
+
*
|
|
13
|
+
* @returns The default Storm config values
|
|
14
|
+
*/
|
|
15
|
+
export declare const getDefaultConfig: (config?: Partial<StormConfig>, root?: string) => StormConfig;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { LogLevel, LogLevelLabel } from "../types";
|
|
2
|
+
/**
|
|
3
|
+
* Convert the log level label to a log level
|
|
4
|
+
*
|
|
5
|
+
* @param label - The log level label to convert
|
|
6
|
+
* @returns The log level
|
|
7
|
+
*/
|
|
8
|
+
export declare const getLogLevel: (label?: string) => LogLevel;
|
|
9
|
+
/**
|
|
10
|
+
* Convert the log level to a log level label
|
|
11
|
+
*
|
|
12
|
+
* @param logLevel - The log level to convert
|
|
13
|
+
* @returns The log level label
|
|
14
|
+
*/
|
|
15
|
+
export declare const getLogLevelLabel: (logLevel?: number) => LogLevelLabel;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export * from "./apply-workspace-tokens";
|
|
2
|
+
export * from "./chalk";
|
|
3
|
+
export * from "./correct-paths";
|
|
4
|
+
export * from "./file-path-utils";
|
|
5
|
+
export * from "./find-workspace-root";
|
|
6
|
+
export * from "./get-default-config";
|
|
7
|
+
export * from "./get-log-level";
|
|
8
|
+
export * from "./logger";
|
|
9
|
+
export * from "./process-handler";
|
|
10
|
+
export * from "./run";
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import type { StormConfig } from "@storm-software/config";
|
|
2
|
+
import { LogLevel } from "../types";
|
|
3
|
+
/**
|
|
4
|
+
* Get the log function for a log level
|
|
5
|
+
*
|
|
6
|
+
* @param logLevel - The log level
|
|
7
|
+
* @param config - The Storm configuration
|
|
8
|
+
* @returns The log function
|
|
9
|
+
*/
|
|
10
|
+
export declare const getLogFn: (logLevel?: number | LogLevel, config?: Partial<StormConfig>) => ((message?: any) => void);
|
|
11
|
+
/**
|
|
12
|
+
* Write a message to the console at the `fatal` log level
|
|
13
|
+
*
|
|
14
|
+
* @param message - The message to write
|
|
15
|
+
* @param config - The Storm configuration
|
|
16
|
+
*/
|
|
17
|
+
export declare const writeFatal: (message?: any, config?: Partial<StormConfig>) => void;
|
|
18
|
+
/**
|
|
19
|
+
* Write a message to the console at the `error` log level
|
|
20
|
+
*
|
|
21
|
+
* @param message - The message to write
|
|
22
|
+
* @param config - The Storm configuration
|
|
23
|
+
*/
|
|
24
|
+
export declare const writeError: (message?: any, config?: Partial<StormConfig>) => void;
|
|
25
|
+
/**
|
|
26
|
+
* Write a message to the console at the `warning` log level
|
|
27
|
+
*
|
|
28
|
+
* @param message - The message to write
|
|
29
|
+
* @param config - The Storm configuration
|
|
30
|
+
*/
|
|
31
|
+
export declare const writeWarning: (message?: any, config?: Partial<StormConfig>) => void;
|
|
32
|
+
/**
|
|
33
|
+
* Write a message to the console at the `info` log level
|
|
34
|
+
*
|
|
35
|
+
* @param message - The message to write
|
|
36
|
+
* @param config - The Storm configuration
|
|
37
|
+
*/
|
|
38
|
+
export declare const writeInfo: (message?: any, config?: Partial<StormConfig>) => void;
|
|
39
|
+
/**
|
|
40
|
+
* Write a message to the console at the `success` log level
|
|
41
|
+
*
|
|
42
|
+
* @param message - The message to write
|
|
43
|
+
* @param config - The Storm configuration
|
|
44
|
+
*/
|
|
45
|
+
export declare const writeSuccess: (message?: any, config?: Partial<StormConfig>) => void;
|
|
46
|
+
/**
|
|
47
|
+
* Write a message to the console at the `debug` log level
|
|
48
|
+
*
|
|
49
|
+
* @param message - The message to write
|
|
50
|
+
* @param config - The Storm configuration
|
|
51
|
+
*/
|
|
52
|
+
export declare const writeDebug: (message?: any, config?: Partial<StormConfig>) => void;
|
|
53
|
+
/**
|
|
54
|
+
* Write a message to the console at the `trace` log level
|
|
55
|
+
*
|
|
56
|
+
* @param message - The message to write
|
|
57
|
+
* @param config - The Storm configuration
|
|
58
|
+
*/
|
|
59
|
+
export declare const writeTrace: (message?: any, config?: Partial<StormConfig>) => void;
|
|
60
|
+
/**
|
|
61
|
+
* Write a message to the console at the `all` log level
|
|
62
|
+
*
|
|
63
|
+
* @param message - The message to write
|
|
64
|
+
* @param config - The Storm configuration
|
|
65
|
+
*/
|
|
66
|
+
export declare const writeSystem: (message?: any, config?: Partial<StormConfig>) => void;
|
|
67
|
+
/**
|
|
68
|
+
* Get a stopwatch function
|
|
69
|
+
*
|
|
70
|
+
* @param name - The name of the process
|
|
71
|
+
* @returns The stopwatch function
|
|
72
|
+
*/
|
|
73
|
+
export declare const getStopwatch: (name: string) => () => void;
|
|
74
|
+
export declare const formatLogMessage: (message?: any, prefix?: string) => string;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { StormConfig } from "@storm-software/config";
|
|
2
|
+
export declare const exitWithError: (config?: Partial<StormConfig>) => never;
|
|
3
|
+
export declare const exitWithSuccess: (config?: Partial<StormConfig>) => never;
|
|
4
|
+
export declare const handleProcess: (config?: Partial<StormConfig>) => void;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { StormConfig } from "@storm-software/config";
|
|
2
|
+
export declare const LARGE_BUFFER: number;
|
|
3
|
+
export type IOType = "overlapped" | "pipe" | "ignore" | "inherit";
|
|
4
|
+
export type StdioOptions = IOType | Array<IOType | "ipc" | number | null | undefined>;
|
|
5
|
+
/**
|
|
6
|
+
* Run a command line process
|
|
7
|
+
*
|
|
8
|
+
* @remarks
|
|
9
|
+
* A wrapper around execSync to run our command line processes
|
|
10
|
+
*
|
|
11
|
+
* @param config - The Storm configuration object
|
|
12
|
+
* @param command - The command to run
|
|
13
|
+
* @param cwd - The current working directory
|
|
14
|
+
* @param stdio - The standard input/output options
|
|
15
|
+
* @param env - The environment variables
|
|
16
|
+
* @returns The result of the command
|
|
17
|
+
*/
|
|
18
|
+
export declare const run: (config: StormConfig, command: string, cwd?: string, stdio?: StdioOptions, env?: NodeJS.ProcessEnv) => Buffer;
|