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

refactor(cli): organize files, simplify types, use @immich/sdk #6747

Merged
merged 1 commit into from
Jan 30, 2024

Conversation

jrasm91
Copy link
Contributor

@jrasm91 jrasm91 commented Jan 30, 2024

Before After
image image

@jrasm91 jrasm91 added the cli Tasks related to the Immich CLI label Jan 30, 2024
@jrasm91 jrasm91 requested a review from etnoy January 30, 2024 03:39
Copy link

cloudflare-workers-and-pages bot commented Jan 30, 2024

Deploying with  Cloudflare Pages  Cloudflare Pages

Latest commit: 0330dba
Status: ✅  Deploy successful!
Preview URL: https://ef340894.immich.pages.dev
Branch Preview URL: https://refactor-cli-1.immich.pages.dev

View logs

Copy link
Contributor

@benmccann benmccann left a comment

Choose a reason for hiding this comment

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

awesome! thank you!!

@@ -1,31 +1,40 @@
import fs from 'node:fs';
import yaml from 'yaml';
import { existsSync } from 'fs';
Copy link
Contributor

Choose a reason for hiding this comment

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

I probably wouldn't remove the node: prefix here

Suggested change
import { existsSync } from 'fs';
import { existsSync } from 'node:fs';

Copy link
Contributor Author

Choose a reason for hiding this comment

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

True, true. Do you know if there is a linting rule or some way to prefer the prefix? The code base is quite inconsistent.

Copy link
Contributor

Choose a reason for hiding this comment

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

Copy link
Contributor

Choose a reason for hiding this comment

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

I created #6751 as a proof of concept for this (and most other unicorn rules)

loginCredentialDto: { email: 'cli@immich.app', password: 'password' },
});
const { data: apiKey } = await api.keyApi.createApiKey(
{ aPIKeyCreateDto: { name: 'CLI Test' } },
Copy link
Contributor

Choose a reason for hiding this comment

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

the capitalization looks off here

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Haha yeah. This is the auto generated code from open API generator. I think if we changed the dto on the server from APIKey to ApiKey it would generate more how you would expect it to.

Copy link
Contributor

@mertalev mertalev Jan 30, 2024

Choose a reason for hiding this comment

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

Based on this SO post, it seems style guidelines for acronyms lean toward using the normal casing instead of all-caps. So XmlHttpRequest, not XMLHTTPRequest. Maybe we should adopt that for consistency.

if (!this.fileCreatedAt) throw new Error('File created at not set');
if (!this.fileModifiedAt) throw new Error('File modified at not set');

// TODO: doesn't xmp replace the file extension? Will need investigation
Copy link
Member

Choose a reason for hiding this comment

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

Normally you get a .xmp after the original extension, so foo.jpg.xmp

Copy link
Contributor

Choose a reason for hiding this comment

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

This is actually not standardized! I've used a bunch of photo tools in my workflow and some use foo.xmp and some use foo.jpg.xmp. This is something on my backlog to fix across all of Immich, currently we only support one format.

Copy link
Member

Choose a reason for hiding this comment

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

Oh really? I hate this.

@jrasm91 jrasm91 merged commit 64da2c1 into main Jan 30, 2024
24 checks passed
@jrasm91 jrasm91 deleted the refactor/cli-1 branch January 30, 2024 12:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cli Tasks related to the Immich CLI
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants