chore: upgrade moduleResolution to Node16 (#9269)

This commit is contained in:
Harminder Virk authored and GitHub committed 2024-09-24 17:19:20 +05:30
1 parent d721282600
commit 9e711720dd
216 files changed
+981 -2439

No files matched your search

+2 -24
View File
@@ -1,24 +1,2 @@
module.exports = {
transform: {
"^.+\\.[jt]s$": [
"@swc/jest",
{
jsc: {
parser: {
syntax: "typescript",
decorators: true,
},
transform: {
useDefineForClassFields: false,
legacyDecorator: true,
decoratorMetadata: true,
},
target: "ES2021",
},
},
],
},
testPathIgnorePatterns: [`dist/`, `node_modules/`],
testEnvironment: `node`,
moduleFileExtensions: [`js`, `ts`],
}
const defineJestConfig = require("../../../define_jest_config")
module.exports = defineJestConfig()
+18 -17
View File
@@ -4,6 +4,7 @@ import {
} from "@medusajs/types"
import type { RedisOptions } from "ioredis"
// @ts-expect-error
import type { InlineConfig } from "vite"
/**
@@ -15,7 +16,7 @@ export type AdminOptions = {
/**
* Whether to disable the admin dashboard. If set to `true`, the admin dashboard is disabled,
* in both development and production environments. The default value is `false`.
*
*
* @example
* ```js title="medusa-config.js"
* module.exports = defineConfig({
@@ -36,14 +37,14 @@ export type AdminOptions = {
* - `/store`
* - `/auth`
* - `/`
*
*
* :::note
*
*
* When using Docker, make sure that the root path of the Docker image doesn't path the admin's `path`. For example, if the Docker image's root path is `/app`, change
* the value of the `path` configuration, as it's `/app` by default.
*
*
* :::
*
*
* @example
* ```js title="medusa-config.js"
* module.exports = defineConfig({
@@ -58,7 +59,7 @@ export type AdminOptions = {
/**
* The directory where the admin build is outputted when you run the `build` command.
* The default value is `./build`.
*
*
* @example
* ```js title="medusa-config.js"
* module.exports = defineConfig({
@@ -72,7 +73,7 @@ export type AdminOptions = {
outDir?: string
/**
* The URL of your Medusa application. This is useful to set when you deploy the Medusa application.
*
*
* @example
* ```js title="medusa-config.js"
* module.exports = defineConfig({
@@ -270,11 +271,11 @@ export type ProjectConfigOptions = {
*
* This is useful for production databases, which can be supported by setting the `rejectUnauthorized` attribute of `ssl` object to `false`.
* During development, it’s recommended not to pass this option.
*
*
* :::note
*
*
* Make sure to add to the end of the database URL `?ssl_mode=disable` as well when disabling `rejectUnauthorized`.
*
*
* :::
*
* @example
@@ -416,9 +417,9 @@ export type ProjectConfigOptions = {
* // ...
* })
* ```
*
*
* @ignore
*
*
* @privateRemarks
* Couldn't find any use for this option.
*/
@@ -499,7 +500,7 @@ export type ProjectConfigOptions = {
jwtSecret?: string
/**
* The expiration time for the JWT token. Its format is based off the [ms package](https://github.com/vercel/ms).
*
*
* If not provided, the default value is `24h`.
*
* @example
@@ -760,7 +761,7 @@ export type ProjectConfigOptions = {
* The configurations for your Medusa application are in `medusa-config.js` located in the root of your Medusa project. The configurations include configurations for database, modules, and more.
*
* `medusa-config.js` exports the value returned by the `defineConfig` utility function imported from `@medusajs/utils`.
*
*
* `defineConfig` accepts as a parameter an object with the following properties:
*
* - {@link ConfigModule.projectConfig | projectConfig} (required): An object that holds general configurations related to the Medusa application, such as database or CORS configurations.
@@ -866,12 +867,12 @@ export type ConfigModule = {
/**
* This property holds all custom modules installed in your Medusa application.
*
*
* :::note
*
*
* Medusa's commerce modules are configured by default, so only
* add them to this property if you're changing their configurations or adding providers to a module.
*
*
* :::
*
* The keys of the `modules` configuration object refer to the module's registration name. Its value can be one of the following:
@@ -1,5 +1,6 @@
import {
ContainerRegistrationKeys,
dynamicImport,
FlagRouter,
isDefined,
isObject,
@@ -112,7 +113,7 @@ export async function featureFlagsLoader(
return
}
const fileExports = await import(join(flagDir, file.name))
const fileExports = await dynamicImport(join(flagDir, file.name))
const featureFlag = fileExports.default
if (!featureFlag) {
+12 -4
View File
@@ -1,4 +1,10 @@
import { parseCorsOrigins, promiseAll, wrapHandler } from "@medusajs/utils"
import {
dynamicImport,
parseCorsOrigins,
promiseAll,
resolveExports,
wrapHandler,
} from "@medusajs/utils"
import cors from "cors"
import {
type Express,
@@ -348,7 +354,7 @@ class ApiRoutesLoader {
const absolutePath = descriptor.absolutePath
const route = descriptor.route
return await import(absolutePath).then((import_) => {
return await dynamicImport(absolutePath).then((import_) => {
const map = this.#routesMap
const config: RouteConfig = {
@@ -486,8 +492,10 @@ class ApiRoutesLoader {
const absolutePath = join(this.#sourceDir, middlewareFilePath)
await import(absolutePath).then((import_) => {
const middlewaresConfig = import_.default as MiddlewaresConfig | undefined
await dynamicImport(absolutePath).then((import_) => {
const middlewaresConfig = resolveExports(import_).default as
| MiddlewaresConfig
| undefined
if (!middlewaresConfig) {
log({
@@ -1,6 +1,11 @@
import type { SchedulerOptions } from "@medusajs/orchestration"
import { MedusaContainer } from "@medusajs/types"
import { isObject, MedusaError, promiseAll } from "@medusajs/utils"
import {
dynamicImport,
isObject,
MedusaError,
promiseAll,
} from "@medusajs/utils"
import {
createStep,
createWorkflow,
@@ -150,11 +155,11 @@ export class JobLoader {
fileEntries.map(async (entry) => {
const fullPath = join(entry.path, entry.name)
const module_ = await import(fullPath)
const module_ = await dynamicImport(fullPath)
const input = {
config: module_.config,
handler: module_.default,
handler: module_.default.default,
}
this.validateConfig(input.config)
@@ -1,4 +1,4 @@
import { promiseAll } from "@medusajs/utils"
import { dynamicImport, promiseAll } from "@medusajs/utils"
import { logger } from "../logger"
import { access, readdir } from "fs/promises"
import { join } from "path"
@@ -59,7 +59,7 @@ export class LinkLoader {
return await promiseAll(
fileEntries.map(async (entry) => {
const fullPath = join(entry.path, entry.name)
return await import(fullPath)
return await dynamicImport(fullPath)
})
)
})
@@ -1,5 +1,11 @@
import { Event, IEventBusModuleService, Subscriber } from "@medusajs/types"
import { Modules, kebabCase, promiseAll } from "@medusajs/utils"
import {
dynamicImport,
kebabCase,
Modules,
promiseAll,
resolveExports,
} from "@medusajs/utils"
import { access, readdir } from "fs/promises"
import { join, parse } from "path"
@@ -115,7 +121,8 @@ export class SubscriberLoader {
}
private async createDescriptor(absolutePath: string) {
return await import(absolutePath).then((module_) => {
return await dynamicImport(absolutePath).then((module_) => {
module_ = resolveExports(module_)
const isValid = this.validateSubscriber(module_, absolutePath)
if (!isValid) {
@@ -1,4 +1,4 @@
import { promiseAll } from "@medusajs/utils"
import { dynamicImport, promiseAll } from "@medusajs/utils"
import { logger } from "../logger"
import { access, readdir } from "fs/promises"
import { join } from "path"
@@ -59,7 +59,7 @@ export class WorkflowLoader {
return await promiseAll(
fileEntries.map(async (entry) => {
const fullPath = join(entry.path, entry.name)
return await import(fullPath)
return await dynamicImport(fullPath)
})
)
})
+1 -30
View File
@@ -1,32 +1,3 @@
{
"compilerOptions": {
"lib": ["ESNext"],
"target": "ESNext",
"outDir": "./dist",
"esModuleInterop": true,
"declarationMap": true,
"declaration": true,
"module": "commonjs",
"moduleResolution": "node",
"noUnusedLocals": true,
"forceConsistentCasingInFileNames": true,
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"sourceMap": false,
"noImplicitReturns": true,
"strictNullChecks": true,
"strictFunctionTypes": true,
"noImplicitThis": true,
"allowJs": true,
"skipLibCheck": true,
"baseUrl": ".",
"resolveJsonModule": true,
"paths": {
},
},
"include": ["src"],
"exclude": [
"dist",
"node_modules"
]
"extends": "../../../_tsconfig.base.json"
}
@@ -163,6 +163,7 @@ export function medusaIntegrationTestRunner({
const { logger, container, MedusaAppLoader } = await import(
"@medusajs/framework"
)
const appLoader = new MedusaAppLoader()
container.register({
[ContainerRegistrationKeys.LOGGER]: asValue(logger),
+2 -17
View File
@@ -1,17 +1,2 @@
module.exports = {
transform: {
"^.+\\.[jt]s$": [
"@swc/jest",
{
jsc: {
parser: { syntax: "typescript", decorators: true },
transform: { decoratorMetadata: true },
target: "ES2021",
},
},
],
},
testPathIgnorePatterns: [`dist/`, `node_modules/`],
testEnvironment: `node`,
moduleFileExtensions: [`js`, `ts`],
}
const defineJestConfig = require("../../../define_jest_config")
module.exports = defineJestConfig()
@@ -1,5 +1,6 @@
import { MedusaContainer, ModuleProvider } from "@medusajs/types"
import {
dynamicImport,
isString,
lowerCaseFirst,
normalizeImportPathWithSource,
@@ -44,7 +45,7 @@ export async function loadModuleProvider(
if (isString(provider.resolve)) {
const normalizedPath = normalizeImportPathWithSource(provider.resolve)
loadedProvider = await import(normalizedPath)
loadedProvider = await dynamicImport(normalizedPath)
}
} catch (error) {
throw new Error(
@@ -11,11 +11,13 @@ import {
} from "@medusajs/types"
import {
ContainerRegistrationKeys,
DmlEntity,
MedusaModuleType,
ModulesSdkUtils,
createMedusaContainer,
defineJoinerConfig,
DmlEntity,
dynamicImport,
MedusaModuleType,
ModulesSdkUtils,
resolveExports,
toMikroOrmEntities,
} from "@medusajs/utils"
import { asFunction, asValue } from "awilix"
@@ -65,7 +67,7 @@ export async function loadInternalModule(
// If we want to benefit from the auto load mechanism, even if the module exports is provided, we need to ask for the module path
loadedModule = resolution.moduleExports
} else {
loadedModule = await import(modulePath)
loadedModule = await dynamicImport(modulePath)
loadedModule = (loadedModule as any).default
}
} catch (error) {
@@ -195,7 +197,8 @@ export async function loadModuleMigrations(
let loadedModule: ModuleExports
try {
loadedModule =
moduleExports ?? (await import(resolution.resolutionPath as string))
moduleExports ??
(await dynamicImport(resolution.resolutionPath as string))
let runMigrations = loadedModule.runMigrations
let revertMigration = loadedModule.revertMigration
@@ -263,7 +266,7 @@ async function importAllFromDir(path: string) {
return (
await Promise.all(filesToLoad.map((filePath) => import(filePath)))
).flatMap((value) => {
return Object.values(value)
return Object.values(resolveExports(value))
})
}
@@ -284,7 +287,9 @@ export async function loadResources(
}
const [moduleService, services, models, repositories] = await Promise.all([
import(modulePath).then((moduleExports) => moduleExports.default.service),
import(modulePath).then((moduleExports) => {
return resolveExports(moduleExports).default.service
}),
importAllFromDir(resolve(normalizedPath, "services")).catch(
defaultOnFail
),
+9 -8
View File
@@ -18,12 +18,13 @@ import {
} from "@medusajs/types"
import {
ContainerRegistrationKeys,
createMedusaContainer,
dynamicImport,
isObject,
isString,
MedusaError,
Modules,
ModulesSdkUtils,
createMedusaContainer,
isObject,
isString,
promiseAll,
} from "@medusajs/utils"
import type { Knex } from "@mikro-orm/knex"
@@ -36,7 +37,7 @@ import {
RegisterModuleJoinerConfig,
} from "./medusa-module"
import { RemoteLink } from "./remote-link"
import { RemoteQuery, createQuery } from "./remote-query"
import { createQuery, RemoteQuery } from "./remote-query"
import { MODULE_RESOURCE_TYPE, MODULE_SCOPE } from "./types"
import { cleanGraphQLSchema } from "./utils"
@@ -171,7 +172,7 @@ async function initializeLinks({
}) {
try {
const { initialize, getMigrationPlanner } =
moduleExports ?? (await import(LinkModulePackage))
moduleExports ?? (await dynamicImport(LinkModulePackage))
const linkResolution = await initialize(
config,
@@ -298,9 +299,9 @@ async function MedusaApp_({
const modules: MedusaModuleConfig =
modulesConfig ??
(
await import(
modulesConfigPath ??
process.cwd() + (modulesConfigFileName ?? "/modules-config")
await dynamicImport(
await (modulesConfigPath ??
process.cwd() + (modulesConfigFileName ?? "/modules-config"))
)
).default
+1 -26
View File
@@ -1,28 +1,3 @@
{
"compilerOptions": {
"lib": ["es2021"],
"target": "es2021",
"outDir": "./dist",
"esModuleInterop": true,
"declarationMap": true,
"declaration": true,
"module": "commonjs",
"moduleResolution": "node",
"noUnusedLocals": true,
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"forceConsistentCasingInFileNames": true,
"sourceMap": true,
"noImplicitReturns": true,
"strictNullChecks": true,
"strictFunctionTypes": true,
"noImplicitThis": true,
"allowJs": true,
"skipLibCheck": true
},
"include": ["src"],
"exclude": [
"dist",
"node_modules"
]
"extends": "../../../_tsconfig.base.json"
}
+2 -24
View File
@@ -1,24 +1,2 @@
module.exports = {
transform: {
"^.+\\.[jt]s$": [
"@swc/jest",
{
jsc: {
parser: {
syntax: "typescript",
decorators: true,
},
transform: {
useDefineForClassFields: false,
legacyDecorator: true,
decoratorMetadata: true,
},
target: "ES2021",
},
},
],
},
testPathIgnorePatterns: [`dist/`, `node_modules/`],
testEnvironment: `node`,
moduleFileExtensions: [`js`, `ts`],
}
const defineJestConfig = require("../../../define_jest_config")
module.exports = defineJestConfig()
+1 -26
View File
@@ -1,28 +1,3 @@
{
"compilerOptions": {
"lib": ["es2021"],
"target": "es2021",
"outDir": "./dist",
"esModuleInterop": true,
"declarationMap": true,
"declaration": true,
"module": "commonjs",
"moduleResolution": "node",
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"noUnusedLocals": true,
"forceConsistentCasingInFileNames": true,
"sourceMap": true,
"noImplicitReturns": true,
"strictNullChecks": true,
"strictFunctionTypes": true,
"noImplicitThis": true,
"allowJs": true,
"skipLibCheck": true
},
"include": ["src"],
"exclude": [
"dist",
"node_modules"
]
"extends": "../../../_tsconfig.base.json"
}
+2 -24
View File
@@ -1,24 +1,2 @@
module.exports = {
transform: {
"^.+\\.[jt]s$": [
"@swc/jest",
{
jsc: {
parser: {
syntax: "typescript",
decorators: true,
},
transform: {
useDefineForClassFields: false,
legacyDecorator: true,
decoratorMetadata: true,
},
target: "ES2021",
},
},
],
},
testPathIgnorePatterns: [`dist/`, `node_modules/`],
testEnvironment: `node`,
moduleFileExtensions: [`js`, `ts`],
}
const defineJestConfig = require("../../../define_jest_config")
module.exports = defineJestConfig()
@@ -4,6 +4,7 @@ import {
} from "../modules-sdk"
import type { RedisOptions } from "ioredis"
// @ts-ignore
import type { InlineConfig } from "vite"
/**
+1 -26
View File
@@ -1,28 +1,3 @@
{
"compilerOptions": {
"lib": ["es2021"],
"target": "es2021",
"outDir": "./dist",
"esModuleInterop": true,
"declarationMap": true,
"declaration": true,
"module": "commonjs",
"moduleResolution": "node",
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"noUnusedLocals": true,
"forceConsistentCasingInFileNames": true,
"sourceMap": true,
"noImplicitReturns": true,
"strictNullChecks": true,
"strictFunctionTypes": true,
"noImplicitThis": true,
"allowJs": true,
"skipLibCheck": true
},
"include": ["src"],
"exclude": [
"dist",
"node_modules"
]
"extends": "../../../_tsconfig.base.json"
}
+2 -24
View File
@@ -1,24 +1,2 @@
module.exports = {
transform: {
"^.+\\.[jt]s$": [
"@swc/jest",
{
jsc: {
parser: {
syntax: "typescript",
decorators: true,
},
transform: {
useDefineForClassFields: false,
legacyDecorator: true,
decoratorMetadata: true,
},
target: "ES2021",
},
},
],
},
testPathIgnorePatterns: [`dist/`, `node_modules/`],
testEnvironment: `node`,
moduleFileExtensions: [`js`, `ts`],
}
const defineJestConfig = require("../../../define_jest_config")
module.exports = defineJestConfig()
@@ -0,0 +1,17 @@
import { resolveExports } from "./resolve-exports"
/**
* Utility that should be used instead of either await import() or require()
* to avoid bundling issues. That way we have a single place
* where we manage the strategy to dynamically import a module.
*
* This issue arise from migration to Node16 or NodeNext module resolution as well
* as ts-node not being maintained anymore and throwing deprecation warnings.
* all over the place.
*
* @param path
*/
export async function dynamicImport(path: string): Promise<any> {
const module = require(path)
return resolveExports(module)
}
+2
View File
@@ -72,3 +72,5 @@ export * from "./trim-zeros"
export * from "./upper-case-first"
export * from "./validate-handle"
export * from "./wrap-handler"
export * from "./resolve-exports"
export * from "./dynamic-import"
@@ -0,0 +1,6 @@
export function resolveExports(moduleExports) {
if ("default" in moduleExports && "default" in moduleExports.default) {
return resolveExports(moduleExports.default)
}
return moduleExports
}
@@ -1,7 +1,9 @@
import { ModuleServiceInitializeOptions } from "@medusajs/types"
import { Filter as MikroORMFilter } from "@mikro-orm/core"
import { TSMigrationGenerator } from "@mikro-orm/migrations"
import { ModuleServiceInitializeOptions } from "@medusajs/types"
import { isString } from "../../common"
import { FilterDef } from "@mikro-orm/core/typings"
type FilterDef = Parameters<typeof MikroORMFilter>[0]
export class CustomTsMigrationGenerator extends TSMigrationGenerator {
createStatement(sql: string, padLeft: number): string {
@@ -1,7 +1,11 @@
import { EntityClass, EntityProperty } from "@mikro-orm/core/typings"
import { EntityMetadata, EntitySchema, ReferenceType } from "@mikro-orm/core"
import { SqlEntityManager } from "@mikro-orm/postgresql"
import type { FindOneOptions, FindOptions } from "@mikro-orm/core/drivers"
import type {
FindOptions,
EntityClass,
EntityProperty,
FindOneOptions,
} from "@mikro-orm/core"
export const FreeTextSearchFilterKey = "freeTextSearch"
@@ -16,13 +16,13 @@ import {
ReferenceType,
RequiredEntityData,
} from "@mikro-orm/core"
import { FindOptions as MikroOptions } from "@mikro-orm/core/drivers/IDatabaseDriver"
import {
EntityClass,
EntityName,
EntityProperty,
FindOptions as MikroOptions,
FilterQuery as MikroFilterQuery,
} from "@mikro-orm/core/typings"
} from "@mikro-orm/core"
import { SqlEntityManager } from "@mikro-orm/postgresql"
import {
MedusaError,
@@ -8,10 +8,10 @@ import {
Platform,
Reference,
ReferenceType,
SerializeOptions,
SerializationContext,
Utils,
} from "@mikro-orm/core"
import { SerializeOptions } from "@mikro-orm/core/serialization/EntitySerializer"
function isVisible<T extends object>(
meta: EntityMetadata<T>,
@@ -0,0 +1,8 @@
export * from "./apply-searchable"
export * from "./build-indexes"
export * from "./create-big-number-properties"
export * from "./create-default-properties"
export * from "./define-property"
export * from "./define-relationship"
export * from "./parse-entity-name"
export * from "./query-builder"
+3
View File
@@ -1,3 +1,6 @@
export * from "./entity-builder"
export * from "./entity"
export * from "./helpers/entity-builder/index"
export * from "./helpers/create-mikro-orm-entity"
export * from "./relations/index"
export * from "./properties/index"
@@ -0,0 +1,12 @@
export * from "./array"
export * from "./base"
export * from "./big-number"
export * from "./boolean"
export * from "./date-time"
export * from "./enum"
export * from "./id"
export * from "./json"
export * from "./nullable"
export * from "./number"
export * from "./primary-key"
export * from "./text"
@@ -1,5 +1,5 @@
import { BaseRelationship } from "./base"
import { NullableModifier } from "./nullable"
import { RelationNullableModifier } from "./nullable"
export class BelongsTo<T> extends BaseRelationship<T> {
type = "belongsTo" as const
@@ -12,6 +12,6 @@ export class BelongsTo<T> extends BaseRelationship<T> {
* Apply nullable modifier on the schema
*/
nullable() {
return new NullableModifier<T, BelongsTo<T>>(this)
return new RelationNullableModifier<T, BelongsTo<T>>(this)
}
}
@@ -1,5 +1,5 @@
import { BaseRelationship } from "./base"
import { NullableModifier } from "./nullable"
import { RelationNullableModifier } from "./nullable"
/**
* HasOne relationship defines a relationship between two entities
@@ -22,6 +22,6 @@ export class HasOne<T> extends BaseRelationship<T> {
* Apply nullable modifier on the schema
*/
nullable() {
return new NullableModifier<T, HasOne<T>>(this)
return new RelationNullableModifier<T, HasOne<T>>(this)
}
}
@@ -0,0 +1,6 @@
export * from "./base"
export * from "./belongs-to"
export * from "./has-many"
export * from "./has-one"
export * from "./many-to-many"
export * from "./nullable"
@@ -6,7 +6,7 @@ const IsNullableModifier = Symbol.for("isNullableModifier")
/**
* Nullable modifier marks a schema node as nullable
*/
export class NullableModifier<T, Relation extends RelationshipType<T>>
export class RelationNullableModifier<T, Relation extends RelationshipType<T>>
implements RelationshipType<T | null>
{
[IsNullableModifier]: true = true;
@@ -14,7 +14,7 @@ export class NullableModifier<T, Relation extends RelationshipType<T>>
static isNullableModifier<T>(
modifier: any
): modifier is NullableModifier<T, any> {
): modifier is RelationNullableModifier<T, any> {
return !!modifier?.[IsNullableModifier]
}
@@ -17,3 +17,5 @@ export * from "./mikro-orm-cli-config-builder"
export * from "./module"
export * from "./query-context"
export * from "./query-filter"
export * from "./types/links-config"
export * from "./types/medusa-service"
@@ -9,8 +9,7 @@ import {
PerformedActions,
UpsertWithReplaceConfig,
} from "@medusajs/types"
import { EntitySchema } from "@mikro-orm/core"
import { EntityClass } from "@mikro-orm/core/typings"
import type { EntitySchema, EntityClass } from "@mikro-orm/core"
import {
doNotForceTransaction,
isDefined,
@@ -4,6 +4,7 @@ import { EOL } from "os"
import { resolve } from "path"
import { mikroOrmCreateConnection } from "../../dal"
import { loadDatabaseConfig } from "../load-module-database-config"
import { dynamicImport } from "../../common"
/**
* Utility function to build a seed script that will insert the seed data.
@@ -42,12 +43,14 @@ export function buildSeedScript({
const logger_ = (logger ?? console) as unknown as Logger
logger_.info(`Loading seed data from ${path}...`)
const dataSeed = await import(resolve(process.cwd(), path)).catch((e) => {
logger_.error(
`Failed to load seed data from ${path}. Please, provide a relative path and check that you export the following productCategoriesData, productsData, variantsData.${EOL}${e}`
)
throw e
})
const dataSeed = await dynamicImport(resolve(process.cwd(), path)).catch(
(e) => {
logger_.error(
`Failed to load seed data from ${path}. Please, provide a relative path and check that you export the following productCategoriesData, productsData, variantsData.${EOL}${e}`
)
throw e
}
)
const dbData = loadDatabaseConfig(moduleName, options)!
const entities = Object.values(models) as unknown as EntitySchema[]
@@ -1,12 +1,12 @@
import { MikroORMOptions } from "@mikro-orm/core/utils/Configuration"
import { DmlEntity, toMikroOrmEntities } from "../dml"
import { CustomTsMigrationGenerator } from "../dal"
import type {
AnyEntity,
EntityClass,
EntitySchema,
MikroORMOptions,
EntityClassGroup,
} from "@mikro-orm/core/typings"
import type { EntitySchema } from "@mikro-orm/core/metadata/EntitySchema"
} from "@mikro-orm/core"
import { kebabCase } from "../common"
type Options = Partial<Omit<MikroORMOptions, "entities" | "entitiesTs">> & {
+1 -26
View File
@@ -1,28 +1,3 @@
{
"compilerOptions": {
"lib": ["es2021"],
"target": "es2021",
"outDir": "./dist",
"esModuleInterop": true,
"declaration": true,
"noUnusedLocals": true,
"declarationMap": true,
"module": "commonjs",
"moduleResolution": "node",
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"sourceMap": true,
"noImplicitReturns": true,
"forceConsistentCasingInFileNames": true,
"strictNullChecks": true,
"strictFunctionTypes": true,
"noImplicitThis": true,
"allowJs": true,
"skipLibCheck": true
},
"include": ["src"],
"exclude": [
"dist",
"node_modules"
]
"extends": "../../../_tsconfig.base.json"
}
+2 -24
View File
@@ -1,24 +1,2 @@
module.exports = {
transform: {
"^.+\\.[jt]s$": [
"@swc/jest",
{
jsc: {
parser: {
syntax: "typescript",
decorators: true,
},
transform: {
useDefineForClassFields: false,
legacyDecorator: true,
decoratorMetadata: true,
},
target: "ES2021",
},
},
],
},
testPathIgnorePatterns: [`dist/`, `node_modules/`],
testEnvironment: `node`,
moduleFileExtensions: [`js`, `ts`],
}
const defineJestConfig = require("../../../define_jest_config")
module.exports = defineJestConfig()
+1 -23
View File
@@ -1,25 +1,3 @@
{
"compilerOptions": {
"lib": ["es2021"],
"target": "es2021",
"outDir": "./dist",
"esModuleInterop": true,
"declaration": true,
"noUnusedLocals": true,
"declarationMap": true,
"module": "commonjs",
"moduleResolution": "node",
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"sourceMap": true,
"noImplicitReturns": true,
"forceConsistentCasingInFileNames": true,
"strictNullChecks": true,
"strictFunctionTypes": true,
"noImplicitThis": true,
"allowJs": true,
"skipLibCheck": true
},
"include": ["src"],
"exclude": ["dist", "node_modules"]
"extends": "../../../_tsconfig.base.json"
}