Skip to content
Open
Show file tree
Hide file tree
Changes from 32 commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
38da21b
build: removed const enums, even TS team says they are a pitfall
matteobruni Apr 29, 2024
d66bdfb
build: updated deps
matteobruni May 26, 2024
34af9cc
build: updated deps
matteobruni May 27, 2024
f275d81
build: updating cli with eslint 9
matteobruni Aug 31, 2025
84a390a
build: adding missing files, updated some deps
matteobruni Aug 31, 2025
4b7ab77
build: updated postversion script
matteobruni Aug 31, 2025
33c35f6
build: updated postversion script
matteobruni Aug 31, 2025
962b031
build: updated postversion script
matteobruni Aug 31, 2025
d4dd087
3.0.0
matteobruni Aug 31, 2025
c23627f
build: updated deps and fixed eslint build
matteobruni Aug 31, 2025
17f4157
3.0.1
matteobruni Aug 31, 2025
40a02c9
build: updated workflows
matteobruni Aug 31, 2025
2cd3d7c
build: updated workflows
matteobruni Aug 31, 2025
8be9b89
Merge branch 'main' into dev
matteobruni Aug 31, 2025
431b685
build: updated tests and output
matteobruni Aug 31, 2025
e8da7df
3.0.2
matteobruni Aug 31, 2025
61bd03e
build: updated imports
matteobruni Aug 31, 2025
986f452
3.0.3
matteobruni Aug 31, 2025
1bb5554
build: updated tsconfig
matteobruni Aug 31, 2025
8aaefe7
3.0.4
matteobruni Aug 31, 2025
366cb91
build: updated deps
matteobruni Aug 31, 2025
3d88374
3.0.5
matteobruni Aug 31, 2025
c1b9cd3
build: updated deps and build configs
matteobruni Aug 31, 2025
1bcbc48
3.0.6
matteobruni Aug 31, 2025
b13b270
build: updated short flags in build command
matteobruni Aug 31, 2025
37734fe
3.0.7
matteobruni Aug 31, 2025
25faccf
build: updated short flags in build command
matteobruni Aug 31, 2025
ddea6e5
3.0.8
matteobruni Aug 31, 2025
d9c9098
fix: fixed issues with path.resolve
matteobruni Aug 31, 2025
7e2e802
3.0.9
matteobruni Aug 31, 2025
108969b
fix: fixed build process and templates
matteobruni Sep 1, 2025
637477d
3.0.10
matteobruni Sep 1, 2025
8d9a16f
build: updated deps
matteobruni Sep 1, 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
2 changes: 0 additions & 2 deletions .eslintignore

This file was deleted.

13 changes: 0 additions & 13 deletions .eslintrc.js

This file was deleted.

16 changes: 8 additions & 8 deletions .github/workflows/node.js-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,18 +12,18 @@ jobs:
runs-on: ubuntu-latest
if: ${{ github.event_name != 'pull_request' }}
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v5
name: Checkout [main]
with:
fetch-depth: 0
- uses: actions/setup-node@v4
with:
node-version: "16"
- uses: pnpm/action-setup@v3.0.0
node-version: "22"
- uses: pnpm/action-setup@v4
name: Install pnpm
id: pnpm-install
with:
version: 8
version: 10
run_install: false
- name: Get pnpm version
id: pnpm-version
Expand All @@ -49,19 +49,19 @@ jobs:
runs-on: ubuntu-latest
if: ${{ github.event_name == 'pull_request' }}
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v5
with:
ref: ${{ github.event.pull_request.head.ref }}
repository: ${{ github.event.pull_request.head.repo.full_name }}
fetch-depth: 0
- uses: actions/setup-node@v4
with:
node-version: "16"
- uses: pnpm/action-setup@v3.0.0
node-version: "22"
- uses: pnpm/action-setup@v3
name: Install pnpm
id: pnpm-install
with:
version: 8
version: 10
run_install: false
- name: Get pnpm version
id: pnpm-version
Expand Down
22 changes: 22 additions & 0 deletions eslint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import path from "path";
import {fileURLToPath} from "url";
import {defineConfig} from "eslint/config";
import tsParticlesESLintConfig from "@tsparticles/eslint-config";

const __dirname = path.dirname(fileURLToPath(import.meta.url));

export default defineConfig([
tsParticlesESLintConfig,
{
languageOptions: {
parserOptions: {
project: [path.join(__dirname, "src", "tsconfig.json")],
tsconfigRootDir: __dirname,
sourceType: "module"
}
},
rules: {
"no-console": "off"
}
}
]);
2 changes: 2 additions & 0 deletions files/create-shape/src/ShapeDrawer.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import type { IShapeDrawData, IShapeDrawer } from "@tsparticles/engine";

export class ShapeDrawer implements IShapeDrawer {
readonly validTypes = ["#template#"] as const;

draw(_data: IShapeDrawData): void {
// draw the particle using the context
// which is already centered in the particle position
Expand Down
2 changes: 1 addition & 1 deletion files/create-shape/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@ import type { Engine } from "@tsparticles/engine";
export async function loadTemplateShape(engine: Engine): Promise<void> {
const { ShapeDrawer } = await import("./ShapeDrawer.js");

await engine.addShape("#template#", new ShapeDrawer());
await engine.addShape(new ShapeDrawer());
}
2 changes: 0 additions & 2 deletions files/empty-project/.eslintignore

This file was deleted.

5 changes: 0 additions & 5 deletions files/empty-project/.eslintrc.js

This file was deleted.

6 changes: 6 additions & 0 deletions files/empty-project/eslint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import tsParticlesESLintConfig from "@tsparticles/eslint-config";
import { defineConfig } from "eslint/config";

export default defineConfig([
tsParticlesESLintConfig,
]);
1 change: 1 addition & 0 deletions files/empty-project/package.dist.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"name": "@tsparticles/empty-template",
"version": "1.0.0",
"private": true,
"type": "module",
"author": "Matteo Bruni <[email protected]>",
"description": "tsParticles empty template",
"homepage": "https://particles.js.org",
Expand Down
42 changes: 21 additions & 21 deletions files/empty-project/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"name": "@tsparticles/empty-template",
"version": "1.0.0",
"private": true,
"type": "module",
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue

"type": "module" conflicts with CommonJS "main" entry; use exports map or .cjs.

With "type": "module", Node treats .js as ESM. Pointing "main" at dist/cjs/index.js (CommonJS) will break require/import. Prefer an exports map and emit .cjs for CJS output.

Apply:

-  "main": "dist/cjs/index.js",
-  "module": "dist/esm/index.js",
-  "types": "dist/types/index.d.ts",
+  "exports": {
+    ".": {
+      "types": "./dist/types/index.d.ts",
+      "import": "./dist/esm/index.js",
+      "require": "./dist/cjs/index.cjs"
+    },
+    "./package.json": "./package.json"
+  },
+  "main": "./dist/esm/index.js",
+  "types": "./dist/types/index.d.ts",

Note: ensure your build emits dist/cjs/index.cjs (or rename accordingly).

Also applies to: 81-83

🤖 Prompt for AI Agents
In files/empty-project/package.json around line 5, "type": "module" conflicts
with the CommonJS "main" entry; update package.json and build outputs so ESM and
CJS artifacts match: either remove "type": "module" to keep CommonJS, or
(preferred) keep "type": "module", change "main" to point to a CJS file like
"dist/cjs/index.cjs", add an "exports" map exposing "./" with import ->
"dist/esm/index.js" and require -> "dist/cjs/index.cjs", and ensure the build
emits dist/cjs/index.cjs (or rename your CJS output) so require consumers and
import consumers both resolve correctly.

"description": "tsParticles empty template",
"homepage": "https://particles.js.org",
"scripts": {
Expand Down Expand Up @@ -82,29 +83,28 @@
"types": "dist/types/index.d.ts",
"prettier": "@tsparticles/prettier-config",
"devDependencies": {
"@babel/core": "^7.23.9",
"@tsparticles/cli": "^2.3.3",
"@tsparticles/eslint-config": "^2.2.1",
"@tsparticles/prettier-config": "^2.1.6",
"@tsparticles/tsconfig": "^2.1.7",
"@tsparticles/webpack-plugin": "^2.2.1",
"@types/webpack-env": "^1.18.4",
"@typescript-eslint/eslint-plugin": "^7.1.0",
"@typescript-eslint/parser": "^7.1.0",
"babel-loader": "^9.1.3",
"browserslist": "^4.23.0",
"@babel/core": "^7.28.3",
"@tsparticles/cli": "^3.0.10",
"@tsparticles/eslint-config": "^3.0.5",
"@tsparticles/prettier-config": "^3.0.1",
"@tsparticles/tsconfig": "^3.0.5",
"@tsparticles/webpack-plugin": "^3.0.5",
"@types/webpack-env": "^1.18.8",
"babel-loader": "^10.0.0",
"browserslist": "^4.25.4",
"copyfiles": "^2.4.1",
"eslint": "^8.56.0",
"eslint-config-prettier": "^9.1.0",
"prettier": "^3.2.4",
"rimraf": "^5.0.5",
"terser-webpack-plugin": "^5.3.10",
"typescript": "^5.3.3",
"webpack": "^5.90.0",
"webpack-bundle-analyzer": "^4.10.1",
"webpack-cli": "^5.1.4"
"eslint": "^9.34.0",
"eslint-config-prettier": "^10.1.8",
"prettier": "^3.6.2",
"rimraf": "^6.0.1",
"terser-webpack-plugin": "^5.3.14",
"typescript": "^5.9.2",
"typescript-eslint": "^8.41.0",
"webpack": "^5.101.3",
"webpack-bundle-analyzer": "^4.10.2",
"webpack-cli": "^6.0.1"
},
"dependencies": {
"@tsparticles/engine": "^3.3.0"
"@tsparticles/engine": "^3.9.1"
}
}
18 changes: 15 additions & 3 deletions files/empty-project/webpack.config.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,16 @@
const { loadParticlesTemplate } = require("@tsparticles/webpack-plugin"),
version = require("./package.json").version;
import {loadParticlesTemplate} from "@tsparticles/webpack-plugin";
import {fileURLToPath} from "url";
import fs from "fs-extra";
import path from "path";

module.exports = loadParticlesTemplate({ moduleName: "empty", templateName: "Empty", version, dir: __dirname });
const __filename = fileURLToPath(import.meta.url),
__dirname = path.dirname(__filename),
rootPkgPath = path.join(__dirname, "package.json"),
pkg = await fs.readJson(rootPkgPath);

export default loadParticlesTemplate({
moduleName: "empty",
templateName: "Empty",
version: pkg.version,
dir: __dirname
});
83 changes: 39 additions & 44 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
{
"name": "@tsparticles/cli",
"version": "2.3.3",
"version": "3.0.10",
"license": "MIT",
"type": "module",
"bin": {
"tsparticles-cli": "dist/cli.js"
},
Expand All @@ -21,66 +22,60 @@
"compile:ci": "pnpm run build:ts",
"build:ts": "pnpm run build:ts:cjs",
"build:ts:cjs": "tsc -p src",
"test": "cross-env TS_NODE_PROJECT='./tests/tsconfig.json' nyc mocha --timeout 300000",
"test": "vitest run",
"build": "pnpm run clear:dist && pnpm run prettify:src && pnpm run lint && pnpm run compile && pnpm run circular-deps && pnpm run prettify:readme && chmod +x dist/cli.js && chmod +x dist/build/build.js && chmod +x dist/create/create.js && chmod +x dist/create/preset/preset.js",
"build:ci": "pnpm run clear:dist && pnpm run prettify:ci:src && pnpm run lint:ci && pnpm run compile:ci && pnpm run prettify:ci:readme",
"clear:dist": "rimraf ./dist",
"prepack": "pnpm run build",
"version": "node scripts/postversion.js && git add files/empty-project/package.json"
},
"dependencies": {
"@tsparticles/eslint-config": "^2.3.0",
"@tsparticles/prettier-config": "^2.1.6",
"@tsparticles/tsconfig": "^2.3.0",
"@tsparticles/webpack-plugin": "^2.3.0",
"@typescript-eslint/eslint-plugin": "^7.1.1",
"@typescript-eslint/parser": "^7.1.1",
"commander": "^12.0.0",
"eslint": "^8.57.0",
"eslint-config-prettier": "^9.1.0",
"eslint-plugin-jsdoc": "^48.2.0",
"eslint-plugin-prettier": "^5.1.3",
"eslint-plugin-tsdoc": "^0.2.17",
"fs-extra": "^11.2.0",
"@tsparticles/eslint-config": "^3.0.5",
"@tsparticles/prettier-config": "^3.0.1",
"@tsparticles/tsconfig": "^3.0.5",
"@tsparticles/webpack-plugin": "^3.0.5",
"commander": "^14.0.0",
"eslint": "^9.34.0",
"eslint-config-prettier": "^10.1.8",
"eslint-plugin-jsdoc": "^54.1.1",
"eslint-plugin-prettier": "^5.5.4",
"eslint-plugin-tsdoc": "^0.4.0",
"fs-extra": "^11.3.1",
"klaw": "^4.1.0",
"lookpath": "^1.2.2",
"madge": "^6.1.0",
"path-scurry": "^1.10.1",
"prettier": "^3.2.5",
"prettier-plugin-multiline-arrays": "^3.0.4",
"lookpath": "^1.2.3",
"madge": "^8.0.0",
"path-scurry": "^2.0.0",
"prettier": "^3.6.2",
"prettier-plugin-multiline-arrays": "^4.0.3",
"prompts": "^2.4.2",
"rimraf": "^5.0.5",
"typescript": "^5.4.2",
"webpack": "^5.90.3"
"rimraf": "^6.0.1",
"typescript": "^5.9.2",
"typescript-eslint": "^8.41.0",
"webpack": "^5.101.3"
},
"devDependencies": {
"@babel/core": "^7.23.9",
"@tsparticles/cli": "^2.2.4",
"@tsparticles/engine": "^3.3.0",
"@types/chai": "^4.3.12",
"@types/eslint": "^8.56.5",
"@babel/core": "^7.28.3",
"@tsparticles/cli": "^2.3.3",
"@tsparticles/engine": "^3.9.1",
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue

Remove self-dependency from devDependencies.

The package lists itself as a devDependency, which can cause resolution issues.

   "devDependencies": {
-    "@babel/core": "^7.28.3",
-    "@tsparticles/cli": "^2.3.3",
+    "@babel/core": "^7.28.3",
📝 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
"@babel/core": "^7.28.3",
"@tsparticles/cli": "^2.3.3",
"@tsparticles/engine": "^3.9.1",
"@babel/core": "^7.28.3",
"@tsparticles/engine": "^3.9.1",
🤖 Prompt for AI Agents
package.json around lines 57-59: remove the package's own name from
devDependencies (the self-dependency entry) so the project does not list itself
as a devDependency; delete that dependency line, save package.json, then run
your package manager (npm install or yarn install) to update node_modules and
the lockfile and verify package.json remains valid.

"@types/eslint": "^9.6.1",
"@types/estree": "^1.0.8",
"@types/fs-extra": "^11.0.4",
"@types/klaw": "^3.0.6",
"@types/klaw": "^3.0.7",
"@types/madge": "^5.0.3",
"@types/mocha": "^10.0.6",
"@types/node": "^20.11.24",
"@types/node": "^24.3.0",
"@types/prompts": "^2.4.9",
"@types/webpack-env": "^1.18.4",
"@typescript-eslint/eslint-plugin": "^7.1.0",
"@typescript-eslint/parser": "^7.1.0",
"babel-loader": "^9.1.3",
"browserslist": "^4.23.0",
"chai": "^4.4.1",
"@types/webpack-env": "^1.18.8",
"babel-loader": "^10.0.0",
"browserslist": "^4.25.4",
"copyfiles": "^2.4.1",
"cross-env": "^7.0.3",
"mocha": "^10.3.0",
"nyc": "^15.1.0",
"terser-webpack-plugin": "^5.3.10",
"cross-env": "^10.0.0",
"terser-webpack-plugin": "^5.3.14",
"ts-node": "^10.9.2",
"webpack-bundle-analyzer": "^4.10.1",
"webpack-cli": "^5.1.4"
"vitest": "^1.5.6",
"webpack-bundle-analyzer": "^4.10.2",
"webpack-cli": "^6.0.1"
},
"description": "tsParticles CLI",
"main": ".eslintrc.js",
"main": "eslint.config.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

"main" points to eslint.config.js; set it to the CLI entry or drop it.

Current value breaks consumers importing the package.

-  "main": "eslint.config.js",
+  "main": "dist/cli.js",
+  "exports": {
+    ".": "./dist/cli.js",
+    "./package.json": "./package.json"
+  },
📝 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
"main": "eslint.config.js",
// before (around line 79)
- "main": "eslint.config.js",
// after
"main": "dist/cli.js",
"exports": {
".": "./dist/cli.js",
"./package.json": "./package.json"
},
🤖 Prompt for AI Agents
In package.json around line 79, the "main" field incorrectly points to
eslint.config.js which breaks consumers; update the "main" field to point to
your package's actual runtime/CLI entry (e.g., the built CommonJS entry like
"lib/index.js" or the published CLI entry), or remove the "main" field entirely
if the package is only a CLI and you expose binaries via "bin"; ensure the
chosen path exists in the published package and matches your build/output.

"author": "Matteo Bruni <[email protected]>"
}
Loading
Loading