Skip to content

feat: Add typescript support #595

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 17 commits into
base: master
Choose a base branch
from

Conversation

abubkr-hago
Copy link

@abubkr-hago abubkr-hago commented Apr 19, 2025

Closes #561

Summary by CodeRabbit

  • New Features

    • Added example environment configuration and TypeScript configuration files.
    • Introduced Docker deployment support with corresponding documentation.
    • Added initial TypeScript type declarations for Parse Server.
  • Improvements

    • Migrated project from JavaScript to TypeScript, updating build, lint, and test workflows.
    • Enhanced ESLint configuration for TypeScript support and improved code style enforcement.
    • Refactored Dockerfile to use multi-stage builds and improved efficiency.
    • Updated documentation to reflect new configurations and workflows.
  • Bug Fixes

    • Updated error codes in cloud functions and tests for better consistency.
  • Chores

    • Updated ignore files for Docker, Git, and nodemon to exclude build artifacts and sensitive files.
    • Cleaned up and replaced obsolete configuration and schema files.

Copy link

I will reformat the title to use the proper commit message syntax.

@parse-github-assistant parse-github-assistant bot changed the title feat: add typescript support feat: Add typescript support Apr 19, 2025
Copy link

🚀 Thanks for opening this pull request!

Copy link
Member

@mtrezza mtrezza left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice!

@mtrezza mtrezza requested a review from dblythy April 19, 2025 18:30
@abubkr-hago abubkr-hago force-pushed the feat/typescript-support branch from ddcd572 to fc7e68a Compare April 19, 2025 22:37
@abubkr-hago abubkr-hago force-pushed the feat/typescript-support branch 2 times, most recently from 0ff84ec to 4a1ae28 Compare April 20, 2025 19:21
@abubkr-hago abubkr-hago force-pushed the feat/typescript-support branch from 9524cf2 to fd27b5b Compare April 21, 2025 11:05
package.json Outdated
"@semantic-release/changelog": "6.0.3",
"@semantic-release/commit-analyzer": "13.0.1",
"@semantic-release/git": "10.0.1",
"@semantic-release/github": "11.0.1",
"@semantic-release/npm": "12.0.1",
"@semantic-release/release-notes-generator": "14.0.3",
"@types/jasmine": "^5.1.7",
"@types/node": "^22.14.1",
"@types/parse": "^3.0.9",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Parse started to bring its own types. Do we still need this?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Parse types aren't working for some reason, I'll revert this commit until I know why it is not working

@abubkr-hago abubkr-hago force-pushed the feat/typescript-support branch from bc06b95 to 9dc780b Compare April 26, 2025 12:43
@mtrezza
Copy link
Member

mtrezza commented Apr 28, 2025

Could you please resolve the conflicts?

# Conflicts:
#	package-lock.json
#	package.json
Copy link

coderabbitai bot commented Apr 28, 2025

Walkthrough

This update migrates the example package from JavaScript to TypeScript. It introduces TypeScript configuration files, updates ESLint and Jasmine configurations for TypeScript, and replaces or refactors JavaScript files with TypeScript equivalents. The build and start scripts are updated to use the TypeScript compiler and compiled output. Supporting files such as .env.example, .dockerignore, and nodemon.json are added or updated to reflect the new project structure. The documentation is revised to describe TypeScript usage and Docker deployment. Type definitions for external modules are stubbed as needed.

Changes

Files / Patterns Change Summary
cloud/schema.js, eslint.config.js, spec/.eslintrc.json Removed legacy JavaScript schema and ESLint configuration files.
cloud/schema.ts, eslint.config.mjs, spec/tsconfig.json, tsconfig.json, types/parse-server.d.ts Added TypeScript schema, ESLint config for TS, TypeScript configs, and module declarations for 'parse-server'.
cloud/functions.ts, cloud/main.ts, config.ts, spec/Tests.spec.ts Migrated or updated logic to TypeScript, adjusted error codes, added type ignore comments, and updated exports.
.dockerignore, .env.example, .gitignore, nodemon.json Added or updated configuration files for Docker, environment variables, git, and nodemon to match new structure.
Dockerfile Refactored to a multi-stage build for TypeScript, updated paths, and entrypoint.
package.json Updated scripts, entry points, dependencies, and devDependencies for TypeScript tooling and workflows.
README.md, public/test.html Updated documentation and references to reflect TypeScript migration and new file locations.
spec/support/jasmine.json Updated Jasmine configuration to use TypeScript test files and helpers.
index.ts Minor formatting change (added blank line).

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant Docker
    participant App (TypeScript)
    participant Parse Server

    User->>Docker: Build image (uses Dockerfile, tsconfig.json, etc.)
    Docker->>App (TypeScript): Run compiled app (dist/index.js)
    App (TypeScript)->>Parse Server: Initialize with config, cloud code, schema
    User->>App (TypeScript): Send request (e.g., save TestObject)
    App (TypeScript)->>Parse Server: Process request, run cloud functions
    Parse Server-->>App (TypeScript): Return response
    App (TypeScript)-->>User: Return result
Loading

Assessment against linked issues

Objective (Issue #) Addressed Explanation
Migrate example package to TypeScript (#561)
✨ Finishing Touches
  • 📝 Generate Docstrings

🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 11

♻️ Duplicate comments (2)
tsconfig.json (1)

2-14: Align TS config with Parse SDK conventions
As previously noted, the Parse JS SDK and Parse Server share a common tsconfig.json to enforce consistent compiler settings across repositories. If you intend to maintain uniform rulesets, consider reconciling this config with the upstream one.

package.json (1)

53-53: Replace the range operator (^) with an exact version.

Previous review requested removing range operators by using exact versions. The typescript-eslint dependency still has a range operator (^8.30.1).

#!/bin/bash
# Check if other dependencies use range operators
grep -E '"\^' package.json
📜 Review details

Configuration used: CodeRabbit UI
Review profile: ASSERTIVE
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between f9d0f17 and b7d3c78.

⛔ Files ignored due to path filters (1)
  • package-lock.json is excluded by !**/package-lock.json
📒 Files selected for processing (22)
  • .dockerignore (1 hunks)
  • .env.example (1 hunks)
  • .gitignore (1 hunks)
  • Dockerfile (1 hunks)
  • README.md (2 hunks)
  • cloud/functions.ts (1 hunks)
  • cloud/main.ts (1 hunks)
  • cloud/schema.js (0 hunks)
  • cloud/schema.ts (1 hunks)
  • config.ts (1 hunks)
  • eslint.config.js (0 hunks)
  • eslint.config.mjs (1 hunks)
  • index.ts (1 hunks)
  • nodemon.json (1 hunks)
  • package.json (2 hunks)
  • public/test.html (2 hunks)
  • spec/.eslintrc.json (0 hunks)
  • spec/Tests.spec.ts (1 hunks)
  • spec/support/jasmine.json (1 hunks)
  • spec/tsconfig.json (1 hunks)
  • tsconfig.json (1 hunks)
  • types/parse-server.d.ts (1 hunks)
💤 Files with no reviewable changes (3)
  • spec/.eslintrc.json
  • cloud/schema.js
  • eslint.config.js
🧰 Additional context used
🪛 LanguageTool
README.md

[style] ~88-~88: Three successive sentences begin with the same word. Consider rewording the sentence or use a thesaurus to find a synonym.
Context: ... .eslintrc.json. * npm run lint-fix will attempt fix the linting of your cloud c...

(ENGLISH_WORD_REPEAT_BEGINNING_RULE)


[style] ~89-~89: Three successive sentences begin with the same word. Consider rewording the sentence or use a thesaurus to find a synonym.
Context: ...ts and index.ts. * npm run prettier will help improve the formatting and layout ...

(ENGLISH_WORD_REPEAT_BEGINNING_RULE)


[style] ~90-~90: Three successive sentences begin with the same word. Consider rewording the sentence or use a thesaurus to find a synonym.
Context: ... defined in .prettierrc. * npm test will run all tests * npm run coverage will...

(ENGLISH_WORD_REPEAT_BEGINNING_RULE)

🪛 markdownlint-cli2 (0.17.2)
README.md

59-59: Fenced code blocks should be surrounded by blank lines
null

(MD031, blanks-around-fences)


59-59: Fenced code blocks should have a language specified
null

(MD040, fenced-code-language)


68-68: Fenced code blocks should be surrounded by blank lines
null

(MD031, blanks-around-fences)


68-68: Fenced code blocks should have a language specified
null

(MD040, fenced-code-language)


77-77: Lists should be surrounded by blank lines
null

(MD032, blanks-around-lists)


83-83: Headings should be surrounded by blank lines
Expected: 1; Actual: 0; Below

(MD022, blanks-around-headings)


86-86: Unordered list style
Expected: dash; Actual: asterisk

(MD004, ul-style)


87-87: Unordered list style
Expected: dash; Actual: asterisk

(MD004, ul-style)


88-88: Unordered list style
Expected: dash; Actual: asterisk

(MD004, ul-style)


89-89: Unordered list style
Expected: dash; Actual: asterisk

(MD004, ul-style)


90-90: Unordered list style
Expected: dash; Actual: asterisk

(MD004, ul-style)


91-91: Unordered list style
Expected: dash; Actual: asterisk

(MD004, ul-style)

🔇 Additional comments (31)
index.ts (1)

9-9: Formatting: Insert blank line after imports
The blank line after the import { config } from './config.js'; statement improves readability by visually separating dependency imports from application logic.

nodemon.json (3)

2-4: Ignore build output directory
Excluding dist from watch prevents Nodemon from restarting when compiled artifacts change, which is exactly the intended behavior in a TS build workflow.


5-5: Watch relevant file extensions
The ext: "json,ts,mjs,cjs,js" setting properly covers your source files and configs, ensuring Nodemon reacts to all changes you care about.


7-8: Ensure tsx runtime is installed
You’ve mapped .ts files to be executed via tsx. Please verify that tsx is declared in your devDependencies so that Nodemon can invoke it without errors.

.gitignore (3)

33-33: Ignore ESLint cache file
Adding .eslintcache prevents committing ESLint’s cache—good for keeping diffs clean.


34-36: Exclude compiled artifacts
Ignoring the dist directory aligns with your TypeScript build output configuration.


37-39: Handle environment files securely
Ignoring all .env* files while whitelisting .env.example is a best practice to protect sensitive variables.

spec/support/jasmine.json (1)

3-4: LGTM: TypeScript test file patterns properly configured

The configuration has been correctly updated to target TypeScript test files (.ts) instead of JavaScript files, which aligns with the project's migration to TypeScript.

cloud/main.ts (1)

4-4: LGTM: Empty export makes this a proper TypeScript module

Adding export {}; is good practice to mark this file as a module in TypeScript, which affects its scope.

spec/Tests.spec.ts (1)

16-16: LGTM: Using Parse.Error constant instead of magic number

Good improvement to use the Parse.Error.OTHER_CAUSE constant instead of a hardcoded error code. This enhances code readability and maintainability.

spec/tsconfig.json (1)

1-10: LGTM: Well-configured TypeScript setup for tests

This is a well-structured TypeScript configuration for tests:

  • Extends the root config for consistency
  • Sets noEmit: true which is appropriate for test files
  • Includes all TypeScript files in the spec directory

The configuration follows TypeScript best practices for test setups.

types/parse-server.d.ts (1)

1-2: Good first step for TypeScript compatibility

This declaration file provides a minimal type definition for the Parse Server module, allowing TypeScript to recognize imports from this package without type errors. While this approach doesn't provide actual type checking, it's a pragmatic way to start the TypeScript migration.

For future improvements, consider:

  • Creating more detailed type definitions
  • Using DefinitelyTyped (@types/parse-server) if available
  • Contributing types back to the original project
public/test.html (1)

71-71: Path update correctly reflects TypeScript migration

Good update to change the file extension from .js to .ts, ensuring the documentation correctly references the TypeScript cloud code file.

cloud/functions.ts (4)

2-3: Good use of TypeScript comment to acknowledge type limitations

The @ts-expect-error comment is appropriate here since the req.log property exists in Parse Server but isn't included in the type definitions.

For future improvements, consider adding this property to your custom type definitions.


9-10: Consistent error handling for TypeScript compatibility

Same technique applied consistently throughout the file.


15-15: Improved code clarity by using named constant

Great improvement to replace the magic number 9001 with the named constant Parse.Error.OTHER_CAUSE. This makes the code more readable and maintainable.


18-18: Required export for TypeScript modules

The empty export statement is necessary for TypeScript to treat this file as a proper module. This is good practice when migrating to TypeScript.

.dockerignore (1)

1-39: Great addition of the .dockerignore file!

This file properly excludes unnecessary files from the Docker build context, which will improve build performance and reduce image size. The organization by category (logs, runtime data, coverage, etc.) makes it easy to understand and maintain.

config.ts (2)

3-6: Improved database URI formatting

The reformatting of the database URI configuration improves readability.


6-6:

✅ Verification successful

Modernized cloud code loading approach

Changing from a direct path to a dynamic import function is a good modernization that aligns with TypeScript practices and allows for asynchronous loading of cloud code.


🏁 Script executed:

#!/bin/bash
# Check if the referenced main.js file exists or if it should be main.ts
ls -la cloud/main.js cloud/main.ts 2>/dev/null || echo "Neither file exists"

# Check for other modules using dynamic imports that might provide examples
grep -r "import(" --include="*.ts" . | grep -v "config.ts"

Length of output: 78031


Cloud import path is correct and ready to ship

The dynamic import of ./cloud/main.js aligns with the compiled output (main.tsmain.js). This modernization is spot-on and no further changes are needed.

README.md (3)

25-26: Properly updated table of contents

The table of contents has been updated to include the new Docker Deployment section, maintaining document structure integrity.


77-80: Clear explanation of Docker volume benefits

The explanation of Docker volume usage is clear and informative, helping users understand the benefits of the recommended approach.

🧰 Tools
🪛 markdownlint-cli2 (0.17.2)

77-77: Lists should be surrounded by blank lines
null

(MD032, blanks-around-lists)


95-95: Updated configuration file reference

The configuration file reference has been properly updated from config.js to config.ts to reflect the TypeScript migration.

Dockerfile (4)

1-13: Excellent multi-stage build implementation

The implementation of a multi-stage build process is an excellent improvement. This approach:

  • Separates build-time dependencies from runtime dependencies
  • Optimizes Docker layer caching by copying package.json files first
  • Creates a smaller final image by only including necessary artifacts

These changes follow Docker best practices and will result in smaller, more efficient images.


19-23: Optimized final image with selective copying

Selectively copying only the required files from the builder stage is a good practice that minimizes the final image size.


24-24: Properly configured volumes for persistence

The volume configuration aligns well with the Docker deployment instructions in the README, allowing for persistence of logs and runtime modification of cloud code.


28-28: Simplified startup command

The startup command has been simplified to directly run the Node.js application rather than using npm scripts. This reduces an additional process layer and provides more direct control over the application process.

package.json (2)

10-22: LGTM! Good configuration for TypeScript migration.

The changes to the package.json file correctly set up the project for TypeScript:

  • Entry point updated to the compiled output
  • Scripts updated to handle TypeScript files
  • Build process properly configured with tsc
  • Watch and preview scripts provide good developer experience

39-41: Appropriate type definitions added.

Adding TypeScript type definitions for Jasmine, Node, and Parse is essential for TypeScript support.

eslint.config.mjs (2)

8-47: Well-structured TypeScript ESLint configuration.

The ESLint configuration is comprehensive and well-designed for a TypeScript project:

  • Properly extends recommended JS and TS configs
  • Correctly sets up TypeScript parser with project references
  • Provides appropriate globals including Parse
  • Defines sensible rules for TypeScript development
  • Ignores build artifacts and non-source directories

27-29: Good TypeScript-specific rule configuration.

The configuration properly disables explicit return types (which can be too restrictive), warns on any usage (encouraging proper typing), and handles unused variables with appropriate exceptions for underscore-prefixed variables.

"target": "ES2022",
"moduleResolution": "Node",
"outDir": "./dist",
"noImplicitAny": false,
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick (assertive)

Reconsider disabling noImplicitAny
You’ve enabled strict: true but then overridden noImplicitAny to false, which weakens type safety by allowing implicit any types. Unless you have a specific need for this exception, remove the override or set noImplicitAny: true to catch unintended any usage.

Comment on lines +2 to +14
"compilerOptions": {
"module": "ES2022",
"target": "ES2022",
"moduleResolution": "Node",
"outDir": "./dist",
"noImplicitAny": false,
"allowJs": false,
"allowSyntheticDefaultImports": true,
"esModuleInterop": true,
"forceConsistentCasingInFileNames": true,
"strict": true,
"skipLibCheck": true
},
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick (assertive)

Specify rootDir for clearer project boundaries
Adding "rootDir": "./" (or the appropriate subdirectory) under compilerOptions helps the compiler determine your source root explicitly and avoid potential path resolution surprises.

Comment on lines +1 to +5
APP_ID=myAppId
MASTER_KEY=myMasterKey
MONGODB_URI=mongodb://localhost:27017/parse
PORT=1337
SERVER_URL=http://localhost:1337
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick (assertive)

Provide guidance for environment variables
The example variables are in place—consider adding inline comments or placeholder descriptions (e.g., # Example: Your Parse App ID) to help new users configure each key correctly.

await Promise.all([
import('./functions.js')
]);
Promise.all([import('./functions.js')]);
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

Update the file extension in the import path

Since you're migrating to TypeScript, the import should reference the TypeScript file:

-Promise.all([import('./functions.js')]);
+Promise.all([import('./functions.ts')]);

This assumes that you're using a bundler or runtime (like ts-node or tsx) that can handle TypeScript imports directly. If you're relying on compiled output, the import path may be correct as-is, but should be clarified with a comment.

📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
Promise.all([import('./functions.js')]);
Promise.all([import('./functions.ts')]);

💡 Verification agent

🧩 Analysis chain

Consider keeping the await before Promise.all

You've removed the await before Promise.all, which changes the behavior of this code. Without await, the module imports will happen asynchronously in the background without ensuring they complete before the module finishes loading.

-Promise.all([import('./functions.js')]);
+await Promise.all([import('./functions.js')]);

🏁 Script executed:

#!/bin/bash
# Find occurrences of the dynamic import snippet
rg -n "import\('\./functions\.js'\)" -n .

Length of output: 108


🏁 Script executed:

#!/bin/bash
# Display the first 50 lines of cloud/main.ts for context.
sed -n '1,50p' cloud/main.ts

Length of output: 206


Ensure dynamic imports complete with await

By omitting await, your module won’t wait for functions.js to load, which can lead to unregistered functions and unhandled promise rejections. Add a top-level await (requires ES module support in your TS config), or wrap the import in an async IIFE if your setup doesn’t support top-level await.

• cloud/main.ts:2

-Promise.all([import('./functions.js')]);
+await Promise.all([import('./functions.js')]);
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
Promise.all([import('./functions.js')]);
await Promise.all([import('./functions.js')]);

Comment on lines +1 to +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 },
},
},
];
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick (assertive)

Well-structured schema definition

The schema definition follows Parse Server's format correctly and exports properly as a TypeScript module.

For future improvements, consider:

  1. Adding explicit TypeScript interfaces for the schema structure
  2. Reviewing security implications of full public permissions (although this appears to be for a test object only)
// Example of using explicit interfaces
interface SchemaField {
  type: string;
  defaultValue?: any;
}

interface SchemaPermissions {
  [operation: string]: {
    [role: string]: boolean;
  };
}

interface SchemaDefinition {
  className: string;
  fields: {
    [fieldName: string]: SchemaField;
  };
  classLevelPermissions: SchemaPermissions;
}

@@ -1,7 +1,9 @@
import { schemaDefinitions } from "./cloud/schema.js";
import { schemaDefinitions } from './cloud/schema.js';
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Verification agent

🧩 Analysis chain

Verify file extension in import path

The import statement is using .js extension even though we're migrating to TypeScript. This could be intentional depending on your TypeScript configuration, but verify that this import works correctly at runtime.


🏁 Script executed:

#!/bin/bash
# Check if the referenced schema.js file exists or if it should be schema.ts
ls -la cloud/schema.js cloud/schema.ts 2>/dev/null || echo "Neither file exists"

# Check TypeScript compilation settings
grep -n "moduleResolution\|allowJs\|allowSyntheticDefaultImports" tsconfig.json 2>/dev/null

Length of output: 337


schema.js missing—update import path or tsconfig

The repo only contains cloud/schema.ts, not cloud/schema.js. With your current tsconfig ("moduleResolution": "Node", "allowJs": false), imports ending in .js won’t resolve to .ts files at compile time.

• In config.ts (line 1):

// Before
import { schemaDefinitions } from './cloud/schema.js';

––> references a non-existent file.

• In tsconfig.json:

{
  //
-   "moduleResolution": "Node",
+   "moduleResolution": "NodeNext",
  "allowJs": false,
  "allowSyntheticDefaultImports": true
  //
}

Choose one of the following fixes:

  • Update tsconfig to "moduleResolution": "NodeNext" (and, if needed, "module": "ESNext"), so .js imports resolve to .ts at compile time while still emitting .js for Node ESM.
  • Change the import in config.ts to a resolvable path (e.g. import { schemaDefinitions } from './cloud/schema.ts'; or drop the extension and handle it in your build).

Ensure both your TypeScript compiler and your runtime loader can find the module.

Comment on lines +54 to +82
## Docker Deployment

You can also run Parse Server using Docker:

1. Create a `.env` file with your configuration variables. For example:
```
APP_ID=myAppId
MASTER_KEY=myMasterKey
DATABASE_URI=mongodb://localhost:27017/parse
PORT=1337
PARSE_MOUNT=/parse
```

2. Run Docker with the following command, mounting volumes as needed:
```
docker build -t parse-server .
docker run -p 1337:1337 --env-file .env \
-v $(pwd)/logs:/usr/src/parse/logs \
-v $(pwd)/cloud:/usr/src/parse/cloud \
parse-server
```

This allows you to:
- Use an environment file for configuration
- Mount the logs directory to persist logs outside the container
- Mount the cloud directory to access your Cloud Code files from the container

You can customize the mounted volumes based on your needs, such as mounting config files or other directories that require persistence or runtime modifications.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick (assertive)

Well-documented Docker deployment instructions

The new Docker Deployment section provides comprehensive instructions for configuring and running the application with Docker. This is a valuable addition that helps users take advantage of the improved Docker setup.

Consider adding syntax highlighting to the code blocks by specifying the language:

-   ```
+   ```env
    APP_ID=myAppId
    MASTER_KEY=myMasterKey
    DATABASE_URI=mongodb://localhost:27017/parse
    PORT=1337
    PARSE_MOUNT=/parse
    ```
-   ```
+   ```bash
    docker build -t parse-server .
    docker run -p 1337:1337 --env-file .env \
      -v $(pwd)/logs:/usr/src/parse/logs \
      -v $(pwd)/cloud:/usr/src/parse/cloud \
      parse-server
    ```
🧰 Tools
🪛 markdownlint-cli2 (0.17.2)

59-59: Fenced code blocks should be surrounded by blank lines
null

(MD031, blanks-around-fences)


59-59: Fenced code blocks should have a language specified
null

(MD040, fenced-code-language)


68-68: Fenced code blocks should be surrounded by blank lines
null

(MD031, blanks-around-fences)


68-68: Fenced code blocks should have a language specified
null

(MD040, fenced-code-language)


77-77: Lists should be surrounded by blank lines
null

(MD032, blanks-around-lists)

Comment on lines +87 to 90
* `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
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick (assertive)

Updated script references for TypeScript

The script references have been properly updated to reflect the TypeScript migration, changing from index.js to index.ts.

Consider standardizing the bullet point style. The static analysis hints suggest using dashes instead of asterisks for consistency:

-* `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 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`.

Also, there's a grammar issue in the lint-fix description:

-* `npm run lint-fix` will attempt fix the linting of your cloud code, tests and `index.ts`.
+* `npm run lint-fix` will attempt to fix the linting of your cloud code, tests and `index.ts`.

Committable suggestion skipped: line range outside the PR's diff.

🧰 Tools
🪛 LanguageTool

[style] ~88-~88: Three successive sentences begin with the same word. Consider rewording the sentence or use a thesaurus to find a synonym.
Context: ... .eslintrc.json. * npm run lint-fix will attempt fix the linting of your cloud c...

(ENGLISH_WORD_REPEAT_BEGINNING_RULE)


[style] ~89-~89: Three successive sentences begin with the same word. Consider rewording the sentence or use a thesaurus to find a synonym.
Context: ...ts and index.ts. * npm run prettier will help improve the formatting and layout ...

(ENGLISH_WORD_REPEAT_BEGINNING_RULE)


[style] ~90-~90: Three successive sentences begin with the same word. Consider rewording the sentence or use a thesaurus to find a synonym.
Context: ... defined in .prettierrc. * npm test will run all tests * npm run coverage will...

(ENGLISH_WORD_REPEAT_BEGINNING_RULE)

🪛 markdownlint-cli2 (0.17.2)

87-87: Unordered list style
Expected: dash; Actual: asterisk

(MD004, ul-style)


88-88: Unordered list style
Expected: dash; Actual: asterisk

(MD004, ul-style)


89-89: Unordered list style
Expected: dash; Actual: asterisk

(MD004, ul-style)


90-90: Unordered list style
Expected: dash; Actual: asterisk

(MD004, ul-style)

@@ -1,26 +1,28 @@
FROM node:latest
# Builder stage
FROM node:22.12.0-alpine AS builder
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Verification agent

🧩 Analysis chain

Verify Node.js version compatibility

The specified Node.js version (22.12.0) seems unusually high. As of April 2024, Node.js 20.x is the latest LTS version, and version 22 would be experimental if available.


🌐 Web query:

What is the latest stable version of Node.js as of April 2024?

💡 Result:

As of April 2024, the latest stable version of Node.js is Node.js 20, which is currently the LTS (Long-Term Support) version. The most recent update to this version is 20.19.1, which was released on April 22, 2025.

Node.js follows a release schedule where even-numbered versions (like 20.x) become LTS versions, providing long-term stability and support for production environments. Node.js 20 entered LTS status in October 2023 and will remain in maintenance LTS until April 2025[9].

In addition to Node.js 20, there are other versions available:

  • Node.js 21.7.3 (released on April 10, 2024) is the latest in the 21.x series, which is a "Current" release but not an LTS version[2].
  • Node.js 18.20.8 (released on March 27, 2025) is also an LTS version but older than version 20.

Node.js 22 has also been released as of April 2024, but it is in the "Current" release status and will not become an LTS version until October 2024[7][8]. For production environments requiring stability, the recommended version to use is Node.js 20 LTS.

Citations:


Use Node.js 20 LTS for Production Builds

The Dockerfile currently pins to Node.js 22.12.0 (“Current” release), which is not an LTS version as of April 2024. For production stability and long-term support, switch to the latest 20.x LTS image (20.19.1 at the time of writing):

• File: Dockerfile

- FROM node:22.12.0-alpine AS builder
+ FROM node:20.19.1-alpine AS builder

If you explicitly need Node.js 22 features, document that requirement and be aware it won’t enter LTS status until October 2024.

📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
FROM node:22.12.0-alpine AS builder
FROM node:20.19.1-alpine AS builder

import globals from 'globals';
import path from 'node:path';

const __dirname = path.resolve();
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick (assertive)

Add a comment explaining the __dirname workaround.

The __dirname workaround is necessary because ES Modules don't have access to the CommonJS __dirname global. Adding a comment would improve code clarity and maintainability.

-const __dirname = path.resolve();
+// __dirname is not available in ES modules, so we have to recreate it
+const __dirname = path.resolve();
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
const __dirname = path.resolve();
// __dirname is not available in ES modules, so we have to recreate it
const __dirname = path.resolve();

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Convert example package to Typescript
2 participants