| 📦 Turbo JS 91999d1 k33g 12h ago | 1 | # turbo-js tools. |
| 2 | # |
| 3 | # Each [[tool]] becomes one line of the JavaScript menu, in the order they |
| 4 | # appear here. name is what the menu shows; a letter between tildes is its |
| 5 | # hot key, and no two tools should claim the same one. |
| 6 | # |
| 7 | # command goes to "sh -c", so pipes, globs and && work: one entry can be a |
| 8 | # whole sequence. |
| 9 | # |
| 10 | # menu says which menu it appears in. Leave it out and the tool goes into the |
| 11 | # JavaScript menu; name anything else and that menu is created for you, in the |
| 12 | # order the names first appear here. A tool that has nothing to do with |
| 13 | # JavaScript belongs in one of your own: |
| 14 | # |
| 15 | # [[tool]] |
| 16 | # name = "~E~cho" |
| 17 | # command = "echo TADA" |
| 18 | # menu = "Tools" |
| 19 | # |
| 20 | # A {{label}} in a command is a value the editor asks for before running it, in |
| 21 | # a box titled after the tool. The text between the braces is what it asks for: |
| 22 | # |
| 23 | # [[tool]] |
| 24 | # name = "~A~dd a package" |
| 25 | # command = "npm install {{package name}}" |
| 26 | # |
| 27 | # The value is quoted, so a path with a space in it stays one argument. Add ... |
| 28 | # inside the braces when you mean several arguments rather than one value: |
| 29 | # |
| 30 | # [[tool]] |
| 31 | # name = "Test ~o~ne" |
| 32 | # command = "node --test {{extra flags...}}" |
| 33 | # |
| 34 | # Double braces, not single. Single ones appear in real commands — awk '{print |
| 35 | # $1}' and find . -exec rm {} + are both ordinary things to put here — and |
| 36 | # neither is asking you for anything. |
| 37 | # |
| 38 | # output says where what the command prints goes: |
| 39 | # popup a dialog that fills in as it runs, and says the exit code (default) |
| 40 | # terminal a terminal window, for anything that reads the keyboard or runs long |
| 41 | # editor an editing window once it has finished, to search with Ctrl-F |
| 42 | # |
| 43 | # Commands run in the directory the editor was started in, which is why they |
| 44 | # see the whole project when you start from the directory holding package.json. |
| 45 | |
| 46 | [[tool]] |
| 47 | name = "~I~nstall" |
| 48 | command = "npm install" |
| 49 | output = "popup" |
| 50 | |
| 51 | [[tool]] |
| 52 | name = "~F~ormat" |
| 53 | command = "npx prettier --write ." |
| 54 | output = "popup" |
| 55 | |
| 56 | [[tool]] |
| 57 | name = "~L~int" |
| 58 | command = "npx eslint ." |
| 59 | output = "popup" |
| 60 | |
| 61 | [[tool]] |
| 62 | name = "~T~est" |
| 63 | # Node's own test runner: every *.test.js, *.spec.js and test/**/*.js file. |
| 64 | command = "node --test" |
| 65 | output = "popup" |
| 66 | |
| 67 | [[tool]] |
| 68 | name = "~R~un" |
| 69 | # A Node project has no single entry point the editor could know, so this one |
| 70 | # asks. The value is quoted, so a path with a space in it stays one argument. |
| 71 | command = "node {{script, e.g. main.js}}" |
| 72 | # A terminal, not a popup: a program that reads the keyboard has to be able to |
| 73 | # be answered, and one that runs long has to be able to be interrupted. |
| 74 | output = "terminal" |
| 75 | |
| 76 | [[tool]] |
| 77 | name = "~S~tart" |
| 78 | # Whatever package.json's "start" script says — a server, usually, which is |
| 79 | # why it gets a terminal too. |
| 80 | command = "npm start" |
| 81 | output = "terminal" |
| 82 | |
| 83 | # A tool naming a `menu` gets a menu of its own on the bar. Nothing above does, |
| 84 | # so every tool above is in the JavaScript menu. This one is in a menu called |
| 85 | # Tools, which appears between JavaScript and Help — that is the whole |
| 86 | # mechanism. |
| 87 | |
| 88 | [[tool]] |
| 89 | name = "~E~cho" |
| 90 | command = "echo 🎉 tada!" |
| 91 | menu = "Tools" |
| 92 | output = "terminal" |