|
| 1 | +# Step by step guide to setting up the Typescript template from scratch |
| 2 | +This guide is mostly focused on Windows users (Mac instructions are given at some places). |
| 3 | +If you're a Linux/Mac/Other user, there's an expectancy that you know your system and it's peculiarities compared to Windows. |
| 4 | +If you need help with your particular system, feel free to ask for help in the Official Bitburner Discord. |
| 5 | + |
| 6 | +### 1. Backup your savegame (just in case) |
| 7 | +- Augmentations -> Backup save |
| 8 | + |
| 9 | +### 2. Install Node.js |
| 10 | +- Go to https://nodejs.org/en/ |
| 11 | +- Download the version that's recommended for most users. |
| 12 | +- Install it. Just click next, next, next, next, finish. |
| 13 | + |
| 14 | +### 3. Download this: |
| 15 | +- Go to https://github.com/bitburner-official/typescript-template |
| 16 | +- Click the green 'Code' button |
| 17 | +- If you're unfamiliar with Git and have no intention to use it: |
| 18 | + - Press the Download Zip button |
| 19 | + - Extract the zip anywhere, for example `C:\Users\yourusername\Workspace\BitburnerScripts` on Windows or `~/Workspace/BitburnerScripts` on Other |
| 20 | + |
| 21 | +### 4. Start the Remote File API server |
| 22 | +- Open command prompt / terminal |
| 23 | + - Windows: Open start menu and type `cmd` (enter) |
| 24 | + - Mac: Click the Launchpad icon in the Dock, type `Terminal` in the search field, then click Terminal. |
| 25 | +- To go to the directory you just created: |
| 26 | + - Windows: Type `cd ` and drag the folder you created to the cmd window, or type `cd C:\Users\yourusername\Workspace\BitburnerScripts` or whatever folder you chose previously. |
| 27 | + - Mac: Type `cd ` drag the folder you created to the terminal window, or type `cd ~/Workspace/BitburnerScripts` or whatever folder you chose previously. |
| 28 | + |
| 29 | +- type `npm install` |
| 30 | +- type `npm run watch` |
| 31 | +- If NPM asks if you want to install something it needs, answer `y` for yes. |
| 32 | +- Your firewall may yell at you; allow the connection. |
| 33 | + |
| 34 | +### 5. Go back to Bitburner. |
| 35 | +- Options -> Remote API -> type in the port: `12525` -> click connect. The icon should turn green and say it's online. |
| 36 | +- Your firewall may yell at you again; allow the connection. |
| 37 | + |
| 38 | +### 6. Starting the Typescript transpiler |
| 39 | +- DON'T SKIP EVEN WHEN USING JS ONLY |
| 40 | +- Open another cmd/terminal window just like you did in step 4. |
| 41 | +- This time run the command `npm run transpile` in your folder. |
| 42 | + Yes, you need them both to be running at the same time. |
| 43 | +- Put your .ts files to the `src\` directory. |
| 44 | + |
| 45 | +### 7. Test that the connection works |
| 46 | +- You should see a file `template.js` in the root of your `home` server in Bitburner. |
| 47 | +- You should see a NetscriptDefinitions.d.ts automatically appear in the folder on your computer (ex. `C:\Users\yourusername\Workspace\BitburnerScripts\NetscriptDefinitions.d.ts`). |
| 48 | + |
| 49 | +### 8. Try some other files too! |
| 50 | +- Copy/create a .js to the `src` folder on your computer and check Bitburner. The file should be transferred! |
| 51 | +- Sadly, at the time of writing, Typescript doesn't support 'compiling' text files. So copy/create a .txt in the `dist` folder and check Bitburner. This file should be transferred as well. |
| 52 | + |
| 53 | + |
| 54 | +### 9. Thats it! |
| 55 | +- You can now make and edit the files in the `src` directory to your liking, and have them be changed in Bitburner automatically. |
| 56 | +<br /> |
| 57 | +<br /> |
| 58 | + |
| 59 | +### For more information |
| 60 | +Read the readme of this https://github.com/bitburner-official/typescript-template and feel free to ask in Bitburner Discord channel `#external-editors:` https://discord.com/channels/415207508303544321/923428435618058311 |
0 commit comments