Skip to content

Commit

Permalink
feat: moved to common tsconfig package (#26)
Browse files Browse the repository at this point in the history
  • Loading branch information
CptSchnitz authored Dec 25, 2024
1 parent c95ac8d commit f26ea3a
Show file tree
Hide file tree
Showing 7 changed files with 22 additions and 20 deletions.
11 changes: 11 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@
"ts-jest": "^29.1.5",
"typescript": "^5.4.5",
"prom-client": "^15.0.0",
"jest-extended": "^4.0.2"
"jest-extended": "^4.0.2",
"@map-colonies/tsconfig": "^1.0.0"
}
}
2 changes: 1 addition & 1 deletion src/env.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ function parseSchemaEnv(schema: JSONSchema): EnvMap {
debug('going over object properties at path %s', key, path);
const subSchema = schema.properties[key];

if (typeof subSchema !== 'boolean') {
if (typeof subSchema !== 'boolean' && subSchema !== undefined) {
iterateOverSchemaObject(subSchema, path === '' ? key : `${path}.${key}`);
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
export { ConfigOptions, ConfigInstance } from './types';
export type { ConfigOptions, ConfigInstance } from './types';
export { config } from './config';
export { ConfigErrors, isConfigError, ConfigError } from './errors';
export { type ConfigErrors, isConfigError, ConfigError } from './errors';
2 changes: 1 addition & 1 deletion src/options.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ export function initializeOptions(options: Partial<BaseOptions>): BaseOptions {
const [errors, validatedOptions] = validate(ajvOptionsValidator, optionsSchema, mergedOptions);

if (errors) {
debug('error validating options: %s', errors[0].message);
debug('error validating options: %s', errors[0] !== undefined ? errors[0].message : 'unknown error');
throw createConfigError(
'optionValidationError',
'An error occurred while validating the given options. please check both arguments and environment variables',
Expand Down
4 changes: 4 additions & 0 deletions src/schemas.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,10 @@ export async function loadSchema(schema: JSONSchema): ReturnType<typeof refParse
read: (file: { url: string; hash: string; extension: string }) => {
const subPath = file.url.split(SCHEMA_DOMAIN)[1];

if (subPath === undefined) {
throw createConfigError(`schemaNotFoundError`, `Schema url is not valid`, { schemaPath: file.url });
}

return loadSpecificSchema(subPath);
},
},
Expand Down
16 changes: 1 addition & 15 deletions tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,19 +1,5 @@
{
"compilerOptions": {
"target": "ES2022",
"allowSyntheticDefaultImports": true,
"strict": true,
"module": "NodeNext",
"esModuleInterop": true,
"moduleResolution": "NodeNext",
"resolveJsonModule": true,
"outDir": "dist",
"sourceMap": true,
"declaration": true,
"declarationMap": true,
"noEmit": true,
"strictNullChecks": true
},
"extends": "@map-colonies/tsconfig/tsconfig-library",
"include": ["src"],
"exclude": ["dist", "node_modules"]
}

0 comments on commit f26ea3a

Please sign in to comment.