Skip to content

Commit c71cf9b

Browse files
authored
Merge pull request #41 from tsparticles/dev
Dev
2 parents f759905 + 3e2ef15 commit c71cf9b

File tree

13 files changed

+1773
-1286
lines changed

13 files changed

+1773
-1286
lines changed

files/create-plugin/src/index.ts

Lines changed: 3 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,41 +1,10 @@
1-
import type { Container, Engine, IPlugin, ISourceOptions, Options } from "@tsparticles/engine";
2-
import { PluginInstance } from "./PluginInstance";
3-
4-
/**
5-
*/
6-
class Plugin implements IPlugin {
7-
readonly id;
8-
9-
private readonly _engine;
10-
11-
constructor(engine: Engine) {
12-
this.id = "#template#";
13-
14-
this._engine = engine;
15-
}
16-
17-
getPlugin(container: Container): PluginInstance {
18-
return new PluginInstance(container, this._engine);
19-
}
20-
21-
loadOptions(_options: Options, _source?: ISourceOptions): void {
22-
if (!this.needsPlugin()) {
23-
// ignore plugin options when not needed
24-
25-
return;
26-
}
27-
28-
// Load your options here
29-
}
30-
31-
needsPlugin(_options?: ISourceOptions): boolean {
32-
return true; // add your condition here, replace true with condition if needed
33-
}
34-
}
1+
import type { Engine } from "@tsparticles/engine";
352

363
/**
374
* @param engine - The engine instance
385
*/
396
export async function loadTemplatePlugin(engine: Engine): Promise<void> {
7+
const { Plugin } = await import("./plugin.js");
8+
409
await engine.addPlugin(new Plugin(engine));
4110
}

files/create-plugin/src/plugin.ts

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
import { type Container, type Engine, type IPlugin, type ISourceOptions, type Options } from "@tsparticles/engine";
2+
import type { PluginInstance } from "./PluginInstance.js";
3+
4+
/**
5+
*/
6+
export class Plugin implements IPlugin {
7+
readonly id;
8+
9+
private readonly _engine;
10+
11+
constructor(engine: Engine) {
12+
this.id = "#template#";
13+
14+
this._engine = engine;
15+
}
16+
17+
async getPlugin(container: Container): Promise<PluginInstance> {
18+
const { PluginInstance } = await import("./PluginInstance.js");
19+
20+
return new PluginInstance(container, this._engine);
21+
}
22+
23+
loadOptions(_options: Options, _source?: ISourceOptions): void {
24+
if (!this.needsPlugin()) {
25+
// ignore plugin options when not needed
26+
27+
return;
28+
}
29+
30+
// Load your options here
31+
}
32+
33+
needsPlugin(_options?: ISourceOptions): boolean {
34+
return true; // add your condition here, replace true with condition if needed
35+
}
36+
}

files/create-preset/src/index.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
import type { Engine } from "@tsparticles/engine";
2-
import { options } from "./options";
32

43
/**
54
*
65
* @param engine - the engine instance to load the preset into
76
*/
87
export async function loadTemplatePreset(engine: Engine): Promise<void> {
8+
const { options } = await import("./options.js");
9+
910
// TODO: additional modules must be loaded here
1011

1112
// Adds the preset to the engine, with the given options

files/create-shape/src/index.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
import type { Engine } from "@tsparticles/engine";
2-
import { ShapeDrawer } from "./ShapeDrawer";
32

43
/**
54
* @param engine - the engine instance to load the shape into
65
*/
76
export async function loadTemplateShape(engine: Engine): Promise<void> {
7+
const { ShapeDrawer } = await import("./ShapeDrawer.js");
8+
89
await engine.addShape("#template#", new ShapeDrawer());
910
}

files/empty-project/package.dist.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,6 @@
7272
"module": "index.js",
7373
"types": "index.d.ts",
7474
"dependencies": {
75-
"@tsparticles/engine": "^3.0.3"
75+
"@tsparticles/engine": "^3.3.0"
7676
}
7777
}

files/empty-project/package.json

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -83,16 +83,16 @@
8383
"prettier": "@tsparticles/prettier-config",
8484
"devDependencies": {
8585
"@babel/core": "^7.23.9",
86-
"@tsparticles/cli": "^2.0.5",
87-
"@tsparticles/eslint-config": "^2.1.0",
88-
"@tsparticles/prettier-config": "^2.1.0",
89-
"@tsparticles/tsconfig": "^2.0.1",
90-
"@tsparticles/webpack-plugin": "^2.1.0",
86+
"@tsparticles/cli": "^2.3.2",
87+
"@tsparticles/eslint-config": "^2.2.1",
88+
"@tsparticles/prettier-config": "^2.1.6",
89+
"@tsparticles/tsconfig": "^2.1.7",
90+
"@tsparticles/webpack-plugin": "^2.2.1",
9191
"@types/webpack-env": "^1.18.4",
92-
"@typescript-eslint/eslint-plugin": "^6.19.1",
93-
"@typescript-eslint/parser": "^6.19.1",
92+
"@typescript-eslint/eslint-plugin": "^7.1.0",
93+
"@typescript-eslint/parser": "^7.1.0",
9494
"babel-loader": "^9.1.3",
95-
"browserslist": "^4.22.3",
95+
"browserslist": "^4.23.0",
9696
"copyfiles": "^2.4.1",
9797
"eslint": "^8.56.0",
9898
"eslint-config-prettier": "^9.1.0",
@@ -105,6 +105,6 @@
105105
"webpack-cli": "^5.1.4"
106106
},
107107
"dependencies": {
108-
"@tsparticles/engine": "^3.0.3"
108+
"@tsparticles/engine": "^3.3.0"
109109
}
110110
}

package.json

Lines changed: 37 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@tsparticles/cli",
3-
"version": "2.0.5",
3+
"version": "2.3.2",
44
"license": "MIT",
55
"bin": {
66
"tsparticles-cli": "dist/cli.js"
@@ -16,52 +16,69 @@
1616
"prettify:readme": "prettier --write ./README.md",
1717
"lint": "eslint src --ext .js,.jsx,.ts,.tsx --fix",
1818
"lint:ci": "eslint src --ext .js,.jsx,.ts,.tsx",
19+
"circular-deps": "madge --circular --extensions ts src",
1920
"compile": "pnpm run build:ts",
2021
"compile:ci": "pnpm run build:ts",
2122
"build:ts": "pnpm run build:ts:cjs",
2223
"build:ts:cjs": "tsc -p src",
2324
"test": "cross-env TS_NODE_PROJECT='./tests/tsconfig.json' nyc mocha --timeout 300000",
24-
"build": "pnpm run clear:dist && pnpm run prettify:src && pnpm run lint && pnpm run compile && 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",
25-
"build:ci": "pnpm run clear:dist && pnpm run prettify:ci:src && pnpm run lint:ci && pnpm run compile && pnpm run prettify:ci:readme",
25+
"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",
26+
"build:ci": "pnpm run clear:dist && pnpm run prettify:ci:src && pnpm run lint:ci && pnpm run compile:ci && pnpm run prettify:ci:readme",
2627
"clear:dist": "rimraf ./dist",
2728
"prepack": "pnpm run build",
2829
"version": "node scripts/postversion.js && git add files/empty-project/package.json"
2930
},
3031
"dependencies": {
31-
"@tsparticles/eslint-config": "^2.1.0",
32-
"@tsparticles/prettier-config": "^2.1.0",
33-
"@tsparticles/tsconfig": "^2.0.1",
34-
"@tsparticles/webpack-plugin": "^2.1.0",
35-
"@typescript-eslint/eslint-plugin": "^6.19.1",
36-
"@typescript-eslint/parser": "^6.19.1",
37-
"commander": "^11.1.0",
38-
"eslint": "^8.56.0",
32+
"@tsparticles/eslint-config": "^2.2.1",
33+
"@tsparticles/prettier-config": "^2.1.6",
34+
"@tsparticles/tsconfig": "^2.1.7",
35+
"@tsparticles/webpack-plugin": "^2.2.1",
36+
"@typescript-eslint/eslint-plugin": "^7.1.0",
37+
"@typescript-eslint/parser": "^7.1.0",
38+
"commander": "^12.0.0",
39+
"eslint": "^8.57.0",
3940
"eslint-config-prettier": "^9.1.0",
40-
"eslint-plugin-jsdoc": "^48.0.4",
41+
"eslint-plugin-jsdoc": "^48.2.0",
42+
"eslint-plugin-prettier": "^5.1.3",
4143
"eslint-plugin-tsdoc": "^0.2.17",
4244
"fs-extra": "^11.2.0",
4345
"klaw": "^4.1.0",
4446
"lookpath": "^1.2.2",
47+
"madge": "^6.1.0",
4548
"path-scurry": "^1.10.1",
46-
"prettier": "^3.2.4",
47-
"prettier-plugin-multiline-arrays": "^3.0.1",
49+
"prettier": "^3.2.5",
50+
"prettier-plugin-multiline-arrays": "^3.0.4",
4851
"prompts": "^2.4.2",
4952
"rimraf": "^5.0.5",
5053
"typescript": "^5.3.3",
51-
"webpack": "^5.90.0"
54+
"webpack": "^5.90.3"
5255
},
5356
"devDependencies": {
54-
"@types/chai": "^4.3.11",
57+
"@babel/core": "^7.23.9",
58+
"@tsparticles/cli": "^2.2.4",
59+
"@tsparticles/engine": "^3.3.0",
60+
"@types/chai": "^4.3.12",
61+
"@types/eslint": "^8.56.5",
5562
"@types/fs-extra": "^11.0.4",
5663
"@types/klaw": "^3.0.6",
64+
"@types/madge": "^5.0.3",
5765
"@types/mocha": "^10.0.6",
58-
"@types/node": "^20.11.9",
66+
"@types/node": "^20.11.24",
5967
"@types/prompts": "^2.4.9",
60-
"chai": "^4.4.0",
68+
"@types/webpack-env": "^1.18.4",
69+
"@typescript-eslint/eslint-plugin": "^7.1.0",
70+
"@typescript-eslint/parser": "^7.1.0",
71+
"babel-loader": "^9.1.3",
72+
"browserslist": "^4.23.0",
73+
"chai": "^4.4.1",
74+
"copyfiles": "^2.4.1",
6175
"cross-env": "^7.0.3",
62-
"mocha": "^10.2.0",
76+
"mocha": "^10.3.0",
6377
"nyc": "^15.1.0",
64-
"ts-node": "^10.9.2"
78+
"terser-webpack-plugin": "^5.3.10",
79+
"ts-node": "^10.9.2",
80+
"webpack-bundle-analyzer": "^4.10.1",
81+
"webpack-cli": "^5.1.4"
6582
},
6683
"description": "tsParticles CLI",
6784
"main": ".eslintrc.js",

0 commit comments

Comments
 (0)