Implements feature to auto detect project type#69
Conversation
Signed-off-by: Sujith <sujith@merchstack.com>
Signed-off-by: Sujith <sujith@merchstack.com>
| .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"]) |
There was a problem hiding this comment.
Why was this removed?
There was a problem hiding this comment.
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
There was a problem hiding this comment.
My question was actually why did we remove the default, but I realized why now
brent-hoover
left a comment
There was a problem hiding this comment.
One change and a question
| packageData.scripts = newScripts; | ||
| packageData.name = projectName; | ||
| packageData.version = "1.0.0"; | ||
| packageData.reactionProjectType = "api"; |
There was a problem hiding this comment.
The name of the project is Mailchimp Open Commerce so I would prefer we don't use Reaction here, just projectType
There was a problem hiding this comment.
Ok, I shall change it from reactionProjectType to projectType.
I included 'reaction' just in case projectType was a reserved property
Signed-off-by: Sujith <sujith@merchstack.com>
Signed-off-by: Sujith <sujith@merchstack.com>
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