Skip to content

Commit

Permalink
feat: get uniDependency
Browse files Browse the repository at this point in the history
  • Loading branch information
FliPPeDround committed Apr 15, 2024
1 parent 88e0d04 commit 10c9304
Showing 1 changed file with 19 additions and 2 deletions.
21 changes: 19 additions & 2 deletions src/commands/info/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,14 @@ import { gray, link, yellow } from 'kolorist'
import { ora } from '../../utils'
import { question } from './question'

const uniDependenciesMap = {
'@uni-helper/uni-use': ['@vueuse/core'],
'@uni-helper/axios-adapter': ['axios'],
'@uni-helper/uni-preset-uni': ['unocss'],
'@uni-helper/eslint-config': ['eslint'],
'@uni-helper/vite-plugin-uni-tailwind': ['tailwindcss'],
} as Record<string, string[]>

async function getuniHelperDependencies() {
const isUniPkg = isPackageExists('@dcloudio/uni-app')
if (!isUniPkg) {
Expand Down Expand Up @@ -34,7 +42,7 @@ async function getBaseDependencies() {
if (packageInfo?.version) {
baseDependencies.push({
name,
version: packageInfo,
version: packageInfo.version,
})
}
}
Expand All @@ -57,6 +65,7 @@ async function getErrorDependencies() {
}
return errorDependencies
}

async function getVSCodeInfo() {
const vscode = await envinfo.helpers.getVSCodeInfo()
if (vscode.length !== 3)
Expand Down Expand Up @@ -143,6 +152,7 @@ export async function getUniAppInfo() {
const { errorExtensions, volarExtensions } = await getErrorExtensions()
const baseEnvInfo = await getBaseEnvInfo()
const baseDependencies = await getBaseDependencies()
console.log(baseDependencies)

Check warning on line 155 in src/commands/info/index.ts

View workflow job for this annotation

GitHub Actions / lint

Unexpected console statement
const splitter = '----------------------------------------------'

let baseEnvInfoStr = ''
Expand All @@ -156,8 +166,15 @@ export async function getUniAppInfo() {
baseDependenciesStr += `- ${name}: \`${version}\`\n`

let errorDependenciesStr = ''
for (const { name, version, bugs } of errorDependencies)
for (const { name, version, bugs } of errorDependencies) {
errorDependenciesStr += `- ${link(name, bugs!)}: \`${version}\`\n`
if (uniDependenciesMap[name]) {
for (const uniDependency of uniDependenciesMap[name]) {
const { version } = await getDependenciesVersionAndBugs(uniDependency)
errorDependenciesStr += ` - ${uniDependency}: \`${version}\`\n`
}
}
}

let errorExtensionsStr = ''
for (const { name, version, bugs } of errorExtensions)
Expand Down

0 comments on commit 10c9304

Please sign in to comment.