Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions .github/actions/prepare/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,6 @@ inputs:
build:
description: Build packages
default: "true"
sub-dir:
description: Is run in src sub directory
default: "false"
runs:
using: composite
steps:
Expand Down
12 changes: 7 additions & 5 deletions src/lib/global-config/global-config-handler.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { read, readUser, write, writeUser } from "rc9";
import { read, readUserConfig, write, writeUserConfig } from "rc9";

import { GLOBAL_CONFIG_FILE_NAME } from "@lib/constants";
import { type DeepPartial } from "@lib/types";
Expand All @@ -12,9 +12,11 @@ type CReader = (options: { name: string; dir?: string }) => GlobalConfig;

export class GlobalConfigHandler {
static read(dir?: string): GlobalConfig {
const localConfig = this._readConfig(read, false, dir);
if (localConfig) return localConfig;
return this._readConfig(readUser, true);
const dirConfig = this._readConfig(read, false, dir);
if (dirConfig) return dirConfig;
const cwdConfig = this._readConfig(read, false, process.cwd());
if (cwdConfig) return cwdConfig;
return this._readConfig(readUserConfig, true);
}

static write(config: DeepPartial<GlobalConfig>, local: boolean = false, dir?: string): void {
Expand All @@ -23,7 +25,7 @@ export class GlobalConfigHandler {
dir,
};
if (local) write(config, options);
else writeUser(config, options);
else writeUserConfig(config, options);
}

private static _readConfig(func: CReader, force: true): GlobalConfig;
Expand Down
Loading