Skip to content

Commit

Permalink
Merge pull request #94 from Avivbens/support-open-docs-link-select-list
Browse files Browse the repository at this point in the history
support open docs link select list
  • Loading branch information
Avivbens authored May 10, 2024
2 parents a9ab20d + 3b0e57c commit 063c8a5
Show file tree
Hide file tree
Showing 38 changed files with 877 additions and 1,170 deletions.
1,307 changes: 226 additions & 1,081 deletions package-lock.json

Large diffs are not rendered by default.

5 changes: 4 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,13 @@
"docs:preview": "vitepress preview docs"
},
"dependencies": {
"@inquirer/core": "^8.1.0",
"@nestjs/axios": "^3.0.2",
"@nestjs/common": "^10.3.7",
"@nestjs/core": "^10.3.7",
"ansi-escapes": "^4.3.2",
"boxen": "^5.1.2",
"chalk": "^4.1.2",
"eslint-plugin-jsonc": "^2.15.1",
"inquirer": "^8.2.6",
"jsonc-eslint-parser": "^2.4.0",
Expand Down Expand Up @@ -135,4 +138,4 @@
"^@commands/(.*)$": "<rootDir>/commands/$1"
}
}
}
}
5 changes: 3 additions & 2 deletions src/app.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,9 @@ import { ShellCommand } from '@commands/shell/shell.command'
import { UpdateCommand } from '@commands/update/update.command'
import { HttpModule } from '@nestjs/axios'
import { Module } from '@nestjs/common'
import { LoggerModule } from '@services/logger/logger.module'
import { CheckUpdateService } from './services/check-update.service'
import { LoggerService } from './services/logger.service'
import { LoggerService } from './services/logger/logger.service'

const COMMANDS = [
InitCommand,
Expand All @@ -21,7 +22,7 @@ const COMMANDS = [
]

@Module({
imports: [HttpModule],
imports: [HttpModule, LoggerModule.register()],
providers: [LoggerService, CheckUpdateService, ...COMMANDS],
})
export class AppModule {}
5 changes: 2 additions & 3 deletions src/commands/assets/assets.command.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { Command, CommandRunner } from 'nest-commander'
import { mkdir, readdir, writeFile } from 'node:fs/promises'
import { execPromise } from '@common/utils'
import { CheckUpdateService } from '@services/check-update.service'
import { LoggerService } from '@services/logger.service'
import { InjectLogger, LoggerService } from '@services/logger'
import type { AvailableActionIds } from './config/ constants.config'
import { GIT_PROFILES_TARGET, HELP_BOX_MESSAGE, NPM_PROFILES_TARGET } from './config/ constants.config'
import {
Expand All @@ -25,11 +25,10 @@ import { replaceInTemplate } from './template-handle/replace-in-template'
})
export class AssetsCommand extends CommandRunner {
constructor(
private readonly logger: LoggerService,
@InjectLogger(AssetsCommand.name) private readonly logger: LoggerService,
private readonly checkUpdateService: CheckUpdateService,
) {
super()
this.logger.setContext(AssetsCommand.name)
}

async run(inputs: string[], options: unknown): Promise<void> {
Expand Down
5 changes: 2 additions & 3 deletions src/commands/external/sub-commands/delete.sub-command.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { CommandRunner, SubCommand } from 'nest-commander'
import { readdir, rm } from 'node:fs/promises'
import { CheckUpdateService } from '@services/check-update.service'
import { LoggerService } from '@services/logger.service'
import { InjectLogger, LoggerService } from '@services/logger'
import { EXTERNAL_REGISTRY_DIR_PATH } from '../config/constants'

@SubCommand({
Expand All @@ -11,11 +11,10 @@ import { EXTERNAL_REGISTRY_DIR_PATH } from '../config/constants'
})
export class DeleteSubCommand extends CommandRunner {
constructor(
private readonly logger: LoggerService,
@InjectLogger(DeleteSubCommand.name) private readonly logger: LoggerService,
private readonly checkUpdateService: CheckUpdateService,
) {
super()
this.logger.setContext(DeleteSubCommand.name)
}

async run(inputs: string[], options: Record<string, unknown>): Promise<void> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import type { TestingModule } from '@nestjs/testing'
import { Test } from '@nestjs/testing'
import { CheckUpdateService } from '@services/check-update.service'
import { LoggerService } from '@services/logger.service'
import { loggerMockCreator } from '@services/logger/testing/logger.mock'
import { InstallSubCommand } from './install.sub-command'

describe('InstallSubCommand', () => {
Expand All @@ -12,10 +12,7 @@ describe('InstallSubCommand', () => {
const module: TestingModule = await Test.createTestingModule({
providers: [
InstallSubCommand,
{
provide: LoggerService,
useValue: { setContext: jest.fn() },
},
loggerMockCreator(InstallSubCommand.name),
{
provide: CheckUpdateService,
useValue: { checkUpdate: jest.fn() },
Expand Down
4 changes: 2 additions & 2 deletions src/commands/external/sub-commands/install.sub-command.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { CommandRunner, SubCommand } from 'nest-commander'
import { existsSync } from 'node:fs'
import { copyFile, readdir } from 'node:fs/promises'
import { CheckUpdateService } from '@services/check-update.service'
import { LoggerService } from '@services/logger.service'
import { InjectLogger, LoggerService } from '@services/logger'
import { EXTERNAL_REGISTRY_DIR_PATH } from '../config/constants'

@SubCommand({
Expand All @@ -17,7 +17,7 @@ import { EXTERNAL_REGISTRY_DIR_PATH } from '../config/constants'
})
export class InstallSubCommand extends CommandRunner {
constructor(
private readonly logger: LoggerService,
@InjectLogger(InstallSubCommand.name) private readonly logger: LoggerService,
private readonly checkUpdateService: CheckUpdateService,
) {
super()
Expand Down
4 changes: 2 additions & 2 deletions src/commands/external/sub-commands/list.sub-command.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { CommandRunner, SubCommand } from 'nest-commander'
import { readdir } from 'node:fs/promises'
import { CheckUpdateService } from '@services/check-update.service'
import { LoggerService } from '@services/logger.service'
import { InjectLogger, LoggerService } from '@services/logger'
import { EXTERNAL_REGISTRY_DIR_PATH } from '../config/constants'

@SubCommand({
Expand All @@ -11,7 +11,7 @@ import { EXTERNAL_REGISTRY_DIR_PATH } from '../config/constants'
})
export class ListSubCommand extends CommandRunner {
constructor(
private readonly logger: LoggerService,
@InjectLogger(ListSubCommand.name) private readonly logger: LoggerService,
private readonly checkUpdateService: CheckUpdateService,
) {
super()
Expand Down
4 changes: 2 additions & 2 deletions src/commands/init/init.command.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import ora from 'ora'
import { BASE_PATH } from '@common/constants'
import { copyBundledAsset, execPromise, resolveBundledAsset } from '@common/utils'
import { CheckUpdateService } from '@services/check-update.service'
import { LoggerService } from '@services/logger.service'
import { InjectLogger, LoggerService } from '@services/logger'
import {
BREW_DIRECTORY,
BREW_INSTALLATION_COMMAND,
Expand All @@ -25,7 +25,7 @@ import { LINK_SHELL_COMMAND, LINK_SHELL_COMMAND_EXISTS } from './config/link-com
})
export class InitCommand extends CommandRunner {
constructor(
private readonly logger: LoggerService,
@InjectLogger(InitCommand.name) private readonly logger: LoggerService,
private readonly checkUpdateService: CheckUpdateService,
) {
super()
Expand Down
34 changes: 33 additions & 1 deletion src/commands/install/config/apps-groups/apps.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
import type { IAppSetup } from '@models/app-setup.model'
import { BREW_CASK, BREW_INSTALL, BROW_CASK, OPEN_APP_STORE_APP_LINK, OPEN_BROWSER_LINK } from '../common-commands'
import {
BREW_CASK,
BREW_HOME,
BREW_INSTALL,
BROW_CASK,
OPEN_APP_STORE_APP_LINK,
OPEN_BROWSER_LINK,
} from '../common-commands'

export const APPS: Readonly<IAppSetup[]> = [
{
Expand All @@ -8,6 +15,7 @@ export const APPS: Readonly<IAppSetup[]> = [
description: 'Productivity app, create custom shortcuts and workflows (paid)',
tags: ['productivity'],
paid: true,
openUrl: () => BREW_HOME('alfred', true),
commands: () => [BREW_CASK('alfred')],
},
{
Expand All @@ -16,50 +24,59 @@ export const APPS: Readonly<IAppSetup[]> = [
description: 'Hide menu bar icons and manage them (paid)',
tags: ['productivity'],
paid: true,
openUrl: () => BREW_HOME('bartender', true),
commands: () => [BREW_CASK('bartender')],
},
{
name: 'Google Drive',
description: 'Cloud storage service by Google (password needed)',
group: 'apps',
default: true,
openUrl: () => BREW_HOME('google-drive', true),
commands: () => [BREW_CASK('google-drive')],
},
{
name: 'Rectangle',
group: 'apps',
description: 'Move and resize windows in macOS using keyboard shortcuts',
tags: ['productivity'],
openUrl: () => BREW_HOME('rectangle', true),
commands: () => [BREW_CASK('rectangle')],
},
{
name: 'MonitorControl',
group: 'apps',
description: 'Tool to control external monitor brightness and volume',
openUrl: () => BREW_HOME('monitorcontrol', true),
commands: () => [BREW_CASK('monitorcontrol')],
},
{
name: 'Slack',
group: 'apps',
tags: ['work'],
openUrl: () => BREW_HOME('slack', true),
commands: () => [BREW_CASK('slack')],
},
{
name: 'UTM',
group: 'apps',
description: 'Virtual machine MacOS',
openUrl: () => BREW_HOME('utm', true),
commands: () => [BREW_CASK('utm')],
},
{
name: '1Password',
group: 'apps',
tags: ['personal', 'work'],
paid: true,
openUrl: () => BREW_HOME('1password', true),
commands: () => [BREW_CASK('1password')],
},
{
name: 'Grammarly',
group: 'apps',
default: true,
openUrl: () => BREW_HOME('grammarly-desktop', true),
commands: () => [BREW_CASK('grammarly-desktop')],
},
{
Expand All @@ -68,6 +85,7 @@ export const APPS: Readonly<IAppSetup[]> = [
group: 'apps',
tags: ['productivity'],
paid: true,
openUrl: () => BREW_HOME('cleanshot', true),
commands: () => [BREW_CASK('cleanshot')],
},
{
Expand All @@ -76,6 +94,7 @@ export const APPS: Readonly<IAppSetup[]> = [
group: 'apps',
tags: ['super-user'],
paid: true,
openUrl: () => `open https://pasteapp.io/`,
commands: () => [OPEN_APP_STORE_APP_LINK('paste-endless-clipboard/id967805235')],
},
{
Expand All @@ -84,6 +103,7 @@ export const APPS: Readonly<IAppSetup[]> = [
group: 'apps',
tags: ['super-user'],
paid: true,
openUrl: () => `open https://lowtechguys.com/rcmd/`,
commands: () => [OPEN_APP_STORE_APP_LINK('rcmd-app-switcher/id1596283165')],
},
{
Expand All @@ -98,6 +118,7 @@ export const APPS: Readonly<IAppSetup[]> = [
description: 'Easy window resize & organize',
group: 'apps',
tags: ['super-user'],
openUrl: () => `open https://folivora.ai/bettersnaptool`,
commands: () => [OPEN_APP_STORE_APP_LINK('bettersnaptool/id417375580')],
},
{
Expand All @@ -106,20 +127,23 @@ export const APPS: Readonly<IAppSetup[]> = [
group: 'apps',
tags: ['productivity'],
paid: true,
openUrl: () => BREW_HOME('textsniper', true),
commands: () => [BREW_CASK('textsniper')],
},
{
name: 'Rocket',
description: 'Emoji shortcuts for faster typing',
group: 'apps',
tags: ['productivity'],
openUrl: () => BREW_HOME('rocket', true),
commands: () => [BREW_CASK('rocket')],
},
{
name: 'TinkerTool',
description: 'Access hidden system settings on macOS',
group: 'apps',
tags: ['super-user'],
openUrl: () => `open https://www.bresink.com/osx/TinkerTool.html`,
commands: () => [OPEN_BROWSER_LINK('https://www.bresink.com/osx/0TinkerTool/download.php')],
},
{
Expand All @@ -128,31 +152,36 @@ export const APPS: Readonly<IAppSetup[]> = [
group: 'apps',
tags: ['super-user'],
paid: true,
openUrl: () => `open https://dropoverapp.com/`,
commands: () => [OPEN_APP_STORE_APP_LINK('dropover-easier-drag-drop/id1355679052')],
},
{
name: 'Hovrly',
description: 'Easily see time zones in your menu bar',
group: 'apps',
openUrl: () => BREW_HOME('hovrly'),
commands: () => [BREW_INSTALL('hovrly')],
},
{
name: 'Notion',
group: 'apps',
tags: ['productivity'],
openUrl: () => BREW_HOME('notion', true),
commands: () => [BREW_CASK('notion')],
},
{
name: 'WhatsApp',
group: 'apps',
tags: ['personal'],
openUrl: () => BREW_HOME('whatsapp', true),
commands: () => [BREW_CASK('whatsapp')],
fallbackCommands: () => [BROW_CASK('whatsapp')],
},
{
name: 'WhatsApp (legacy)',
description: 'WhatsApp legacy version',
group: 'apps',
openUrl: () => BREW_HOME('whatsapp', true),
commands: () => [
BREW_CASK(
'https://raw.githubusercontent.com/Homebrew/homebrew-cask/2f428f0d63c346637aafd8a8b2f474670c2e42f1/Casks/w/whatsapp.rb',
Expand All @@ -168,20 +197,23 @@ export const APPS: Readonly<IAppSetup[]> = [
name: 'Telegram',
group: 'apps',
tags: ['personal'],
openUrl: () => BREW_HOME('telegram', true),
commands: () => [BREW_CASK('telegram')],
fallbackCommands: () => [BROW_CASK('telegram')],
},
{
name: 'Dash',
group: 'apps',
description: 'Documentation browser',
openUrl: () => BREW_HOME('dash', true),
commands: () => [BREW_CASK('dash')],
},
{
name: 'Vivid',
group: 'apps',
description: 'Unlocks the full brightness of your MacBook Pro (paid)',
paid: true,
openUrl: () => BREW_HOME('vivid', true),
commands: () => [BREW_CASK('vivid')],
},
] as const
Loading

0 comments on commit 063c8a5

Please sign in to comment.