Skip to content

Commit

Permalink
change createproject URL , project create issue, regx for project nam… (
Browse files Browse the repository at this point in the history
#1323)

* change createproject URL , project create issue, regx for project name and project key

* project name can be cap case

* code improve by Jay comment

Co-authored-by: Louise wang <louisewang118@.gmail.com>
  • Loading branch information
bighammerw and Louise wang committed Sep 29, 2022
1 parent c9e3121 commit ffe2813
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 3 deletions.
3 changes: 2 additions & 1 deletion packages/cli/src/commands/project/create-project.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,8 @@ export default class Create_project extends Command {
ROOT_API_URL_PROD
).catch((e) => this.error(e));

const [account, name] = result.key.split('/');
this.log(`Successfully created project: ${result.key}
\nProject Url: ${BASE_PROJECT_URL}/project/${result.key}`);
\nProject Url: ${BASE_PROJECT_URL}/orgs/${account}/projects/${name}/deployments`);
}
}
2 changes: 1 addition & 1 deletion packages/cli/src/commands/project/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ export default class Project extends Command {
const handler = Project.optionMapping[userOptions];
// removes arguments -> deployment and everything before it from the process.argv
const stripped_argv: string[] = process.argv
.filter((v, idx) => idx > process.argv.indexOf('deployment') && !v.includes('--options'))
.filter((v, idx) => idx > process.argv.indexOf('project') && !v.includes('--options'))
.reduce((acc, val) => acc.concat(val.split('=')), []);

await handler.run(stripped_argv);
Expand Down
8 changes: 7 additions & 1 deletion packages/cli/src/controller/project-controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,12 @@ import {errorHandle} from '../utils';
interface createProjectType {
key: string;
}
export const suffixFormat = (value: string) => {
return value
.replace(/(^\s*)|(\s*$)/g, '')
.replace(/\s+/g, '-')
.toLowerCase();
};
export async function createProject(
organization: string,
subtitle: string,
Expand All @@ -31,7 +37,7 @@ export async function createProject(
apiVersion: `v${apiVersion}`,
description: description,
gitRepository: gitRepository,
key: `${organization}/${project_name}`,
key: `${organization}/${suffixFormat(project_name)}`,
logoUrl: logoUrl,
name: project_name,
subtitle: subtitle,
Expand Down

0 comments on commit ffe2813

Please sign in to comment.