Skip to content

Commit

Permalink
chore: update dependencies and related code
Browse files Browse the repository at this point in the history
  • Loading branch information
imba97 committed Nov 20, 2024
1 parent 6a69b71 commit 0a4654f
Show file tree
Hide file tree
Showing 8 changed files with 794 additions and 308 deletions.
7 changes: 3 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,15 +32,14 @@
"prepare": "simple-git-hooks"
},
"dependencies": {
"@initx-plugin/core": "^0.0.23",
"@initx-plugin/utils": "^0.0.23",
"@initx-plugin/core": "^0.0.25",
"@initx-plugin/utils": "^0.0.25",
"columnify": "^1.6.0",
"fs-extra": "^11.2.0",
"ora": "^8.1.1",
"picocolors": "^1.1.1"
},
"devDependencies": {
"@imba97/eslint-config": "^0.0.4",
"@imba97/eslint-config": "^0.0.5",
"@types/columnify": "^1.5.4",
"@types/fs-extra": "^11.0.4",
"@types/node": "^22.9.0",
Expand Down
1,049 changes: 772 additions & 277 deletions pnpm-lock.yaml

Large diffs are not rendered by default.

8 changes: 4 additions & 4 deletions src/add.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { c, inquirer, log } from '@initx-plugin/utils'
import { dim, gray, green, reset } from 'picocolors'

import { communityName, isCompleteMatchName, isInitxPlugin, isInstalledPlugin, loadingFunction, nameColor, officialName, searchPlugin } from './utils'
import type { PluginInfo } from './types'
import { c, inquirer, loadingFunction, log } from '@initx-plugin/utils'

import { dim, gray, green, reset } from 'picocolors'
import { communityName, isCompleteMatchName, isInitxPlugin, isInstalledPlugin, nameColor, officialName, searchPlugin } from './utils'

export async function addPlugin(targetPlugin: string) {
// search plugin
Expand Down
2 changes: 1 addition & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ import { log } from '@initx-plugin/utils'

import { addPlugin } from './add'
import { showPluginList } from './list'
import { updatePlugin } from './update'
import { removePlugin } from './remove'
import { updatePlugin } from './update'

export default class PluginManagerPlugin extends InitxPlugin {
matchers = [
Expand Down
9 changes: 5 additions & 4 deletions src/list.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
import type { PluginInfo } from './types'
import path from 'node:path'
import fs from 'fs-extra'

import { fetchPlugins } from '@initx-plugin/core'
import { loadingFunction } from '@initx-plugin/utils'

import columnify from 'columnify'
import { gray } from 'picocolors'
import fs from 'fs-extra'

import { loadingFunction, nameColor } from './utils'
import type { PluginInfo } from './types'
import { gray } from 'picocolors'
import { nameColor } from './utils'

export async function showPluginList() {
const plugins = await loadingFunction('Fetching plugins', fetchPlugins)
Expand Down
4 changes: 2 additions & 2 deletions src/remove.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { fetchPlugins } from '@initx-plugin/core'
import { c, inquirer, log } from '@initx-plugin/utils'
import { c, inquirer, loadingFunction, log } from '@initx-plugin/utils'

import { communityName, loadingFunction, nameColor, officialName } from './utils'
import { communityName, nameColor, officialName } from './utils'

export async function removePlugin(targetName: string) {
const plugins = await fetchPlugins()
Expand Down
10 changes: 5 additions & 5 deletions src/update.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import type { NeedUpdatePlugin } from './types'
import path from 'node:path'
import fs from 'fs-extra'

import { dim, gray } from 'picocolors'
import { fetchPlugins } from '@initx-plugin/core'
import { c, inquirer, log } from '@initx-plugin/utils'
import { c, inquirer, loadingFunction, log } from '@initx-plugin/utils'
import fs from 'fs-extra'

import { loadingFunction, nameColor, searchPlugin } from './utils'
import type { NeedUpdatePlugin } from './types'
import { dim, gray } from 'picocolors'
import { nameColor, searchPlugin } from './utils'

export async function updatePlugin() {
const excludedPlugins = await fetchExcludedPlugins()
Expand Down
13 changes: 2 additions & 11 deletions src/utils.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
import type { PluginInfo } from './types'
import { fetchPlugins } from '@initx-plugin/core'

import { c } from '@initx-plugin/utils'

import ora from 'ora'
import { blue, green } from 'picocolors'

import type { PluginInfo } from './types'

const installedPluginInfo = {
once: false,
names: [] as string[]
Expand All @@ -30,14 +29,6 @@ export function nameColor(name: string) {
return blue(name)
}

export async function loadingFunction<T>(message: string, fn: () => Promise<T>) {
const spinner = ora(message).start()

return fn().finally(() => {
spinner.stop()
})
}

export async function getInstalledPluginNames() {
if (installedPluginInfo.once) {
return installedPluginInfo.names
Expand Down

0 comments on commit 0a4654f

Please sign in to comment.