|
1 | | -# TypeScript Cloud Code for Parse Server |
| 1 | +# TypeScript Cloud Code |
2 | 2 |
|
3 | | -This directory contains TypeScript versions of cloud code for Parse Server. The TypeScript files are compiled to JavaScript and automatically copied to the `cloud` directory, which is where Parse Server looks for cloud code. |
| 3 | +This directory contains TypeScript code that compiles to the `cloud` directory where Parse Server reads cloud code. |
4 | 4 |
|
5 | | -## How it works |
6 | | - |
7 | | -1. Write your cloud code in TypeScript in this directory |
8 | | -2. When you save a TypeScript file, it's automatically compiled to JavaScript |
9 | | -3. The compiled JavaScript file is automatically placed in the `cloud` directory |
10 | | -4. Parse Server reads the JavaScript files from the `cloud` directory |
11 | | - |
12 | | -## Development |
13 | | - |
14 | | -To start development with TypeScript: |
15 | | - |
16 | | -1. Run `npm run dev` - This will start both: |
17 | | - - The TypeScript watcher that compiles files when you save them |
18 | | - - The Parse Server with nodemon for auto-reloading |
19 | | - |
20 | | -2. Edit your TypeScript files in the `cloud-ts` directory |
21 | | -3. Every time you save a file (Ctrl+S), it will: |
22 | | - - Automatically compile to JavaScript |
23 | | - - Place the compiled JavaScript in the `cloud` directory |
24 | | - - Parse Server will reload with the new code |
25 | | - |
26 | | -## Building |
27 | | - |
28 | | -To manually build all TypeScript files: |
| 5 | +## Quick Start |
29 | 6 |
|
30 | 7 | ```bash |
31 | | -npm run build |
32 | | -``` |
33 | | - |
34 | | -This will compile all TypeScript files in the `cloud-ts` directory to JavaScript and place them in the `cloud` directory. |
| 8 | +# Development with auto-compilation and file sync (including deletions) |
| 9 | +npm run dev |
35 | 10 |
|
36 | | -## Type Checking |
| 11 | +# One-time build (for commits) |
| 12 | +npm run build:cloud-sync |
| 13 | +``` |
37 | 14 |
|
38 | | -To check your TypeScript files for errors without compiling: |
| 15 | +## How It Works |
39 | 16 |
|
40 | | -```bash |
41 | | -npm run ts-check |
42 | | -``` |
| 17 | +- Write TypeScript in `cloud-ts/` |
| 18 | +- Files auto-compile to JavaScript in `cloud/` |
| 19 | +- When TS files are deleted, JS files are also deleted |
43 | 20 |
|
44 | | -## Best Practices |
| 21 | +## Tips |
45 | 22 |
|
46 | | -- Keep the same file structure in `cloud-ts` as you would in `cloud` |
47 | | -- Don't edit files in the `cloud` directory directly, as they will be overwritten |
48 | | -- When adding new files, be sure to import them in `main.ts` |
49 | | -- Use TypeScript interfaces for Parse objects when possible |
| 23 | +- Don't edit files in `cloud/` - they'll be overwritten |
| 24 | +- New files should be imported in `main.ts` |
| 25 | +- Use TypeScript interfaces for Parse objects |
0 commit comments