@tsparticles/cli 3.0.1 → 3.0.2
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/.github/workflows/node.js-ci.yml +8 -8
- package/dist/build/build-bundle.js +5 -44
- package/dist/build/build-circular-deps.js +4 -10
- package/dist/build/build-clear.js +4 -10
- package/dist/build/build-distfiles.js +21 -60
- package/dist/build/build-diststats.js +8 -47
- package/dist/build/build-eslint.js +7 -13
- package/dist/build/build-prettier.js +38 -47
- package/dist/build/build-tsc.js +7 -46
- package/dist/build/build.js +13 -49
- package/dist/cli.js +10 -15
- package/dist/create/create.js +9 -12
- package/dist/create/plugin/create-plugin.js +22 -28
- package/dist/create/plugin/plugin.js +12 -18
- package/dist/create/preset/create-preset.js +26 -32
- package/dist/create/preset/preset.js +12 -18
- package/dist/create/shape/create-shape.js +23 -29
- package/dist/create/shape/shape.js +12 -18
- package/dist/utils/file-utils.js +16 -25
- package/dist/utils/string-utils.js +3 -8
- package/dist/utils/template-utils.js +23 -35
- package/eslint.config.js +0 -1
- package/files/empty-project/eslint.config.js +6 -0
- package/files/empty-project/package.dist.json +1 -0
- package/files/empty-project/package.json +2 -1
- package/files/empty-project/webpack.config.js +10 -3
- package/package.json +3 -7
- package/pnpm-workspace.yaml +1 -0
- package/src/tsconfig.json +1 -1
- package/tests/create-plugin.test.ts +4 -5
- package/tests/create-preset.test.ts +4 -5
- package/tests/create-shape.test.ts +4 -5
- package/tests/file-utils.test.ts +8 -9
- package/tests/string-utils.test.ts +24 -25
- package/tests/tsconfig.json +2 -1
- package/vitest.config.ts +11 -0
- package/files/empty-project/.eslintignore +0 -2
- package/files/empty-project/.eslintrc.js +0 -5
package/tests/file-utils.test.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import { describe, it } from "
|
|
2
|
-
import { expect } from "chai";
|
|
1
|
+
import { describe, it, expect, after } from "vitest";
|
|
3
2
|
import fs from "fs-extra";
|
|
4
3
|
import path from "path";
|
|
5
4
|
import {
|
|
@@ -36,8 +35,8 @@ describe("file-utils", async () => {
|
|
|
36
35
|
const data1 = await fs.readFile(path.join(baseDir, "files1.txt"), "utf8"),
|
|
37
36
|
data2 = await fs.readFile(path.join(baseDir, "files2.txt"), "utf8");
|
|
38
37
|
|
|
39
|
-
expect(data1).
|
|
40
|
-
expect(data2).
|
|
38
|
+
expect(data1).toBe("test1");
|
|
39
|
+
expect(data2).toBe("test2");
|
|
41
40
|
});
|
|
42
41
|
});
|
|
43
42
|
|
|
@@ -55,7 +54,7 @@ describe("file-utils", async () => {
|
|
|
55
54
|
it("should replace tokens in files", async () => {
|
|
56
55
|
const data = await fs.readFile(path.join(baseDir, "file1.txt"), "utf8");
|
|
57
56
|
|
|
58
|
-
expect(data).
|
|
57
|
+
expect(data).toBe("test1");
|
|
59
58
|
});
|
|
60
59
|
});
|
|
61
60
|
|
|
@@ -63,13 +62,13 @@ describe("file-utils", async () => {
|
|
|
63
62
|
const destDir = await getDestinationDir(path.join(baseDir, "baz"));
|
|
64
63
|
|
|
65
64
|
it("should return the destination dir", () => {
|
|
66
|
-
expect(destDir).
|
|
65
|
+
expect(destDir).toBe(path.join(baseDir, "baz"));
|
|
67
66
|
});
|
|
68
67
|
|
|
69
68
|
it("should return the destination dir", async () => {
|
|
70
69
|
const destDir2 = await getDestinationDir(path.join(baseDir, "baz"));
|
|
71
70
|
|
|
72
|
-
expect(destDir2).
|
|
71
|
+
expect(destDir2).toBe(path.join(baseDir, "baz"));
|
|
73
72
|
});
|
|
74
73
|
|
|
75
74
|
it("should throw exception", async () => {
|
|
@@ -85,13 +84,13 @@ describe("file-utils", async () => {
|
|
|
85
84
|
ex = true;
|
|
86
85
|
}
|
|
87
86
|
|
|
88
|
-
expect(ex).
|
|
87
|
+
expect(ex).toBe(true);
|
|
89
88
|
});
|
|
90
89
|
});
|
|
91
90
|
|
|
92
91
|
describe("get repository url", () => {
|
|
93
92
|
it("should return the repository url", async () => {
|
|
94
|
-
expect(await getRepositoryUrl()).
|
|
93
|
+
expect(await getRepositoryUrl()).not.toBe("");
|
|
95
94
|
});
|
|
96
95
|
});
|
|
97
96
|
|
|
@@ -1,125 +1,124 @@
|
|
|
1
|
-
import { describe, it } from "
|
|
2
|
-
import { expect } from "chai";
|
|
1
|
+
import { describe, it, expect } from "vitest";
|
|
3
2
|
import { camelize, capitalize, dash } from "../src/utils/string-utils";
|
|
4
3
|
|
|
5
4
|
describe("capitalize", () => {
|
|
6
5
|
describe("empty string", () => {
|
|
7
|
-
expect(capitalize("")).
|
|
6
|
+
expect(capitalize("")).toBe("");
|
|
8
7
|
});
|
|
9
8
|
|
|
10
9
|
describe("lowercase string", () => {
|
|
11
10
|
it("should return capitalized string", () => {
|
|
12
|
-
expect(capitalize("test")).
|
|
11
|
+
expect(capitalize("test")).toBe("Test");
|
|
13
12
|
});
|
|
14
13
|
});
|
|
15
14
|
|
|
16
15
|
describe("capitalized string", () => {
|
|
17
16
|
it("should return capitalized string", () => {
|
|
18
|
-
expect(capitalize("Test")).
|
|
17
|
+
expect(capitalize("Test")).toBe("Test");
|
|
19
18
|
});
|
|
20
19
|
});
|
|
21
20
|
|
|
22
21
|
describe("multiple lowercase words string", () => {
|
|
23
22
|
it("should return capitalized string, no split", () => {
|
|
24
|
-
expect(capitalize("test test")).
|
|
23
|
+
expect(capitalize("test test")).toBe("Test test");
|
|
25
24
|
});
|
|
26
25
|
|
|
27
26
|
it("should return capitalized string, split", () => {
|
|
28
|
-
expect(capitalize("test test", " ")).
|
|
27
|
+
expect(capitalize("test test", " ")).toBe("TestTest");
|
|
29
28
|
});
|
|
30
29
|
|
|
31
30
|
it("should return capitalized string, wrong split", () => {
|
|
32
|
-
expect(capitalize("test test", ";")).
|
|
31
|
+
expect(capitalize("test test", ";")).toBe("Test test");
|
|
33
32
|
});
|
|
34
33
|
});
|
|
35
34
|
|
|
36
35
|
describe("multiple uppercase words string", () => {
|
|
37
36
|
it("should return capitalized string, no split", () => {
|
|
38
|
-
expect(capitalize("Test Test")).
|
|
37
|
+
expect(capitalize("Test Test")).toBe("Test Test");
|
|
39
38
|
});
|
|
40
39
|
|
|
41
40
|
it("should return capitalized string, split", () => {
|
|
42
|
-
expect(capitalize("Test Test", " ")).
|
|
41
|
+
expect(capitalize("Test Test", " ")).toBe("TestTest");
|
|
43
42
|
});
|
|
44
43
|
|
|
45
44
|
it("should return capitalized string, wrong split", () => {
|
|
46
|
-
expect(capitalize("Test Test", ";")).
|
|
45
|
+
expect(capitalize("Test Test", ";")).toBe("Test Test");
|
|
47
46
|
});
|
|
48
47
|
});
|
|
49
48
|
});
|
|
50
49
|
|
|
51
50
|
describe("camelize", () => {
|
|
52
51
|
describe("empty string", () => {
|
|
53
|
-
expect(camelize("")).
|
|
52
|
+
expect(camelize("")).toBe("");
|
|
54
53
|
});
|
|
55
54
|
|
|
56
55
|
describe("lowercase string", () => {
|
|
57
56
|
it("should return camelized string", () => {
|
|
58
|
-
expect(camelize("test")).
|
|
57
|
+
expect(camelize("test")).toBe("test");
|
|
59
58
|
});
|
|
60
59
|
});
|
|
61
60
|
|
|
62
61
|
describe("uppercase string", () => {
|
|
63
62
|
it("should return camelized string", () => {
|
|
64
|
-
expect(camelize("Test")).
|
|
63
|
+
expect(camelize("Test")).toBe("test");
|
|
65
64
|
});
|
|
66
65
|
});
|
|
67
66
|
|
|
68
67
|
describe("multiple lowercase words string", () => {
|
|
69
68
|
it("should return camelized string, no split", () => {
|
|
70
|
-
expect(camelize("test test")).
|
|
69
|
+
expect(camelize("test test")).toBe("test test");
|
|
71
70
|
});
|
|
72
71
|
|
|
73
72
|
it("should return camelized string, split", () => {
|
|
74
|
-
expect(camelize("test test", " ")).
|
|
73
|
+
expect(camelize("test test", " ")).toBe("testTest");
|
|
75
74
|
});
|
|
76
75
|
|
|
77
76
|
it("should return camelized string, wrong split", () => {
|
|
78
|
-
expect(camelize("test test", ";")).
|
|
77
|
+
expect(camelize("test test", ";")).toBe("test test");
|
|
79
78
|
});
|
|
80
79
|
});
|
|
81
80
|
|
|
82
81
|
describe("multiple uppercase words string", () => {
|
|
83
82
|
it("should return camelized string, no split", () => {
|
|
84
|
-
expect(camelize("Test Test")).
|
|
83
|
+
expect(camelize("Test Test")).toBe("test Test");
|
|
85
84
|
});
|
|
86
85
|
|
|
87
86
|
it("should return camelized string, split", () => {
|
|
88
|
-
expect(camelize("Test Test", " ")).
|
|
87
|
+
expect(camelize("Test Test", " ")).toBe("testTest");
|
|
89
88
|
});
|
|
90
89
|
|
|
91
90
|
it("should return camelized string, wrong split", () => {
|
|
92
|
-
expect(camelize("Test Test", ";")).
|
|
91
|
+
expect(camelize("Test Test", ";")).toBe("test Test");
|
|
93
92
|
});
|
|
94
93
|
});
|
|
95
94
|
});
|
|
96
95
|
|
|
97
96
|
describe("dash", () => {
|
|
98
97
|
describe("empty string", () => {
|
|
99
|
-
expect(dash("")).
|
|
98
|
+
expect(dash("")).toBe("");
|
|
100
99
|
});
|
|
101
100
|
|
|
102
101
|
describe("lowercase string", () => {
|
|
103
102
|
it("should return dashed string", () => {
|
|
104
|
-
expect(dash("test")).
|
|
103
|
+
expect(dash("test")).toBe("test");
|
|
105
104
|
});
|
|
106
105
|
});
|
|
107
106
|
|
|
108
107
|
describe("uppercase string", () => {
|
|
109
108
|
it("should return dashed string", () => {
|
|
110
|
-
expect(dash("Test")).
|
|
109
|
+
expect(dash("Test")).toBe("test");
|
|
111
110
|
});
|
|
112
111
|
});
|
|
113
112
|
|
|
114
113
|
describe("capitalized word string", () => {
|
|
115
114
|
it("should return dashed string", () => {
|
|
116
|
-
expect(dash("TestTest")).
|
|
115
|
+
expect(dash("TestTest")).toBe("test-test");
|
|
117
116
|
});
|
|
118
117
|
});
|
|
119
118
|
|
|
120
119
|
describe("camelized word string", () => {
|
|
121
120
|
it("should return dashed string", () => {
|
|
122
|
-
expect(dash("testTest")).
|
|
121
|
+
expect(dash("testTest")).toBe("test-test");
|
|
123
122
|
});
|
|
124
123
|
});
|
|
125
124
|
});
|
package/tests/tsconfig.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"target": "ES2021",
|
|
4
4
|
"module": "commonjs",
|
|
5
5
|
"lib": ["ESNext", "ES2022", "ES2021", "ES2020", "ES2019", "ES2018", "ES2017", "ES2016", "ES2015", "DOM"],
|
|
6
|
-
"types": ["jsdom", "
|
|
6
|
+
"types": ["jsdom", "vitest", "node"],
|
|
7
7
|
"allowJs": true,
|
|
8
8
|
"rootDir": ".",
|
|
9
9
|
"declaration": false,
|
|
@@ -21,4 +21,5 @@
|
|
|
21
21
|
"forceConsistentCasingInFileNames": true
|
|
22
22
|
},
|
|
23
23
|
"references": [{ "path": "../src" }],
|
|
24
|
+
"include": ["**/*.ts"]
|
|
24
25
|
}
|
package/vitest.config.ts
ADDED