refactor(framework): Align configuration and fixes (#9246)

* refactor(framework): Align configuration and fixes

* refactor(framework): Align configuration and fixes

* move framework

* rm unnecessary script

* update jest config
This commit is contained in:
Adrien de Peretti
2024-09-23 13:07:30 +02:00
committed by GitHub
parent 9f72fb5902
commit 94e07c8da0
82 changed files with 42 additions and 49 deletions

View File

@@ -0,0 +1,24 @@
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`],
}

View File

@@ -5,7 +5,10 @@
"main": "dist/index.js",
"types": "dist/index.d.ts",
"files": [
"dist"
"dist",
"!dist/**/__tests__",
"!dist/**/__mocks__",
"!dist/**/__fixtures__"
],
"exports": {
".": "./dist/index.js",
@@ -31,11 +34,10 @@
"author": "Medusa",
"license": "MIT",
"scripts": {
"watch": "tsc --watch -p ./tsconfig.build.json",
"watch:test": "tsc --build tsconfig.spec.json --watch",
"build": "rimraf dist && tsc -p ./tsconfig.spec.json --noEmit && tsc -p ./tsconfig.build.json && tsc-alias -p ./tsconfig.build.json",
"test": "jest --runInBand --bail --passWithNoTests --forceExit -- src",
"test:integration": "jest --forceExit -- integration-tests/**/__tests__/**/*.ts"
"watch": "tsc --watch ",
"watch:test": "tsc --watch",
"build": "rimraf dist && tsc --build",
"test": "jest --runInBand --bail --passWithNoTests --forceExit"
},
"devDependencies": {
"@medusajs/orchestration": "^0.5.7",
@@ -43,10 +45,11 @@
"@types/express": "^4.17.17",
"@types/jsonwebtoken": "^8.5.9",
"cross-env": "^7.0.3",
"jest": "^29.7.0",
"rimraf": "^3.0.2",
"supertest": "^4.0.2",
"tsc-alias": "^1.8.6",
"typescript": "^5.1.6",
"typescript": "^5.6.2",
"vite": "^5.2.11"
},
"dependencies": {

View File

@@ -1,4 +1,4 @@
import { NextFunction, Request, Response } from "express"
import { Request, Response } from "express"
export function GET(req: Request, res: Response) {
res.send("list customers")

View File

@@ -74,7 +74,7 @@ export class MedusaAppLoader {
}
)
const configModules = { ...modulesConfig } ?? {}
const configModules = { ...modulesConfig }
for (const defaultModule of defaultModules as ModuleDefinition[]) {
configModules[defaultModule.key] ??=

View File

@@ -8,6 +8,8 @@
"declaration": true,
"module": "commonjs",
"moduleResolution": "node",
"noUnusedLocals": true,
"forceConsistentCasingInFileNames": true,
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"sourceMap": false,
@@ -17,7 +19,6 @@
"noImplicitThis": true,
"allowJs": true,
"skipLibCheck": true,
"downlevelIteration": true,
"baseUrl": ".",
"resolveJsonModule": true,
"paths": {

View File

@@ -1,17 +0,0 @@
module.exports = {
moduleNameMapper: {},
transform: {
"^.+\\.[jt]s$": [
"@swc/jest",
{
jsc: {
parser: { syntax: "typescript", decorators: true },
transform: { decoratorMetadata: true },
},
},
],
},
testEnvironment: `node`,
moduleFileExtensions: [`js`, `ts`],
modulePathIgnorePatterns: ["dist/"],
}

View File

@@ -1,11 +0,0 @@
{
"extends": "./tsconfig.json",
"include": ["src"],
"exclude": [
"dist",
"src/**/__tests__",
"src/**/__mocks__",
"src/**/__fixtures__",
"node_modules"
],
}

View File

@@ -1,8 +0,0 @@
{
"extends": "./tsconfig.json",
"include": ["src", "integration-tests"],
"exclude": ["node_modules", "dist"],
"compilerOptions": {
"sourceMap": true
}
}

View File

@@ -5921,9 +5921,9 @@ __metadata:
languageName: unknown
linkType: soft
"@medusajs/framework@^0.0.1, @medusajs/framework@workspace:packages/framework/framework":
"@medusajs/framework@^0.0.1, @medusajs/framework@workspace:packages/core/framework":
version: 0.0.0-use.local
resolution: "@medusajs/framework@workspace:packages/framework/framework"
resolution: "@medusajs/framework@workspace:packages/core/framework"
dependencies:
"@medusajs/medusa-cli": ^1.3.22
"@medusajs/modules-sdk": ^1.12.11
@@ -5941,13 +5941,14 @@ __metadata:
express-session: ^1.17.3
ioredis: ^5.4.1
ioredis-mock: 8.4.0
jest: ^29.7.0
jsonwebtoken: ^9.0.2
medusa-telemetry: ^0.0.17
morgan: ^1.9.1
rimraf: ^3.0.2
supertest: ^4.0.2
tsc-alias: ^1.8.6
typescript: ^5.1.6
typescript: ^5.6.2
vite: ^5.2.11
zod: 3.22.4
peerDependencies: