@tsparticles/cli 3.0.13 → 3.0.15

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.
Files changed (60) hide show
  1. package/.github/workflows/node.js-ci.yml +13 -7
  2. package/dist/build/build-bundle.d.ts +5 -0
  3. package/dist/build/build-circular-deps.d.ts +6 -0
  4. package/dist/build/build-clear.d.ts +5 -0
  5. package/dist/build/build-distfiles.d.ts +5 -0
  6. package/dist/build/build-distfiles.js +7 -8
  7. package/dist/build/build-diststats.d.ts +12 -0
  8. package/dist/build/build-eslint.d.ts +5 -0
  9. package/dist/build/build-eslint.js +1 -3
  10. package/dist/build/build-prettier.d.ts +25 -0
  11. package/dist/build/build-prettier.js +4 -4
  12. package/dist/build/build-tsc.d.ts +5 -0
  13. package/dist/build/build.d.ts +3 -0
  14. package/dist/cli.d.ts +2 -0
  15. package/dist/create/create.d.ts +3 -0
  16. package/dist/create/plugin/create-plugin.d.ts +8 -0
  17. package/dist/create/plugin/plugin.d.ts +3 -0
  18. package/dist/create/preset/create-preset.d.ts +8 -0
  19. package/dist/create/preset/preset.d.ts +3 -0
  20. package/dist/create/shape/create-shape.d.ts +8 -0
  21. package/dist/create/shape/shape.d.ts +3 -0
  22. package/dist/tsconfig.tsbuildinfo +1 -0
  23. package/dist/utils/file-utils.d.ts +28 -0
  24. package/dist/utils/string-utils.d.ts +20 -0
  25. package/dist/utils/template-utils.d.ts +47 -0
  26. package/files/create-plugin/src/PluginInstance.ts +4 -2
  27. package/files/create-plugin/src/index.ts +1 -1
  28. package/files/create-plugin/src/plugin.ts +6 -6
  29. package/files/empty-project/.browserslistrc +1 -1
  30. package/files/empty-project/package.dist.json +1 -1
  31. package/files/empty-project/package.json +9 -9
  32. package/files/empty-project/tsconfig.base.json +2 -1
  33. package/package.json +14 -14
  34. package/src/build/build-bundle.ts +34 -34
  35. package/src/build/build-circular-deps.ts +23 -23
  36. package/src/build/build-clear.ts +11 -11
  37. package/src/build/build-distfiles.ts +67 -70
  38. package/src/build/build-diststats.ts +41 -41
  39. package/src/build/build-eslint.ts +26 -28
  40. package/src/build/build-prettier.ts +166 -166
  41. package/src/build/build-tsc.ts +146 -149
  42. package/src/build/build.ts +116 -116
  43. package/src/cli.ts +3 -3
  44. package/src/create/plugin/create-plugin.ts +108 -111
  45. package/src/create/plugin/plugin.ts +31 -31
  46. package/src/create/preset/create-preset.ts +123 -126
  47. package/src/create/preset/preset.ts +31 -31
  48. package/src/create/shape/create-shape.ts +112 -115
  49. package/src/create/shape/shape.ts +31 -31
  50. package/src/tsconfig.json +7 -125
  51. package/src/utils/file-utils.ts +35 -35
  52. package/src/utils/string-utils.ts +13 -13
  53. package/src/utils/template-utils.ts +130 -130
  54. package/tests/create-plugin.test.ts +11 -3
  55. package/tests/create-preset.test.ts +10 -2
  56. package/tests/create-shape.test.ts +10 -2
  57. package/tests/tsconfig.json +3 -15
  58. package/tsconfig.json +53 -20
  59. package/.mocharc.json +0 -11
  60. package/tsconfig.eslint.json +0 -8
@@ -2,11 +2,11 @@ import fs from "fs-extra";
2
2
  import path from "path";
3
3
 
4
4
  enum ExitCodes {
5
- OK = 0,
6
- EmitErrors = 1,
7
- NoDataOrOptions = 2,
8
- NoOptions = 3,
9
- ParseError = 4,
5
+ OK = 0,
6
+ EmitErrors = 1,
7
+ NoDataOrOptions = 2,
8
+ NoOptions = 3,
9
+ ParseError = 4,
10
10
  }
11
11
 
12
12
  /**
@@ -15,15 +15,15 @@ enum ExitCodes {
15
15
  * @returns the file content or undefined if the file doesn't exist
16
16
  */
17
17
  async function readConfig(basePath: string, file: string): Promise<string | undefined> {
18
- const tsconfigPath = path.join(basePath, file);
18
+ const tsconfigPath = path.join(basePath, file);
19
19
 
20
- if (await fs.pathExists(tsconfigPath)) {
21
- const data = await fs.readFile(path.join(basePath, file));
20
+ if (await fs.pathExists(tsconfigPath)) {
21
+ const data = await fs.readFile(path.join(basePath, file));
22
22
 
23
- return data.toString();
24
- }
23
+ return data.toString();
24
+ }
25
25
 
26
- return undefined;
26
+ return undefined;
27
27
  }
28
28
 
29
29
  /**
@@ -32,136 +32,133 @@ async function readConfig(basePath: string, file: string): Promise<string | unde
32
32
  * @returns the exit code
33
33
  */
34
34
  async function compile(basePath: string, type: "browser" | "cjs" | "esm" | "types" | "umd"): Promise<number> {
35
- let options: unknown, data: string | undefined;
36
-
37
- switch (type) {
38
- case "browser":
39
- data = await readConfig(basePath, "tsconfig.browser.json");
40
-
41
- if (!data) {
42
- options = {
43
- extends: "@tsparticles/tsconfig/tsconfig.browser.json",
44
- compilerOptions: {
45
- rootDir: "./src",
46
- outDir: "./dist/browser",
47
- },
48
- include: ["./src"],
49
- };
50
- }
51
-
52
- break;
53
- case "cjs":
54
- data = await readConfig(basePath, "tsconfig.json");
55
-
56
- if (!data) {
57
- options = {
58
- extends: "@tsparticles/tsconfig/tsconfig.json",
59
- compilerOptions: {
60
- rootDir: "./src",
61
- outDir: "./dist/cjs",
62
- },
63
- include: ["./src"],
64
- };
65
- }
66
-
67
- break;
68
- case "esm":
69
- data = await readConfig(basePath, "tsconfig.module.json");
70
-
71
- if (!data) {
72
- options = {
73
- extends: "@tsparticles/tsconfig/tsconfig.module.json",
74
- compilerOptions: {
75
- rootDir: "./src",
76
- outDir: "./dist/esm",
77
- },
78
- include: ["./src"],
79
- };
80
- }
81
-
82
- break;
83
- case "types":
84
- data = await readConfig(basePath, "tsconfig.types.json");
85
-
86
- if (!data) {
87
- options = {
88
- extends: "@tsparticles/tsconfig/tsconfig.types.json",
89
- compilerOptions: {
90
- rootDir: "./src",
91
- outDir: "./dist/types",
92
- },
93
- include: ["./src"],
94
- };
95
- }
96
-
97
- break;
98
- case "umd":
99
- data = await readConfig(basePath, "tsconfig.umd.json");
100
-
101
- if (!data) {
102
- options = {
103
- extends: "@tsparticles/tsconfig/tsconfig.umd.json",
104
- compilerOptions: {
105
- rootDir: "./src",
106
- outDir: "./dist/umd",
107
- },
108
- include: ["./src"],
109
- };
110
- }
111
-
112
- break;
113
- }
114
-
115
- if (!data && !options) {
116
- return ExitCodes.NoDataOrOptions;
117
- }
118
-
119
- if (!options && data) {
120
- options = JSON.parse(data);
121
- }
122
-
123
- if (!options) {
124
- return ExitCodes.NoOptions;
125
- }
126
-
127
- const ts = await import("typescript"),
128
- parsed = ts.parseJsonConfigFileContent(options, ts.sys, basePath);
129
-
130
- if (parsed.errors.length) {
131
- return ExitCodes.ParseError;
132
- }
133
-
134
- const program = ts.createProgram(parsed.fileNames, parsed.options),
135
- emitResult = program.emit(),
136
- allDiagnostics = ts.getPreEmitDiagnostics(program).concat(emitResult.diagnostics);
137
-
138
- let failed = false;
139
-
140
- for (const diagnostic of allDiagnostics) {
141
- failed = failed || diagnostic.category === ts.DiagnosticCategory.Error;
142
-
143
- if (diagnostic.file) {
144
- const startingPos = 0,
145
- { line, character } = ts.getLineAndCharacterOfPosition(
146
- diagnostic.file,
147
- diagnostic.start ?? startingPos,
148
- ),
149
- message = ts.flattenDiagnosticMessageText(diagnostic.messageText, "\n"),
150
- increment = 1;
151
-
152
- console.log(
153
- `${diagnostic.file.fileName} (${(line + increment).toString()},${(character + increment).toString()}): ${message}`,
154
- );
155
- } else {
156
- console.log(ts.flattenDiagnosticMessageText(diagnostic.messageText, "\n"));
157
- }
35
+ let options: unknown, data: string | undefined;
36
+
37
+ switch (type) {
38
+ case "browser":
39
+ data = await readConfig(basePath, "tsconfig.browser.json");
40
+
41
+ if (!data) {
42
+ options = {
43
+ extends: "@tsparticles/tsconfig/tsconfig.browser.json",
44
+ compilerOptions: {
45
+ rootDir: "./src",
46
+ outDir: "./dist/browser",
47
+ },
48
+ include: ["./src"],
49
+ };
50
+ }
51
+
52
+ break;
53
+ case "cjs":
54
+ data = await readConfig(basePath, "tsconfig.json");
55
+
56
+ if (!data) {
57
+ options = {
58
+ extends: "@tsparticles/tsconfig/tsconfig.json",
59
+ compilerOptions: {
60
+ rootDir: "./src",
61
+ outDir: "./dist/cjs",
62
+ },
63
+ include: ["./src"],
64
+ };
65
+ }
66
+
67
+ break;
68
+ case "esm":
69
+ data = await readConfig(basePath, "tsconfig.module.json");
70
+
71
+ if (!data) {
72
+ options = {
73
+ extends: "@tsparticles/tsconfig/tsconfig.module.json",
74
+ compilerOptions: {
75
+ rootDir: "./src",
76
+ outDir: "./dist/esm",
77
+ },
78
+ include: ["./src"],
79
+ };
80
+ }
81
+
82
+ break;
83
+ case "types":
84
+ data = await readConfig(basePath, "tsconfig.types.json");
85
+
86
+ if (!data) {
87
+ options = {
88
+ extends: "@tsparticles/tsconfig/tsconfig.types.json",
89
+ compilerOptions: {
90
+ rootDir: "./src",
91
+ outDir: "./dist/types",
92
+ },
93
+ include: ["./src"],
94
+ };
95
+ }
96
+
97
+ break;
98
+ case "umd":
99
+ data = await readConfig(basePath, "tsconfig.umd.json");
100
+
101
+ if (!data) {
102
+ options = {
103
+ extends: "@tsparticles/tsconfig/tsconfig.umd.json",
104
+ compilerOptions: {
105
+ rootDir: "./src",
106
+ outDir: "./dist/umd",
107
+ },
108
+ include: ["./src"],
109
+ };
110
+ }
111
+
112
+ break;
113
+ }
114
+
115
+ if (!data && !options) {
116
+ return ExitCodes.NoDataOrOptions;
117
+ }
118
+
119
+ if (!options && data) {
120
+ options = JSON.parse(data);
121
+ }
122
+
123
+ if (!options) {
124
+ return ExitCodes.NoOptions;
125
+ }
126
+
127
+ const ts = await import("typescript"),
128
+ parsed = ts.parseJsonConfigFileContent(options, ts.sys, basePath);
129
+
130
+ if (parsed.errors.length) {
131
+ return ExitCodes.ParseError;
132
+ }
133
+
134
+ const program = ts.createProgram(parsed.fileNames, parsed.options),
135
+ emitResult = program.emit(),
136
+ allDiagnostics = ts.getPreEmitDiagnostics(program).concat(emitResult.diagnostics);
137
+
138
+ let failed = false;
139
+
140
+ for (const diagnostic of allDiagnostics) {
141
+ failed = failed || diagnostic.category === ts.DiagnosticCategory.Error;
142
+
143
+ if (diagnostic.file) {
144
+ const startingPos = 0,
145
+ { line, character } = ts.getLineAndCharacterOfPosition(diagnostic.file, diagnostic.start ?? startingPos),
146
+ message = ts.flattenDiagnosticMessageText(diagnostic.messageText, "\n"),
147
+ increment = 1;
148
+
149
+ console.log(
150
+ `${diagnostic.file.fileName} (${(line + increment).toString()},${(character + increment).toString()}): ${message}`,
151
+ );
152
+ } else {
153
+ console.log(ts.flattenDiagnosticMessageText(diagnostic.messageText, "\n"));
158
154
  }
155
+ }
159
156
 
160
- const exitCode = emitResult.emitSkipped || failed ? ExitCodes.EmitErrors : ExitCodes.OK;
157
+ const exitCode = emitResult.emitSkipped || failed ? ExitCodes.EmitErrors : ExitCodes.OK;
161
158
 
162
- console.log(`TSC for ${type} done with exit code: '${exitCode.toLocaleString()}'.`);
159
+ console.log(`TSC for ${type} done with exit code: '${exitCode.toLocaleString()}'.`);
163
160
 
164
- return exitCode;
161
+ return exitCode;
165
162
  }
166
163
 
167
164
  /**
@@ -169,25 +166,25 @@ async function compile(basePath: string, type: "browser" | "cjs" | "esm" | "type
169
166
  * @returns true if the build was successful
170
167
  */
171
168
  export async function buildTS(basePath: string): Promise<boolean> {
172
- console.log("Building TS files");
169
+ console.log("Building TS files");
173
170
 
174
- let res = true;
171
+ let res = true;
175
172
 
176
- const types: ("browser" | "cjs" | "esm" | "types" | "umd")[] = ["browser", "cjs", "esm", "types", "umd"];
173
+ const types: ("browser" | "cjs" | "esm" | "types" | "umd")[] = ["browser", "cjs", "esm", "types", "umd"];
177
174
 
178
- for (const type of types) {
179
- console.log(`Building TS files for ${type} configuration`);
175
+ for (const type of types) {
176
+ console.log(`Building TS files for ${type} configuration`);
180
177
 
181
- const exitCode = await compile(basePath, type);
178
+ const exitCode = await compile(basePath, type);
182
179
 
183
- if (exitCode) {
184
- res = false;
180
+ if (exitCode) {
181
+ res = false;
185
182
 
186
- break;
187
- }
183
+ break;
188
184
  }
185
+ }
189
186
 
190
- console.log("Building TS files done");
187
+ console.log("Building TS files done");
191
188
 
192
- return res;
189
+ return res;
193
190
  }
@@ -4,16 +4,16 @@ const buildCommand = new Command("build");
4
4
 
5
5
  buildCommand.description("Build the tsParticles library using TypeScript");
6
6
  buildCommand.option(
7
- "-a, --all",
8
- "Do all build steps (default if no flags are specified) (same as -b -c -d -l -p -t)",
9
- false,
7
+ "-a, --all",
8
+ "Do all build steps (default if no flags are specified) (same as -b -c -d -l -p -t)",
9
+ false,
10
10
  );
11
11
  buildCommand.option("-b, --bundle", "Bundle the library using Webpack", false);
12
12
  buildCommand.option("-c, --clean", "Clean the dist folder", false);
13
13
  buildCommand.option(
14
- "--ci",
15
- "Do all build steps for CI, no fixing files, only checking if they are formatted correctly",
16
- false,
14
+ "--ci",
15
+ "Do all build steps for CI, no fixing files, only checking if they are formatted correctly",
16
+ false,
17
17
  );
18
18
  buildCommand.option("-r, --circular-deps", "Check for circular dependencies", false);
19
19
  buildCommand.option("-d, --dist", "Build the dist files", false);
@@ -23,116 +23,116 @@ buildCommand.option("-t, --tsc", "Build the library using TypeScript", false);
23
23
 
24
24
  buildCommand.argument("[path]", `Path to the project root folder, default is "src"`, "src");
25
25
  buildCommand.action(async (argPath: string) => {
26
- const opts = buildCommand.opts(),
27
- ci = !!opts["ci"],
28
- all =
29
- !!opts["all"] ||
30
- (!opts["bundle"] && !opts["clean"] && !opts["dist"] && !opts["lint"] && !opts["prettify"] && !opts["tsc"]),
31
- doBundle = all || !!opts["bundle"],
32
- circularDeps = all || !!opts["circularDeps"],
33
- clean = all || !!opts["clean"],
34
- distfiles = all || !!opts["dist"],
35
- doLint = all || !!opts["lint"],
36
- prettier = all || !!opts["prettify"],
37
- tsc = all || !!opts["tsc"];
38
-
39
- const basePath = process.cwd(),
40
- { getDistStats } = await import("./build-diststats.js"),
41
- oldStats = await getDistStats(basePath);
42
-
43
- if (clean) {
44
- const { clearDist } = await import("./build-clear.js");
45
-
46
- await clearDist(basePath);
47
- }
48
-
49
- const path = await import("path"),
50
- srcPath = path.join(basePath, argPath),
51
- fs = await import("fs-extra");
52
-
53
- if (!(await fs.pathExists(srcPath))) {
54
- throw new Error("Provided path does not exist");
55
- }
56
-
57
- let canContinue = true;
58
-
59
- if (prettier) {
60
- const { prettifySrc } = await import("./build-prettier.js");
61
-
62
- canContinue = await prettifySrc(basePath, srcPath, ci);
63
- }
64
-
65
- if (canContinue && doLint) {
66
- const { lint } = await import("./build-eslint.js");
67
-
68
- canContinue = await lint(ci);
69
- }
70
-
71
- if (canContinue && tsc) {
72
- const { buildTS } = await import("./build-tsc.js");
73
-
74
- canContinue = await buildTS(basePath);
75
- }
76
-
77
- if (canContinue && circularDeps) {
78
- const { buildCircularDeps } = await import("./build-circular-deps.js");
79
-
80
- canContinue = await buildCircularDeps(basePath);
81
- }
82
-
83
- if (canContinue && doBundle) {
84
- const { bundle } = await import("./build-bundle.js");
85
-
86
- canContinue = await bundle(basePath);
87
- }
88
-
89
- if (canContinue && prettier) {
90
- const { prettifyReadme, prettifyPackageJson, prettifyPackageDistJson } = await import("./build-prettier.js");
91
-
92
- canContinue =
93
- (await prettifyReadme(basePath, ci)) &&
94
- (await prettifyPackageJson(basePath, ci)) &&
95
- (await prettifyPackageDistJson(basePath, ci));
96
- }
97
-
98
- if (canContinue && distfiles) {
99
- const { buildDistFiles } = await import("./build-distfiles.js");
100
-
101
- canContinue = await buildDistFiles(basePath);
102
- }
103
-
104
- if (!canContinue) {
105
- throw new Error("Build failed");
106
- }
107
-
108
- const newStats = await getDistStats(basePath),
109
- diffSize = newStats.totalSize - oldStats.totalSize,
110
- bundleDiffSize = newStats.bundleSize - oldStats.bundleSize,
111
- minSize = 0,
112
- bundleSizeIncreased = bundleDiffSize > minSize,
113
- outputFunc = bundleSizeIncreased ? console.warn : console.info,
114
- bundleSizeIncreasedText = bundleSizeIncreased ? "increased" : "decreased",
115
- diffSizeIncreasedText = diffSize > minSize ? "increased" : "decreased",
116
- texts = [
117
- !bundleDiffSize
118
- ? "Bundle size unchanged"
119
- : `Bundle size ${bundleSizeIncreasedText} from ${oldStats.bundleSize.toString()} to ${newStats.bundleSize.toString()} (${Math.abs(bundleDiffSize).toString()}B)`,
120
- !diffSize
121
- ? "Size unchanged"
122
- : `Size ${diffSizeIncreasedText} from ${oldStats.totalSize.toString()} to ${newStats.totalSize.toString()} (${Math.abs(diffSize).toString()}B)`,
123
- `Files count changed from ${oldStats.totalFiles.toString()} to ${newStats.totalFiles.toString()} (${(
124
- newStats.totalFiles - oldStats.totalFiles
125
- ).toString()})`,
126
- `Folders count changed from ${oldStats.totalFolders.toString()} to ${newStats.totalFolders.toString()} (${(
127
- newStats.totalFolders - oldStats.totalFolders
128
- ).toString()})`,
129
- ];
130
-
131
- console.log("Build finished successfully!");
132
-
133
- for (const text of texts) {
134
- outputFunc(text);
135
- }
26
+ const opts = buildCommand.opts(),
27
+ ci = !!opts["ci"],
28
+ all =
29
+ !!opts["all"] ||
30
+ (!opts["bundle"] && !opts["clean"] && !opts["dist"] && !opts["lint"] && !opts["prettify"] && !opts["tsc"]),
31
+ doBundle = all || !!opts["bundle"],
32
+ circularDeps = all || !!opts["circularDeps"],
33
+ clean = all || !!opts["clean"],
34
+ distfiles = all || !!opts["dist"],
35
+ doLint = all || !!opts["lint"],
36
+ prettier = all || !!opts["prettify"],
37
+ tsc = all || !!opts["tsc"];
38
+
39
+ const basePath = process.cwd(),
40
+ { getDistStats } = await import("./build-diststats.js"),
41
+ oldStats = await getDistStats(basePath);
42
+
43
+ if (clean) {
44
+ const { clearDist } = await import("./build-clear.js");
45
+
46
+ await clearDist(basePath);
47
+ }
48
+
49
+ const path = await import("path"),
50
+ srcPath = path.join(basePath, argPath),
51
+ fs = await import("fs-extra");
52
+
53
+ if (!(await fs.pathExists(srcPath))) {
54
+ throw new Error("Provided path does not exist");
55
+ }
56
+
57
+ let canContinue = true;
58
+
59
+ if (prettier) {
60
+ const { prettifySrc } = await import("./build-prettier.js");
61
+
62
+ canContinue = await prettifySrc(basePath, srcPath, ci);
63
+ }
64
+
65
+ if (canContinue && doLint) {
66
+ const { lint } = await import("./build-eslint.js");
67
+
68
+ canContinue = await lint(ci);
69
+ }
70
+
71
+ if (canContinue && tsc) {
72
+ const { buildTS } = await import("./build-tsc.js");
73
+
74
+ canContinue = await buildTS(basePath);
75
+ }
76
+
77
+ if (canContinue && circularDeps) {
78
+ const { buildCircularDeps } = await import("./build-circular-deps.js");
79
+
80
+ canContinue = await buildCircularDeps(basePath);
81
+ }
82
+
83
+ if (canContinue && doBundle) {
84
+ const { bundle } = await import("./build-bundle.js");
85
+
86
+ canContinue = await bundle(basePath);
87
+ }
88
+
89
+ if (canContinue && prettier) {
90
+ const { prettifyReadme, prettifyPackageJson, prettifyPackageDistJson } = await import("./build-prettier.js");
91
+
92
+ canContinue =
93
+ (await prettifyReadme(basePath, ci)) &&
94
+ (await prettifyPackageJson(basePath, ci)) &&
95
+ (await prettifyPackageDistJson(basePath, ci));
96
+ }
97
+
98
+ if (canContinue && distfiles) {
99
+ const { buildDistFiles } = await import("./build-distfiles.js");
100
+
101
+ canContinue = await buildDistFiles(basePath);
102
+ }
103
+
104
+ if (!canContinue) {
105
+ throw new Error("Build failed");
106
+ }
107
+
108
+ const newStats = await getDistStats(basePath),
109
+ diffSize = newStats.totalSize - oldStats.totalSize,
110
+ bundleDiffSize = newStats.bundleSize - oldStats.bundleSize,
111
+ minSize = 0,
112
+ bundleSizeIncreased = bundleDiffSize > minSize,
113
+ outputFunc = bundleSizeIncreased ? console.warn : console.info,
114
+ bundleSizeIncreasedText = bundleSizeIncreased ? "increased" : "decreased",
115
+ diffSizeIncreasedText = diffSize > minSize ? "increased" : "decreased",
116
+ texts = [
117
+ !bundleDiffSize
118
+ ? "Bundle size unchanged"
119
+ : `Bundle size ${bundleSizeIncreasedText} from ${oldStats.bundleSize.toString()} to ${newStats.bundleSize.toString()} (${Math.abs(bundleDiffSize).toString()}B)`,
120
+ !diffSize
121
+ ? "Size unchanged"
122
+ : `Size ${diffSizeIncreasedText} from ${oldStats.totalSize.toString()} to ${newStats.totalSize.toString()} (${Math.abs(diffSize).toString()}B)`,
123
+ `Files count changed from ${oldStats.totalFiles.toString()} to ${newStats.totalFiles.toString()} (${(
124
+ newStats.totalFiles - oldStats.totalFiles
125
+ ).toString()})`,
126
+ `Folders count changed from ${oldStats.totalFolders.toString()} to ${newStats.totalFolders.toString()} (${(
127
+ newStats.totalFolders - oldStats.totalFolders
128
+ ).toString()})`,
129
+ ];
130
+
131
+ console.log("Build finished successfully!");
132
+
133
+ for (const text of texts) {
134
+ outputFunc(text);
135
+ }
136
136
  });
137
137
 
138
138
  export { buildCommand };
package/src/cli.ts CHANGED
@@ -7,9 +7,9 @@ import path from "path";
7
7
  import { program } from "commander";
8
8
 
9
9
  const __filename = fileURLToPath(import.meta.url),
10
- __dirname = path.dirname(__filename),
11
- rootPkgPath = path.join(__dirname, "..", "package.json"),
12
- pkg = (await fs.readJson(rootPkgPath)) as { version: string };
10
+ __dirname = path.dirname(__filename),
11
+ rootPkgPath = path.join(__dirname, "..", "package.json"),
12
+ pkg = (await fs.readJson(rootPkgPath)) as { version: string };
13
13
 
14
14
  program.name("tsparticles-cli");
15
15
  program.description("tsParticles CLI");