Skip to content
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
2 changes: 1 addition & 1 deletion app/utils/charts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -340,7 +340,7 @@ export function computeLineChartAnalysis(values: Array<number | null>): LineChar

/**
* Coefficient of variation : relative volatility
* - expressed in %
* - expressed as a decimal from 0 to 1
* - calculation: standard deviation / mean
* |---------------|----------------------------------------------------------|
* | VALUE | INTERPRETATION |
Expand Down
13 changes: 9 additions & 4 deletions app/utils/run-command.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Comment thread
jsoref marked this conversation as resolved.
}

/**
* Extract executable command information from a package's bin field.
* Handles both string format ("bin": "./cli.js") and object format ("bin": { "cmd": "./cli.js" }).
Expand Down Expand Up @@ -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 {
Expand Down Expand Up @@ -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]
Expand Down
2 changes: 1 addition & 1 deletion server/api/auth/session.delete.ts
Original file line number Diff line number Diff line change
@@ -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()
Expand Down
2 changes: 1 addition & 1 deletion server/api/registry/org/[org]/packages.get.ts
Original file line number Diff line number Diff line change
@@ -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 {
Expand Down
8 changes: 4 additions & 4 deletions server/utils/atproto/utils/likes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 <T = unknown>(
url: string,
options: Parameters<typeof $fetch>[1] = {},
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
Loading