@tsparticles/cli 1.6.1 → 1.6.4

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.
@@ -76,6 +76,12 @@ async function buildDistFiles(basePath) {
76
76
  const contents = await fs_extra_1.default.readFile(file.path, "utf8");
77
77
  await fs_extra_1.default.writeFile(file.path, contents.replaceAll("__VERSION__", `"${pkgInfo.version}"`), "utf8");
78
78
  }
79
+ for await (const file of (0, klaw_1.default)(path_1.default.join(distPath, "cjs"))) {
80
+ await fs_extra_1.default.rename(file.path, file.path.replace(/\.js$/, ".cjs"));
81
+ }
82
+ for await (const file of (0, klaw_1.default)(path_1.default.join(distPath, "esm"))) {
83
+ await fs_extra_1.default.rename(file.path, file.path.replace(/\.js$/, ".mjs"));
84
+ }
79
85
  await fs_extra_1.default.writeFile(path_1.default.join(distPath, "cjs", "package.json"), `{ "type": "commonjs" }`);
80
86
  await fs_extra_1.default.writeFile(path_1.default.join(distPath, "esm", "package.json"), `{ "type": "module" }`);
81
87
  res = true;
@@ -56,7 +56,7 @@ async function updatePresetPackageDistFile(destPath, name, description, repoUrl)
56
56
  * @param repoUrl - The repository url
57
57
  */
58
58
  async function updateReadmeFile(destPath, name, description, repoUrl) {
59
- const readmePath = path_1.default.resolve(destPath, "README.md"), readme = await fs_extra_1.default.readFile(readmePath, "utf-8"), capitalizedName = (0, string_utils_1.capitalize)((0, string_utils_1.capitalize)(name, "-"), " "), camelizedName = (0, string_utils_1.camelize)(capitalizedName), dashedName = (0, string_utils_1.dash)(camelizedName), readmeDescriptionRegex = /tsParticles Template Preset/g, replacedDescriptionText = readme.replace(readmeDescriptionRegex, `tsParticles ${description} Preset`), readmePackageNameRegex = /tsparticles-preset-template/g, replacedPackageNameText = replacedDescriptionText.replace(readmePackageNameRegex, `tsparticles-preset-${dashedName}`), readmeFileNameRegex = /tsparticles\.preset\.template(\.bundle)?\.min\.js/g, replacedFileNameText = replacedPackageNameText.replace(readmeFileNameRegex, `tsparticles.preset.${camelizedName}$1.min.js`), readmeFunctionNameRegex = /loadTemplatePreset/g, replacedFunctionNameText = replacedFileNameText.replace(readmeFunctionNameRegex, `load${capitalizedName}Preset`), readmeMiniDescriptionRegex = /\[tsParticles\]\(https:\/\/github.com\/matteobruni\/tsparticles\) preset template\./g, replacedMiniDescriptionText = replacedFunctionNameText.replace(readmeMiniDescriptionRegex, `[tsParticles](https://github.com/matteobruni/tsparticles) preset ${name}.`), readmeUsageRegex = /preset: "template"/g, replacedUsageText = replacedMiniDescriptionText.replace(readmeUsageRegex, `preset: "${camelizedName}`), sampleImageRegex = /!\[demo\]\(https:\/\/raw.githubusercontent.com\/tsparticles\/preset-template\/main\/images\/sample.png\)/g, repoPath = repoUrl.includes("github.com")
59
+ const readmePath = path_1.default.resolve(destPath, "README.md"), readme = await fs_extra_1.default.readFile(readmePath, "utf-8"), capitalizedName = (0, string_utils_1.capitalize)((0, string_utils_1.capitalize)(name, "-"), " "), camelizedName = (0, string_utils_1.camelize)(capitalizedName), dashedName = (0, string_utils_1.dash)(camelizedName), readmeDescriptionRegex = /tsParticles Template Preset/g, replacedDescriptionText = readme.replace(readmeDescriptionRegex, `tsParticles ${description} Preset`), readmePackageNameRegex = /tsparticles-preset-template/g, replacedPackageNameText = replacedDescriptionText.replace(readmePackageNameRegex, `tsparticles-preset-${dashedName}`), readmeFileNameRegex = /tsparticles\.preset\.template(\.bundle)?\.min\.js/g, replacedFileNameText = replacedPackageNameText.replace(readmeFileNameRegex, `tsparticles.preset.${camelizedName}$1.min.js`), readmeFunctionNameRegex = /loadTemplatePreset/g, replacedFunctionNameText = replacedFileNameText.replace(readmeFunctionNameRegex, `load${capitalizedName}Preset`), readmeMiniDescriptionRegex = /\[tsParticles]\(https:\/\/github.com\/matteobruni\/tsparticles\) preset template\./g, replacedMiniDescriptionText = replacedFunctionNameText.replace(readmeMiniDescriptionRegex, `[tsParticles](https://github.com/matteobruni/tsparticles) preset ${name}.`), readmeUsageRegex = /preset: "template"/g, replacedUsageText = replacedMiniDescriptionText.replace(readmeUsageRegex, `preset: "${camelizedName}`), sampleImageRegex = /!\[demo]\(https:\/\/raw.githubusercontent.com\/tsparticles\/preset-template\/main\/images\/sample.png\)/g, repoPath = repoUrl.includes("github.com")
60
60
  ? repoUrl.substring(repoUrl.indexOf("github.com/") + 11, repoUrl.indexOf(".git"))
61
61
  : "tsparticles/preset-template", replacedText = replacedUsageText.replace(sampleImageRegex, `![demo](https://raw.githubusercontent.com/${repoPath}/main/images/sample.png)`);
62
62
  await fs_extra_1.default.writeFile(readmePath, replacedText);
@@ -83,7 +83,7 @@
83
83
  "prettier": "@tsparticles/prettier-config",
84
84
  "devDependencies": {
85
85
  "@babel/core": "^7.22.5",
86
- "@tsparticles/cli": "1.6.1",
86
+ "@tsparticles/cli": "1.6.4",
87
87
  "@tsparticles/eslint-config": "^1.13.0",
88
88
  "@tsparticles/prettier-config": "^1.10.0",
89
89
  "@tsparticles/tsconfig": "^1.13.0",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tsparticles/cli",
3
- "version": "1.6.1",
3
+ "version": "1.6.4",
4
4
  "license": "MIT",
5
5
  "bin": {
6
6
  "tsparticles-cli": "dist/cli.js"
@@ -10,10 +10,10 @@
10
10
  },
11
11
  "prettier": "@tsparticles/prettier-config",
12
12
  "dependencies": {
13
- "@tsparticles/eslint-config": "^1.13.0",
13
+ "@tsparticles/eslint-config": "^1.13.3",
14
14
  "@tsparticles/prettier-config": "^1.10.0",
15
15
  "@tsparticles/tsconfig": "^1.13.0",
16
- "@tsparticles/webpack-plugin": "^1.15.1",
16
+ "@tsparticles/webpack-plugin": "^1.15.5",
17
17
  "@typescript-eslint/eslint-plugin": "^5.60.0",
18
18
  "@typescript-eslint/parser": "^5.60.0",
19
19
  "commander": "^11.0.0",
@@ -71,6 +71,14 @@ export async function buildDistFiles(basePath: string): Promise<boolean> {
71
71
  await fs.writeFile(file.path, contents.replaceAll("__VERSION__", `"${pkgInfo.version}"`), "utf8");
72
72
  }
73
73
 
74
+ for await (const file of klaw(path.join(distPath, "cjs"))) {
75
+ await fs.rename(file.path, file.path.replace(/\.js$/, ".cjs"));
76
+ }
77
+
78
+ for await (const file of klaw(path.join(distPath, "esm"))) {
79
+ await fs.rename(file.path, file.path.replace(/\.js$/, ".mjs"));
80
+ }
81
+
74
82
  await fs.writeFile(path.join(distPath, "cjs", "package.json"), `{ "type": "commonjs" }`);
75
83
  await fs.writeFile(path.join(distPath, "esm", "package.json"), `{ "type": "module" }`);
76
84
 
@@ -125,7 +125,7 @@ async function updateReadmeFile(destPath: string, name: string, description: str
125
125
  `load${capitalizedName}Preset`
126
126
  ),
127
127
  readmeMiniDescriptionRegex =
128
- /\[tsParticles\]\(https:\/\/github.com\/matteobruni\/tsparticles\) preset template\./g,
128
+ /\[tsParticles]\(https:\/\/github.com\/matteobruni\/tsparticles\) preset template\./g,
129
129
  replacedMiniDescriptionText = replacedFunctionNameText.replace(
130
130
  readmeMiniDescriptionRegex,
131
131
  `[tsParticles](https://github.com/matteobruni/tsparticles) preset ${name}.`
@@ -133,7 +133,7 @@ async function updateReadmeFile(destPath: string, name: string, description: str
133
133
  readmeUsageRegex = /preset: "template"/g,
134
134
  replacedUsageText = replacedMiniDescriptionText.replace(readmeUsageRegex, `preset: "${camelizedName}`),
135
135
  sampleImageRegex =
136
- /!\[demo\]\(https:\/\/raw.githubusercontent.com\/tsparticles\/preset-template\/main\/images\/sample.png\)/g,
136
+ /!\[demo]\(https:\/\/raw.githubusercontent.com\/tsparticles\/preset-template\/main\/images\/sample.png\)/g,
137
137
  repoPath = repoUrl.includes("github.com")
138
138
  ? repoUrl.substring(repoUrl.indexOf("github.com/") + 11, repoUrl.indexOf(".git"))
139
139
  : "tsparticles/preset-template",