Skip to content

Commit

Permalink
fix(common): move normalizePath to Ts.ED core
Browse files Browse the repository at this point in the history
  • Loading branch information
Romakita committed Sep 16, 2022
1 parent d40b962 commit 94d2549
Show file tree
Hide file tree
Showing 14 changed files with 23 additions and 38 deletions.
7 changes: 5 additions & 2 deletions packages/core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,11 @@
},
"dependencies": {
"reflect-metadata": "^0.1.13",
"normalize-path": "3.0.0",
"tslib": "2.4.0"
},
"devDependencies": {},
"devDependencies": {
"@types/normalize-path": "^3.0.0"
},
"peerDependencies": {}
}
}
1 change: 1 addition & 0 deletions packages/core/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ export * from "./interfaces/HashOf";
export * from "./interfaces/MetadataTypes";
export * from "./interfaces/ValueOf";
export * from "./utils/catchError";
export * from "./utils/normalizePath";
export * from "./utils/proxyDelegation";
export * from "./utils/uniq";
export * from "./utils/decorators/decorateMethodsOf";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import {isArray, isString} from "@tsed/core";
import {join} from "path";
import fixPath from "normalize-path";
import {isString} from "./objects/isString";
import {isArray} from "./objects/isArray";

export function normalizePath(item: string, ...paths: string[]): string;
export function normalizePath(item: (string | any)[]): (string | any)[];
Expand Down
8 changes: 4 additions & 4 deletions packages/di/coverage.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"statements": 99,
"branches": 93.12,
"lines": 99.1,
"functions": 98.46
"statements": 98.63,
"branches": 92.95,
"lines": 98.72,
"functions": 98.11
}
4 changes: 2 additions & 2 deletions packages/di/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"build:cjs": "tsc --build tsconfig.compile.json",
"build:esm": "tsc --build tsconfig.compile.esm.json",
"barrels": "yarn barrelsby --delete -d ./src -e \"\\.spec\\.ts\" -e \"__mock__\"",
"test": "cross-env NODE_ENV=test yarn jest --max-workers=2"
"test": "cross-env NODE_ENV=test yarn jest --max-workers=2 -u"
},
"dependencies": {
"tslib": "2.4.0"
Expand All @@ -44,4 +44,4 @@
"optional": false
}
}
}
}
7 changes: 0 additions & 7 deletions packages/di/src/decorators/__snapshots__/inject.spec.ts.snap

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ describe("PlatformConfiguration", () => {
settings.routers = {mergeParams: true};
settings.exclude = ["./**/*.spec.ts"];
settings.debug = true;
settings.jsonMapper = {};
//settings.jsonMapper = {};

settings.setHttpPort({address: "address", port: 8081});
settings.setHttpsPort({address: "address", port: 8080});
Expand Down Expand Up @@ -157,7 +157,7 @@ describe("PlatformConfiguration", () => {
});

it("should return jsonMapper settings", () => {
expect(settings.jsonMapper).toEqual({});
expect(settings.jsonMapper).toEqual({additionalProperties: false, disableUnsecureConstructor: true});
});

it("should return controllerScope", () => {
Expand Down
3 changes: 1 addition & 2 deletions packages/specs/swagger/src/SwaggerModule.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,14 @@ import {
Inject,
InjectorService,
Module,
normalizePath,
OnReady,
PlatformApplication,
PlatformContext
} from "@tsed/common";
import {PlatformRouter, useContextHandler} from "@tsed/platform-router";
import Fs from "fs";
import {join} from "path";
import {Env} from "@tsed/core";
import {Env, normalizePath} from "@tsed/core";
import {absolutePath} from "swagger-ui-dist";
import {SwaggerSettings} from "./interfaces/SwaggerSettings";
import {cssMiddleware} from "./middlewares/cssMiddleware";
Expand Down
6 changes: 2 additions & 4 deletions packages/third-parties/components-scan/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,11 @@
},
"dependencies": {
"globby": "11.0.3",
"normalize-path": "3.0.0",
"tslib": "2.4.0"
},
"devDependencies": {
"@tsed/core": "7.0.0-rc.5",
"@tsed/di": "7.0.0-rc.5",
"@types/normalize-path": "^3.0.0"
"@tsed/di": "7.0.0-rc.5"
},
"peerDependencies": {}
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import {resolve} from "path";
import {isTsEnv} from "./isTsEnv";
import {normalizePath} from "./normalizePath";
import {normalizePath} from "@tsed/core";

function mapExcludes(excludes: string[]) {
return excludes.map((s: string) => `!${s.replace(/!/gi, "")}`);
Expand Down
1 change: 0 additions & 1 deletion packages/third-parties/components-scan/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,3 @@ export * from "./cleanGlobPatterns";
export * from "./importFiles";
export * from "./importProviders";
export * from "./isTsEnv";
export * from "./normalizePath";
13 changes: 2 additions & 11 deletions packages/third-parties/formio/src/FormioModule.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,5 @@
import {
Constant,
Inject,
InjectorService,
normalizePath,
OnReady,
OnRoutesInit,
PlatformApplication,
PlatformRouteDetails
} from "@tsed/common";
import {deepClone} from "@tsed/core";
import {Constant, Inject, InjectorService, OnReady, OnRoutesInit, PlatformApplication, PlatformRouteDetails} from "@tsed/common";
import {deepClone, normalizePath} from "@tsed/core";
import {Module} from "@tsed/di";
import {AlterActions} from "./components/AlterActions";
import {AlterAudit} from "./components/AlterAudit";
Expand Down
2 changes: 1 addition & 1 deletion packages/third-parties/formio/src/components/AlterSkip.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import {Constant, PlatformContext} from "@tsed/common";
import {normalizePath} from "@tsed/common";
import {normalizePath} from "@tsed/core";
import {Alter} from "../decorators/alter";
import {AlterHook} from "../domain/AlterHook";

Expand Down

0 comments on commit 94d2549

Please sign in to comment.