Skip to content
Open
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
1 change: 1 addition & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
dist
4 changes: 2 additions & 2 deletions global.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
*/

declare module '*.json' {
export {}
export {};
}

interface Config {}
export interface Config {} // eslint-disable-line @typescript-eslint/no-empty-interface
6 changes: 4 additions & 2 deletions iso.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
declare const __CONFIG__: Config
import { Config } from './global';

export const config: Config = __CONFIG__
declare const __CONFIG__: Config;

export const config: Config = __CONFIG__;
18 changes: 9 additions & 9 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
{
"name": "@wonderzgmbh/node-config-ts",
"version": "2.0.0",
"version": "2.1.0",
"main": "./dist/index.js",
"bin": "./bin/cli",
"publishConfig": {
"registry": "https://npm.pkg.github.com/"
},
"scripts": {
"audit:prod": "yarn audit --groups dependencies",
"lint": "eslint --max-warnings=0 --ext ts,tsx src",
"lint": "eslint --max-warnings=0 .",
"test": "mocha",
"test:cli": "yarn compile && NODE_ENV=production NODE_CONFIG_TS_DIR=./dist/src/__tests__/__fixtures__/config OUTPUT_FILENAME=config.d.ts OUTPUT_FOLDER=./ node ./bin/cli",
"compile": "tsc",
Expand All @@ -19,7 +19,7 @@
"debug": "^4.3.4",
"json-to-ts": "^1.6.0",
"minimist": "^1.2.7",
"prettier": "^2.7.1",
"prettier": "^2.8.8",
"ramda": "^0.27.0"
},
"peerDependencies": {},
Expand All @@ -30,13 +30,13 @@
"@types/node": "^18.11.9",
"@types/prettier": "^2.7.1",
"@types/ramda": "^0.26.40",
"@typescript-eslint/eslint-plugin": "^5.43.0",
"@typescript-eslint/parser": "^5.43.0",
"@typescript-eslint/eslint-plugin": "^5.59.6",
"@typescript-eslint/parser": "^5.59.6",
"cz-conventional-changelog": "^3.1.0",
"eslint": "^8.28.0",
"eslint-config-prettier": "^8.5.0",
"eslint-import-resolver-typescript": "^3.5.2",
"eslint-plugin-import": "^2.26.0",
"eslint": "^8.40.0",
"eslint-config-prettier": "^8.8.0",
"eslint-import-resolver-typescript": "^3.5.5",
"eslint-plugin-import": "^2.27.5",
"eslint-plugin-mocha": "^10.1.0",
"eslint-plugin-no-only-tests": "^3.1.0",
"eslint-plugin-prettier": "^4.2.1",
Expand Down
4 changes: 2 additions & 2 deletions src/loadFileConfigs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import fs from 'fs';
import * as R from 'ramda';
import { configPaths, ConfigTypes } from './configPaths';

export type Configurations<T> = { [key in keyof T]: any };
export type Configurations<T> = { [key in keyof T]: any }; // eslint-disable-line @typescript-eslint/no-explicit-any

/**
* Loads the configs provided in the {ConfigPaths}
Expand All @@ -16,6 +16,6 @@ export const loadFileConfigs = (process: NodeJS.Process): Configurations<ConfigT
const paths = configPaths(process);
debug('paths', paths);

const itar: any = R.mapObjIndexed(R.ifElse(fs.existsSync, require, R.always({})));
const itar: any = R.mapObjIndexed(R.ifElse(fs.existsSync, require, R.always({}))); // eslint-disable-line @typescript-eslint/no-explicit-any
return itar(paths);
};
1 change: 1 addition & 0 deletions src/mergeFileConfigs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import * as R from 'ramda';
* @return {any}
*/

// eslint-disable-next-line @typescript-eslint/no-explicit-any
export const mergeFileConfigs = (configs: { [key: string]: any }) => {
return R.reduce(R.mergeDeepRight, configs.defaultConfig, [
configs.envConfig,
Expand Down
1 change: 1 addition & 0 deletions src/overwriteWithCustomEnvVars.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ export const overwriteWithCustomEnvVars = (process: NodeJS.Process) => {
const vars = require(customEnvironmentVariablesPath); // eslint-disable-line @typescript-eslint/no-var-requires
debug(vars);

// eslint-disable-next-line @typescript-eslint/no-explicit-any
const itar = (value: any, path: Array<string>) => {
debug('itar', value, path);
if (R.is(Object, value)) {
Expand Down
1 change: 1 addition & 0 deletions src/replaceWithEnvVar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ const getVarName = R.replace('@@', '');
const hasEnvVar = R.test(/^@@.*$/);

export const replaceWithEnvVar = <T>(baseConfig: T, process: NodeJS.Process): T => {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
const itar: any = R.map((value: any) => {
if (R.is(Object, value)) {
return itar(value);
Expand Down
Loading