Skip to content

Conversation

@matteobruni
Copy link
Contributor

@matteobruni matteobruni commented Dec 30, 2025

Summary by CodeRabbit

  • Chores
    • Bumped package and dev-tooling versions (minor/patch), updated sample project engine; tightened and reorganized TypeScript configs; removed Mocha and an ESLint TypeScript config.
  • CI
    • Upgraded GitHub Actions components and added a workspace cleanup step.
  • Refactor
    • Simplified plugin initialization and removed unused internal state while preserving public behavior.
  • Tests
    • Improved test resilience by adding error handling to prevent unhandled rejections.

✏️ Tip: You can customize this high-level summary in your review settings.

Copilot AI review requested due to automatic review settings December 30, 2025 22:34
@coderabbitai
Copy link

coderabbitai bot commented Dec 30, 2025

Note

Other AI code review bot(s) detected

CodeRabbit has detected other AI code review bot(s) in this pull request and will avoid duplicating their findings in the review comments. This may lead to a less comprehensive review.

📝 Walkthrough

Walkthrough

Bumped multiple package/devDependency versions, upgraded CI actions and added a cleanup step, removed Mocha & ESLint TS configs, tightened and rearranged TypeScript configs, made a minor syntactic change in an ESLint build script, and removed Engine/Container runtime usage from the create-plugin code.

Changes

Cohort / File(s) Summary
Package version updates
files/empty-project/package.json, package.json, files/empty-project/package.dist.json
Bumped multiple dependencies/devDependencies (e.g., @tsparticles/*, @tsparticles/cli ^3.0.11→^3.0.14, @tsparticles/eslint-config ^3.0.6→^3.0.9, typescript-eslint ^8.50.0→^8.51.0, prettier-plugin-multiline-arrays 4.1.1→^4.1.3). Updated @tsparticles/engine in dist from ^3.3.0→^3.9.1.
CI workflow updates
.github/workflows/node.js-ci.yml
Upgraded Actions versions (actions/checkout v5→v6, actions/setup-node v4→v5, actions/cache v4→v5), bumped pnpm-action in PR path, and added an always-run cleanup step to remove tests/tmp-files.
Build script minor syntax change
src/build/build-eslint.ts
Added a trailing comma resulting in an extra (undefined) parameter being passed to an Array.map callback — syntactic-only edit with no behavioral change.
Plugin API & implementation simplification
files/create-plugin/src/plugin.ts, files/create-plugin/src/PluginInstance.ts, files/create-plugin/src/index.ts
Removed direct Engine/Container usage: constructor args and private engine/container fields commented/removed; getPlugin() changed to a no-arg async method; PluginInstance created without container/engine; init() made to return Promise.resolve(). Signatures in these files updated accordingly.
Test error handling tweaks
tests/create-plugin.test.ts, tests/create-preset.test.ts, tests/create-shape.test.ts
Wrapped asynchronous template creation calls in try/catch blocks and log errors via console.error instead of allowing exceptions to propagate.
TypeScript & test config changes
tsconfig.json, src/tsconfig.json, tests/tsconfig.json, tsconfig.eslint.json, .mocharc.json, files/empty-project/tsconfig.base.json
Deleted .mocharc.json and tsconfig.eslint.json. Replaced root tsconfig.json with a much stricter, expanded config (many strict flags enabled). src/tsconfig.json simplified to extend the base and set outDir. tests/tsconfig.json adjusted to extend base and changed compilerOptions. Added strictNullChecks in files/empty-project/tsconfig.base.json.

Sequence Diagram(s)

(omitted — changes do not introduce new multi-component control flow requiring a sequence diagram)

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

  • 3.0.0 #62 — Overlapping edits to build/lint tooling; both touch src/build/build-eslint.ts and related packaging/workflow areas.

Suggested labels

size/XL

Poem

🐇 I hopped through packages, neat and spry,

Commas nudged, workflows waved goodbye,
Engines tucked, configs made tight,
Tests now catch the dark of night,
I nibble updates — code feels right.

Pre-merge checks and finishing touches

❌ Failed checks (1 inconclusive)
Check name Status Explanation Resolution
Title check ❓ Inconclusive The title '3.0.14' is vague and does not convey meaningful information about the changeset. While it matches a version bump in package.json, it uses a generic version number without context about the actual changes. Consider using a more descriptive title that summarizes the main changes, such as 'Bump version to 3.0.14 and update dependencies' or 'Update dependencies and TypeScript configuration'.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
✨ Finishing touches
  • 📝 Generate docstrings

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR updates the package version from 3.0.11 to 3.0.14 and upgrades several dependencies including @tsparticles/* packages, typescript-eslint, and prettier-plugin-multiline-arrays. A minor code formatting fix (adding a trailing comma) is also included in the build-eslint.ts file.

Key changes:

  • Version bump from 3.0.11 to 3.0.14 in package.json
  • Updated @tsparticles/* dependencies (eslint-config, prettier-config, tsconfig, webpack-plugin)
  • Upgraded typescript-eslint from ^8.50.0 to ^8.51.0
  • Updated prettier-plugin-multiline-arrays from 4.1.1 to ^4.1.3 (also changed from pinned to caret versioning)

Reviewed changes

Copilot reviewed 3 out of 4 changed files in this pull request and generated 2 comments.

File Description
src/build/build-eslint.ts Added trailing comma to improve code formatting consistency
pnpm-lock.yaml Updated lockfile to reflect all dependency version changes
package.json Bumped package version to 3.0.14 and updated multiple dependencies
files/empty-project/package.json Updated @tsparticles/cli reference to ^3.0.14, but missing updates to other @tsparticles/* packages
Files not reviewed (1)
  • pnpm-lock.yaml: Language not supported
Comments suppressed due to low confidence (1)

files/empty-project/package.json:91

  • The version in files/empty-project/package.json has inconsistent dependency versions. While @tsparticles/cli is updated to ^3.0.14, the other @tsparticles packages remain at ^3.0.6:
  • @tsparticles/eslint-config should be ^3.0.9 (to match package.json line 33)
  • @tsparticles/prettier-config should be ^3.0.7 (to match package.json line 34)
  • @tsparticles/tsconfig should be ^3.0.9 (to match package.json line 35)
  • @tsparticles/webpack-plugin should be ^3.0.6 (to match package.json line 36)

These inconsistencies could lead to version conflicts and unexpected behavior.

    "@tsparticles/eslint-config": "^3.0.6",
    "@tsparticles/prettier-config": "^3.0.6",
    "@tsparticles/tsconfig": "^3.0.6",
    "@tsparticles/webpack-plugin": "^3.0.6",

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

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: 0

♻️ Duplicate comments (2)
package.json (2)

3-3: Version mismatch with PR title already flagged.

The discrepancy between the PR title ("3.0.13") and the actual version ("3.0.14") was already noted in a previous review. Please address this to ensure consistency.


49-49: Versioning strategy change already flagged.

The change from an exact version (4.1.1) to a caret range (^4.1.3) was already noted in a previous review. Please confirm this change in dependency management strategy is intentional.

🧹 Nitpick comments (1)
src/build/build-eslint.ts (1)

30-31: Minor: Trailing comma change appears unrelated to version bump.

The trailing comma addition is harmless and often preferred for cleaner git diffs. However, this formatting change seems unrelated to the PR's primary objective (version bump). Consider whether such changes should be handled separately by automated formatting tools or in a dedicated formatting PR.

📜 Review details

Configuration used: defaults

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between c86e1d6 and dbec5b1.

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (3)
  • files/empty-project/package.json
  • package.json
  • src/build/build-eslint.ts
🔇 Additional comments (4)
files/empty-project/package.json (1)

87-87: LGTM! Dependency version aligned with the root package.

The @tsparticles/cli devDependency update correctly aligns with the version being published in the root package.json.

package.json (3)

33-36: LGTM! @tsparticles dependencies updated consistently.

The @tsparticles internal dependencies have been updated to newer minor versions, which is appropriate for this release.


53-53: LGTM! TypeScript ESLint updated to latest minor version.

The typescript-eslint update from ^8.50.0 to ^8.51.0 is appropriate for incorporating recent fixes and improvements.


58-58: LGTM! Self-referential devDependency updated correctly.

The @tsparticles/cli devDependency has been updated to match the version being published.

@matteobruni matteobruni changed the title 3.0.13 3.0.14 Dec 31, 2025
@pull-request-size pull-request-size bot added size/M and removed size/S labels Dec 31, 2025
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: 2

🧹 Nitpick comments (2)
files/create-plugin/src/PluginInstance.ts (2)

4-12: Consider cleaning up nested comment marker for clarity.

The /* on line 9 inside the block comment (lines 4-12) doesn't serve a functional purpose and may confuse developers using this template. Consider removing it for cleaner commented-out code.

🔎 Suggested cleanup
    /*
    private readonly _container;
    private readonly _engine;

    constructor(container: Container, engine: Engine) {
-       /*this._container = container;
+       this._container = container;
        this._engine = engine;
    }
    */

14-17: Redundant await on resolved promise.

The await keyword is redundant since Promise.resolve() returns an already-resolved promise. Consider simplifying to return Promise.resolve(); or just return;.

🔎 Suggested simplification
    async init(): Promise<void> {
        // add your plugin initialization here, replace the empty promise
-       return await Promise.resolve();
+       return Promise.resolve();
    }

Or even simpler:

    async init(): Promise<void> {
        // add your plugin initialization here, replace the empty promise
-       return await Promise.resolve();
    }
📜 Review details

Configuration used: defaults

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between dbec5b1 and f2aaf6c.

📒 Files selected for processing (4)
  • .github/workflows/node.js-ci.yml
  • files/create-plugin/src/PluginInstance.ts
  • files/create-plugin/src/index.ts
  • files/create-plugin/src/plugin.ts
✅ Files skipped from review due to trivial changes (1)
  • .github/workflows/node.js-ci.yml
🧰 Additional context used
🧬 Code graph analysis (1)
files/create-plugin/src/index.ts (1)
files/create-plugin/src/plugin.ts (1)
  • Plugin (6-36)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: pr
🔇 Additional comments (3)
files/create-plugin/src/PluginInstance.ts (1)

1-1: LGTM!

Import changes correctly remove Container and Engine type dependencies while preserving IContainerPlugin, which is still needed for the class implementation.

files/create-plugin/src/plugin.ts (2)

1-1: LGTM!

Import changes appropriately remove Container and Engine type dependencies while preserving the types still needed for the plugin implementation.


9-15: Constructor changes look consistent.

The removal of the engine parameter and related field/assignment is consistent with the broader refactoring across the plugin template files.

const { Plugin } = await import("./plugin.js");

await engine.addPlugin(new Plugin(engine));
await engine.addPlugin(new Plugin(/*engine*/));
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

🧩 Analysis chain

🏁 Script executed:

# First, locate the plugin.ts file to verify the constructor signature
find . -name "plugin.ts" -o -name "plugin.js" | head -20

Repository: tsparticles/cli

Length of output: 124


🏁 Script executed:

# Search for the Plugin class definition and its constructor
rg "class Plugin" -A 10 --max-count 5

Repository: tsparticles/cli

Length of output: 1369


🏁 Script executed:

# Check for changelog, migration docs, or release notes
fd -e md -e txt | xargs rg -l "3\.0\.|breaking|migration|changelog" -i 2>/dev/null | head -20

Repository: tsparticles/cli

Length of output: 41


🏁 Script executed:

# Search for references to the Plugin constructor to see the pattern across the codebase
rg "new Plugin\(" -B 2 -A 2

Repository: tsparticles/cli

Length of output: 297


Ensure this breaking change is documented in release notes or migration guide.

The Plugin constructor change is correctly implemented in the template code—the engine parameter is removed and the instantiation passes no argument, matching the plugin.ts signature. However, this breaking change appears to lack documentation: no changelog, migration guide, or release notes entry was found in the repository explaining the change or migration path for users upgrading to this version.

🤖 Prompt for AI Agents
In files/create-plugin/src/index.ts around line 9, the change removing the
engine parameter from the Plugin constructor is not documented for users; add a
concise release-notes/changelog and/or migration-guide entry describing the
breaking change, show the old instantiation pattern (new Plugin(engine)) and the
new one (new Plugin()), include any rationale and migration steps (how to obtain
engine now or refactor callers), and update the repository's template/README or
upgrade notes so users upgrading to this version see the required changes.

Comment on lines +17 to 21
async getPlugin(/*container: Container*/): Promise<PluginInstance> {
const { PluginInstance } = await import("./PluginInstance.js");

return new PluginInstance(container, this._engine);
return new PluginInstance(/*container, this._engine*/);
}
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🔴 Critical

🧩 Analysis chain

🏁 Script executed:

# Search for IPlugin interface definition
find . -type f \( -name "*.ts" -o -name "*.d.ts" \) | head -20

Repository: tsparticles/cli

Length of output: 684


🏁 Script executed:

# Search for IPlugin interface
rg -A 10 "interface IPlugin" --type ts --type-list

Repository: tsparticles/cli

Length of output: 448


🏁 Script executed:

# Look for imports and IPlugin references in the plugin.ts file
cat -n files/create-plugin/src/plugin.ts

Repository: tsparticles/cli

Length of output: 1297


🏁 Script executed:

# Search for IPlugin in the entire codebase
rg "interface IPlugin" -A 10

Repository: tsparticles/cli

Length of output: 41


🏁 Script executed:

# Search for IPlugin interface in node_modules
find node_modules -path "*/tsparticles/engine*" -name "*.d.ts" -o -name "*.ts" | grep -E "(engine|IPlugin)" | head -20

Repository: tsparticles/cli

Length of output: 106


🏁 Script executed:

# Search more broadly in node_modules for IPlugin
rg "interface IPlugin" node_modules --type ts

Repository: tsparticles/cli

Length of output: 111


🏁 Script executed:

# Check package.json to understand the dependency
cat package.json | grep -A 2 -B 2 "tsparticles"

Repository: tsparticles/cli

Length of output: 812


🏁 Script executed:

# Search for other implementations of IPlugin in the codebase
rg "implements IPlugin"

Repository: tsparticles/cli

Length of output: 133


🏁 Script executed:

# Search for other getPlugin implementations
rg "getPlugin" --type ts -B 2 -A 5

Repository: tsparticles/cli

Length of output: 554


🌐 Web query:

@tsparticles/engine IPlugin interface getPlugin method signature

💡 Result:

The IPlugin's getPlugin method is synchronous and takes a Container, returning the plugin instance. Example signature from the official type files:

getPlugin(container: Container):

(eg. in EmittersPlugin: getPlugin(container: Container): Emitters). [1][2]

Sources:

  • EmittersPlugin d.ts (shows getPlugin(container: Container): Emitters). [1]
  • @tsparticles engine type declarations (engine/main d.ts exports IPlugin usage). [2]

References:
[1] https://app.unpkg.com/[email protected]/files/dist/ts4.0/Plugins/Emitters/EmittersPlugin.d.ts
[2] https://app.unpkg.com/[email protected]/files/engine.d.ts


Remove async/Promise wrapper and restore container parameter to match IPlugin interface contract.

The IPlugin interface requires getPlugin(container: Container): PluginInstance (synchronous with container parameter), but the implementation has both removed the container parameter and wrapped the return in an async/Promise, violating the interface contract. The method must be synchronous and accept the container parameter.

🤖 Prompt for AI Agents
In files/create-plugin/src/plugin.ts around lines 17 to 21, the getPlugin
implementation is async and drops the container parameter, violating the IPlugin
contract which expects a synchronous getPlugin(container: Container):
PluginInstance; change the method signature to accept the container parameter
(e.g., getPlugin(container: Container): PluginInstance), remove the
async/Promise wrapper, import PluginInstance synchronously if needed or keep
dynamic import but return the instance directly, and pass the container (and
this._engine if required) into the PluginInstance constructor so the method is
synchronous and matches the interface.

@pull-request-size pull-request-size bot added size/L and removed size/M labels Dec 31, 2025
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: 0

🧹 Nitpick comments (2)
tsconfig.json (2)

15-23: Optional: Remove redundant strict flags.

Lines 16-23 are redundant since "strict": true on line 15 already enables all of these individual flags: noImplicitAny, strictNullChecks, strictFunctionTypes, strictBindCallApply, strictPropertyInitialization, noImplicitThis, useUnknownInCatchVariables, and alwaysStrict.

The flags on lines 24-31 are correctly kept as they are not part of the strict flag.

🔎 Proposed simplification
     "compilerOptions": {
         "rootDir": ".",
         "outDir": ".",
         "resolveJsonModule": true,
         "composite": true,
         "types": [
             "node",
             "fs-extra",
             "klaw",
             "madge",
             "prompts",
             "eslint"
         ],
         "strict": true,
-        "noImplicitAny": true,
-        "strictNullChecks": true,
-        "strictFunctionTypes": true,
-        "strictBindCallApply": true,
-        "strictPropertyInitialization": true,
-        "noImplicitThis": true,
-        "useUnknownInCatchVariables": true,
-        "alwaysStrict": true,
         "noUnusedLocals": true,
         "noUnusedParameters": true,
         "exactOptionalPropertyTypes": true,
         "noImplicitReturns": true,
         "noFallthroughCasesInSwitch": true,
         "noUncheckedIndexedAccess": true,
         "noImplicitOverride": true,
         "noPropertyAccessFromIndexSignature": true
     },

3-4: Confirm whether outputting compiled JavaScript alongside source files is intentional.

With rootDir: "." and outDir: ".", TypeScript will compile source files and place .js output in the same directory structure (e.g., src/myfile.ts becomes src/myfile.js). This pattern is unusual and can clutter source directories.

If this is unintentional, consider using rootDir: "src" and outDir: "dist" to separate compiled output from source code. If this configuration is deliberate for your monorepo or build setup, confirm and document it.

📜 Review details

Configuration used: defaults

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 942ef44 and 6e5de95.

📒 Files selected for processing (3)
  • .github/workflows/node.js-ci.yml
  • .mocharc.json
  • tsconfig.json
💤 Files with no reviewable changes (1)
  • .mocharc.json
🚧 Files skipped from review as they are similar to previous changes (1)
  • .github/workflows/node.js-ci.yml
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: pr
🔇 Additional comments (1)
tsconfig.json (1)

33-37: LGTM! Comprehensive include configuration.

The include block appropriately covers all relevant directories (src, tests, and files), ensuring TypeScript compilation and type-checking are applied across the entire codebase.

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: 1

🧹 Nitpick comments (2)
tsconfig.json (2)

10-22: Consider simplifying the lib array.

When "ESNext" is included, it implicitly encompasses all prior ES versions (ES2024, ES2023, etc.). The additional entries are redundant and could be simplified to just ["ESNext"].

🔎 Suggested simplification
         "lib": [
-            "ESNext",
-            "ES2024",
-            "ES2023",
-            "ES2022",
-            "ES2021",
-            "ES2020",
-            "ES2019",
-            "ES2018",
-            "ES2017",
-            "ES2016",
-            "ES2015"
+            "ESNext"
         ],

32-48: Redundant strict flags when "strict": true is set.

Setting "strict": true already enables all the individual strict-mode flags (noImplicitAny, strictNullChecks, strictFunctionTypes, strictBindCallApply, strictPropertyInitialization, noImplicitThis, useUnknownInCatchVariables, alwaysStrict). The explicit flags on lines 33-40 are redundant.

However, I understand keeping them explicit can serve as documentation or guard against future changes to what strict includes. This is purely a stylistic choice.

📜 Review details

Configuration used: defaults

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 6e5de95 and dadc957.

📒 Files selected for processing (4)
  • src/tsconfig.json
  • tests/tsconfig.json
  • tsconfig.eslint.json
  • tsconfig.json
💤 Files with no reviewable changes (1)
  • tsconfig.eslint.json
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: pr
🔇 Additional comments (3)
tsconfig.json (1)

2-55: Well-structured base configuration with comprehensive strictness.

The configuration correctly sets up:

  • "composite": true for project references
  • "moduleResolution": "NodeNext" which is appropriate for modern Node.js projects
  • Strong type-checking with additional flags like noUncheckedIndexedAccess and exactOptionalPropertyTypes
src/tsconfig.json (1)

2-8: Clean extension pattern for source configuration.

The configuration properly extends the root config, overrides only the necessary paths (rootDir, outDir), and includes all source files. This is a clean and maintainable approach.

tests/tsconfig.json (1)

2-12: Well-configured test project setup.

The configuration correctly:

  • Extends the base config for consistent compiler settings
  • Overrides target to ES2021 for test runtime compatibility
  • Disables declaration generation (unnecessary for tests)
  • References ../src establishing the correct build dependency
  • Sets importHelpers: false to avoid tslib dependency in tests

"outDir": "../dist"
},
"references": [{ "path": "../" }]
"references": [{ "path": "../" }],
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Check if there are any other tsconfig files at root level that might justify this reference
echo "=== Root-level tsconfig files ==="
fd -d 1 'tsconfig.*\.json$' .

echo -e "\n=== Root tsconfig.json include/exclude/files ==="
cat tsconfig.json | jq '.include, .exclude, .files'

echo -e "\n=== src/tsconfig.json full config ==="
cat src/tsconfig.json

Repository: tsparticles/cli

Length of output: 410


Remove the project reference to the root directory.

The root tsconfig.json is a base configuration file (indicated by its include: ["src/**/*"] and the src/tsconfig.json extending it), not a separate project. The references field in src/tsconfig.json should not include { "path": "../" } because:

  1. extends and references serve different purposes: extends is for config inheritance, while references declares project dependencies
  2. There is no project to build at the root level—it only includes src files which belong to the src project itself
  3. This creates a confusing and potentially problematic circular-like relationship

Delete the references line from src/tsconfig.json entirely.

🤖 Prompt for AI Agents
In src/tsconfig.json around line 7, remove the project reference entry
{"path":"../"} from the "references" array — the src config extends the root
base config and should not declare the root as a referenced project; delete the
entire "references" line (or the array entry) so src/tsconfig.json no longer
references the root directory.

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: 6

📜 Review details

Configuration used: defaults

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 14ea768 and f21657f.

📒 Files selected for processing (3)
  • tests/create-plugin.test.ts
  • tests/create-preset.test.ts
  • tests/create-shape.test.ts
🧰 Additional context used
🧬 Code graph analysis (3)
tests/create-shape.test.ts (1)
src/create/shape/create-shape.ts (1)
  • createShapeTemplate (167-190)
tests/create-plugin.test.ts (1)
src/create/plugin/create-plugin.ts (1)
  • createPluginTemplate (162-184)
tests/create-preset.test.ts (1)
src/create/preset/create-preset.ts (1)
  • createPresetTemplate (180-204)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: pr

Comment on lines +11 to +15
try {
await createPluginTemplate("foo", "Foo", "", destDir);
} catch (e) {
console.error(e);
}
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🔴 Critical

Tests should fail when template creation fails.

Wrapping createPluginTemplate in a try/catch that only logs errors will cause the test to continue and potentially pass even when the core functionality fails. This defeats the purpose of the test and can mask real issues.

Remove the try/catch and let failures propagate naturally.

🔎 Proposed fix
-        try {
-            await createPluginTemplate("foo", "Foo", "", destDir);
-        } catch (e) {
-            console.error(e);
-        }
+        await createPluginTemplate("foo", "Foo", "", destDir);
📝 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
try {
await createPluginTemplate("foo", "Foo", "", destDir);
} catch (e) {
console.error(e);
}
await createPluginTemplate("foo", "Foo", "", destDir);
🤖 Prompt for AI Agents
In tests/create-plugin.test.ts around lines 11 to 15, the test wraps
createPluginTemplate in a try/catch that only logs errors which suppresses
failures; remove the try/catch so that any error thrown by createPluginTemplate
propagates and fails the test, ensuring the test fails on template creation
errors.

Comment on lines +27 to +31
try {
await createPluginTemplate("bar", "Bar", "https://github.com/matteobruni/tsparticles", destDir);
} catch (e) {
console.error(e);
}
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🔴 Critical

Tests should fail when template creation fails.

Same issue: the try/catch prevents test failures when createPluginTemplate throws, allowing the test to pass incorrectly.

🔎 Proposed fix
-        try {
-            await createPluginTemplate("bar", "Bar", "https://github.com/matteobruni/tsparticles", destDir);
-        } catch (e) {
-            console.error(e);
-        }
+        await createPluginTemplate("bar", "Bar", "https://github.com/matteobruni/tsparticles", destDir);
🤖 Prompt for AI Agents
In tests/create-plugin.test.ts around lines 27 to 31, the test wraps
createPluginTemplate in a try/catch and logs errors, which masks failures;
remove the try/catch so exceptions propagate (or replace with an assertion,
e.g., await expect(createPluginTemplate(...)).resolves.toBeUndefined() /
.rejects.toThrow(...) as appropriate) so the test fails when template creation
throws; ensure no console.error swallow is left.

Comment on lines +10 to +14
try {
await createPresetTemplate("foo", "Foo", "", destDir);
} catch (e) {
console.error(e);
}
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🔴 Critical

Tests should fail when template creation fails.

Wrapping createPresetTemplate in a try/catch that only logs errors will cause the test to pass even when preset creation fails. The test will continue to run assertions that may pass for the wrong reasons (e.g., stale files from previous runs).

Remove the try/catch to ensure proper test failure propagation.

🔎 Proposed fix
-        try {
-            await createPresetTemplate("foo", "Foo", "", destDir);
-        } catch (e) {
-            console.error(e);
-        }
+        await createPresetTemplate("foo", "Foo", "", destDir);
📝 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
try {
await createPresetTemplate("foo", "Foo", "", destDir);
} catch (e) {
console.error(e);
}
await createPresetTemplate("foo", "Foo", "", destDir);
🤖 Prompt for AI Agents
In tests/create-preset.test.ts around lines 10 to 14, the test wraps the
createPresetTemplate call in a try/catch that only logs errors, preventing
failures from bubbling up; remove the try/catch and call await
createPresetTemplate("foo", "Foo", "", destDir) directly so any thrown errors
cause the test to fail (let the test framework propagate the exception).

Comment on lines +27 to +31
try {
await createPresetTemplate("bar", "Bar", "https://github.com/matteobruni/tsparticles", destDir);
} catch (e) {
console.error(e);
}
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🔴 Critical

Tests should fail when template creation fails.

Same issue: catching and only logging errors from createPresetTemplate prevents the test from failing when it should, undermining test reliability.

🔎 Proposed fix
-        try {
-            await createPresetTemplate("bar", "Bar", "https://github.com/matteobruni/tsparticles", destDir);
-        } catch (e) {
-            console.error(e);
-        }
+        await createPresetTemplate("bar", "Bar", "https://github.com/matteobruni/tsparticles", destDir);
📝 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
try {
await createPresetTemplate("bar", "Bar", "https://github.com/matteobruni/tsparticles", destDir);
} catch (e) {
console.error(e);
}
await createPresetTemplate("bar", "Bar", "https://github.com/matteobruni/tsparticles", destDir);
🤖 Prompt for AI Agents
In tests/create-preset.test.ts around lines 27 to 31, the test is swallowing
errors by catching and only logging them; remove the try/catch (or rethrow the
caught error after logging) so that any failure in createPresetTemplate causes
the test to fail. Update the block to let the promise rejection/error propagate
(or rethrow) instead of just console.error, ensuring test runner detects the
failure.

Comment on lines +10 to +14
try {
await createShapeTemplate("foo", "Foo", "", destDir);
} catch (e) {
console.error(e);
}
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🔴 Critical

Tests should fail when template creation fails.

Wrapping createShapeTemplate in a try/catch block that only logs the error will cause the test to pass even if template creation fails. The subsequent assertions will run regardless, potentially passing if the directory exists from a previous run or failing with an unrelated error if it doesn't.

Remove the try/catch and allow failures to propagate, or explicitly fail the test when an error is caught.

🔎 Proposed fix
-        try {
-            await createShapeTemplate("foo", "Foo", "", destDir);
-        } catch (e) {
-            console.error(e);
-        }
+        await createShapeTemplate("foo", "Foo", "", destDir);
📝 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
try {
await createShapeTemplate("foo", "Foo", "", destDir);
} catch (e) {
console.error(e);
}
await createShapeTemplate("foo", "Foo", "", destDir);
🤖 Prompt for AI Agents
In tests/create-shape.test.ts around lines 10 to 14, the test swallows errors
from createShapeTemplate by catching and only logging them, which masks
failures; remove the try/catch so exceptions propagate and fail the test, or if
you prefer explicit handling, replace the catch with a rethrow or call to
fail/assert.fail with the caught error so the test fails when template creation
fails.

Comment on lines +27 to +31
try {
await createShapeTemplate("bar", "Bar", "https://github.com/matteobruni/tsparticles", destDir);
} catch (e) {
console.error(e);
}
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🔴 Critical

Tests should fail when template creation fails.

Same issue as the first test case: wrapping createShapeTemplate in a try/catch that only logs errors will cause false positives. The test should fail immediately if template creation fails.

🔎 Proposed fix
-        try {
-            await createShapeTemplate("bar", "Bar", "https://github.com/matteobruni/tsparticles", destDir);
-        } catch (e) {
-            console.error(e);
-        }
+        await createShapeTemplate("bar", "Bar", "https://github.com/matteobruni/tsparticles", destDir);
📝 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
try {
await createShapeTemplate("bar", "Bar", "https://github.com/matteobruni/tsparticles", destDir);
} catch (e) {
console.error(e);
}
await createShapeTemplate("bar", "Bar", "https://github.com/matteobruni/tsparticles", destDir);
🤖 Prompt for AI Agents
In tests/create-shape.test.ts around lines 27 to 31, the test wraps
createShapeTemplate in a try/catch that only logs errors which hides failures
and yields false positives; remove the try/catch so the thrown error propagates
(or rethrow the caught error / use await
expect(createShapeTemplate(...)).resolves/rejects as appropriate) so the test
will fail when template creation fails.

@matteobruni matteobruni merged commit d8d62cf into main Dec 31, 2025
3 checks passed
@matteobruni matteobruni deleted the dev branch December 31, 2025 12:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants