diff --git a/app/utils/charts.ts b/app/utils/charts.ts index 357e298cbb..3cdbe3fd34 100644 --- a/app/utils/charts.ts +++ b/app/utils/charts.ts @@ -340,7 +340,7 @@ export function computeLineChartAnalysis(values: Array): LineChar /** * Coefficient of variation : relative volatility - * - expressed in % + * - expressed as a decimal from 0 to 1 * - calculation: standard deviation / mean * |---------------|----------------------------------------------------------| * | VALUE | INTERPRETATION | diff --git a/app/utils/run-command.ts b/app/utils/run-command.ts index b97debebe0..265acbf7af 100644 --- a/app/utils/run-command.ts +++ b/app/utils/run-command.ts @@ -14,6 +14,13 @@ export interface ExecutableInfo { hasExecutable: boolean } +/** + * Extract basename from package + */ +function getPackageBaseName(packageName: string): string | undefined { + return packageName.startsWith('@') ? packageName.split('/')[1] : packageName +} + /** * Extract executable command information from a package's bin field. * Handles both string format ("bin": "./cli.js") and object format ("bin": { "cmd": "./cli.js" }). @@ -43,7 +50,7 @@ export function getExecutableInfo( } // Prefer command matching package name if it exists; otherwise, use first - const baseName = packageName.startsWith('@') ? packageName.split('/')[1] : packageName + const baseName = getPackageBaseName(packageName) const primaryCommand = baseName && commands.includes(baseName) ? baseName : firstCommand return { @@ -87,9 +94,7 @@ export function getRunCommandParts(options: RunCommandOptions): string[] { // For local execute with specific command name different from package name // e.g., `pnpm exec tsc` for typescript package if (options.command && options.command !== options.packageName) { - const baseName = options.packageName.startsWith('@') - ? options.packageName.split('/')[1] - : options.packageName + const baseName = getPackageBaseName(options.packageName) // If command matches base package name, use the package spec if (options.command === baseName) { return [...executeParts, spec] diff --git a/server/api/auth/session.delete.ts b/server/api/auth/session.delete.ts index 7bfce2e686..34957d76ec 100644 --- a/server/api/auth/session.delete.ts +++ b/server/api/auth/session.delete.ts @@ -1,5 +1,5 @@ export default eventHandlerWithOAuthSession(async (event, oAuthSession, serverSession) => { - // Even tho the signOut also clears part of the server cache should be done in order + // Even though the signOut also clears part of the server cache, this should be done in order // to let the OAuth package do any other clean up it may need await oAuthSession?.signOut() await serverSession.clear() diff --git a/server/api/registry/org/[org]/packages.get.ts b/server/api/registry/org/[org]/packages.get.ts index 85c07bee03..47b7a7f011 100644 --- a/server/api/registry/org/[org]/packages.get.ts +++ b/server/api/registry/org/[org]/packages.get.ts @@ -1,7 +1,7 @@ import { CACHE_MAX_AGE_ONE_HOUR, NPM_REGISTRY } from '#shared/utils/constants' import { FetchError } from 'ofetch' -// Validation pattern for npm org names - url-sage symbol and not start with a dot (incl. ~test24214. or -ex~-) +// Validation pattern for npm org names - should be a url-safe symbol and not start with a dot (incl. ~test24214. or -ex~-) const NPM_ORG_NAME_RE = /^[\w~-][\w.~-]*$/ function validateOrgName(name: string): void { diff --git a/server/utils/atproto/utils/likes.ts b/server/utils/atproto/utils/likes.ts index 8667256e27..0a547fb6f1 100644 --- a/server/utils/atproto/utils/likes.ts +++ b/server/utils/atproto/utils/likes.ts @@ -54,7 +54,7 @@ export class PackageLikesUtils { this.constellation = deps?.constellation ?? new Constellation( - // Passes in a fetch wrapped as CachedFetch since are already doing some heavy caching here + // Passes in a fetch wrapped as CachedFetch because we're already doing some heavy caching here async ( url: string, options: Parameters[1] = {}, @@ -107,7 +107,7 @@ export class PackageLikesUtils { } /** - * Gets the likes for a npm package on npmx. Tries a local cache first, if not found uses constellation + * Gets the likes for a npm package on npmx. Tries a local cache first; if not found, uses constellation * @param packageName * @param usersDid * @returns @@ -168,8 +168,8 @@ export class PackageLikesUtils { } /** - * It is assumed it has been checked by this point that if a user has liked a package and the new like was made as a record - * to the user's atproto repository + * Assumes the caller has already verified that a user's like for a package was stored as a record in the user's AT Protocol + * repository (atUri refers to that like record). * @param packageName * @param usersDid * @param atUri - The URI of the like record