mirror of
https://github.com/LukeHagar/vercel.git
synced 2025-12-07 21:07:46 +00:00
`vc`'s default command is `deploy`, which can lead to ambiguous cli invocations when running `vc dir-or-command` like: ``` $ vc list Vercel CLI 23.1.2 Error! The supplied argument "list" is ambiguous. If you wish to deploy the subdirectory "list", first run "cd list". ``` when run in a directory that contains a subdirectory "list". This conflict will happen with any current and future commands, like `vc build`. In order to make sure the CLI can be invoked either way, this PR deprecates the default behavior. Going forward, a user would see the following. **Conflicting Command, Run Command** ```bash $ vc list # warning: Did you mean to deploy the subdirectory "list"? Use `vc --cwd list` instead. # ... runs the `list` command ``` **Conflicting Command, Deploy Directory** ```bash $ vc --cwd list # ... deploy as normal ``` --- Card: https://linear.app/vercel/issue/BUI-33/prevent-ambiguous-vc-command-oror-dir
92 lines
2.3 KiB
TypeScript
92 lines
2.3 KiB
TypeScript
import { client } from './client';
|
|
|
|
const envs = [
|
|
{
|
|
type: 'encrypted',
|
|
id: '781dt89g8r2h789g',
|
|
key: 'REDIS_CONNECTION_STRING',
|
|
value: 'redis://abc123@redis.example.com:6379',
|
|
target: ['production', 'preview'],
|
|
gitBranch: null,
|
|
configurationId: null,
|
|
updatedAt: 1557241361455,
|
|
createdAt: 1557241361455,
|
|
},
|
|
{
|
|
type: 'encrypted',
|
|
id: 'r124t6frtu25df16',
|
|
key: 'SQL_CONNECTION_STRING',
|
|
value: 'Server=sql.example.com;Database=app;Uid=root;Pwd=P455W0RD;',
|
|
target: ['production'],
|
|
gitBranch: null,
|
|
configurationId: null,
|
|
updatedAt: 1557241361445,
|
|
createdAt: 1557241361445,
|
|
},
|
|
];
|
|
|
|
export const defaultProject = {
|
|
id: 'foo',
|
|
name: 'cli',
|
|
accountId: 'K4amb7K9dAt5R2vBJWF32bmY',
|
|
createdAt: 1555413045188,
|
|
updatedAt: 1555413045188,
|
|
env: envs,
|
|
targets: {
|
|
production: {
|
|
alias: ['foobar.com'],
|
|
aliasAssigned: 1571239348998,
|
|
createdAt: 1571239348998,
|
|
createdIn: 'sfo1',
|
|
deploymentHostname: 'a-project-name-rjtr4pz3f',
|
|
forced: false,
|
|
id: 'dpl_89qyp1cskzkLrVicDaZoDbjyHuDJ',
|
|
meta: {},
|
|
plan: 'pro',
|
|
private: true,
|
|
readyState: 'READY',
|
|
requestedAt: 1571239348998,
|
|
target: 'production',
|
|
teamId: null,
|
|
type: 'LAMBDAS',
|
|
url: 'a-project-name-rjtr4pz3f.vercel.app',
|
|
userId: 'K4amb7K9dAt5R2vBJWF32bmY',
|
|
},
|
|
},
|
|
latestDeployments: [
|
|
{
|
|
alias: ['foobar.com'],
|
|
aliasAssigned: 1571239348998,
|
|
createdAt: 1571239348998,
|
|
createdIn: 'sfo1',
|
|
deploymentHostname: 'a-project-name-rjtr4pz3f',
|
|
forced: false,
|
|
id: 'dpl_89qyp1cskzkLrVicDaZoDbjyHuDJ',
|
|
meta: {},
|
|
plan: 'pro',
|
|
private: true,
|
|
readyState: 'READY',
|
|
requestedAt: 1571239348998,
|
|
target: 'production',
|
|
teamId: null,
|
|
type: 'LAMBDAS',
|
|
url: 'a-project-name-rjtr4pz3f.vercel.app',
|
|
userId: 'K4amb7K9dAt5R2vBJWF32bmY',
|
|
},
|
|
],
|
|
};
|
|
|
|
export function useProject(project = defaultProject) {
|
|
client.scenario.get(`/v8/projects/${project.name}`, (_req, res) => {
|
|
res.json(project);
|
|
});
|
|
client.scenario.get(`/v8/projects/${project.id}`, (_req, res) => {
|
|
res.json(project);
|
|
});
|
|
client.scenario.get(`/v8/projects/${project.id}/env`, (_req, res) => {
|
|
res.json({ envs });
|
|
});
|
|
|
|
return { project, envs };
|
|
}
|