first of all, let"s talk about my project, which uses vue-li3.0 as scaffolding. After running the service and packaging, it is changed to the specified directory, that is, there will be many subprojects under this project. each time you run or package, you need to specify the name of the subproject, which is the background . So here comes the idea:
1. List all the subproject names through the command line
2. Select a name
3. Select the environment (local environment, test environment, demo environment.)
4. Choose to run the service or package operation
all the previous command line selections can be done through inquirer, but how do I execute a command after selecting it?
at present, I want to select the corresponding command configured under package.json, such as npm run serve
, which can be successfully executed through child_process, but cannot see the running output
Note: at present, my command to switch subprojects and run is npm config set project:name demoName & & npm run serve,. I"m a little tired every time I write this. Let"s see if the gods have a good way to implement it
.