Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
6db0e54
feat: add typescript support
abubkr-hago Apr 19, 2025
fca9f06
feat: apply tsconfig from parse-server and fix errors
abubkr-hago Apr 19, 2025
03d49ed
feat: update Dockerfile to build and package the compiled code
abubkr-hago Apr 19, 2025
5569c03
feat: configure eslint with tseslint
abubkr-hago Apr 19, 2025
99c9bcf
fix: docker ignore file
abubkr-hago Apr 19, 2025
0eec7ee
fix: build failure due to es module config
abubkr-hago Apr 19, 2025
640f833
fix: invalid CMD command for Dockerfile
abubkr-hago Apr 19, 2025
7b03f63
refactor: move express routes outside server start promise
abubkr-hago Apr 19, 2025
edf059c
fix: eslint config to apply on spec folder without emitting files dur…
abubkr-hago Apr 19, 2025
7f5b807
fix: apply eslint to the whole project
abubkr-hago Apr 19, 2025
cd8dca4
fix: run jasmine tests using tsx
abubkr-hago Apr 20, 2025
5217420
fix: inconsistent node version between stages
abubkr-hago Apr 20, 2025
4c97627
fix: remove ENV variables and better structure files inside image
abubkr-hago Apr 20, 2025
fd27b5b
docs: add docker deployment documentation
abubkr-hago Apr 20, 2025
9dc780b
fix: remove range ops from newly added packages
abubkr-hago Apr 21, 2025
cfa5f83
feat: increase module and target to support more features
abubkr-hago Apr 26, 2025
b7d3c78
Merge branch 'master' into feat/typescript-support
abubkr-hago Apr 28, 2025
5c95cde
fix: remove range op for typescript-eslint package
abubkr-hago Apr 28, 2025
667f8db
fix: specify rootDir for clearer project boundaries
abubkr-hago Apr 28, 2025
22bfac1
fix: module detection
abubkr-hago Apr 28, 2025
9ad95ae
fix: ensure dynamic imports complete with await
abubkr-hago Apr 28, 2025
f636536
fix: adding syntax highlighting to code blocks
abubkr-hago Apr 28, 2025
bf5b023
fix: use Node.js 20 LTS for Production Builds
abubkr-hago Apr 28, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -30,3 +30,6 @@ node_modules
# Emacs
*~
.eslintcache

# build folder
dist
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,15 +54,15 @@ The [Parse Server guide](https://docs.parseplatform.org/parse-server/guide/) is
These scripts can help you to develop your app for Parse Server:

* `npm run watch` will start your Parse Server and restart if you make any changes.
* `npm run lint` will check the linting of your cloud code, tests and `index.js`, as defined in `.eslintrc.json`.
* `npm run lint-fix` will attempt fix the linting of your cloud code, tests and `index.js`.
* `npm run prettier` will help improve the formatting and layout of your cloud code, tests and `index.js`, as defined in `.prettierrc`.
* `npm run lint` will check the linting of your cloud code, tests and `index.ts`, as defined in `.eslintrc.json`.
* `npm run lint-fix` will attempt fix the linting of your cloud code, tests and `index.ts`.
* `npm run prettier` will help improve the formatting and layout of your cloud code, tests and `index.ts`, as defined in `.prettierrc`.
* `npm test` will run all tests
* `npm run coverage` will run tests and check coverage. Output is available in the `/coverage` folder.

## Configuration

Configuration is located in `config.js`.
Configuration is located in `config.ts`.


# Remote Deployment
Expand Down
6 changes: 5 additions & 1 deletion cloud/functions.js → cloud/functions.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,18 @@
Parse.Cloud.define('hello', req => {
// @ts-ignore
req.log.info(req);
return 'Hi';
});

Parse.Cloud.define('helloAsyncFunction', async req => {
await new Promise(resolve => setTimeout(resolve, 1000));
// @ts-ignore
req.log.info(req);
return 'Hi async';
});

Parse.Cloud.beforeSave('TestObject', () => {
throw new Parse.Error(9001, 'Saving test objects is not available.');
throw new Parse.Error(Parse.Error.OTHER_CAUSE, 'Saving test objects is not available.');
});

export {};
6 changes: 3 additions & 3 deletions cloud/main.js → cloud/main.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// It is best practise to organize your cloud functions group into their own file. You can then import them in your main.js.
await Promise.all([
import('./functions.js')
]);
await Promise.all([import('./functions.js')]);

export {};
15 changes: 0 additions & 15 deletions cloud/schema.js

This file was deleted.

17 changes: 17 additions & 0 deletions cloud/schema.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
export const schemaDefinitions = [
{
className: 'TestObject',
fields: {
beforeSave: { type: 'Boolean', defaultValue: false },
additionalData: { type: 'String' },
},
classLevelPermissions: {
find: { '*': true },
count: { '*': true },
get: { '*': true },
update: { '*': true },
create: { '*': true },
delete: { '*': true },
},
},
];
10 changes: 7 additions & 3 deletions config.js → config.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
import { schemaDefinitions } from "./cloud/schema.js";
import { schemaDefinitions } from './cloud/schema.js';

export const config = {
databaseURI: process.env.DATABASE_URI || process.env.MONGODB_URI || 'mongodb://localhost:27017/dev',
cloud: process.env.CLOUD_CODE_MAIN || './cloud/main.js',
databaseURI:
process.env.DATABASE_URI || process.env.MONGODB_URI || 'mongodb://localhost:27017/dev',
cloud: async () => {
await import('./cloud/main.js');
},
appId: process.env.APP_ID || 'myAppId',
masterKey: process.env.MASTER_KEY || '', //Add your master key here. Keep it secret!
serverURL: process.env.SERVER_URL || 'http://localhost:1337/parse', // Don't forget to change to https if needed
Expand Down
2 changes: 1 addition & 1 deletion eslint.config.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
export default [
{
files: ['**/*.js'], // Apply to JavaScript files.
files: ['**/*.js', '**/*.ts', '**/*.mjs', '**/*.cjs'], // Apply to JavaScript files.
languageOptions: {
ecmaVersion: 2022,
sourceType: 'module',
Expand Down
File renamed without changes.
9 changes: 9 additions & 0 deletions nodemon.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"ignore": [
"dist"
],
"ext": "json,ts,mjs,cjs,js",
"execMap": {
"ts": "node -r source-map-support/register --loader=ts-node/esm/transpile-only"
}
}
Loading