@tsparticles/cli 3.0.17 → 3.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.dependency-cruiser.cjs +382 -0
- package/dist/build/build-bundle.js +1 -1
- package/dist/build/build-circular-deps.d.ts +2 -2
- package/dist/build/build-circular-deps.js +61 -21
- package/dist/build/build-clear.js +1 -1
- package/dist/build/build-distfiles.js +1 -1
- package/dist/build/build-prettier.js +1 -1
- package/dist/build/build-tsc.js +1 -1
- package/dist/cli.js +1 -1
- package/dist/create/plugin/create-plugin.js +1 -1
- package/dist/create/plugin/plugin.js +1 -1
- package/dist/create/preset/create-preset.js +1 -1
- package/dist/create/preset/preset.js +1 -1
- package/dist/create/shape/create-shape.js +1 -1
- package/dist/create/shape/shape.js +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/utils/file-utils.js +2 -2
- package/dist/utils/template-utils.js +2 -2
- package/files/empty-project/package.json +5 -7
- package/package.json +10 -13
- package/pnpm-workspace.yaml +1 -0
- package/src/build/build-bundle.ts +1 -1
- package/src/build/build-circular-deps.ts +92 -24
- package/src/build/build-clear.ts +1 -1
- package/src/build/build-distfiles.ts +1 -1
- package/src/build/build-prettier.ts +1 -1
- package/src/build/build-tsc.ts +1 -1
- package/src/cli.ts +1 -1
- package/src/create/plugin/create-plugin.ts +1 -1
- package/src/create/plugin/plugin.ts +1 -1
- package/src/create/preset/create-preset.ts +1 -1
- package/src/create/preset/preset.ts +1 -1
- package/src/create/shape/create-shape.ts +1 -1
- package/src/create/shape/shape.ts +1 -1
- package/src/utils/file-utils.ts +2 -2
- package/src/utils/template-utils.ts +2 -2
- package/tests/create-plugin.test.ts +1 -1
- package/tests/create-preset.test.ts +1 -1
- package/tests/create-shape.test.ts +1 -1
- package/tests/file-utils.test.ts +1 -1
- package/tsconfig.json +0 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tsparticles/cli",
|
|
3
|
-
"version": "3.0
|
|
3
|
+
"version": "3.1.0",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -11,20 +11,20 @@
|
|
|
11
11
|
},
|
|
12
12
|
"prettier": "@tsparticles/prettier-config",
|
|
13
13
|
"dependencies": {
|
|
14
|
-
"@tsparticles/eslint-config": "^3.0
|
|
14
|
+
"@tsparticles/eslint-config": "^3.1.0",
|
|
15
15
|
"@tsparticles/prettier-config": "^3.0.11",
|
|
16
|
-
"@tsparticles/tsconfig": "^3.0
|
|
17
|
-
"@tsparticles/webpack-plugin": "^3.0
|
|
18
|
-
"commander": "^14.0.
|
|
16
|
+
"@tsparticles/tsconfig": "^3.1.0",
|
|
17
|
+
"@tsparticles/webpack-plugin": "^3.1.0",
|
|
18
|
+
"commander": "^14.0.3",
|
|
19
19
|
"eslint": "^9.39.2",
|
|
20
20
|
"eslint-config-prettier": "^10.1.8",
|
|
21
|
-
"eslint-plugin-jsdoc": "^62.
|
|
21
|
+
"eslint-plugin-jsdoc": "^62.5.0",
|
|
22
22
|
"eslint-plugin-prettier": "^5.5.5",
|
|
23
23
|
"eslint-plugin-tsdoc": "^0.5.0",
|
|
24
24
|
"fs-extra": "^11.3.3",
|
|
25
25
|
"klaw": "^4.1.0",
|
|
26
26
|
"lookpath": "^1.2.3",
|
|
27
|
-
"
|
|
27
|
+
"dependency-cruiser": "^17.3.7",
|
|
28
28
|
"path-scurry": "^2.0.1",
|
|
29
29
|
"prettier": "^3.8.1",
|
|
30
30
|
"prettier-plugin-multiline-arrays": "^4.1.3",
|
|
@@ -35,18 +35,15 @@
|
|
|
35
35
|
"webpack": "^5.104.1"
|
|
36
36
|
},
|
|
37
37
|
"devDependencies": {
|
|
38
|
-
"@
|
|
39
|
-
"@tsparticles/cli": "^3.0.16",
|
|
38
|
+
"@tsparticles/cli": "^3.0.17",
|
|
40
39
|
"@tsparticles/engine": "^3.9.1",
|
|
41
40
|
"@types/eslint": "^9.6.1",
|
|
42
41
|
"@types/estree": "^1.0.8",
|
|
43
42
|
"@types/fs-extra": "^11.0.4",
|
|
44
43
|
"@types/klaw": "^3.0.7",
|
|
45
|
-
"@types/
|
|
46
|
-
"@types/node": "^25.0.10",
|
|
44
|
+
"@types/node": "^25.2.0",
|
|
47
45
|
"@types/prompts": "^2.4.9",
|
|
48
46
|
"@types/webpack-env": "^1.18.8",
|
|
49
|
-
"babel-loader": "^10.0.0",
|
|
50
47
|
"browserslist": "^4.28.1",
|
|
51
48
|
"copyfiles": "^2.4.1",
|
|
52
49
|
"cross-env": "^10.1.0",
|
|
@@ -66,7 +63,7 @@
|
|
|
66
63
|
"prettify:readme": "prettier --write ./README.md",
|
|
67
64
|
"lint": "eslint src --ext .js,.jsx,.ts,.tsx --fix",
|
|
68
65
|
"lint:ci": "eslint src --ext .js,.jsx,.ts,.tsx",
|
|
69
|
-
"circular-deps": "
|
|
66
|
+
"circular-deps": "depcruise src --include-only '^src' --validate --output-type err-long",
|
|
70
67
|
"compile": "pnpm run build:ts",
|
|
71
68
|
"compile:ci": "pnpm run build:ts",
|
|
72
69
|
"build:ts": "pnpm run build:ts:cjs",
|
package/pnpm-workspace.yaml
CHANGED
|
@@ -1,39 +1,107 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
1
|
+
import {
|
|
2
|
+
type ICruiseOptions,
|
|
3
|
+
type ICruiseResult,
|
|
4
|
+
type IForbiddenRuleType,
|
|
5
|
+
type IViolation,
|
|
6
|
+
cruise,
|
|
7
|
+
} from "dependency-cruiser";
|
|
8
|
+
import fs from "fs-extra";
|
|
9
|
+
import path from "node:path";
|
|
10
|
+
|
|
11
|
+
const ZERO_VIOLATIONS = 0;
|
|
3
12
|
|
|
4
13
|
/**
|
|
5
|
-
*
|
|
6
|
-
* @param basePath -
|
|
14
|
+
* Checks for circular dependencies using dependency-cruiser
|
|
15
|
+
* @param basePath - The project root path
|
|
7
16
|
* @returns true if no circular dependencies are found, false otherwise
|
|
8
17
|
*/
|
|
9
18
|
export async function buildCircularDeps(basePath: string): Promise<boolean> {
|
|
10
|
-
|
|
19
|
+
const srcPath = path.join(basePath, "src"),
|
|
20
|
+
configPath = path.join(basePath, ".dependency-cruiser.js"),
|
|
21
|
+
configPathCjs = path.join(basePath, ".dependency-cruiser.cjs");
|
|
22
|
+
|
|
23
|
+
// Base options with explicit type
|
|
24
|
+
let cruiseOptions: ICruiseOptions = {
|
|
25
|
+
tsPreCompilationDeps: false,
|
|
26
|
+
tsConfig: {
|
|
27
|
+
fileName: path.join(srcPath, "tsconfig.json"),
|
|
28
|
+
},
|
|
29
|
+
};
|
|
11
30
|
|
|
12
31
|
try {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
}
|
|
32
|
+
if (await fs.pathExists(configPath)) {
|
|
33
|
+
const configModule = (await import(configPath)) as {
|
|
34
|
+
default: {
|
|
35
|
+
forbidden?: IForbiddenRuleType[];
|
|
36
|
+
options?: ICruiseOptions;
|
|
37
|
+
};
|
|
19
38
|
},
|
|
20
|
-
|
|
21
|
-
circularDeps = madgeRes.circular();
|
|
39
|
+
extendedConfig = configModule.default;
|
|
22
40
|
|
|
23
|
-
|
|
24
|
-
|
|
41
|
+
cruiseOptions = {
|
|
42
|
+
...cruiseOptions,
|
|
43
|
+
...extendedConfig.options,
|
|
44
|
+
ruleSet: {
|
|
45
|
+
forbidden: extendedConfig.forbidden ?? [],
|
|
46
|
+
},
|
|
47
|
+
};
|
|
48
|
+
} else if (await fs.pathExists(configPathCjs)) {
|
|
49
|
+
const configModule = (await import(configPathCjs)) as {
|
|
50
|
+
default: {
|
|
51
|
+
forbidden?: IForbiddenRuleType[];
|
|
52
|
+
options?: ICruiseOptions;
|
|
53
|
+
};
|
|
54
|
+
},
|
|
55
|
+
extendedConfig = configModule.default;
|
|
25
56
|
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
57
|
+
cruiseOptions = {
|
|
58
|
+
...cruiseOptions,
|
|
59
|
+
...extendedConfig.options,
|
|
60
|
+
ruleSet: {
|
|
61
|
+
forbidden: extendedConfig.forbidden ?? [],
|
|
62
|
+
},
|
|
63
|
+
};
|
|
29
64
|
} else {
|
|
30
|
-
|
|
65
|
+
console.log("No .dependency-cruiser.js found, applying default circular check.");
|
|
66
|
+
|
|
67
|
+
cruiseOptions.ruleSet = {
|
|
68
|
+
forbidden: [
|
|
69
|
+
{
|
|
70
|
+
name: "no-circular",
|
|
71
|
+
severity: "error",
|
|
72
|
+
from: {},
|
|
73
|
+
to: { circular: true },
|
|
74
|
+
},
|
|
75
|
+
],
|
|
76
|
+
};
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
const result: unknown = await cruise([srcPath], cruiseOptions),
|
|
80
|
+
cruiseResult = result as ICruiseResult,
|
|
81
|
+
violations: IViolation[] = cruiseResult.summary.violations,
|
|
82
|
+
circularViolations = violations.filter((violation: IViolation) => violation.rule.name === "no-circular");
|
|
83
|
+
|
|
84
|
+
if (circularViolations.length > ZERO_VIOLATIONS) {
|
|
85
|
+
console.error("⚠️ Circular dependencies found!");
|
|
86
|
+
|
|
87
|
+
for (const violation of circularViolations) {
|
|
88
|
+
const cyclePath = (violation.cycle ?? []).map(step => {
|
|
89
|
+
return (step as { name: string }).name;
|
|
90
|
+
});
|
|
91
|
+
|
|
92
|
+
console.error(`Cycle detected: ${cyclePath.join(" -> ")}`);
|
|
93
|
+
}
|
|
94
|
+
return false;
|
|
31
95
|
}
|
|
32
|
-
} catch (e) {
|
|
33
|
-
console.error(e);
|
|
34
|
-
}
|
|
35
96
|
|
|
36
|
-
|
|
97
|
+
console.log("✅ No circular dependencies found.");
|
|
37
98
|
|
|
38
|
-
|
|
99
|
+
return true;
|
|
100
|
+
} catch (e) {
|
|
101
|
+
console.error("❌ Error while checking dependencies:", e);
|
|
102
|
+
|
|
103
|
+
return false;
|
|
104
|
+
} finally {
|
|
105
|
+
console.log("Finished checking circular dependencies.");
|
|
106
|
+
}
|
|
39
107
|
}
|
package/src/build/build-clear.ts
CHANGED
package/src/build/build-tsc.ts
CHANGED
package/src/cli.ts
CHANGED
|
@@ -3,7 +3,7 @@ import { buildCommand } from "./build/build.js";
|
|
|
3
3
|
import { createCommand } from "./create/create.js";
|
|
4
4
|
import { fileURLToPath } from "url";
|
|
5
5
|
import fs from "fs-extra";
|
|
6
|
-
import path from "path";
|
|
6
|
+
import path from "node:path";
|
|
7
7
|
import { program } from "commander";
|
|
8
8
|
|
|
9
9
|
const __filename = fileURLToPath(import.meta.url),
|
|
@@ -3,7 +3,7 @@ import prompts, { type PromptObject } from "prompts";
|
|
|
3
3
|
import { Command } from "commander";
|
|
4
4
|
import { capitalize } from "../../utils/string-utils.js";
|
|
5
5
|
import { createPluginTemplate } from "./create-plugin.js";
|
|
6
|
-
import path from "path";
|
|
6
|
+
import path from "node:path";
|
|
7
7
|
|
|
8
8
|
const pluginCommand = new Command("plugin");
|
|
9
9
|
|
|
@@ -3,7 +3,7 @@ import prompts, { type PromptObject } from "prompts";
|
|
|
3
3
|
import { Command } from "commander";
|
|
4
4
|
import { capitalize } from "../../utils/string-utils.js";
|
|
5
5
|
import { createPresetTemplate } from "./create-preset.js";
|
|
6
|
-
import path from "path";
|
|
6
|
+
import path from "node:path";
|
|
7
7
|
|
|
8
8
|
const presetCommand = new Command("preset");
|
|
9
9
|
|
|
@@ -3,7 +3,7 @@ import prompts, { type PromptObject } from "prompts";
|
|
|
3
3
|
import { Command } from "commander";
|
|
4
4
|
import { capitalize } from "../../utils/string-utils.js";
|
|
5
5
|
import { createShapeTemplate } from "./create-shape.js";
|
|
6
|
-
import path from "path";
|
|
6
|
+
import path from "node:path";
|
|
7
7
|
|
|
8
8
|
const shapeCommand = new Command("shape");
|
|
9
9
|
|
package/src/utils/file-utils.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { exec } from "child_process";
|
|
1
|
+
import { exec } from "node:child_process";
|
|
2
2
|
import fs from "fs-extra";
|
|
3
3
|
import { lookpath } from "lookpath";
|
|
4
|
-
import path from "path";
|
|
4
|
+
import path from "node:path";
|
|
5
5
|
|
|
6
6
|
export interface ReplaceTokensOptions {
|
|
7
7
|
path: string;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { exec } from "child_process";
|
|
1
|
+
import { exec } from "node:child_process";
|
|
2
2
|
import fs from "fs-extra";
|
|
3
3
|
import { lookpath } from "lookpath";
|
|
4
|
-
import path from "path";
|
|
4
|
+
import path from "node:path";
|
|
5
5
|
import { replaceTokensInFile } from "./file-utils.js";
|
|
6
6
|
|
|
7
7
|
/**
|
package/tests/file-utils.test.ts
CHANGED