@autometa/config 0.1.26 → 1.0.0-rc.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/README.md +34 -2
- package/dist/builder-types.d.ts +27 -0
- package/dist/config.d.ts +12 -0
- package/dist/environment-selector.d.ts +10 -0
- package/dist/index.cjs +809 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.ts +4 -117
- package/dist/index.js +760 -142
- package/dist/index.js.map +1 -1
- package/dist/schema.d.ts +584 -0
- package/dist/types.d.ts +47 -0
- package/package.json +24 -22
- package/.eslintignore +0 -3
- package/.eslintrc.cjs +0 -4
- package/.turbo/turbo-coverage.log +0 -27
- package/.turbo/turbo-lint$colon$fix.log +0 -4
- package/.turbo/turbo-prettify.log +0 -5
- package/.turbo/turbo-test.log +0 -16
- package/CHANGELOG.md +0 -214
- package/dist/esm/index.js +0 -151
- package/dist/esm/index.js.map +0 -1
- package/dist/index.d.cts +0 -117
- package/tsup.config.ts +0 -14
package/README.md
CHANGED
|
@@ -1,3 +1,35 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @autometa/config
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Environment-aware configuration utilities for Autometa executors. This package
|
|
4
|
+
exposes a schema-backed `defineConfig` helper that resolves the active
|
|
5
|
+
environment, merges overrides, and provides an immutable configuration object
|
|
6
|
+
to downstream runners.
|
|
7
|
+
|
|
8
|
+
## Quick start
|
|
9
|
+
|
|
10
|
+
```ts
|
|
11
|
+
import { defineConfig } from "@autometa/config";
|
|
12
|
+
|
|
13
|
+
export const config = defineConfig({
|
|
14
|
+
default: {
|
|
15
|
+
runner: "vitest",
|
|
16
|
+
roots: {
|
|
17
|
+
features: ["features"],
|
|
18
|
+
steps: ["steps"],
|
|
19
|
+
},
|
|
20
|
+
},
|
|
21
|
+
environments: {
|
|
22
|
+
ci: {
|
|
23
|
+
test: {
|
|
24
|
+
timeout: { value: 30, unit: "s" },
|
|
25
|
+
},
|
|
26
|
+
},
|
|
27
|
+
},
|
|
28
|
+
environment: (env) => env.byEnvironmentVariable("AUTOMETA_ENV"),
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
const { config: resolved } = config.resolve();
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
See `src/config.ts` and the unit tests under `src/__tests__` for more usage
|
|
35
|
+
examples.
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
export type ModuleFormat = "cjs" | "esm";
|
|
2
|
+
export type SourceMapSetting = boolean | "inline" | "external";
|
|
3
|
+
export interface BuildHookContext {
|
|
4
|
+
readonly cwd: string;
|
|
5
|
+
readonly cacheDir: string;
|
|
6
|
+
readonly outDir: string;
|
|
7
|
+
readonly entries: readonly string[];
|
|
8
|
+
readonly format: ModuleFormat;
|
|
9
|
+
readonly target?: string | string[];
|
|
10
|
+
readonly sourcemap?: SourceMapSetting;
|
|
11
|
+
readonly tsconfig?: string;
|
|
12
|
+
readonly external?: string[];
|
|
13
|
+
}
|
|
14
|
+
export type BuildHook = (context: BuildHookContext) => void | Promise<void>;
|
|
15
|
+
export interface BuilderHooks {
|
|
16
|
+
before?: BuildHook[] | undefined;
|
|
17
|
+
after?: BuildHook[] | undefined;
|
|
18
|
+
}
|
|
19
|
+
export interface BuilderConfig {
|
|
20
|
+
format?: ModuleFormat | undefined;
|
|
21
|
+
target?: string | string[] | undefined;
|
|
22
|
+
sourcemap?: SourceMapSetting | undefined;
|
|
23
|
+
tsconfig?: string | undefined;
|
|
24
|
+
external?: string[] | undefined;
|
|
25
|
+
outDir?: string | undefined;
|
|
26
|
+
hooks?: BuilderHooks | undefined;
|
|
27
|
+
}
|
package/dist/config.d.ts
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { ConfigDefinition, ConfigDefinitionInput, ExecutorConfig, ResolveOptions, ResolvedConfig } from "./types";
|
|
2
|
+
export declare class Config {
|
|
3
|
+
private readonly definition;
|
|
4
|
+
constructor(definition: ConfigDefinition);
|
|
5
|
+
resolve(options?: ResolveOptions): ResolvedConfig;
|
|
6
|
+
current(options?: ResolveOptions): ExecutorConfig;
|
|
7
|
+
get environment(): string;
|
|
8
|
+
forEnvironment(environment: string): ExecutorConfig;
|
|
9
|
+
private resolveEnvironment;
|
|
10
|
+
private assertEnvironment;
|
|
11
|
+
}
|
|
12
|
+
export declare const defineConfig: (input: ConfigDefinitionInput) => Config;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export type EnvironmentFactory = () => string | undefined;
|
|
2
|
+
export declare class EnvironmentSelector {
|
|
3
|
+
private readonly detectors;
|
|
4
|
+
private fallback;
|
|
5
|
+
byLiteral(name: string): this;
|
|
6
|
+
byEnvironmentVariable(variable: string): this;
|
|
7
|
+
byFactory(factory: EnvironmentFactory): this;
|
|
8
|
+
defaultTo(name: string): this;
|
|
9
|
+
resolve(): string;
|
|
10
|
+
}
|