chore: perform dependencies scan and fix all dependencies (#9296)

This commit is contained in:
Harminder Virk
2024-09-26 14:14:38 +05:30
committed by GitHub
parent fba78c0fb1
commit 48bea267dc
593 changed files with 2729 additions and 2314 deletions

View File

@@ -1,5 +1,2 @@
module.exports = {
transform: { "^.+\\.[jt]s$": ["@swc/jest"] },
testEnvironment: `node`,
moduleFileExtensions: [`js`, `jsx`, `ts`, `tsx`, `json`],
}
const defineJestConfig = require("../../../define_jest_config")
module.exports = defineJestConfig()

View File

@@ -16,10 +16,13 @@
},
"files": [
"dist",
"cli.js"
"cli.js",
"!dist/**/__tests__",
"!dist/**/__mocks__",
"!dist/**/__fixtures__"
],
"engines": {
"node": ">=16"
"node": ">=20"
},
"scripts": {
"test": "jest --passWithNoTests src",
@@ -29,17 +32,24 @@
"author": "Sebastian Rindom",
"license": "MIT",
"devDependencies": {
"@swc/core": "^1.5.29",
"@swc/core": "^1.7.28",
"@swc/jest": "^0.2.36",
"@types/yargs": "^15.0.15",
"cross-env": "^5.2.1",
"jest": "^29.7.0",
"rimraf": "^5.0.1",
"typescript": "^5.3.3"
"rimraf": "^6.0.1",
"ts-node": "^10.9.2",
"typescript": "^5.6.2"
},
"peerDependencies": {
"ts-node": "^10.9.2"
},
"peerDependenciesMeta": {
"ts-node": {
"optional": true
}
},
"dependencies": {
"@medusajs/utils": "^1.11.9",
"axios": "^0.21.4",
"@medusajs/utils": "1.11.9",
"chalk": "^4.0.0",
"configstore": "5.0.1",
"dotenv": "^16.4.5",
@@ -52,19 +62,15 @@
"is-valid-path": "^0.1.1",
"meant": "^1.0.3",
"medusa-telemetry": "^0.0.17",
"open": "^8.0.6",
"ora": "^5.4.1",
"pg": "^8.11.3",
"pg-god": "^1.0.12",
"prompts": "^2.4.2",
"resolve-cwd": "^3.0.0",
"semver": "^7.3.8",
"stack-trace": "^0.0.10",
"ulid": "^2.3.0",
"winston": "^3.8.2",
"yargs": "^15.3.1"
},
"peerDependencies": {
"ulid": "^2.3.0"
},
"gitHead": "81a7ff73d012fda722f6e9ef0bd9ba0232d37808"
}

View File

@@ -12,9 +12,10 @@ import sysPath from "path"
import prompts from "prompts"
import { Pool } from "pg"
import url from "url"
// @ts-ignore
import inquirer from "inquirer"
import { createDatabase } from "pg-god"
import { track } from "medusa-telemetry"
import inquirer from "inquirer"
import reporter from "../reporter"
import { getPackageManager, setPackageManager } from "../util/package-manager"
@@ -180,7 +181,10 @@ const clone = async (hostInfo, rootPath, v2 = false, inputBranch) => {
url = hostInfo.https({ noCommittish: true, noGitPlus: true })
}
let branch = (inputBranch || hostInfo.committish ? [`-b`, inputBranch || hostInfo.committish] : [])
let branch =
inputBranch || hostInfo.committish
? [`-b`, inputBranch || hostInfo.committish]
: []
if (v2) {
branch = [`-b`, inputBranch || "feat/v2"]
@@ -215,24 +219,6 @@ const clone = async (hostInfo, rootPath, v2 = false, inputBranch) => {
if (!isGit) await createInitialGitCommit(rootPath, url)
}
const getMedusaConfig = (rootPath) => {
try {
const configPath = sysPath.join(rootPath, "medusa-config.js")
if (existsSync(configPath)) {
const resolved = sysPath.resolve(configPath)
const configModule = require(resolved)
return configModule
}
throw Error()
} catch (err) {
console.log(err)
reporter.warn(
`Couldn't find a medusa-config.js file; please double check that you have the correct starter installed`
)
}
return {}
}
const getPaths = async (starterPath, rootPath, v2 = false) => {
let selectedOtherStarter = false
@@ -515,7 +501,9 @@ const attemptSeed = async (rootPath) => {
export const newStarter = async (args) => {
const nodeVersion = getNodeVersion()
if (nodeVersion < MIN_SUPPORTED_NODE_VERSION) {
reporter.error(`Medusa requires at least v20 of Node.js. You're using v${nodeVersion}. Please install at least v20 and try again: https://nodejs.org/en/download`)
reporter.error(
`Medusa requires at least v20 of Node.js. You're using v${nodeVersion}. Please install at least v20 and try again: https://nodejs.org/en/download`
)
process.exit(1)
}
track("CLI_NEW")
@@ -534,7 +522,7 @@ export const newStarter = async (args) => {
dbPort,
dbHost,
v2,
branch
branch,
} = args
const dbCredentials = removeUndefined({
@@ -656,7 +644,7 @@ medusa new ${rootPath} [url-to-starter]
// remove demo files
clearProject(rootPath)
// remove .git directory
fs.rmSync(path.join(rootPath, '.git'), {
fs.rmSync(path.join(rootPath, ".git"), {
recursive: true,
force: true,
})

View File

@@ -15,11 +15,6 @@ if (os.platform() === `win32`) {
// ensureWindowsDriveLetterIsUppercase()
}
// Check if update is available
// updateNotifier({ pkg }).notify({ isGlobal: true })
const MIN_NODE_VERSION = `10.13.0`
process.on(`unhandledRejection`, (reason) => {
// This will exit the process in newer Node anyway so lets be consistent
// across versions and crash

View File

@@ -3,8 +3,6 @@ import ora from "ora"
import stackTrace from "stack-trace"
import { ulid } from "ulid"
import winston from "winston"
import * as Transport from "winston-transport"
import { panicHandler } from "./panic-handler"
const LOG_LEVEL = process.env.LOG_LEVEL || "info"
@@ -12,7 +10,7 @@ const LOG_FILE = process.env.LOG_FILE || ""
const NODE_ENV = process.env.NODE_ENV || "development"
const IS_DEV = NODE_ENV.startsWith("dev")
let transports: Transport[] = []
let transports: winston.transport[] = []
if (!IS_DEV) {
transports.push(new winston.transports.Console())

View File

@@ -1,3 +1,4 @@
// @ts-ignore
import ConfigStore from "configstore"
import reporter from "../reporter"

View File

@@ -1,30 +1,3 @@
{
"compilerOptions": {
"lib": ["es2021"],
"target": "es2021",
"outDir": "./dist",
"esModuleInterop": true,
"declarationMap": true,
"declaration": true,
"module": "commonjs",
"moduleResolution": "node",
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"sourceMap": true,
"noImplicitReturns": true,
"strictNullChecks": true,
"strictFunctionTypes": true,
"noImplicitThis": true,
"allowJs": true,
"skipLibCheck": true,
"downlevelIteration": true // to use ES5 specific tooling
},
"include": ["src"],
"exclude": [
"dist",
"./src/**/__tests__",
"./src/**/__mocks__",
"./src/**/__fixtures__",
"node_modules"
]
"extends": "../../../_tsconfig.base.json"
}

View File

@@ -1,5 +0,0 @@
{
"extends": "./tsconfig.json",
"include": ["src"],
"exclude": ["node_modules"]
}