Jump to content

NorahMaria

Member
  • Posts

    7
  • Joined

  • Last visited

Everything posted by NorahMaria

  1. No, I mean feedback to the user from the Alfred Window, like items / replies. I'm sorry I don't know the lingo for it! Like for example, when I press enter and it starts creating an app - Alfred shows a lil loading indicator, and once it finishes it, the Alfred window again updates to say 'Done' or something. Hope that clarified it!
  2. @vitor thanks for your help, and sorry, I did not realise this was the same issue! The reason I am switching it is to allow for feedback on the process of it in Alfred, rather than running the command and Alfred going away, and then waiting for some minutes to see if it opens or not - I want some feedback in Alfred for 'created folder', 'creating app', 'created' etc, and I know how to do that in NodeJS, if that makes sense!
  3. I'm trying to create a workflow for creating a Create React App template. A new extended version of this question I asked, wasn't sure if I should comment on that one or create a new post, so sorry if this is repetitive! The process should be: Create folder inside Codes with the name passed in arguments Go inside that folder with the terminal, and run this command: npx create-react-app ./ --template typescrip Once the nix command finishes, delete the src folder created in the project, and copy the template src folder (my react boilerplate template I have in my workflow folder) to the project. Open in VS Code This is my NodeJS code right now, commented out step 3 as I first want to get my npx command to work. import { spawn } from 'child_process' import alfy from 'alfy' import fs from 'fs-extra' import os from 'os' async function run() { const homePath = os.homedir() const dirName = alfy.input const fullPath = homePath + '/Codes/' + dirName if (fs.existsSync(fullPath)) return alfy.output([{ title: 'Folder already exists' }]) await fs.promises.mkdir(fullPath) const ls = spawn(`cd ${fullPath} && npx create-react-app ./ --template typescript`, { shell: '/bin/zsh', }) ls.stdout.on('data', data => { console.log(`stdout: ${data}`) }) ls.stderr.on('data', data => { console.log(`stderr: ${data}`) }) ls.on('error', error => { console.log(`error: ${error.message}`) }) ls.on('close', code => { console.log(`child process exited with code ${code}`) }) // fs.rmdirSync(fullPath + '/src', { recursive: true, force: true }) // fs.mkdirSync(fullPath + '/src') // fs.copySync('src', fullPath + '/src') } run() The error inside the Alfred debugger: stderr: zsh:1: command not found: npx New to child_process in NodeJS, so I'm sure it's something obvious I'm missing! Hope that makes sense, any help is appreciated! ☺️
  4. @vitor thank you! I actually figured it out a lil earlier, thanks to an older post in the forum on kind of the same thing ☺️
  5. 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}"
  6. @deanishe that worked beautifully! Thank you so so much, definitely will be my most used workflow 😄
  7. I regularly use the terminal to go into a folder (always the same folder called Codes) and make a folder, then use Alfred to open that new folder in vscode. I'd love to be able to just use alfred to create the folder itself rather than go into alfred to type cd Codes then type mkdir newFolderName in the terminal, and then go back to alfred to open it in vscode. I know this should be relatively easy considering the complex scripts I've seen people do, but I can't seem to figure it out. Ideally i'd like to write just create hello, and that would create a folder in Codes called hello, and then open it in vs code with alfred, or even do it all in one smooth motion by writing something like co (create open), maybe (but that's really not needed, i might be able to tie those together myself if i have the create folder script). Anyone able to help me make this? ☺️ I've been bugging me head trying to figure it out but I know nothing about these things. My mac is set to zsh I think, if that matters. (I saw some people had done similar things before, but the links were all mostly broken or not compatible anymore).
×
×
  • Create New...