Skip to content

Commit

Permalink
fix(cli): docs link (#3337)
Browse files Browse the repository at this point in the history
* fix(cli): docs link

* fix(cli): messages by application type

* fix(cli): remove unused import
  • Loading branch information
emmenko authored Dec 12, 2023
1 parent edd2943 commit 3d4d502
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 10 deletions.
5 changes: 5 additions & 0 deletions .changeset/dry-bottles-tan.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@commercetools-frontend/create-mc-app': patch
---

Fix docs link
29 changes: 19 additions & 10 deletions packages/create-mc-app/src/cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,24 @@ process.on('unhandledRejection', (err) => {
throw err;
});

const messagesByApplicationType = {
[applicationTypes['custom-application']]: {
docsLink: 'https://docs.commercetools.com/custom-applications',
featureName: 'Custom Application',
},
[applicationTypes['custom-view']]: {
docsLink:
'https://docs-beta-custom-views.commercetools.vercel.app/custom-views',
featureName: 'Custom View',
},
} as const;

const run = () => {
// Default command
cli
.command('[project-directory]')
.usage(
'[project-directory]\n\n Bootstraps a new Custom Application project using one of the predefined templates.'
'[project-directory]\n\n Bootstraps a new project using one of the predefined templates.'
)
.option(
'--application-type <type>',
Expand Down Expand Up @@ -75,15 +87,13 @@ const run = () => {

hintOutdatedVersion(pkgJson.version, releaseVersion);

const taskOptions = await processOptions(projectDirectory, options);
const messages = messagesByApplicationType[taskOptions.applicationType];

console.log('');
console.log(
// TODO: Use link based on the application type
`Documentation available at https://docs.commercetools.com/custom-applications`
);
console.log(`Documentation available at ${messages.docsLink}`);
console.log('');

const taskOptions = await processOptions(projectDirectory, options);

const shouldInstallDependencies =
!options.skipInstall ||
// TODO: remove once we manage to ensure the package manager is installed, for example via Corepack.
Expand All @@ -104,7 +114,7 @@ const run = () => {

console.log('');
console.log(
`🎉 🎉 🎉 The application has been created in the "${taskOptions.projectDirectoryName}" folder.`
`🎉 🎉 🎉 The ${messages.featureName} has been created in the "${taskOptions.projectDirectoryName}" folder.`
);
console.log('');
console.log(`To get started:`);
Expand All @@ -115,8 +125,7 @@ const run = () => {
console.log(`$ ${packageManager} start`);
console.log('');
console.log(
// TODO: Use link based on the application type
`Visit https://docs.commercetools.com/custom-applications for more info about developing Custom Applications. Enjoy 🚀`
`Visit ${messages.docsLink} for more info about developing ${messages.featureName}. Enjoy 🚀`
);
});

Expand Down

2 comments on commit 3d4d502

@github-actions
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Deploy preview for merchant-center-application-kit ready!

✅ Preview
https://merchant-center-application-gg7eoc75s-commercetools.vercel.app

Built with commit 3d4d502.
This pull request is being automatically deployed with vercel-action

@github-actions
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Deploy preview for application-kit-custom-views ready!

✅ Preview
https://application-kit-custom-views-ete0xcy5i-commercetools.vercel.app

Built with commit 3d4d502.
This pull request is being automatically deployed with vercel-action

Please sign in to comment.