mirror of
https://github.com/LukeHagar/vercel.git
synced 2025-12-08 21:07:46 +00:00
[all] Remove now prefix in packages (#5928)
* remove prefix from codeowners * remove references from ignore files * Remove prefix from package json and tests * Add run js without prefixes * Rename package folders * Delete auto generated test files * Remove now-node in integration test * Put back deleted vercel json files * Remove eol * Add styfle suggestion to comment in utils/run.js Co-authored-by: Steven <steven@ceriously.com>
This commit is contained in:
23
packages/cli/src/util/projects/get-project-by-id-or-name.ts
Normal file
23
packages/cli/src/util/projects/get-project-by-id-or-name.ts
Normal file
@@ -0,0 +1,23 @@
|
||||
import Client from '../client';
|
||||
import { Project } from '../../types';
|
||||
import { ProjectNotFound } from '../errors-ts';
|
||||
|
||||
export default async function getProjectByNameOrId(
|
||||
client: Client,
|
||||
projectNameOrId: string,
|
||||
accountId?: string
|
||||
) {
|
||||
try {
|
||||
const project = await client.fetch<Project>(
|
||||
`/projects/${encodeURIComponent(projectNameOrId)}`,
|
||||
{ accountId }
|
||||
);
|
||||
return project;
|
||||
} catch (error) {
|
||||
if (error.status === 404) {
|
||||
return new ProjectNotFound(projectNameOrId);
|
||||
}
|
||||
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user