JavaScript/VSCode/Node Setup for Dashy 💜 💜 💜
VS Code is your code editor.
- Smart Semicolon (autoinserts semicolons)
- ESLint (autocorrects common code formatting mistakes)
- Prettier (auto-formats code to make it look prettier)
- Quokka (runs JS code inline so you can see results real-time)
- JavaScript (ES6) Code Snippets (shortcuts to produce commonly used code segments)
- Ctrl+Shift+P > Type
settings.json
> Preferences: Open User Settings (JSON) - Copy-pasta the following code into the above
settings.json
file
{
"editor.formatOnSave": true,
"prettier.jsxSingleQuote": true,
"prettier.singleQuote": true,
"emmet.includeLanguages": {
"javascript": "javascriptreact"
},
"editor.tabSize": 2,
"editor.wordWrap": "on",
"editor.fontSize": 13,
"terminal.integrated.shell.windows": "C:\\Program Files\\Git\\git-cmd.exe",
"terminal.integrated.shellArgs.windows": [
"--command=usr/bin/bash.exe",
"-l",
"-i"
],
"smartsemicolon.autoLineChange": true,
"javascript.updateImportsOnFileMove.enabled": "always",
"[javascript]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[typescript]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[typescriptreact]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"typescript.updateImportsOnFileMove.enabled": "always",
"security.workspace.trust.untrustedFiles": "open",
"terminal.integrated.defaultProfile.windows": "Git Bash",
"editor.linkedEditing": true,
"editor.formatOnPaste": true,
"editor.bracketPairColorization.independentColorPoolPerBracketType": true
}
Git is your version control system - it saves all your code files as you update them, so that you never lose progress/can revert to past working versions of code in case you made a bad edit.
- Create a GitHub account: https://github.com/
- Download Git for Windows: https://git-scm.com/download/win
- Make Git Bash the default VS Code Terminal
- Set up Git Auth (Run each command in Git Bash VS Code Terminal, ask Arunika to add key to her Repo)
ssh-keygen -R github.com
ssh-keygen -t ed25519 -C "your_email@example.com"
- Pull in remote Git code into your PC:
git clone git@github.com:aoyshi/dashyjs.git
- Create your own branch:
git checkout -b "dashy/first-commit"
- Add + push your changes to the remote repo:
git commit -am "my first commit"; git push
- JavaScript is a programming language, and a code engine is required to run it. NodeJS is that engine that runs JS code on your PC.
- "node modules" are helpful packages of code that other developers have created, which you can reuse for your projects.
- NPM is the package management system that lets you install/uninstall these useful "node modules" from other devs.
- NVM is the management system that lets you install/uninstall different versions of NodeJS and NPM.
Run the following in Git Bash VS Code Terminal
- Install NVM in Windows: Go to https://github.com/coreybutler/nvm-windows/releases/tag/1.1.11 and install
nvm-setup.exe
- Modify VS Code to run as administrator (or else it won't have access to NVM): C:\Program Files\Microsoft VS Code\Code.exe > RightClick > Properties > Compatibility Tab > Run as administrator (checked)
- Reopen VS Code and run this in the integrated Git Bash terminal to verify:
nvm -v
- Install Node:
nvm install node
and verifynode -v
- Install NPM:
nvm install-latest-npm
and verifynpm -v
- Worst case scenario, if none of these work, run the following three lines in Git Bash:
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.4/install.sh | bash
export NVM_DIR="$([ -z "${XDG_CONFIG_HOME-}" ] && printf %s "${HOME}/.nvm" || printf %s "${XDG_CONFIG_HOME}/nvm")"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm
- Pull in remote Git code into your PC by running this in your GitBash VSCode Terminal:
git clone git@github.com:aoyshi/dashyjs.git
- Install all node modules required by this code:
npm install
- Go into the sourcecode directory:
cd dashyjs/src
- Run the main code file and see the output in the terminal:
node main.js
The intro instructions here are pretty good (but the actual code needs tweaking to make it work with the latest Discord.js API)! >> https://www.freecodecamp.org/news/create-a-discord-bot-with-javascript-nodejs/