@tsparticles/cli 2.3.3 → 3.0.1

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.
@@ -19,7 +19,7 @@ jobs:
19
19
  - uses: actions/setup-node@v4
20
20
  with:
21
21
  node-version: "16"
22
- - uses: pnpm/action-setup@v2.4.0
22
+ - uses: pnpm/action-setup@v3.0.0
23
23
  name: Install pnpm
24
24
  id: pnpm-install
25
25
  with:
@@ -57,7 +57,7 @@ jobs:
57
57
  - uses: actions/setup-node@v4
58
58
  with:
59
59
  node-version: "16"
60
- - uses: pnpm/action-setup@v2.4.0
60
+ - uses: pnpm/action-setup@v3.0.0
61
61
  name: Install pnpm
62
62
  id: pnpm-install
63
63
  with:
@@ -15,18 +15,28 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
15
15
  }) : function(o, v) {
16
16
  o["default"] = v;
17
17
  });
18
- var __importStar = (this && this.__importStar) || function (mod) {
19
- if (mod && mod.__esModule) return mod;
20
- var result = {};
21
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
- __setModuleDefault(result, mod);
23
- return result;
24
- };
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
25
35
  var __importDefault = (this && this.__importDefault) || function (mod) {
26
36
  return (mod && mod.__esModule) ? mod : { "default": mod };
27
37
  };
28
38
  Object.defineProperty(exports, "__esModule", { value: true });
29
- exports.bundle = void 0;
39
+ exports.bundle = bundle;
30
40
  const path_1 = __importDefault(require("path"));
31
41
  const webpack_1 = __importDefault(require("webpack"));
32
42
  /**
@@ -46,7 +56,7 @@ async function bundle(basePath) {
46
56
  return;
47
57
  }
48
58
  if (!stats) {
49
- const err = "No stats returned from webpack";
59
+ const err = new Error("No stats returned from webpack");
50
60
  console.error(err);
51
61
  reject(err);
52
62
  return;
@@ -54,7 +64,7 @@ async function bundle(basePath) {
54
64
  const info = stats.toJson();
55
65
  if (stats.hasErrors()) {
56
66
  console.error(info.errors);
57
- reject(info.errors);
67
+ reject(new Error(info.errors?.map(error => error.message).join("\n")));
58
68
  }
59
69
  if (stats.hasWarnings()) {
60
70
  console.warn(info.warnings);
@@ -70,4 +80,3 @@ async function bundle(basePath) {
70
80
  console.log("Bundling done");
71
81
  return res;
72
82
  }
73
- exports.bundle = bundle;
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.buildCircularDeps = void 0;
6
+ exports.buildCircularDeps = buildCircularDeps;
7
7
  const madge_1 = __importDefault(require("madge"));
8
8
  const path_1 = __importDefault(require("path"));
9
9
  /**
@@ -25,9 +25,8 @@ async function buildCircularDeps(basePath) {
25
25
  if (circularDeps.length) {
26
26
  console.error("Circular dependencies found!");
27
27
  for (const dep of circularDeps) {
28
- console.error(`${dep.join(" > ")}`);
28
+ console.error(dep.join(" > "));
29
29
  }
30
- res = false;
31
30
  }
32
31
  else {
33
32
  res = true;
@@ -39,4 +38,3 @@ async function buildCircularDeps(basePath) {
39
38
  console.log("Finished checking circular dependencies.");
40
39
  return res;
41
40
  }
42
- exports.buildCircularDeps = buildCircularDeps;
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.clearDist = void 0;
6
+ exports.clearDist = clearDist;
7
7
  const path_1 = __importDefault(require("path"));
8
8
  const rimraf_1 = require("rimraf");
9
9
  /**
@@ -24,4 +24,3 @@ async function clearDist(basePath) {
24
24
  console.log("Clearing dist folder done");
25
25
  return res;
26
26
  }
27
- exports.clearDist = clearDist;
@@ -15,18 +15,28 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
15
15
  }) : function(o, v) {
16
16
  o["default"] = v;
17
17
  });
18
- var __importStar = (this && this.__importStar) || function (mod) {
19
- if (mod && mod.__esModule) return mod;
20
- var result = {};
21
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
- __setModuleDefault(result, mod);
23
- return result;
24
- };
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
25
35
  var __importDefault = (this && this.__importDefault) || function (mod) {
26
36
  return (mod && mod.__esModule) ? mod : { "default": mod };
27
37
  };
28
38
  Object.defineProperty(exports, "__esModule", { value: true });
29
- exports.buildDistFiles = void 0;
39
+ exports.buildDistFiles = buildDistFiles;
30
40
  const fs_extra_1 = __importDefault(require("fs-extra"));
31
41
  const klaw_1 = __importDefault(require("klaw"));
32
42
  const path_1 = __importDefault(require("path"));
@@ -96,4 +106,3 @@ async function buildDistFiles(basePath) {
96
106
  console.log("Build - done on dist files");
97
107
  return res;
98
108
  }
99
- exports.buildDistFiles = buildDistFiles;
@@ -15,18 +15,28 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
15
15
  }) : function(o, v) {
16
16
  o["default"] = v;
17
17
  });
18
- var __importStar = (this && this.__importStar) || function (mod) {
19
- if (mod && mod.__esModule) return mod;
20
- var result = {};
21
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
- __setModuleDefault(result, mod);
23
- return result;
24
- };
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
25
35
  var __importDefault = (this && this.__importDefault) || function (mod) {
26
36
  return (mod && mod.__esModule) ? mod : { "default": mod };
27
37
  };
28
38
  Object.defineProperty(exports, "__esModule", { value: true });
29
- exports.getDistStats = void 0;
39
+ exports.getDistStats = getDistStats;
30
40
  const fs_extra_1 = __importDefault(require("fs-extra"));
31
41
  /**
32
42
  * @param folderPath - the path to the folder to get the stats for
@@ -76,4 +86,3 @@ async function getDistStats(basePath) {
76
86
  : undefined;
77
87
  return await getFolderStats(distFolder, bundlePath);
78
88
  }
79
- exports.getDistStats = getDistStats;
@@ -1,7 +1,12 @@
1
1
  "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
2
5
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.lint = void 0;
6
+ exports.lint = lint;
4
7
  const eslint_1 = require("eslint");
8
+ const config_1 = require("eslint/config");
9
+ const eslint_config_1 = __importDefault(require("@tsparticles/eslint-config"));
5
10
  /**
6
11
  * @param ci -
7
12
  * @returns true if the linting was successful
@@ -10,18 +15,14 @@ async function lint(ci) {
10
15
  console.log("ESLint - started on src");
11
16
  let res;
12
17
  try {
13
- const eslint = new eslint_1.ESLint({
14
- baseConfig: {
15
- extends: ["@tsparticles/eslint-config"],
16
- },
17
- extensions: [".js", ".jsx", ".ts", ".tsx"],
18
- fix: !ci,
19
- });
18
+ const eslint = new eslint_1.ESLint({ baseConfig: (0, config_1.defineConfig)([eslint_config_1.default]), fix: !ci });
20
19
  const results = await eslint.lintFiles(["src"]), errors = eslint_1.ESLint.getErrorResults(results);
21
20
  await eslint_1.ESLint.outputFixes(results);
22
21
  const formatter = await eslint.loadFormatter("stylish"), resultText = formatter.format(results), minimumLength = 0;
23
22
  if (errors.length > minimumLength) {
24
- const messages = errors.map(t => t.messages.map(m => `${t.filePath} (${m.line},${m.column}): ${m.message}`).join("\n"));
23
+ const messages = errors.map(t => t.messages
24
+ .map(m => `${t.filePath} (${m.line.toString()},${m.column.toString()}): ${m.message}`)
25
+ .join("\n"));
25
26
  throw new Error(messages.join("\n"));
26
27
  }
27
28
  console.log(resultText);
@@ -34,4 +35,3 @@ async function lint(ci) {
34
35
  console.log("ESLint - done on src");
35
36
  return res;
36
37
  }
37
- exports.lint = lint;
@@ -3,7 +3,10 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.prettifyReadme = exports.prettifyPackageDistJson = exports.prettifyPackageJson = exports.prettifySrc = void 0;
6
+ exports.prettifySrc = prettifySrc;
7
+ exports.prettifyPackageJson = prettifyPackageJson;
8
+ exports.prettifyPackageDistJson = prettifyPackageDistJson;
9
+ exports.prettifyReadme = prettifyReadme;
7
10
  const fs_extra_1 = __importDefault(require("fs-extra"));
8
11
  const klaw_1 = __importDefault(require("klaw"));
9
12
  const path_1 = __importDefault(require("path"));
@@ -47,7 +50,6 @@ async function prettifySrc(basePath, srcPath, ci) {
47
50
  console.log("Prettier - done on src");
48
51
  return res;
49
52
  }
50
- exports.prettifySrc = prettifySrc;
51
53
  /**
52
54
  * @param basePath -
53
55
  * @param ci -
@@ -80,7 +82,6 @@ async function prettifyPackageJson(basePath, ci) {
80
82
  console.log("Prettier - done on package.json");
81
83
  return res;
82
84
  }
83
- exports.prettifyPackageJson = prettifyPackageJson;
84
85
  /**
85
86
  * @param basePath -
86
87
  * @param _ci -
@@ -113,7 +114,6 @@ async function prettifyPackageDistJson(basePath, _ci) {
113
114
  console.log("Prettier - done on package.dist.json");
114
115
  return res;
115
116
  }
116
- exports.prettifyPackageDistJson = prettifyPackageDistJson;
117
117
  /**
118
118
  * @param basePath -
119
119
  * @param ci -
@@ -145,7 +145,6 @@ async function prettifyReadme(basePath, ci) {
145
145
  console.log("Prettier - done on README.md");
146
146
  return res;
147
147
  }
148
- exports.prettifyReadme = prettifyReadme;
149
148
  /**
150
149
  * @param basePath -
151
150
  * @param ci -
@@ -15,20 +15,38 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
15
15
  }) : function(o, v) {
16
16
  o["default"] = v;
17
17
  });
18
- var __importStar = (this && this.__importStar) || function (mod) {
19
- if (mod && mod.__esModule) return mod;
20
- var result = {};
21
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
- __setModuleDefault(result, mod);
23
- return result;
24
- };
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
25
35
  var __importDefault = (this && this.__importDefault) || function (mod) {
26
36
  return (mod && mod.__esModule) ? mod : { "default": mod };
27
37
  };
28
38
  Object.defineProperty(exports, "__esModule", { value: true });
29
- exports.buildTS = void 0;
39
+ exports.buildTS = buildTS;
30
40
  const fs_extra_1 = __importDefault(require("fs-extra"));
31
41
  const path_1 = __importDefault(require("path"));
42
+ var ExitCodes;
43
+ (function (ExitCodes) {
44
+ ExitCodes[ExitCodes["OK"] = 0] = "OK";
45
+ ExitCodes[ExitCodes["EmitErrors"] = 1] = "EmitErrors";
46
+ ExitCodes[ExitCodes["NoDataOrOptions"] = 2] = "NoDataOrOptions";
47
+ ExitCodes[ExitCodes["NoOptions"] = 3] = "NoOptions";
48
+ ExitCodes[ExitCodes["ParseError"] = 4] = "ParseError";
49
+ })(ExitCodes || (ExitCodes = {}));
32
50
  /**
33
51
  * @param basePath -
34
52
  * @param file -
@@ -116,32 +134,32 @@ async function compile(basePath, type) {
116
134
  break;
117
135
  }
118
136
  if (!data && !options) {
119
- return 2 /* ExitCodes.NoDataOrOptions */;
137
+ return ExitCodes.NoDataOrOptions;
120
138
  }
121
139
  if (!options && data) {
122
140
  options = JSON.parse(data);
123
141
  }
124
142
  if (!options) {
125
- return 3 /* ExitCodes.NoOptions */;
143
+ return ExitCodes.NoOptions;
126
144
  }
127
145
  const ts = await Promise.resolve().then(() => __importStar(require("typescript"))), parsed = ts.parseJsonConfigFileContent(options, ts.sys, basePath);
128
- if (!parsed) {
129
- return 4 /* ExitCodes.ParseError */;
146
+ if (parsed.errors.length) {
147
+ return ExitCodes.ParseError;
130
148
  }
131
149
  const program = ts.createProgram(parsed.fileNames, parsed.options), emitResult = program.emit(), allDiagnostics = ts.getPreEmitDiagnostics(program).concat(emitResult.diagnostics);
132
150
  let failed = false;
133
- allDiagnostics.forEach(diagnostic => {
151
+ for (const diagnostic of allDiagnostics) {
134
152
  failed = failed || diagnostic.category === ts.DiagnosticCategory.Error;
135
153
  if (diagnostic.file) {
136
154
  const startingPos = 0, { line, character } = ts.getLineAndCharacterOfPosition(diagnostic.file, diagnostic.start ?? startingPos), message = ts.flattenDiagnosticMessageText(diagnostic.messageText, "\n"), increment = 1;
137
- console.log(`${diagnostic.file.fileName} (${line + increment},${character + increment}): ${message}`);
155
+ console.log(`${diagnostic.file.fileName} (${(line + increment).toString()},${(character + increment).toString()}): ${message}`);
138
156
  }
139
157
  else {
140
158
  console.log(ts.flattenDiagnosticMessageText(diagnostic.messageText, "\n"));
141
159
  }
142
- });
143
- const exitCode = emitResult.emitSkipped || failed ? 1 /* ExitCodes.EmitErrors */ : 0 /* ExitCodes.OK */;
144
- console.log(`TSC for ${type} done with exit code: '${exitCode}'.`);
160
+ }
161
+ const exitCode = emitResult.emitSkipped || failed ? ExitCodes.EmitErrors : ExitCodes.OK;
162
+ console.log(`TSC for ${type} done with exit code: '${exitCode.toLocaleString()}'.`);
145
163
  return exitCode;
146
164
  }
147
165
  /**
@@ -152,7 +170,7 @@ async function buildTS(basePath) {
152
170
  console.log("Building TS files");
153
171
  let res = true;
154
172
  const types = ["browser", "cjs", "esm", "types", "umd"];
155
- for await (const type of types) {
173
+ for (const type of types) {
156
174
  console.log(`Building TS files for ${type} configuration`);
157
175
  const exitCode = await compile(basePath, type);
158
176
  if (exitCode) {
@@ -163,4 +181,3 @@ async function buildTS(basePath) {
163
181
  console.log("Building TS files done");
164
182
  return res;
165
183
  }
166
- exports.buildTS = buildTS;
@@ -15,13 +15,23 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
15
15
  }) : function(o, v) {
16
16
  o["default"] = v;
17
17
  });
18
- var __importStar = (this && this.__importStar) || function (mod) {
19
- if (mod && mod.__esModule) return mod;
20
- var result = {};
21
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
- __setModuleDefault(result, mod);
23
- return result;
24
- };
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
25
35
  Object.defineProperty(exports, "__esModule", { value: true });
26
36
  exports.buildCommand = void 0;
27
37
  const commander_1 = require("commander");
@@ -50,7 +60,7 @@ buildCommand.action(async (argPath) => {
50
60
  throw new Error("Provided path does not exist");
51
61
  }
52
62
  let canContinue = true;
53
- if (canContinue && prettier) {
63
+ if (prettier) {
54
64
  const { prettifySrc } = await Promise.resolve().then(() => __importStar(require("./build-prettier.js")));
55
65
  canContinue = await prettifySrc(basePath, srcPath, ci);
56
66
  }
@@ -72,9 +82,10 @@ buildCommand.action(async (argPath) => {
72
82
  }
73
83
  if (canContinue && prettier) {
74
84
  const { prettifyReadme, prettifyPackageJson, prettifyPackageDistJson } = await Promise.resolve().then(() => __importStar(require("./build-prettier.js")));
75
- canContinue = await prettifyReadme(basePath, ci);
76
- canContinue = await prettifyPackageJson(basePath, ci);
77
- canContinue = await prettifyPackageDistJson(basePath, ci);
85
+ canContinue =
86
+ (await prettifyReadme(basePath, ci)) &&
87
+ (await prettifyPackageJson(basePath, ci)) &&
88
+ (await prettifyPackageDistJson(basePath, ci));
78
89
  }
79
90
  if (canContinue && distfiles) {
80
91
  const { buildDistFiles } = await Promise.resolve().then(() => __importStar(require("./build-distfiles.js")));
@@ -83,15 +94,15 @@ buildCommand.action(async (argPath) => {
83
94
  if (!canContinue) {
84
95
  throw new Error("Build failed");
85
96
  }
86
- const newStats = await getDistStats(basePath), diffSize = newStats.totalSize - oldStats.totalSize, bundleDiffSize = newStats.bundleSize - oldStats.bundleSize, minSize = 0, bundleSizeIncreased = bundleDiffSize > minSize, outputFunc = bundleSizeIncreased ? console.warn : console.info, texts = [
97
+ const newStats = await getDistStats(basePath), diffSize = newStats.totalSize - oldStats.totalSize, bundleDiffSize = newStats.bundleSize - oldStats.bundleSize, minSize = 0, bundleSizeIncreased = bundleDiffSize > minSize, outputFunc = bundleSizeIncreased ? console.warn : console.info, bundleSizeIncreasedText = bundleSizeIncreased ? "increased" : "decreased", diffSizeIncreasedText = diffSize > minSize ? "increased" : "decreased", texts = [
87
98
  !bundleDiffSize
88
99
  ? "Bundle size unchanged"
89
- : `Bundle size ${bundleSizeIncreased ? "increased" : "decreased"} from ${oldStats.bundleSize} to ${newStats.bundleSize} (${Math.abs(bundleDiffSize)}B)`,
100
+ : `Bundle size ${bundleSizeIncreasedText} from ${oldStats.bundleSize.toString()} to ${newStats.bundleSize.toString()} (${Math.abs(bundleDiffSize).toString()}B)`,
90
101
  !diffSize
91
102
  ? "Size unchanged"
92
- : `Size ${diffSize > minSize ? "increased" : "decreased"} from ${oldStats.totalSize} to ${newStats.totalSize} (${Math.abs(diffSize)}B)`,
93
- `Files count changed from ${oldStats.totalFiles} to ${newStats.totalFiles} (${newStats.totalFiles - oldStats.totalFiles})`,
94
- `Folders count changed from ${oldStats.totalFolders} to ${newStats.totalFolders} (${newStats.totalFolders - oldStats.totalFolders})`,
103
+ : `Size ${diffSizeIncreasedText} from ${oldStats.totalSize.toString()} to ${newStats.totalSize.toString()} (${Math.abs(diffSize).toString()}B)`,
104
+ `Files count changed from ${oldStats.totalFiles.toString()} to ${newStats.totalFiles.toString()} (${(newStats.totalFiles - oldStats.totalFiles).toString()})`,
105
+ `Folders count changed from ${oldStats.totalFolders.toString()} to ${newStats.totalFolders.toString()} (${(newStats.totalFolders - oldStats.totalFolders).toString()})`,
95
106
  ];
96
107
  console.log("Build finished successfully!");
97
108
  for (const text of texts) {
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.createPluginTemplate = void 0;
6
+ exports.createPluginTemplate = createPluginTemplate;
7
7
  const string_utils_1 = require("../../utils/string-utils");
8
8
  const template_utils_1 = require("../../utils/template-utils");
9
9
  const fs_extra_1 = __importDefault(require("fs-extra"));
@@ -128,4 +128,3 @@ async function createPluginTemplate(name, description, repoUrl, destPath) {
128
128
  await (0, template_utils_1.runInstall)(destPath);
129
129
  await (0, template_utils_1.runBuild)(destPath);
130
130
  }
131
- exports.createPluginTemplate = createPluginTemplate;
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.createPresetTemplate = void 0;
6
+ exports.createPresetTemplate = createPresetTemplate;
7
7
  const string_utils_1 = require("../../utils/string-utils");
8
8
  const template_utils_1 = require("../../utils/template-utils");
9
9
  const fs_extra_1 = __importDefault(require("fs-extra"));
@@ -146,4 +146,3 @@ async function createPresetTemplate(name, description, repoUrl, destPath) {
146
146
  await (0, template_utils_1.runInstall)(destPath);
147
147
  await (0, template_utils_1.runBuild)(destPath);
148
148
  }
149
- exports.createPresetTemplate = createPresetTemplate;
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.createShapeTemplate = void 0;
6
+ exports.createShapeTemplate = createShapeTemplate;
7
7
  const string_utils_1 = require("../../utils/string-utils");
8
8
  const template_utils_1 = require("../../utils/template-utils");
9
9
  const fs_extra_1 = __importDefault(require("fs-extra"));
@@ -128,4 +128,3 @@ async function createShapeTemplate(name, description, repoUrl, destPath) {
128
128
  await (0, template_utils_1.runInstall)(destPath);
129
129
  await (0, template_utils_1.runBuild)(destPath);
130
130
  }
131
- exports.createShapeTemplate = createShapeTemplate;
@@ -3,7 +3,10 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.getRepositoryUrl = exports.getDestinationDir = exports.replaceTokensInFile = exports.replaceTokensInFiles = void 0;
6
+ exports.replaceTokensInFiles = replaceTokensInFiles;
7
+ exports.replaceTokensInFile = replaceTokensInFile;
8
+ exports.getDestinationDir = getDestinationDir;
9
+ exports.getRepositoryUrl = getRepositoryUrl;
7
10
  const child_process_1 = require("child_process");
8
11
  const fs_extra_1 = __importDefault(require("fs-extra"));
9
12
  const lookpath_1 = require("lookpath");
@@ -23,7 +26,6 @@ async function replaceTokensInFiles(options) {
23
26
  await fs_extra_1.default.writeFile(filePath, data);
24
27
  }
25
28
  }
26
- exports.replaceTokensInFiles = replaceTokensInFiles;
27
29
  /**
28
30
  *
29
31
  * @param options -
@@ -31,7 +33,6 @@ exports.replaceTokensInFiles = replaceTokensInFiles;
31
33
  async function replaceTokensInFile(options) {
32
34
  await replaceTokensInFiles([options]);
33
35
  }
34
- exports.replaceTokensInFile = replaceTokensInFile;
35
36
  /**
36
37
  *
37
38
  * @param destination -
@@ -48,7 +49,6 @@ async function getDestinationDir(destination) {
48
49
  await fs_extra_1.default.ensureDir(destPath);
49
50
  return destPath;
50
51
  }
51
- exports.getDestinationDir = getDestinationDir;
52
52
  /**
53
53
  * @returns the repository URL
54
54
  */
@@ -62,8 +62,7 @@ async function getRepositoryUrl() {
62
62
  reject(error);
63
63
  return;
64
64
  }
65
- resolve(stdout.toString());
65
+ resolve(stdout);
66
66
  });
67
67
  });
68
68
  }
69
- exports.getRepositoryUrl = getRepositoryUrl;
@@ -1,6 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.dash = exports.camelize = exports.capitalize = void 0;
3
+ exports.capitalize = capitalize;
4
+ exports.camelize = camelize;
5
+ exports.dash = dash;
4
6
  /**
5
7
  * This function is used to capitalize a string.
6
8
  * @param str - the string to capitalize (e.g. "my-string" -\> "MyString")
@@ -17,7 +19,6 @@ function capitalize(str, ...splits) {
17
19
  }
18
20
  return res;
19
21
  }
20
- exports.capitalize = capitalize;
21
22
  /**
22
23
  * This function is used to camelcase a string.
23
24
  * @param str - the string to camelcase (e.g. "my-string" -\> "myString")
@@ -27,7 +28,6 @@ exports.capitalize = capitalize;
27
28
  function camelize(str, ...splits) {
28
29
  return capitalize(str, ...splits).replace(/./, c => c.toLowerCase());
29
30
  }
30
- exports.camelize = camelize;
31
31
  /**
32
32
  * This function is used to dash a string.
33
33
  * @param str - the string to dash (e.g. "myString" -\> "my-string")
@@ -37,4 +37,3 @@ function dash(str) {
37
37
  const index = 0, dashed = str.replace(/([A-Z])/g, g => `-${g[index].toLowerCase()}`), startPos = 1;
38
38
  return dashed.startsWith("-") ? dashed.substring(startPos) : dashed;
39
39
  }
40
- exports.dash = dash;
@@ -3,7 +3,13 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.runBuild = exports.runInstall = exports.copyFilter = exports.copyEmptyTemplateFiles = exports.updateWebpackFile = exports.updatePackageDistFile = exports.updatePackageFile = void 0;
6
+ exports.updatePackageFile = updatePackageFile;
7
+ exports.updatePackageDistFile = updatePackageDistFile;
8
+ exports.updateWebpackFile = updateWebpackFile;
9
+ exports.copyEmptyTemplateFiles = copyEmptyTemplateFiles;
10
+ exports.copyFilter = copyFilter;
11
+ exports.runInstall = runInstall;
12
+ exports.runBuild = runBuild;
7
13
  const child_process_1 = require("child_process");
8
14
  const fs_extra_1 = __importDefault(require("fs-extra"));
9
15
  const lookpath_1 = require("lookpath");
@@ -48,7 +54,6 @@ async function updatePackageFile(destPath, packageName, description, fileName, r
48
54
  ],
49
55
  });
50
56
  }
51
- exports.updatePackageFile = updatePackageFile;
52
57
  /**
53
58
  * Updates the package.dist.json file with the new project name and description
54
59
  * @param destPath - The path where the package.dist.json file is located
@@ -88,7 +93,6 @@ async function updatePackageDistFile(destPath, packageName, description, fileNam
88
93
  ],
89
94
  });
90
95
  }
91
- exports.updatePackageDistFile = updatePackageDistFile;
92
96
  /**
93
97
  * Updates the webpack file with the new project name and description
94
98
  * @param destPath - The path where the project will be created
@@ -115,7 +119,6 @@ async function updateWebpackFile(destPath, name, description, fnName) {
115
119
  ],
116
120
  });
117
121
  }
118
- exports.updateWebpackFile = updateWebpackFile;
119
122
  /**
120
123
  * Copies the empty template files to the destination path
121
124
  * @param destPath - The path where the project will be created
@@ -126,7 +129,6 @@ async function copyEmptyTemplateFiles(destPath) {
126
129
  filter: copyFilter,
127
130
  });
128
131
  }
129
- exports.copyEmptyTemplateFiles = copyEmptyTemplateFiles;
130
132
  /**
131
133
  * Filters the files to copy
132
134
  * @param src - The source file path
@@ -135,7 +137,6 @@ exports.copyEmptyTemplateFiles = copyEmptyTemplateFiles;
135
137
  function copyFilter(src) {
136
138
  return !(src.endsWith("node_modules") || src.endsWith("dist"));
137
139
  }
138
- exports.copyFilter = copyFilter;
139
140
  /**
140
141
  * Runs npm install in the given path
141
142
  * @param destPath - The path where the project will be created
@@ -156,7 +157,6 @@ async function runInstall(destPath) {
156
157
  });
157
158
  });
158
159
  }
159
- exports.runInstall = runInstall;
160
160
  /**
161
161
  * Runs npm run build in the given path
162
162
  * @param destPath - The path where the project will be build
@@ -177,4 +177,3 @@ async function runBuild(destPath) {
177
177
  });
178
178
  });
179
179
  }
180
- exports.runBuild = runBuild;
@@ -0,0 +1,23 @@
1
+ import path from "path";
2
+ import {fileURLToPath} from "url";
3
+ const __dirname = path.dirname(fileURLToPath(import.meta.url));
4
+
5
+ import {defineConfig} from "eslint/config";
6
+ import tsParticlesESLintConfig from "@tsparticles/eslint-config";
7
+
8
+ export default defineConfig([
9
+ tsParticlesESLintConfig,
10
+ {
11
+ languageOptions: {
12
+ parserOptions: {
13
+ // Usa il tsconfig nella cartella src che contiene i sorgenti effettivi
14
+ project: [path.resolve(__dirname, "src/tsconfig.json")],
15
+ tsconfigRootDir: __dirname,
16
+ sourceType: "module"
17
+ }
18
+ },
19
+ rules: {
20
+ "no-console": "off"
21
+ }
22
+ }
23
+ ]);
@@ -83,7 +83,7 @@
83
83
  "prettier": "@tsparticles/prettier-config",
84
84
  "devDependencies": {
85
85
  "@babel/core": "^7.23.9",
86
- "@tsparticles/cli": "^2.3.3",
86
+ "@tsparticles/cli": "^3.0.1",
87
87
  "@tsparticles/eslint-config": "^2.2.1",
88
88
  "@tsparticles/prettier-config": "^2.1.6",
89
89
  "@tsparticles/tsconfig": "^2.1.7",
package/package.json CHANGED
@@ -1,7 +1,8 @@
1
1
  {
2
2
  "name": "@tsparticles/cli",
3
- "version": "2.3.3",
3
+ "version": "3.0.1",
4
4
  "license": "MIT",
5
+ "type": "module",
5
6
  "bin": {
6
7
  "tsparticles-cli": "dist/cli.js"
7
8
  },
@@ -10,59 +11,57 @@
10
11
  },
11
12
  "prettier": "@tsparticles/prettier-config",
12
13
  "dependencies": {
13
- "@tsparticles/eslint-config": "^2.3.0",
14
- "@tsparticles/prettier-config": "^2.1.6",
15
- "@tsparticles/tsconfig": "^2.3.0",
16
- "@tsparticles/webpack-plugin": "^2.3.0",
17
- "@typescript-eslint/eslint-plugin": "^7.1.1",
18
- "@typescript-eslint/parser": "^7.1.1",
19
- "commander": "^12.0.0",
20
- "eslint": "^8.57.0",
21
- "eslint-config-prettier": "^9.1.0",
22
- "eslint-plugin-jsdoc": "^48.2.0",
23
- "eslint-plugin-prettier": "^5.1.3",
24
- "eslint-plugin-tsdoc": "^0.2.17",
25
- "fs-extra": "^11.2.0",
14
+ "@tsparticles/eslint-config": "^3.0.3",
15
+ "@tsparticles/prettier-config": "^3.0.1",
16
+ "@tsparticles/tsconfig": "^3.0.1",
17
+ "@tsparticles/webpack-plugin": "^3.0.3",
18
+ "commander": "^14.0.0",
19
+ "eslint": "^9.34.0",
20
+ "eslint-config-prettier": "^10.1.8",
21
+ "eslint-plugin-jsdoc": "^54.1.1",
22
+ "eslint-plugin-prettier": "^5.5.4",
23
+ "eslint-plugin-tsdoc": "^0.4.0",
24
+ "fs-extra": "^11.3.1",
26
25
  "klaw": "^4.1.0",
27
- "lookpath": "^1.2.2",
28
- "madge": "^6.1.0",
29
- "path-scurry": "^1.10.1",
30
- "prettier": "^3.2.5",
31
- "prettier-plugin-multiline-arrays": "^3.0.4",
26
+ "lookpath": "^1.2.3",
27
+ "madge": "^8.0.0",
28
+ "path-scurry": "^2.0.0",
29
+ "prettier": "^3.6.2",
30
+ "prettier-plugin-multiline-arrays": "^4.0.3",
32
31
  "prompts": "^2.4.2",
33
- "rimraf": "^5.0.5",
34
- "typescript": "^5.4.2",
35
- "webpack": "^5.90.3"
32
+ "rimraf": "^6.0.1",
33
+ "typescript": "^5.9.2",
34
+ "typescript-eslint": "^8.41.0",
35
+ "webpack": "^5.101.3"
36
36
  },
37
37
  "devDependencies": {
38
- "@babel/core": "^7.23.9",
39
- "@tsparticles/cli": "^2.2.4",
40
- "@tsparticles/engine": "^3.3.0",
41
- "@types/chai": "^4.3.12",
42
- "@types/eslint": "^8.56.5",
38
+ "@babel/core": "^7.28.3",
39
+ "@tsparticles/cli": "^2.3.3",
40
+ "@tsparticles/engine": "^3.9.1",
41
+ "@types/chai": "^5.2.2",
42
+ "@types/eslint": "^9.6.1",
43
+ "@types/estree": "^1.0.8",
43
44
  "@types/fs-extra": "^11.0.4",
44
- "@types/klaw": "^3.0.6",
45
+ "@types/klaw": "^3.0.7",
45
46
  "@types/madge": "^5.0.3",
46
- "@types/mocha": "^10.0.6",
47
- "@types/node": "^20.11.24",
47
+ "@types/mocha": "^10.0.10",
48
+ "@types/node": "^24.3.0",
48
49
  "@types/prompts": "^2.4.9",
49
- "@types/webpack-env": "^1.18.4",
50
- "@typescript-eslint/eslint-plugin": "^7.1.0",
51
- "@typescript-eslint/parser": "^7.1.0",
52
- "babel-loader": "^9.1.3",
53
- "browserslist": "^4.23.0",
54
- "chai": "^4.4.1",
50
+ "@types/webpack-env": "^1.18.8",
51
+ "babel-loader": "^10.0.0",
52
+ "browserslist": "^4.25.4",
53
+ "chai": "^4.5.0",
55
54
  "copyfiles": "^2.4.1",
56
- "cross-env": "^7.0.3",
57
- "mocha": "^10.3.0",
58
- "nyc": "^15.1.0",
59
- "terser-webpack-plugin": "^5.3.10",
55
+ "cross-env": "^10.0.0",
56
+ "mocha": "^10.8.2",
57
+ "nyc": "^17.1.0",
58
+ "terser-webpack-plugin": "^5.3.14",
60
59
  "ts-node": "^10.9.2",
61
- "webpack-bundle-analyzer": "^4.10.1",
62
- "webpack-cli": "^5.1.4"
60
+ "webpack-bundle-analyzer": "^4.10.2",
61
+ "webpack-cli": "^6.0.1"
63
62
  },
64
63
  "description": "tsParticles CLI",
65
- "main": ".eslintrc.js",
64
+ "main": "eslint.config.js",
66
65
  "author": "Matteo Bruni <matteo.bruni@me.com>",
67
66
  "scripts": {
68
67
  "prettify:ci:src": "prettier --check ./src/*",
@@ -0,0 +1,2 @@
1
+ onlyBuiltDependencies:
2
+ - '@tsparticles/engine'
@@ -1,27 +1,24 @@
1
- const pkg = require("../package.json");
2
- const fs = require("fs-extra");
3
- const path = require("path");
1
+ import { fileURLToPath } from "url";
2
+ import fs from "fs-extra";
3
+ import path from "path";
4
4
 
5
- const emptyProjectPkgPath = path.join(__dirname, "..", "files", "empty-project", "package.json");
5
+ const __filename = fileURLToPath(import.meta.url),
6
+ __dirname = path.dirname(__filename),
7
+ emptyProjectPkgPath = path.join(__dirname, "..", "files", "empty-project", "package.json"),
8
+ rootPkgPath = path.join(__dirname, "..", "package.json");
6
9
 
7
10
  (async () => {
8
- await fs.readFile(emptyProjectPkgPath, "utf8", (err, data) => {
9
- if (err) {
10
- console.error(err);
11
-
12
- return;
13
- }
14
-
15
- const obj = JSON.parse(data);
11
+ try {
12
+ // usa readJson/writeJson di fs-extra per evitare parse manuale e problemi di typing
13
+ const pkg = await fs.readJson(rootPkgPath),
14
+ obj = await fs.readJson(emptyProjectPkgPath);
16
15
 
16
+ obj["devDependencies"] = obj["devDependencies"] || {};
17
17
  obj["devDependencies"]["@tsparticles/cli"] = `^${pkg.version}`;
18
18
 
19
- const result = JSON.stringify(obj, undefined, 2);
20
-
21
- fs.writeFile(emptyProjectPkgPath, `${result}\n`, "utf8", (err) => {
22
- if (err) {
23
- console.error(err);
24
- }
25
- });
26
- });
19
+ await fs.writeJson(emptyProjectPkgPath, obj, { spaces: 2 });
20
+ }
21
+ catch (err) {
22
+ console.error(err);
23
+ }
27
24
  })();
@@ -24,7 +24,7 @@ export async function bundle(basePath: string): Promise<boolean> {
24
24
  }
25
25
 
26
26
  if (!stats) {
27
- const err = "No stats returned from webpack";
27
+ const err = new Error("No stats returned from webpack");
28
28
 
29
29
  console.error(err);
30
30
 
@@ -38,7 +38,7 @@ export async function bundle(basePath: string): Promise<boolean> {
38
38
  if (stats.hasErrors()) {
39
39
  console.error(info.errors);
40
40
 
41
- reject(info.errors);
41
+ reject(new Error(info.errors?.map(error => error.message).join("\n")));
42
42
  }
43
43
 
44
44
  if (stats.hasWarnings()) {
@@ -24,10 +24,8 @@ export async function buildCircularDeps(basePath: string): Promise<boolean> {
24
24
  console.error("Circular dependencies found!");
25
25
 
26
26
  for (const dep of circularDeps) {
27
- console.error(`${dep.join(" > ")}`);
27
+ console.error(dep.join(" > "));
28
28
  }
29
-
30
- res = false;
31
29
  } else {
32
30
  res = true;
33
31
  }
@@ -1,4 +1,6 @@
1
1
  import { ESLint } from "eslint";
2
+ import { defineConfig } from "eslint/config";
3
+ import tsParticlesESLintConfig from "@tsparticles/eslint-config";
2
4
 
3
5
  /**
4
6
  * @param ci -
@@ -10,13 +12,7 @@ export async function lint(ci: boolean): Promise<boolean> {
10
12
  let res: boolean;
11
13
 
12
14
  try {
13
- const eslint = new ESLint({
14
- baseConfig: {
15
- extends: ["@tsparticles/eslint-config"],
16
- },
17
- extensions: [".js", ".jsx", ".ts", ".tsx"],
18
- fix: !ci,
19
- });
15
+ const eslint = new ESLint({ baseConfig: defineConfig([tsParticlesESLintConfig]), fix: !ci });
20
16
 
21
17
  const results = await eslint.lintFiles(["src"]),
22
18
  errors = ESLint.getErrorResults(results);
@@ -29,7 +25,9 @@ export async function lint(ci: boolean): Promise<boolean> {
29
25
 
30
26
  if (errors.length > minimumLength) {
31
27
  const messages = errors.map(t =>
32
- t.messages.map(m => `${t.filePath} (${m.line},${m.column}): ${m.message}`).join("\n"),
28
+ t.messages
29
+ .map(m => `${t.filePath} (${m.line.toString()},${m.column.toString()}): ${m.message}`)
30
+ .join("\n"),
33
31
  );
34
32
 
35
33
  throw new Error(messages.join("\n"));
@@ -1,7 +1,7 @@
1
1
  import fs from "fs-extra";
2
2
  import path from "path";
3
3
 
4
- const enum ExitCodes {
4
+ enum ExitCodes {
5
5
  OK = 0,
6
6
  EmitErrors = 1,
7
7
  NoDataOrOptions = 2,
@@ -125,7 +125,7 @@ async function compile(basePath: string, type: "browser" | "cjs" | "esm" | "type
125
125
  const ts = await import("typescript"),
126
126
  parsed = ts.parseJsonConfigFileContent(options, ts.sys, basePath);
127
127
 
128
- if (!parsed) {
128
+ if (parsed.errors.length) {
129
129
  return ExitCodes.ParseError;
130
130
  }
131
131
 
@@ -135,7 +135,7 @@ async function compile(basePath: string, type: "browser" | "cjs" | "esm" | "type
135
135
 
136
136
  let failed = false;
137
137
 
138
- allDiagnostics.forEach(diagnostic => {
138
+ for (const diagnostic of allDiagnostics) {
139
139
  failed = failed || diagnostic.category === ts.DiagnosticCategory.Error;
140
140
 
141
141
  if (diagnostic.file) {
@@ -147,15 +147,17 @@ async function compile(basePath: string, type: "browser" | "cjs" | "esm" | "type
147
147
  message = ts.flattenDiagnosticMessageText(diagnostic.messageText, "\n"),
148
148
  increment = 1;
149
149
 
150
- console.log(`${diagnostic.file.fileName} (${line + increment},${character + increment}): ${message}`);
150
+ console.log(
151
+ `${diagnostic.file.fileName} (${(line + increment).toString()},${(character + increment).toString()}): ${message}`,
152
+ );
151
153
  } else {
152
154
  console.log(ts.flattenDiagnosticMessageText(diagnostic.messageText, "\n"));
153
155
  }
154
- });
156
+ }
155
157
 
156
158
  const exitCode = emitResult.emitSkipped || failed ? ExitCodes.EmitErrors : ExitCodes.OK;
157
159
 
158
- console.log(`TSC for ${type} done with exit code: '${exitCode}'.`);
160
+ console.log(`TSC for ${type} done with exit code: '${exitCode.toLocaleString()}'.`);
159
161
 
160
162
  return exitCode;
161
163
  }
@@ -171,7 +173,7 @@ export async function buildTS(basePath: string): Promise<boolean> {
171
173
 
172
174
  const types: ("browser" | "cjs" | "esm" | "types" | "umd")[] = ["browser", "cjs", "esm", "types", "umd"];
173
175
 
174
- for await (const type of types) {
176
+ for (const type of types) {
175
177
  console.log(`Building TS files for ${type} configuration`);
176
178
 
177
179
  const exitCode = await compile(basePath, type);
@@ -54,7 +54,7 @@ buildCommand.action(async (argPath: string) => {
54
54
 
55
55
  let canContinue = true;
56
56
 
57
- if (canContinue && prettier) {
57
+ if (prettier) {
58
58
  const { prettifySrc } = await import("./build-prettier.js");
59
59
 
60
60
  canContinue = await prettifySrc(basePath, srcPath, ci);
@@ -87,9 +87,10 @@ buildCommand.action(async (argPath: string) => {
87
87
  if (canContinue && prettier) {
88
88
  const { prettifyReadme, prettifyPackageJson, prettifyPackageDistJson } = await import("./build-prettier.js");
89
89
 
90
- canContinue = await prettifyReadme(basePath, ci);
91
- canContinue = await prettifyPackageJson(basePath, ci);
92
- canContinue = await prettifyPackageDistJson(basePath, ci);
90
+ canContinue =
91
+ (await prettifyReadme(basePath, ci)) &&
92
+ (await prettifyPackageJson(basePath, ci)) &&
93
+ (await prettifyPackageDistJson(basePath, ci));
93
94
  }
94
95
 
95
96
  if (canContinue && distfiles) {
@@ -108,23 +109,21 @@ buildCommand.action(async (argPath: string) => {
108
109
  minSize = 0,
109
110
  bundleSizeIncreased = bundleDiffSize > minSize,
110
111
  outputFunc = bundleSizeIncreased ? console.warn : console.info,
112
+ bundleSizeIncreasedText = bundleSizeIncreased ? "increased" : "decreased",
113
+ diffSizeIncreasedText = diffSize > minSize ? "increased" : "decreased",
111
114
  texts = [
112
115
  !bundleDiffSize
113
116
  ? "Bundle size unchanged"
114
- : `Bundle size ${bundleSizeIncreased ? "increased" : "decreased"} from ${oldStats.bundleSize} to ${
115
- newStats.bundleSize
116
- } (${Math.abs(bundleDiffSize)}B)`,
117
+ : `Bundle size ${bundleSizeIncreasedText} from ${oldStats.bundleSize.toString()} to ${newStats.bundleSize.toString()} (${Math.abs(bundleDiffSize).toString()}B)`,
117
118
  !diffSize
118
119
  ? "Size unchanged"
119
- : `Size ${diffSize > minSize ? "increased" : "decreased"} from ${oldStats.totalSize} to ${
120
- newStats.totalSize
121
- } (${Math.abs(diffSize)}B)`,
122
- `Files count changed from ${oldStats.totalFiles} to ${newStats.totalFiles} (${
120
+ : `Size ${diffSizeIncreasedText} from ${oldStats.totalSize.toString()} to ${newStats.totalSize.toString()} (${Math.abs(diffSize).toString()}B)`,
121
+ `Files count changed from ${oldStats.totalFiles.toString()} to ${newStats.totalFiles.toString()} (${(
123
122
  newStats.totalFiles - oldStats.totalFiles
124
- })`,
125
- `Folders count changed from ${oldStats.totalFolders} to ${newStats.totalFolders} (${
123
+ ).toString()})`,
124
+ `Folders count changed from ${oldStats.totalFolders.toString()} to ${newStats.totalFolders.toString()} (${(
126
125
  newStats.totalFolders - oldStats.totalFolders
127
- })`,
126
+ ).toString()})`,
128
127
  ];
129
128
 
130
129
  console.log("Build finished successfully!");
@@ -80,7 +80,7 @@ export async function getRepositoryUrl(): Promise<string> {
80
80
  return;
81
81
  }
82
82
 
83
- resolve(stdout.toString());
83
+ resolve(stdout);
84
84
  });
85
85
  });
86
86
  }
@@ -0,0 +1,8 @@
1
+ {
2
+ "extends": "./tsconfig.json",
3
+ "include": [
4
+ "src/**/*",
5
+ "tests/**/*"
6
+ ]
7
+ }
8
+
package/tsconfig.json CHANGED
@@ -15,7 +15,9 @@
15
15
  "eslint"
16
16
  ]
17
17
  },
18
- "files": [
19
- "package.json"
18
+ "include": [
19
+ "src/**/*",
20
+ "tests/**/*",
21
+ "files/**/*"
20
22
  ]
21
23
  }
package/.eslintignore DELETED
@@ -1,2 +0,0 @@
1
- dist
2
- node_modules
package/.eslintrc.js DELETED
@@ -1,13 +0,0 @@
1
- const path = require("path");
2
-
3
- module.exports = {
4
- extends: ["@tsparticles/eslint-config"],
5
- parserOptions: {
6
- project: "tsconfig.json",
7
- tsconfigRootDir: path.join(__dirname, "src"),
8
- sourceType: "module"
9
- },
10
- rules: {
11
- "no-console": "off"
12
- }
13
- };