@tsparticles/cli 1.6.1 → 1.6.3

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;
@@ -4,15 +4,15 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.buildCommand = void 0;
7
- const build_prettier_1 = require("./build-prettier");
7
+ const build_prettier_js_1 = require("./build-prettier.js");
8
8
  const commander_1 = require("commander");
9
- const build_distfiles_1 = require("./build-distfiles");
10
- const build_tsc_1 = require("./build-tsc");
11
- const build_bundle_1 = require("./build-bundle");
12
- const build_clear_1 = require("./build-clear");
9
+ const build_distfiles_js_1 = require("./build-distfiles.js");
10
+ const build_tsc_js_1 = require("./build-tsc.js");
11
+ const build_bundle_js_1 = require("./build-bundle.js");
12
+ const build_clear_js_1 = require("./build-clear.js");
13
13
  const fs_extra_1 = __importDefault(require("fs-extra"));
14
- const build_diststats_1 = require("./build-diststats");
15
- const build_eslint_1 = require("./build-eslint");
14
+ const build_diststats_js_1 = require("./build-diststats.js");
15
+ const build_eslint_js_1 = require("./build-eslint.js");
16
16
  const path_1 = __importDefault(require("path"));
17
17
  const buildCommand = new commander_1.Command("build");
18
18
  exports.buildCommand = buildCommand;
@@ -28,9 +28,9 @@ buildCommand.option("-t, --tsc", "Build the library using TypeScript", false);
28
28
  buildCommand.argument("[path]", `Path to the project root folder, default is "src"`, "src");
29
29
  buildCommand.action(async (argPath) => {
30
30
  const opts = buildCommand.opts(), ci = !!opts.ci, all = !!opts.all, doBundle = all || !!opts.bundle, clean = all || !!opts.clean, distfiles = all || !!opts.dist, doLint = all || !!opts.lint, prettier = all || !!opts.prettify, tsc = all || !!opts.tsc;
31
- const basePath = process.cwd(), oldStats = await (0, build_diststats_1.getDistStats)(basePath);
31
+ const basePath = process.cwd(), oldStats = await (0, build_diststats_js_1.getDistStats)(basePath);
32
32
  if (clean) {
33
- await (0, build_clear_1.clearDist)(basePath);
33
+ await (0, build_clear_js_1.clearDist)(basePath);
34
34
  }
35
35
  const srcPath = path_1.default.join(basePath, argPath);
36
36
  if (!(await fs_extra_1.default.pathExists(srcPath))) {
@@ -38,27 +38,27 @@ buildCommand.action(async (argPath) => {
38
38
  }
39
39
  let canContinue = true;
40
40
  if (canContinue && prettier) {
41
- canContinue = await (0, build_prettier_1.prettifySrc)(basePath, srcPath, ci);
41
+ canContinue = await (0, build_prettier_js_1.prettifySrc)(basePath, srcPath, ci);
42
42
  }
43
43
  if (canContinue && doLint) {
44
- canContinue = await (0, build_eslint_1.lint)(ci);
44
+ canContinue = await (0, build_eslint_js_1.lint)(ci);
45
45
  }
46
46
  if (canContinue && tsc) {
47
- canContinue = await (0, build_tsc_1.buildTS)(basePath);
47
+ canContinue = await (0, build_tsc_js_1.buildTS)(basePath);
48
48
  }
49
49
  if (canContinue && doBundle) {
50
- canContinue = await (0, build_bundle_1.bundle)(basePath);
50
+ canContinue = await (0, build_bundle_js_1.bundle)(basePath);
51
51
  }
52
52
  if (canContinue && prettier) {
53
- canContinue = await (0, build_prettier_1.prettifyReadme)(basePath, ci);
53
+ canContinue = await (0, build_prettier_js_1.prettifyReadme)(basePath, ci);
54
54
  }
55
55
  if (canContinue && distfiles) {
56
- canContinue = await (0, build_distfiles_1.buildDistFiles)(basePath);
56
+ canContinue = await (0, build_distfiles_js_1.buildDistFiles)(basePath);
57
57
  }
58
58
  if (!canContinue) {
59
59
  throw new Error("Build failed");
60
60
  }
61
- const newStats = await (0, build_diststats_1.getDistStats)(basePath), diffSize = newStats.totalSize - oldStats.totalSize, bundleDiffSize = newStats.bundleSize - oldStats.bundleSize, bundleSizeIncreased = bundleDiffSize > 0, outputFunc = bundleSizeIncreased ? console.warn : console.info, texts = [
61
+ const newStats = await (0, build_diststats_js_1.getDistStats)(basePath), diffSize = newStats.totalSize - oldStats.totalSize, bundleDiffSize = newStats.bundleSize - oldStats.bundleSize, bundleSizeIncreased = bundleDiffSize > 0, outputFunc = bundleSizeIncreased ? console.warn : console.info, texts = [
62
62
  !bundleDiffSize
63
63
  ? "Bundle size unchanged"
64
64
  : `Bundle size ${bundleSizeIncreased ? "increased" : "decreased"} from ${oldStats.bundleSize} to ${newStats.bundleSize} (${Math.abs(bundleDiffSize)}B)`,
package/dist/cli.js CHANGED
@@ -4,13 +4,13 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
4
4
  return (mod && mod.__esModule) ? mod : { "default": mod };
5
5
  };
6
6
  Object.defineProperty(exports, "__esModule", { value: true });
7
- const build_1 = require("./build/build");
8
- const create_1 = require("./create/create");
7
+ const build_js_1 = require("./build/build.js");
8
+ const create_js_1 = require("./create/create.js");
9
9
  const package_json_1 = __importDefault(require("../package.json"));
10
10
  const commander_1 = require("commander");
11
11
  commander_1.program.name("tsparticles-cli build");
12
12
  commander_1.program.description("tsParticles Builder");
13
13
  commander_1.program.version(package_json_1.default.version, "-v, --version", "output the current version");
14
- commander_1.program.addCommand(build_1.buildCommand);
15
- commander_1.program.addCommand(create_1.createCommand);
14
+ commander_1.program.addCommand(build_js_1.buildCommand);
15
+ commander_1.program.addCommand(create_js_1.createCommand);
16
16
  commander_1.program.parse(process.argv);
@@ -2,8 +2,8 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.createCommand = void 0;
4
4
  const commander_1 = require("commander");
5
- const preset_1 = require("./preset/preset");
5
+ const preset_js_1 = require("./preset/preset.js");
6
6
  const createCommand = new commander_1.Command("create");
7
7
  exports.createCommand = createCommand;
8
8
  createCommand.description("Create a new tsParticles project");
9
- createCommand.addCommand(preset_1.presetCommand);
9
+ createCommand.addCommand(preset_js_1.presetCommand);
@@ -4,8 +4,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.createPresetTemplate = void 0;
7
- const string_utils_1 = require("../../utils/string-utils");
8
- const template_utils_1 = require("../../utils/template-utils");
7
+ const string_utils_js_1 = require("../../utils/string-utils.js");
8
+ const template_utils_js_1 = require("../../utils/template-utils.js");
9
9
  const fs_extra_1 = __importDefault(require("fs-extra"));
10
10
  const path_1 = __importDefault(require("path"));
11
11
  /**
@@ -14,7 +14,7 @@ const path_1 = __importDefault(require("path"));
14
14
  * @param name - The name of the project
15
15
  */
16
16
  async function updateBundleFile(destPath, name) {
17
- const bundlePath = path_1.default.resolve(destPath, "src", "bundle.ts"), bundle = await fs_extra_1.default.readFile(bundlePath, "utf-8"), capitalizedName = (0, string_utils_1.capitalize)((0, string_utils_1.capitalize)(name, "-"), " "), bundleRegex = /loadTemplatePreset/g, replacedText = bundle.replace(bundleRegex, `load${capitalizedName}Preset`);
17
+ const bundlePath = path_1.default.resolve(destPath, "src", "bundle.ts"), bundle = await fs_extra_1.default.readFile(bundlePath, "utf-8"), capitalizedName = (0, string_utils_js_1.capitalize)((0, string_utils_js_1.capitalize)(name, "-"), " "), bundleRegex = /loadTemplatePreset/g, replacedText = bundle.replace(bundleRegex, `load${capitalizedName}Preset`);
18
18
  await fs_extra_1.default.writeFile(bundlePath, replacedText);
19
19
  }
20
20
  /**
@@ -23,7 +23,7 @@ async function updateBundleFile(destPath, name) {
23
23
  * @param name - The name of the project
24
24
  */
25
25
  async function updateIndexFile(destPath, name) {
26
- const indexPath = path_1.default.resolve(destPath, "src", "index.ts"), index = await fs_extra_1.default.readFile(indexPath, "utf-8"), capitalizedName = (0, string_utils_1.capitalize)((0, string_utils_1.capitalize)(name, "-"), " "), camelizedName = (0, string_utils_1.camelize)(capitalizedName), indexFunctionRegex = /loadTemplatePreset/g, replacedFuncText = index.replace(indexFunctionRegex, `load${capitalizedName}Preset`), indexNameRegex = /"#template#"/g, replacedNameText = replacedFuncText.replace(indexNameRegex, `"${camelizedName}"`);
26
+ const indexPath = path_1.default.resolve(destPath, "src", "index.ts"), index = await fs_extra_1.default.readFile(indexPath, "utf-8"), capitalizedName = (0, string_utils_js_1.capitalize)((0, string_utils_js_1.capitalize)(name, "-"), " "), camelizedName = (0, string_utils_js_1.camelize)(capitalizedName), indexFunctionRegex = /loadTemplatePreset/g, replacedFuncText = index.replace(indexFunctionRegex, `load${capitalizedName}Preset`), indexNameRegex = /"#template#"/g, replacedNameText = replacedFuncText.replace(indexNameRegex, `"${camelizedName}"`);
27
27
  await fs_extra_1.default.writeFile(indexPath, replacedNameText);
28
28
  }
29
29
  /**
@@ -34,8 +34,8 @@ async function updateIndexFile(destPath, name) {
34
34
  * @param repoUrl - The repository url
35
35
  */
36
36
  async function updatePresetPackageFile(destPath, name, description, repoUrl) {
37
- const camelizedName = (0, string_utils_1.camelize)((0, string_utils_1.camelize)(name, "-"), " "), dashedName = (0, string_utils_1.dash)(camelizedName);
38
- (0, template_utils_1.updatePackageFile)(destPath, `"tsparticles-preset-${dashedName}"`, description, `"tsparticles.preset.${camelizedName}.min.js"`, repoUrl);
37
+ const camelizedName = (0, string_utils_js_1.camelize)((0, string_utils_js_1.camelize)(name, "-"), " "), dashedName = (0, string_utils_js_1.dash)(camelizedName);
38
+ (0, template_utils_js_1.updatePackageFile)(destPath, `"tsparticles-preset-${dashedName}"`, description, `"tsparticles.preset.${camelizedName}.min.js"`, repoUrl);
39
39
  }
40
40
  /**
41
41
  * Updates the preset package dist file
@@ -45,8 +45,8 @@ async function updatePresetPackageFile(destPath, name, description, repoUrl) {
45
45
  * @param repoUrl - The repository url
46
46
  */
47
47
  async function updatePresetPackageDistFile(destPath, name, description, repoUrl) {
48
- const camelizedName = (0, string_utils_1.camelize)((0, string_utils_1.camelize)(name, "-"), " "), dashedName = (0, string_utils_1.dash)(camelizedName);
49
- (0, template_utils_1.updatePackageDistFile)(destPath, `"tsparticles-preset-${dashedName}"`, description, `"tsparticles.preset.${camelizedName}.min.js"`, repoUrl);
48
+ const camelizedName = (0, string_utils_js_1.camelize)((0, string_utils_js_1.camelize)(name, "-"), " "), dashedName = (0, string_utils_js_1.dash)(camelizedName);
49
+ (0, template_utils_js_1.updatePackageDistFile)(destPath, `"tsparticles-preset-${dashedName}"`, description, `"tsparticles.preset.${camelizedName}.min.js"`, repoUrl);
50
50
  }
51
51
  /**
52
52
  * Updates the preset readme file
@@ -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_js_1.capitalize)((0, string_utils_js_1.capitalize)(name, "-"), " "), camelizedName = (0, string_utils_js_1.camelize)(capitalizedName), dashedName = (0, string_utils_js_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);
@@ -68,7 +68,7 @@ async function updateReadmeFile(destPath, name, description, repoUrl) {
68
68
  * @param description - The description of the project
69
69
  */
70
70
  async function updatePresetWebpackFile(destPath, name, description) {
71
- await (0, template_utils_1.updateWebpackFile)(destPath, (0, string_utils_1.camelize)((0, string_utils_1.capitalize)((0, string_utils_1.capitalize)(name, "-"), " ")), `tsParticles ${description} Preset`, "loadParticlesPreset");
71
+ await (0, template_utils_js_1.updateWebpackFile)(destPath, (0, string_utils_js_1.camelize)((0, string_utils_js_1.capitalize)((0, string_utils_js_1.capitalize)(name, "-"), " ")), `tsParticles ${description} Preset`, "loadParticlesPreset");
72
72
  }
73
73
  /**
74
74
  * Creates the preset project
@@ -79,10 +79,10 @@ async function updatePresetWebpackFile(destPath, name, description) {
79
79
  */
80
80
  async function createPresetTemplate(name, description, repoUrl, destPath) {
81
81
  const sourcePath = path_1.default.resolve(__dirname, "..", "..", "..", "files", "create-preset");
82
- await (0, template_utils_1.copyEmptyTemplateFiles)(destPath);
82
+ await (0, template_utils_js_1.copyEmptyTemplateFiles)(destPath);
83
83
  await fs_extra_1.default.copy(sourcePath, destPath, {
84
84
  overwrite: true,
85
- filter: template_utils_1.copyFilter,
85
+ filter: template_utils_js_1.copyFilter,
86
86
  });
87
87
  await updateBundleFile(destPath, name);
88
88
  await updateIndexFile(destPath, name);
@@ -90,7 +90,7 @@ async function createPresetTemplate(name, description, repoUrl, destPath) {
90
90
  await updatePresetPackageDistFile(destPath, name, description, repoUrl);
91
91
  await updateReadmeFile(destPath, name, description, repoUrl);
92
92
  await updatePresetWebpackFile(destPath, name, description);
93
- (0, template_utils_1.runInstall)(destPath);
94
- (0, template_utils_1.runBuild)(destPath);
93
+ (0, template_utils_js_1.runInstall)(destPath);
94
+ (0, template_utils_js_1.runBuild)(destPath);
95
95
  }
96
96
  exports.createPresetTemplate = createPresetTemplate;
@@ -6,8 +6,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.presetCommand = void 0;
7
7
  const prompts_1 = __importDefault(require("prompts"));
8
8
  const commander_1 = require("commander");
9
- const string_utils_1 = require("../../utils/string-utils");
10
- const create_preset_1 = require("./create-preset");
9
+ const string_utils_js_1 = require("../../utils/string-utils.js");
10
+ const create_preset_js_1 = require("./create-preset.js");
11
11
  const child_process_1 = require("child_process");
12
12
  const fs_extra_1 = __importDefault(require("fs-extra"));
13
13
  const path_1 = __importDefault(require("path"));
@@ -44,7 +44,7 @@ presetCommand.action(async (destination) => {
44
44
  name: "description",
45
45
  message: "What is the description of the preset?",
46
46
  validate: (value) => (value ? true : "The description can't be empty"),
47
- initial: (0, string_utils_1.capitalize)(initialName || ""),
47
+ initial: (0, string_utils_js_1.capitalize)(initialName || ""),
48
48
  },
49
49
  {
50
50
  type: "text",
@@ -54,5 +54,5 @@ presetCommand.action(async (destination) => {
54
54
  },
55
55
  ];
56
56
  const { name, description, repositoryUrl } = await (0, prompts_1.default)(questions);
57
- (0, create_preset_1.createPresetTemplate)(name.trim(), description.trim(), repositoryUrl.trim(), destPath);
57
+ (0, create_preset_js_1.createPresetTemplate)(name.trim(), description.trim(), repositoryUrl.trim(), destPath);
58
58
  });
@@ -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.3",
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.3",
4
4
  "license": "MIT",
5
5
  "bin": {
6
6
  "tsparticles-cli": "dist/cli.js"
@@ -10,15 +10,16 @@
10
10
  },
11
11
  "prettier": "@tsparticles/prettier-config",
12
12
  "dependencies": {
13
- "@tsparticles/eslint-config": "^1.13.0",
13
+ "@tsparticles/eslint-config": "^1.13.2",
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.4",
17
17
  "@typescript-eslint/eslint-plugin": "^5.60.0",
18
18
  "@typescript-eslint/parser": "^5.60.0",
19
19
  "commander": "^11.0.0",
20
20
  "eslint": "^8.43.0",
21
21
  "eslint-config-prettier": "^8.8.0",
22
+ "eslint-plugin-import": "^2.27.5",
22
23
  "eslint-plugin-jsdoc": "^46.2.6",
23
24
  "eslint-plugin-tsdoc": "^0.2.17",
24
25
  "fs-extra": "^11.1.1",
@@ -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
 
@@ -1,12 +1,12 @@
1
- import { prettifyReadme, prettifySrc } from "./build-prettier";
1
+ import { prettifyReadme, prettifySrc } from "./build-prettier.js";
2
2
  import { Command } from "commander";
3
- import { buildDistFiles } from "./build-distfiles";
4
- import { buildTS } from "./build-tsc";
5
- import { bundle } from "./build-bundle";
6
- import { clearDist } from "./build-clear";
3
+ import { buildDistFiles } from "./build-distfiles.js";
4
+ import { buildTS } from "./build-tsc.js";
5
+ import { bundle } from "./build-bundle.js";
6
+ import { clearDist } from "./build-clear.js";
7
7
  import fs from "fs-extra";
8
- import { getDistStats } from "./build-diststats";
9
- import { lint } from "./build-eslint";
8
+ import { getDistStats } from "./build-diststats.js";
9
+ import { lint } from "./build-eslint.js";
10
10
  import path from "path";
11
11
 
12
12
  const buildCommand = new Command("build");
package/src/cli.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env node
2
- import { buildCommand } from "./build/build";
3
- import { createCommand } from "./create/create";
2
+ import { buildCommand } from "./build/build.js";
3
+ import { createCommand } from "./create/create.js";
4
4
  import pkgInfo from "../package.json";
5
5
  import { program } from "commander";
6
6
 
@@ -1,5 +1,5 @@
1
1
  import { Command } from "commander";
2
- import { presetCommand } from "./preset/preset";
2
+ import { presetCommand } from "./preset/preset.js";
3
3
 
4
4
  const createCommand = new Command("create");
5
5
 
@@ -1,4 +1,4 @@
1
- import { camelize, capitalize, dash } from "../../utils/string-utils";
1
+ import { camelize, capitalize, dash } from "../../utils/string-utils.js";
2
2
  import {
3
3
  copyEmptyTemplateFiles,
4
4
  copyFilter,
@@ -7,7 +7,7 @@ import {
7
7
  updatePackageDistFile,
8
8
  updatePackageFile,
9
9
  updateWebpackFile,
10
- } from "../../utils/template-utils";
10
+ } from "../../utils/template-utils.js";
11
11
  import fs from "fs-extra";
12
12
  import path from "path";
13
13
 
@@ -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",
@@ -1,7 +1,7 @@
1
1
  import prompts, { type PromptObject } from "prompts";
2
2
  import { Command } from "commander";
3
- import { capitalize } from "../../utils/string-utils";
4
- import { createPresetTemplate } from "./create-preset";
3
+ import { capitalize } from "../../utils/string-utils.js";
4
+ import { createPresetTemplate } from "./create-preset.js";
5
5
  import { execSync } from "child_process";
6
6
  import fs from "fs-extra";
7
7
  import path from "path";