Chore(medusa,utils,types,inventory,stock-location): remove core dependency modules (#3531)

This commit is contained in:
Carlos R. L. Rodrigues
2023-03-23 08:07:32 -03:00
committed by GitHub
parent bfef22b33e
commit 4e9d257d3b
159 changed files with 1769 additions and 693 deletions
@@ -1,11 +1,11 @@
import os from "os"
import fs from "fs/promises"
import execa from "execa"
import fs from "fs/promises"
import * as yaml from "js-yaml"
import { OpenAPIObject, SchemaObject } from "openapi3-ts"
import { OperationObject } from "openapi3-ts/src/model/OpenApi"
import os from "os"
import path from "path"
import { v4 as uid } from "uuid"
import { OpenAPIObject, SchemaObject } from "openapi3-ts"
import * as yaml from "js-yaml"
import { OperationObject } from "openapi3-ts/src/model/OpenApi"
const medusaPackagePath = path.dirname(
require.resolve("@medusajs/medusa/package.json")
@@ -209,14 +209,14 @@ describe("command oas", () => {
/** @oas [get] /store/regions
* operationId: OverwrittenOperation
*/
/**
/**
* @schema FoobarTestSchema
* type: object
* properties:
* foo:
* type: string
*/
/**
/**
* @schema StoreRegionsListRes
* type: object
* properties:
@@ -301,7 +301,7 @@ paths:
"/foobar/tests":
get:
operationId: GetFoobarTests
responses:
responses:
"200":
description: OK
"/store/regions":
@@ -357,7 +357,7 @@ components:
description: foo security
type: apiKey
name: foo-api-key
in: header
in: header
`
const targetDir = path.resolve(tmpDir, uid())
const filePath = path.resolve(targetDir, "custom.oas.base.yaml")
+14 -4
View File
@@ -1,9 +1,9 @@
import * as path from "path"
import { lstat, mkdir, writeFile } from "fs/promises"
import swaggerInline from "swagger-inline"
import OpenAPIParser from "@readme/openapi-parser"
import { OpenAPIObject } from "openapi3-ts"
import { Command, Option, OptionValues } from "commander"
import { lstat, mkdir, writeFile } from "fs/promises"
import { OpenAPIObject } from "openapi3-ts"
import * as path from "path"
import swaggerInline from "swagger-inline"
import { combineOAS } from "./utils/combine-oas"
import {
mergeBaseIntoOAS,
@@ -17,6 +17,14 @@ import {
const medusaPackagePath = path.dirname(
require.resolve("@medusajs/medusa/package.json")
)
// Types package directory
const medusaTypesPath = path.dirname(
require.resolve("@medusajs/types/package.json")
)
// Utils package directory
const medusaUtilsPath = path.dirname(
require.resolve("@medusajs/utils/package.json")
)
const basePath = path.resolve(__dirname, "../")
/**
@@ -129,6 +137,8 @@ async function getOASFromCodebase(
): Promise<OpenAPIObject> {
const gen = await swaggerInline(
[
path.resolve(medusaTypesPath, "dist"),
path.resolve(medusaUtilsPath, "dist"),
path.resolve(medusaPackagePath, "dist", "models"),
path.resolve(medusaPackagePath, "dist", "types"),
path.resolve(medusaPackagePath, "dist", "api/middlewares"),