chore: upgrade moduleResolution to Node16 (#9269)
This commit is contained in:
1 parent
d721282600
commit
9e711720dd
216 files changed
+981
-2439
No files matched your search
@@ -1,4 +1,5 @@
|
||||
module.exports = {
|
||||
const defineJestConfig = require("../../../define_jest_config")
|
||||
module.exports = defineJestConfig({
|
||||
moduleNameMapper: {
|
||||
"^@models": "<rootDir>/src/models",
|
||||
"^@services": "<rootDir>/src/services",
|
||||
@@ -6,16 +7,4 @@ module.exports = {
|
||||
"^@types": "<rootDir>/src/types",
|
||||
"^@utils": "<rootDir>/src/utils",
|
||||
},
|
||||
transform: {
|
||||
"^.+\\.[jt]s?$": [
|
||||
"ts-jest",
|
||||
{
|
||||
tsconfig: "tsconfig.spec.json",
|
||||
isolatedModules: true,
|
||||
},
|
||||
],
|
||||
},
|
||||
testEnvironment: `node`,
|
||||
moduleFileExtensions: [`js`, `ts`],
|
||||
modulePathIgnorePatterns: ["dist/"],
|
||||
}
|
||||
})
|
||||
@@ -5,7 +5,10 @@
|
||||
"main": "dist/index.js",
|
||||
"types": "dist/index.d.ts",
|
||||
"files": [
|
||||
"dist"
|
||||
"dist",
|
||||
"!dist/**/__tests__",
|
||||
"!dist/**/__mocks__",
|
||||
"!dist/**/__fixtures__"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">=20"
|
||||
@@ -23,7 +26,8 @@
|
||||
"scripts": {
|
||||
"watch": "tsc --build --watch",
|
||||
"watch:test": "tsc --build tsconfig.spec.json --watch",
|
||||
"build": "rimraf dist && tsc --build && tsc-alias -p tsconfig.json",
|
||||
"resolve:aliases": "tsc --showConfig -p tsconfig.json > tsconfig.resolved.json && tsc-alias -p tsconfig.resolved.json && rimraf tsconfig.resolved.json",
|
||||
"build": "rimraf dist && tsc --build && npm run resolve:aliases",
|
||||
"test": "jest --runInBand --bail --forceExit -- src/**/__tests__/**/*.ts",
|
||||
"test:integration": "jest --forceExit -- integration-tests/**/__tests__/**/*.ts",
|
||||
"migration:generate": " MIKRO_ORM_CLI=./mikro-orm.config.dev.ts mikro-orm migration:generate",
|
||||
@@ -42,7 +46,7 @@
|
||||
"ts-jest": "^29.1.1",
|
||||
"ts-node": "^10.9.1",
|
||||
"tsc-alias": "^1.8.6",
|
||||
"typescript": "^5.1.6"
|
||||
"typescript": "^5.6.2"
|
||||
},
|
||||
"dependencies": {
|
||||
"@medusajs/utils": "^1.11.9"
|
||||
|
||||
@@ -47,9 +47,8 @@ import {
|
||||
PriceSet,
|
||||
} from "@models"
|
||||
|
||||
import { ServiceTypes } from "@types"
|
||||
import { eventBuilders, validatePriceListDates } from "@utils"
|
||||
import { CreatePriceListDTO, UpsertPriceDTO } from "src/types/services"
|
||||
import { ServiceTypes } from "@types"
|
||||
import { joinerConfig } from "../joiner-config"
|
||||
|
||||
type InjectedDependencies = {
|
||||
@@ -590,7 +589,7 @@ export default class PricingModuleService
|
||||
price_list_id: priceListId,
|
||||
price_rules: hasRulesInput ? rules : undefined,
|
||||
rules_count: hasRulesInput ? ruleEntries.length : undefined,
|
||||
} as UpsertPriceDTO
|
||||
} as ServiceTypes.UpsertPriceDTO
|
||||
delete (entry as CreatePricesDTO).rules
|
||||
|
||||
const entryHash = hashPrice(entry)
|
||||
@@ -967,7 +966,7 @@ export default class PricingModuleService
|
||||
)
|
||||
)
|
||||
.filter(Boolean)
|
||||
.flat() as UpsertPriceDTO[]
|
||||
.flat() as ServiceTypes.UpsertPriceDTO[]
|
||||
|
||||
const priceSetMap = new Map<string, PriceSetDTO>(
|
||||
priceSets.map((p) => [p.id, p])
|
||||
@@ -1025,18 +1024,18 @@ export default class PricingModuleService
|
||||
) {
|
||||
const normalized = this.normalizePriceListDate(data)
|
||||
|
||||
const priceListsToCreate: CreatePriceListDTO[] = normalized.map(
|
||||
(priceListData) => {
|
||||
const priceListsToCreate: ServiceTypes.CreatePriceListDTO[] =
|
||||
normalized.map((priceListData) => {
|
||||
const entry = {
|
||||
...priceListData,
|
||||
rules: undefined,
|
||||
} as CreatePriceListDTO
|
||||
} as ServiceTypes.CreatePriceListDTO
|
||||
|
||||
if (priceListData.prices) {
|
||||
entry.prices = this.normalizePrices(
|
||||
priceListData.prices,
|
||||
[]
|
||||
) as UpsertPriceDTO[]
|
||||
) as ServiceTypes.UpsertPriceDTO[]
|
||||
}
|
||||
|
||||
if (priceListData.rules) {
|
||||
@@ -1060,8 +1059,7 @@ export default class PricingModuleService
|
||||
}
|
||||
|
||||
return entry
|
||||
}
|
||||
)
|
||||
})
|
||||
|
||||
const priceLists = await this.priceListService_.create(
|
||||
priceListsToCreate,
|
||||
@@ -1156,7 +1154,7 @@ export default class PricingModuleService
|
||||
|
||||
const normalizedData = this.normalizePriceListDate(data).map(
|
||||
(priceList) => {
|
||||
const entry: Partial<CreatePriceListDTO> = {
|
||||
const entry: Partial<ServiceTypes.CreatePriceListDTO> = {
|
||||
...priceList,
|
||||
rules: undefined,
|
||||
price_list_rules: undefined,
|
||||
@@ -1214,17 +1212,17 @@ export default class PricingModuleService
|
||||
const pricesToUpsert = data
|
||||
.map((addPrice) =>
|
||||
this.normalizePrices(
|
||||
addPrice.prices as UpsertPriceDTO[],
|
||||
addPrice.prices as ServiceTypes.UpsertPriceDTO[],
|
||||
existingPrices,
|
||||
addPrice.price_list_id
|
||||
)
|
||||
)
|
||||
.filter(Boolean)
|
||||
.flat() as UpsertPriceDTO[]
|
||||
.flat() as ServiceTypes.UpsertPriceDTO[]
|
||||
|
||||
const priceListMap = new Map(priceLists.map((p) => [p.id, p]))
|
||||
|
||||
for (const { price_list_id: priceListId, prices } of data) {
|
||||
for (const { price_list_id: priceListId } of data) {
|
||||
const priceList = priceListMap.get(priceListId)
|
||||
|
||||
if (!priceList) {
|
||||
@@ -1276,7 +1274,7 @@ export default class PricingModuleService
|
||||
)
|
||||
)
|
||||
.filter(Boolean)
|
||||
.flat() as UpsertPriceDTO[]
|
||||
.flat() as ServiceTypes.UpsertPriceDTO[]
|
||||
|
||||
const priceListMap = new Map(priceLists.map((p) => [p.id, p]))
|
||||
pricesToUpsert.forEach((price) => {
|
||||
@@ -1456,7 +1454,7 @@ export default class PricingModuleService
|
||||
data: (
|
||||
| ServiceTypes.UpdatePriceListDTO
|
||||
| ServiceTypes.CreatePriceListDTO
|
||||
| CreatePriceListDTO
|
||||
| ServiceTypes.CreatePriceListDTO
|
||||
)[]
|
||||
) {
|
||||
return data.map((priceListData: any) => {
|
||||
|
||||
@@ -1,26 +1,6 @@
|
||||
{
|
||||
"extends": "../../../_tsconfig.base.json",
|
||||
"compilerOptions": {
|
||||
"lib": ["es2021"],
|
||||
"target": "es2021",
|
||||
"outDir": "./dist",
|
||||
"esModuleInterop": true,
|
||||
"declarationMap": true,
|
||||
"declaration": true,
|
||||
"module": "commonjs",
|
||||
"moduleResolution": "node",
|
||||
"emitDecoratorMetadata": true,
|
||||
"experimentalDecorators": true,
|
||||
"sourceMap": false,
|
||||
"noImplicitReturns": true,
|
||||
"strictNullChecks": true,
|
||||
"strictFunctionTypes": true,
|
||||
"noImplicitThis": true,
|
||||
"allowJs": true,
|
||||
"skipLibCheck": true,
|
||||
"downlevelIteration": true,
|
||||
// to use ES5 specific tooling
|
||||
"baseUrl": ".",
|
||||
"resolveJsonModule": true,
|
||||
"paths": {
|
||||
"@models": ["./src/models"],
|
||||
"@services": ["./src/services"],
|
||||
@@ -28,13 +8,5 @@
|
||||
"@types": ["./src/types"],
|
||||
"@utils": ["./src/utils"]
|
||||
}
|
||||
},
|
||||
"include": ["src"],
|
||||
"exclude": [
|
||||
"dist",
|
||||
"./src/**/__tests__",
|
||||
"./src/**/__mocks__",
|
||||
"./src/**/__fixtures__",
|
||||
"node_modules"
|
||||
]
|
||||
}
|
||||
}
|
||||
@@ -1,8 +0,0 @@
|
||||
{
|
||||
"extends": "./tsconfig.json",
|
||||
"include": ["src", "integration-tests"],
|
||||
"exclude": ["node_modules", "dist"],
|
||||
"compilerOptions": {
|
||||
"sourceMap": true
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user