Skip to content
This repository has been archived by the owner on Aug 14, 2024. It is now read-only.

refactor: migrate to @openally/config #247

Merged
merged 1 commit into from
Jul 31, 2024
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
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,8 @@
"@nodesecure/js-x-ray": "^7.3.0",
"@nodesecure/npm-types": "^1.0.0",
"@nodesecure/vuln": "^1.7.0",
"@openally/config": "^1.0.1",
"@openally/result": "^1.2.1",
"@slimio/config": "^1.2.0",
"lodash.merge": "^4.6.2",
"type-fest": "^4.23.0"
},
Expand Down
6 changes: 3 additions & 3 deletions src/functions/read.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import path from "node:path";
import { once } from "node:events";

// Import Third-party Dependencies
import Config from "@slimio/config";
import { AsynchronousConfig } from "@openally/config";
import { Ok, Err, Result } from "@openally/result";
import { RequireAtLeastOne } from "type-fest";

Expand Down Expand Up @@ -44,8 +44,8 @@ export async function read(
const { createIfDoesNotExist = Boolean(options.createMode), createMode, memoize: memoizeRc = false } = options;

const cfgPath = path.join(location, CONSTANTS.CONFIGURATION_NAME);
const cfg = new Config<RC>(cfgPath, {
defaultSchema: JSONSchema,
const cfg = new AsynchronousConfig<RC>(cfgPath, {
jsonSchema: JSONSchema,
createOnNoEntry: createIfDoesNotExist
});

Expand Down
6 changes: 3 additions & 3 deletions src/functions/write.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import path from "path";

// Import Third-party Dependencies
import Config from "@slimio/config";
import { AsynchronousConfig } from "@openally/config";
import { Ok, Err, Result } from "@openally/result";

// Import Internal Dependencies
Expand Down Expand Up @@ -34,8 +34,8 @@ export async function write(
const { payload, partialUpdate = false } = options;

const cfgPath = path.join(location, CONSTANTS.CONFIGURATION_NAME);
const cfg = new Config<RC>(cfgPath, {
defaultSchema: JSONSchema
const cfg = new AsynchronousConfig<RC>(cfgPath, {
jsonSchema: JSONSchema
});
await cfg.read();

Expand Down
8 changes: 4 additions & 4 deletions test/fixtures/.nodesecurerc
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"version": "2.1.0",
"i18n": "french",
"strategy": "none",
"registry": "https://registry.npmjs.org"
"version": "2.1.0",
"i18n": "french",
"strategy": "none",
"registry": "https://registry.npmjs.org"
}