Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(cli): auto-sort imports #7116

Merged
merged 1 commit into from
Feb 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion cli/.prettierrc
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,7 @@
"singleQuote": true,
"trailingComma": "all",
"printWidth": 120,
"semi": true
"semi": true,
"plugins": ["prettier-plugin-organize-imports"],
"organizeImportsSkipDestructiveCodeActions": true
}
45 changes: 36 additions & 9 deletions cli/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@
"glob": "^10.3.1",
"immich": "file:../server",
"mock-fs": "^5.2.0",
"prettier": "^3.2.5",
"prettier-plugin-organize-imports": "^3.2.4",
"typescript": "^5.3.3",
"vite": "^5.0.12",
"vitest": "^1.2.2",
Expand Down
2 changes: 1 addition & 1 deletion cli/src/commands/base-command.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { ServerVersionResponseDto, UserResponseDto } from '@immich/sdk';
import { SessionService } from '../services/session.service';
import { ImmichApi } from 'src/services/api.service';
import { SessionService } from '../services/session.service';

export abstract class BaseCommand {
protected sessionService!: SessionService;
Expand Down
8 changes: 4 additions & 4 deletions cli/src/commands/upload.command.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import byteSize from 'byte-size';
import cliProgress from 'cli-progress';
import { createHash } from 'node:crypto';
import fs, { createReadStream } from 'node:fs';
import { CrawlService } from '../services/crawl.service';
import { BaseCommand } from './base-command';
import { basename } from 'node:path';
import { access, constants, stat, unlink } from 'node:fs/promises';
import { createHash } from 'node:crypto';
import os from 'node:os';
import { basename } from 'node:path';
import { ImmichApi } from 'src/services/api.service';
import { CrawlService } from '../services/crawl.service';
import { BaseCommand } from './base-command';

class Asset {
readonly path: string;
Expand Down
2 changes: 1 addition & 1 deletion cli/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#! /usr/bin/env node
import { Command, Option } from 'commander';
import path from 'node:path';
import os from 'node:os';
import path from 'node:path';
import { version } from '../package.json';
import { LoginCommand } from './commands/login.command';
import { LogoutCommand } from './commands/logout.command';
Expand Down
14 changes: 7 additions & 7 deletions cli/src/services/api.service.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,11 @@
import {
ApiKeyCreateDto,
AssetBulkUploadCheckDto,
BulkIdsDto,
CreateAlbumDto,
CreateAssetDto,
LoginCredentialDto,
SignUpDto,
addAssetsToAlbum,
checkBulkUpload,
createAlbum,
Expand All @@ -13,13 +20,6 @@ import {
pingServer,
signUpAdmin,
uploadFile,
ApiKeyCreateDto,
AssetBulkUploadCheckDto,
BulkIdsDto,
CreateAlbumDto,
CreateAssetDto,
LoginCredentialDto,
SignUpDto,
} from '@immich/sdk';

/**
Expand Down
2 changes: 1 addition & 1 deletion cli/src/services/crawl.service.spec.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import mockfs from 'mock-fs';
import { CrawlService, CrawlOptions } from './crawl.service';
import { CrawlOptions, CrawlService } from './crawl.service';
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Didn't know that even sorts within a destructed object, nice


interface Test {
test: string;
Expand Down
2 changes: 1 addition & 1 deletion cli/src/services/session.service.spec.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import { SessionService } from './session.service';
import fs from 'node:fs';
import yaml from 'yaml';
import {
Expand All @@ -11,6 +10,7 @@ import {
readTestAuthFile,
spyOnConsole,
} from '../../test/cli-test-utils';
import { SessionService } from './session.service';

const mocks = vi.hoisted(() => {
return {
Expand Down
4 changes: 2 additions & 2 deletions cli/test/e2e/login-key.e2e-spec.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { restoreTempFolder, testApp } from '@test-utils';
import { CLI_BASE_OPTIONS, TEST_AUTH_FILE, deleteAuthFile, setup, spyOnConsole } from 'test/cli-test-utils';
import { readFile, stat } from 'node:fs/promises';
import { LoginCommand } from '../../src/commands/login.command';
import { CLI_BASE_OPTIONS, TEST_AUTH_FILE, deleteAuthFile, setup, spyOnConsole } from 'test/cli-test-utils';
import yaml from 'yaml';
import { LoginCommand } from '../../src/commands/login.command';

describe(`login-key (e2e)`, () => {
let apiKey: string;
Expand Down
2 changes: 1 addition & 1 deletion cli/test/e2e/setup.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import path from 'node:path';
import { PostgreSqlContainer } from '@testcontainers/postgresql';
import { access } from 'node:fs/promises';
import path from 'node:path';

export const directoryExists = (directory: string) =>
access(directory)
Expand Down
2 changes: 1 addition & 1 deletion cli/test/e2e/upload.e2e-spec.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { IMMICH_TEST_ASSET_PATH, restoreTempFolder, testApp } from '@test-utils';
import { ImmichApi } from 'src/services/api.service';
import { CLI_BASE_OPTIONS, setup, spyOnConsole } from 'test/cli-test-utils';
import { UploadCommand } from '../../src/commands/upload.command';
import { ImmichApi } from 'src/services/api.service';

describe(`upload (e2e)`, () => {
let api: ImmichApi;
Expand Down
Loading