Skip to content

Implements feature to auto detect project type#69

Merged
brent-hoover merged 4 commits intotrunkfrom
feat-sujith-autoDetect-projectType
May 4, 2022
Merged

Implements feature to auto detect project type#69
brent-hoover merged 4 commits intotrunkfrom
feat-sujith-autoDetect-projectType

Conversation

@sujithvn
Copy link
Copy Markdown
Contributor

@sujithvn sujithvn commented May 4, 2022

Signed-off-by: Sujith sujith@merchstack.com

Resolves #25
Impact: medium
Type: feature

Issue

Issue as mentioned in the ticket- Develop feature to Auto-detect project type so that you can just type "reaction develop" rather than "reaction develop api"

Solution

Added a new property to package.json which would identify the project type.
"projectType": "api" | "admin-meteor" | "storefront-example"
While issuing 'develop' command, we check if the projectType is provided by user as args and use it if present. Else we check for the newly introduced projectType property in package.json. If not found or if invalid, we throw error and exit.

Note

Follow-up PR required to add the projectType into package.json of the core repos
https://github.com/reactioncommerce/reaction-admin.git
https://github.com/reactioncommerce/example-storefront.git

Breaking changes

None.

Non-breaking change

Removed the option of using 'api' as default in index.js

Testing

Tested both cases of executing develop command with and without projectType argument - pass
Tested case where there is no projectType entry in package.json - pass
Tested case where there is invalid projectType entry in package.json - pass

Sujith added 2 commits May 4, 2022 09:37
Signed-off-by: Sujith <sujith@merchstack.com>
Signed-off-by: Sujith <sujith@merchstack.com>
@sujithvn sujithvn requested a review from brent-hoover May 4, 2022 04:45
Comment thread index.js
.command("develop")
.description("Run a project in locally in development mode")
.addArgument(new commander.Argument("[type]", "which project type to develop on")
.choices(["api", "storefront", "admin"])
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Why was this removed?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

We did not remove the choices. We only removed the .default.
When I included the closing parenthesis to .choices, it shows up as change in git

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

My question was actually why did we remove the default, but I realized why now

Copy link
Copy Markdown
Collaborator

@brent-hoover brent-hoover left a comment

Choose a reason for hiding this comment

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

One change and a question

Comment thread commands/create-project-api.js Outdated
packageData.scripts = newScripts;
packageData.name = projectName;
packageData.version = "1.0.0";
packageData.reactionProjectType = "api";
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

The name of the project is Mailchimp Open Commerce so I would prefer we don't use Reaction here, just projectType

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Ok, I shall change it from reactionProjectType to projectType.
I included 'reaction' just in case projectType was a reserved property

@sujithvn sujithvn changed the title Feat sujith auto detect project type Implements feature to auto detect project type May 4, 2022
Sujith added 2 commits May 4, 2022 11:45
Signed-off-by: Sujith <sujith@merchstack.com>
Signed-off-by: Sujith <sujith@merchstack.com>
@sujithvn sujithvn requested a review from brent-hoover May 4, 2022 06:32
@brent-hoover brent-hoover merged commit 5c76cfb into trunk May 4, 2022
@brent-hoover brent-hoover deleted the feat-sujith-autoDetect-projectType branch May 4, 2022 06:51
Copy link
Copy Markdown

@Redhead88-ui Redhead88-ui left a comment

Choose a reason for hiding this comment

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Auto-detect project type so that you can just type "reaction develop" rather than "reaction develop api"

3 participants