Jump to content

Create new React App workflow


Recommended Posts

I'm trying to create a workflow for creating React Apps, which requires a longer terminal command that I need to wait for to finish before going to the next command.

 

The process would be:
Make a folder in my main Codes folder with the name from when running the action
Go into that folder

🚨 Run Create React App command

Open folder in VS Code

However what happens is it does not run the command in my new folder (or it does, but is interrupted by the next command?), but rather just opens it and it's an empty folder. I'm not even sure this is possible, so if it's not - do let me know! 

 

And if it is, what am I missing here to make this work? This is based on the actual way I'd do it from my terminal. Any help appreciated ☺️

 

# input passed in from previous action, e.g. Keyword
name="$1"
# path of new directory to create
newdir="${HOME}/Codes/${name}"
# create directory
mkdir -p "${newdir}"
# move into new folder
cd "${newdir}"
# create react app
npx create-react-app ./ --template typescript
# open in vs code
/usr/bin/open -a "Visual Studio Code" "${newdir}"
Link to comment

Nice rundown of your issue. Makes it clear to follow along.


When bumping into this type of problem, check Alfred’s debugger. I bet you’ll find a message about not finding npx. Simplest solution is to call it via its full path, like you’re doing with open.


See Understanding the scripting environment for a through explanation of what is happening and other ways to fix it.

Edited by vitor
Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...