Skip to content

Commit

Permalink
tweaks
Browse files Browse the repository at this point in the history
  • Loading branch information
zoe-codez committed Nov 14, 2024
1 parent ed7a601 commit 37fd52e
Show file tree
Hide file tree
Showing 47 changed files with 1,260 additions and 2,269 deletions.
3 changes: 3 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"typescript.tsdk": "node_modules/typescript/lib"
}
2 changes: 1 addition & 1 deletion eslint.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ export default [
{
files: ["testing/**/*.mts"],
languageOptions: {
globals: { ...globals.jest },
globals: { ...globals.vi },
parser: tsParser,
ecmaVersion: 5,
sourceType: "script",
Expand Down
63 changes: 11 additions & 52 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"repository": {
"url": "git+https://github.com/Digital-Alchemy-TS/core"
},
"version": "24.11.1",
"version": "24.11.2",
"author": {
"url": "https://github.com/zoe-codez",
"name": "Zoe Codez"
Expand All @@ -15,7 +15,7 @@
"build": "rm -rf dist/; tsc -p tsconfig.lib.json",
"lint": "eslint src",
"prepublishOnly": "yarn build",
"test": "./scripts/test.sh",
"test": "vitest",
"upgrade": "yarn up '@digital-alchemy/*'"
},
"bugs": {
Expand All @@ -37,8 +37,8 @@
}
],
"exports": {
".": "./dist/index.js",
"./testing": "./dist/testing/helpers/index.js"
".": "./dist/index.mjs",
"./testing": "./dist/testing/helpers/index.mjs"
},
"files": [
"dist/**/*"
Expand All @@ -58,21 +58,19 @@
},
"devDependencies": {
"@cspell/eslint-plugin": "^8.16.0",
"@eslint/compat": "^1.2.2",
"@eslint/compat": "^1.2.3",
"@eslint/eslintrc": "^3.1.0",
"@eslint/js": "^9.14.0",
"@faker-js/faker": "^9.2.0",
"@jest/globals": "^29.7.0",
"@types/dotenv": "^8.2.3",
"@types/ini": "^4.1.1",
"@types/jest": "^29.5.14",
"@types/js-yaml": "^4.0.9",
"@types/minimist": "^1.2.5",
"@types/node": "^22.9.0",
"@types/node-cron": "^3.0.11",
"@types/sinonjs__fake-timers": "^8.1.5",
"@typescript-eslint/eslint-plugin": "8.13.0",
"@typescript-eslint/parser": "8.13.0",
"@typescript-eslint/eslint-plugin": "8.14.0",
"@typescript-eslint/parser": "8.14.0",
"chalk": "^5.3.0",
"dayjs": "^1.11.13",
"dotenv": "^16.4.5",
Expand All @@ -87,56 +85,17 @@
"eslint-plugin-sonarjs": "^2.0.4",
"eslint-plugin-sort-keys-fix": "^1.1.2",
"eslint-plugin-unicorn": "^56.0.0",
"globals": "^15.12.0",
"ini": "^5.0.0",
"jest": "^29.7.0",
"jest-environment-node": "^29.7.0",
"js-yaml": "^4.1.0",
"minimist": "^1.2.8",
"node-cron": "^3.0.3",
"prettier": "^3.3.3",
"ts-jest": "^29.2.5",
"tslib": "^2.8.1",
"tsx": "^4.19.2",
"type-fest": "^4.26.1",
"typescript": "^5.6.3",
"uuid": "^11.0.3"
},
"jest": {
"extensionsToTreatAsEsm": [
".mts"
],
"collectCoverage": true,
"coverageReporters": [
"text",
"cobertura"
],
"coveragePathIgnorePatterns": [
"src/testing/"
],
"preset": "ts-jest",
"testEnvironment": "node",
"moduleFileExtensions": [
"ts",
"js",
"json",
"node"
],
"testMatch": [
"**/?(*.)+(spec|test).mts"
],
"setupFiles": [
"<rootDir>/testing/setup.mts"
],
"transform": {
"^.+\\.mts$": [
"ts-jest",
{
"tsconfig": "tsconfig.spec.json",
"useESM": true
}
]
}
"typescript": "^5.7.0-beta",
"uuid": "^11.0.3",
"vitest": "^2.1.5"
},
"packageManager": "[email protected].0"
"packageManager": "[email protected].1"
}
2 changes: 0 additions & 2 deletions scripts/test.sh

This file was deleted.

4 changes: 2 additions & 2 deletions src/helpers/async.helper.mts → src/helpers/async.mts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/* eslint-disable sonarjs/no-redundant-type-constituents */

import { is } from "../index.mjs";
import { ARRAY_OFFSET, SINGLE, START } from "./utilities.helper.mjs";
import { is } from "../index.mts";
import { ARRAY_OFFSET, SINGLE, START } from "./utilities.mts";

// ? Functions written to be similar to the offerings from the async library
// That library gave me oddly inconsistent results,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import minimist from "minimist";
import { env } from "process";

import { is } from "../index.mjs";
import { is } from "../index.mts";
import {
AbstractConfig,
ConfigLoaderParams,
Expand All @@ -13,8 +13,8 @@ import {
loadDotenv,
ModuleConfiguration,
parseConfig,
} from "./config.helper.mjs";
import { ServiceMap } from "./wiring.helper.mjs";
} from "./config.mts";
import { ServiceMap } from "./wiring.mts";

export async function ConfigLoaderEnvironment<
S extends ServiceMap = ServiceMap,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@ import { homedir } from "os";
import { join } from "path";
import { cwd, platform } from "process";

import { is } from "../index.mjs";
import { ConfigLoaderParams, ConfigLoaderReturn, ModuleConfiguration } from "./config.helper.mjs";
import { deepExtend } from "./extend.helper.mjs";
import { INVERT_VALUE, START } from "./utilities.helper.mjs";
import { PartialConfiguration, ServiceMap } from "./wiring.helper.mjs";
import { is } from "../index.mts";
import { ConfigLoaderParams, ConfigLoaderReturn, ModuleConfiguration } from "./config.mts";
import { deepExtend } from "./extend.mts";
import { INVERT_VALUE, START } from "./utilities.mts";
import { PartialConfiguration, ServiceMap } from "./wiring.mts";

const isWindows = platform === "win32";

Expand Down
8 changes: 4 additions & 4 deletions src/helpers/config.helper.mts → src/helpers/config.mts
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,15 @@ import {
InternalDefinition,
is,
LOAD_PROJECT,
} from "../index.mjs";
import { ILogger } from "./logger.helper.mjs";
import { TBlackHole } from "./utilities.helper.mjs";
} from "../index.mts";
import { ILogger } from "./logger.mts";
import { TBlackHole } from "./utilities.mts";
import {
ApplicationDefinition,
PartialConfiguration,
ServiceMap,
TInjectedConfig,
} from "./wiring.helper.mjs";
} from "./wiring.mts";

export interface ConfigLoaderSource {
/**
Expand Down
File renamed without changes.
6 changes: 3 additions & 3 deletions src/helpers/cron.helper.mts → src/helpers/cron.mts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { Dayjs } from "dayjs";

import { TContext } from "./context.helper.mjs";
import { TBlackHole } from "./utilities.helper.mjs";
import { Schedule, SchedulerOptions } from "./wiring.helper.mjs";
import { TContext } from "./context.mts";
import { TBlackHole } from "./utilities.mts";
import { Schedule, SchedulerOptions } from "./wiring.mts";

export enum CronExpression {
EVERY_SECOND = "* * * * * *",
Expand Down
2 changes: 1 addition & 1 deletion src/helpers/errors.helper.mts → src/helpers/errors.mts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { TContext } from "./context.helper.mjs";
import { TContext } from "./context.mts";

export class BootstrapException extends Error {
context: TContext;
Expand Down
2 changes: 1 addition & 1 deletion src/helpers/events.helper.mts → src/helpers/events.mts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { is } from "../index.mjs";
import { is } from "../index.mts";

export const DIGITAL_ALCHEMY_NODE_GLOBAL_ERROR = "DIGITAL_ALCHEMY_NODE_GLOBAL_ERROR";
export const DIGITAL_ALCHEMY_APPLICATION_ERROR = "DIGITAL_ALCHEMY_APPLICATION_ERROR";
Expand Down
2 changes: 1 addition & 1 deletion src/helpers/extend.helper.mts → src/helpers/extend.mts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { is } from "../index.mjs";
import { is } from "../index.mts";

function isSpecificValue(value: unknown) {
return value instanceof Date || value instanceof RegExp;
Expand Down
28 changes: 14 additions & 14 deletions src/helpers/index.mts
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
export * from "./async.helper.mjs";
export * from "./config.helper.mjs";
export * from "./config-environment-loader.helper.mjs";
export * from "./config-file-loader.helper.mjs";
export * from "./context.helper.mjs";
export * from "./cron.helper.mjs";
export * from "./errors.helper.mjs";
export * from "./events.helper.mjs";
export * from "./extend.helper.mjs";
export * from "./lifecycle.helper.mjs";
export * from "./logger.helper.mjs";
export * from "./module.helper.mjs";
export * from "./utilities.helper.mjs";
export * from "./wiring.helper.mjs";
export * from "./async.mts";
export * from "./config.mts";
export * from "./config-environment-loader.mts";
export * from "./config-file-loader.mts";
export * from "./context.mts";
export * from "./cron.mts";
export * from "./errors.mts";
export * from "./events.mts";
export * from "./extend.mts";
export * from "./lifecycle.mts";
export * from "./logger.mts";
export * from "./module.mts";
export * from "./utilities.mts";
export * from "./wiring.mts";
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { TBlackHole } from "./utilities.helper.mjs";
import { TBlackHole } from "./utilities.mts";

export type LifecycleCallback = () => TBlackHole;
export type LifecyclePrioritizedCallback = [callback: LifecycleCallback, priority: number];
Expand Down
2 changes: 1 addition & 1 deletion src/helpers/logger.helper.mts → src/helpers/logger.mts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { TContext } from "./context.helper.mjs";
import { TContext } from "./context.mts";

export type DigitalAlchemyLogger = {
/**
Expand Down
8 changes: 4 additions & 4 deletions src/helpers/module.helper.mts → src/helpers/module.mts
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
import { Except, Merge } from "type-fest";

import { CreateApplication, iTestRunner, TestRunner } from "../index.mjs";
import { OptionalModuleConfiguration } from "./config.helper.mjs";
import { deepExtend } from "./extend.helper.mjs";
import { CreateApplication, iTestRunner, TestRunner } from "../index.mts";
import { OptionalModuleConfiguration } from "./config.mts";
import { deepExtend } from "./extend.mts";
import {
ApplicationDefinition,
CreateLibrary,
LibraryDefinition,
ServiceFunction,
ServiceMap,
TLibrary,
} from "./wiring.helper.mjs";
} from "./wiring.mts";

export type ExtendOptions = {
name?: string;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { is } from "../index.mjs";
import { is } from "../index.mts";

/* eslint-disable @typescript-eslint/no-magic-numbers */
export const EVEN = 2;
Expand Down
18 changes: 9 additions & 9 deletions src/helpers/wiring.helper.mts → src/helpers/wiring.mts
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ import { AsyncLocalStorage } from "async_hooks";
import { Dayjs } from "dayjs";
import { EventEmitter } from "events";

import { ConfigManager, InternalDefinition, is, LIB_BOILERPLATE, LOAD_PROJECT } from "../index.mjs";
import { eachSeries } from "./async.helper.mjs";
import { ConfigManager, InternalDefinition, is, LIB_BOILERPLATE, LOAD_PROJECT } from "../index.mts";
import { eachSeries } from "./async.mts";
import {
AnyConfig,
BooleanConfig,
Expand All @@ -13,13 +13,13 @@ import {
OptionalModuleConfiguration,
StringArrayConfig,
StringConfig,
} from "./config.helper.mjs";
import { TContext } from "./context.helper.mjs";
import { CronExpression, ScheduleRemove } from "./cron.helper.mjs";
import { BootstrapException } from "./errors.helper.mjs";
import { TLifecycleBase } from "./lifecycle.helper.mjs";
import { ILogger, TConfigLogLevel } from "./logger.helper.mjs";
import { TBlackHole } from "./utilities.helper.mjs";
} from "./config.mts";
import { TContext } from "./context.mts";
import { CronExpression, ScheduleRemove } from "./cron.mts";
import { BootstrapException } from "./errors.mts";
import { TLifecycleBase } from "./lifecycle.mts";
import { ILogger, TConfigLogLevel } from "./logger.mts";
import { TBlackHole } from "./utilities.mts";

export type TServiceReturn<OBJECT extends object = object> = void | OBJECT;

Expand Down
6 changes: 3 additions & 3 deletions src/index.mts
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
export * from "./helpers/index.mjs";
export * from "./services/index.mjs";
export * from "./testing/index.mjs";
export * from "./helpers/index.mts";
export * from "./services/index.mts";
export * from "./testing/index.mts";
4 changes: 2 additions & 2 deletions src/main.mts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { CreateApplication } from "./index.mjs";
import { CreateApplication } from "./index.mts";

export const TEST_APPLICATION = CreateApplication({
name: "test",
Expand All @@ -9,7 +9,7 @@ export const TEST_APPLICATION = CreateApplication({
},
});

declare module "./index.mjs" {
declare module "./index.mts" {
export interface LoadedModules {
test: typeof TEST_APPLICATION;
}
Expand Down
2 changes: 1 addition & 1 deletion src/services/als.service.mts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { AsyncLocalStorage } from "async_hooks";

import { AlsExtension, AsyncLocalData, AsyncLogData, TBlackHole } from "../index.mjs";
import { AlsExtension, AsyncLocalData, AsyncLogData, TBlackHole } from "../index.mts";

export function ALS(): AlsExtension {
const storage = new AsyncLocalStorage<AsyncLocalData>();
Expand Down
4 changes: 2 additions & 2 deletions src/services/configuration.service.mts
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ import {
TInjectedConfig,
TServiceParams,
TSetConfig,
} from "../index.mjs";
import { is } from "./is.service.mjs";
} from "../index.mts";
import { is } from "./is.service.mts";

export const INITIALIZE = Symbol.for("initialize");
export const LOAD_PROJECT = Symbol.for("load-project");
Expand Down
14 changes: 7 additions & 7 deletions src/services/index.mts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
export * from "./als.service.mjs";
export * from "./configuration.service.mjs";
export * from "./internal.service.mjs";
export * from "./is.service.mjs";
export * from "./logger.service.mjs";
export * from "./scheduler.service.mjs";
export * from "./wiring.service.mjs";
export * from "./als.service.mts";
export * from "./configuration.service.mts";
export * from "./internal.service.mts";
export * from "./is.service.mts";
export * from "./logger.service.mts";
export * from "./scheduler.service.mts";
export * from "./wiring.service.mts";
8 changes: 4 additions & 4 deletions src/services/internal.service.mts
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,10 @@ import {
TModuleMappings,
TResolvedModuleMappings,
YEAR,
} from "../index.mjs";
import { is } from "./is.service.mjs";
import { CreateLifecycle } from "./lifecycle.service.mjs";
import { LIB_BOILERPLATE } from "./wiring.service.mjs";
} from "../index.mts";
import { is } from "./is.service.mts";
import { CreateLifecycle } from "./lifecycle.service.mts";
import { LIB_BOILERPLATE } from "./wiring.service.mts";

const EVERYTHING_ELSE = 1;
const MONTHS = 12;
Expand Down
Loading

0 comments on commit 37fd52e

Please sign in to comment.