@tsparticles/cli 3.0.8 → 3.0.9

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.
@@ -42,8 +42,6 @@ async function getFolderStats(folderPath, bundlePath) {
42
42
  export async function getDistStats(basePath) {
43
43
  const path = await import("path"), distFolder = path.join(basePath, "dist"), pkgInfo = (await fs.exists(path.join(distFolder, "package.json")))
44
44
  ? (await import(path.join(distFolder, "package.json")))
45
- : {}, bundlePath = (await fs.exists(distFolder)) && pkgInfo.jsdelivr
46
- ? path.resolve(path.join(distFolder, pkgInfo.jsdelivr))
47
- : undefined;
45
+ : {}, bundlePath = (await fs.exists(distFolder)) && pkgInfo.jsdelivr ? path.join(distFolder, pkgInfo.jsdelivr) : undefined;
48
46
  return await getFolderStats(distFolder, bundlePath);
49
47
  }
@@ -11,7 +11,7 @@ import { replaceTokensInFile } from "../../utils/file-utils.js";
11
11
  async function updateIndexFile(destPath, name) {
12
12
  const capitalizedName = capitalize(name, "-", " "), camelizedName = camelize(capitalizedName);
13
13
  await replaceTokensInFile({
14
- path: path.resolve(destPath, "src", "index.ts"),
14
+ path: path.join(destPath, "src", "index.ts"),
15
15
  tokens: [
16
16
  {
17
17
  from: /loadTemplatePlugin/g,
@@ -54,7 +54,7 @@ async function updatePluginPackageDistFile(destPath, name, description, repoUrl)
54
54
  * @param repoUrl - The repository url
55
55
  */
56
56
  async function updateReadmeFile(destPath, name, description, repoUrl) {
57
- const readmePath = path.resolve(destPath, "README.md"), capitalizedName = capitalize(name, "-", " "), camelizedName = camelize(capitalizedName), dashedName = dash(camelizedName), stringSearch = "github.com", trailingSlashSearch = "github.com/", repoPath = repoUrl.includes(stringSearch)
57
+ const readmePath = path.join(destPath, "README.md"), capitalizedName = capitalize(name, "-", " "), camelizedName = camelize(capitalizedName), dashedName = dash(camelizedName), stringSearch = "github.com", trailingSlashSearch = "github.com/", repoPath = repoUrl.includes(stringSearch)
58
58
  ? repoUrl.substring(repoUrl.indexOf(trailingSlashSearch) + trailingSlashSearch.length, repoUrl.indexOf(".git"))
59
59
  : "tsparticles/plugin-template";
60
60
  await replaceTokensInFile({
@@ -108,7 +108,7 @@ async function updatePluginWebpackFile(destPath, name, description) {
108
108
  * @param destPath - The path where the project is located
109
109
  */
110
110
  export async function createPluginTemplate(name, description, repoUrl, destPath) {
111
- const sourcePath = path.resolve(__dirname, "..", "..", "..", "files", "create-plugin");
111
+ const sourcePath = path.join(__dirname, "..", "..", "..", "files", "create-plugin");
112
112
  await copyEmptyTemplateFiles(destPath);
113
113
  await fs.copy(sourcePath, destPath, {
114
114
  overwrite: true,
@@ -11,7 +11,7 @@ import { replaceTokensInFile } from "../../utils/file-utils.js";
11
11
  async function updateBundleFile(destPath, name) {
12
12
  const capitalizedName = capitalize(name, "-", " ");
13
13
  await replaceTokensInFile({
14
- path: path.resolve(destPath, "src", "bundle.ts"),
14
+ path: path.join(destPath, "src", "bundle.ts"),
15
15
  tokens: [
16
16
  {
17
17
  from: /loadTemplatePreset/g,
@@ -28,7 +28,7 @@ async function updateBundleFile(destPath, name) {
28
28
  async function updateIndexFile(destPath, name) {
29
29
  const capitalizedName = capitalize(name, "-", " "), camelizedName = camelize(capitalizedName);
30
30
  await replaceTokensInFile({
31
- path: path.resolve(destPath, "src", "index.ts"),
31
+ path: path.join(destPath, "src", "index.ts"),
32
32
  tokens: [
33
33
  {
34
34
  from: /loadTemplatePreset/g,
@@ -75,7 +75,7 @@ async function updateReadmeFile(destPath, name, description, repoUrl) {
75
75
  ? repoUrl.substring(repoUrl.indexOf(trailingSlashSearch) + trailingSlashSearch.length, repoUrl.indexOf(".git"))
76
76
  : "tsparticles/preset-template";
77
77
  await replaceTokensInFile({
78
- path: path.resolve(destPath, "README.md"),
78
+ path: path.join(destPath, "README.md"),
79
79
  tokens: [
80
80
  {
81
81
  from: /tsParticles Template Preset/g,
@@ -125,7 +125,7 @@ async function updatePresetWebpackFile(destPath, name, description) {
125
125
  * @param destPath - The path where the project is located
126
126
  */
127
127
  export async function createPresetTemplate(name, description, repoUrl, destPath) {
128
- const sourcePath = path.resolve(__dirname, "..", "..", "..", "files", "create-preset");
128
+ const sourcePath = path.join(__dirname, "..", "..", "..", "files", "create-preset");
129
129
  await copyEmptyTemplateFiles(destPath);
130
130
  await fs.copy(sourcePath, destPath, {
131
131
  overwrite: true,
@@ -11,7 +11,7 @@ import { replaceTokensInFile } from "../../utils/file-utils.js";
11
11
  async function updateIndexFile(destPath, name) {
12
12
  const capitalizedName = capitalize(name, "-", " "), camelizedName = camelize(capitalizedName);
13
13
  await replaceTokensInFile({
14
- path: path.resolve(destPath, "src", "index.ts"),
14
+ path: path.join(destPath, "src", "index.ts"),
15
15
  tokens: [
16
16
  {
17
17
  from: /loadTemplateShape/g,
@@ -58,7 +58,7 @@ async function updateReadmeFile(destPath, name, description, repoUrl) {
58
58
  ? repoUrl.substring(repoUrl.indexOf(trailingSlashSearch) + trailingSlashSearch.length, repoUrl.indexOf(".git"))
59
59
  : "tsparticles/shape-template";
60
60
  await replaceTokensInFile({
61
- path: path.resolve(destPath, "README.md"),
61
+ path: path.join(destPath, "README.md"),
62
62
  tokens: [
63
63
  {
64
64
  from: /tsParticles Template Shape/g,
@@ -108,7 +108,7 @@ async function updateShapeWebpackFile(destPath, name, description) {
108
108
  * @param destPath - The path where the project is located
109
109
  */
110
110
  export async function createShapeTemplate(name, description, repoUrl, destPath) {
111
- const sourcePath = path.resolve(__dirname, "..", "..", "..", "files", "create-shape");
111
+ const sourcePath = path.join(__dirname, "..", "..", "..", "files", "create-shape");
112
112
  await copyEmptyTemplateFiles(destPath);
113
113
  await fs.copy(sourcePath, destPath, {
114
114
  overwrite: true,
@@ -8,7 +8,7 @@ import path from "path";
8
8
  */
9
9
  export async function replaceTokensInFiles(options) {
10
10
  for (const item of options) {
11
- const filePath = path.resolve(item.path);
11
+ const filePath = item.path;
12
12
  let data = await fs.readFile(filePath, "utf-8");
13
13
  for (const token of item.tokens) {
14
14
  const regex = new RegExp(token.from, "g");
@@ -30,7 +30,7 @@ export async function replaceTokensInFile(options) {
30
30
  * @returns the destination directory path
31
31
  */
32
32
  export async function getDestinationDir(destination) {
33
- const destPath = path.resolve(path.join(process.cwd(), destination)), destExists = await fs.pathExists(destPath);
33
+ const destPath = path.join(process.cwd(), destination), destExists = await fs.pathExists(destPath);
34
34
  if (destExists) {
35
35
  const destContents = await fs.readdir(destPath), destContentsNoGit = destContents.filter(t => t !== ".git" && t !== ".gitignore");
36
36
  if (destContentsNoGit.length) {
@@ -13,7 +13,7 @@ import { replaceTokensInFile } from "./file-utils.js";
13
13
  */
14
14
  export async function updatePackageFile(destPath, packageName, description, fileName, repoUrl) {
15
15
  await replaceTokensInFile({
16
- path: path.resolve(destPath, "package.json"),
16
+ path: path.join(destPath, "package.json"),
17
17
  tokens: [
18
18
  {
19
19
  from: /"tsParticles empty template"/g,
@@ -52,7 +52,7 @@ export async function updatePackageFile(destPath, packageName, description, file
52
52
  */
53
53
  export async function updatePackageDistFile(destPath, packageName, description, fileName, repoUrl) {
54
54
  await replaceTokensInFile({
55
- path: path.resolve(destPath, "package.dist.json"),
55
+ path: path.join(destPath, "package.dist.json"),
56
56
  tokens: [
57
57
  {
58
58
  from: /"tsParticles empty template"/g,
@@ -90,7 +90,7 @@ export async function updatePackageDistFile(destPath, packageName, description,
90
90
  */
91
91
  export async function updateWebpackFile(destPath, name, description, fnName) {
92
92
  await replaceTokensInFile({
93
- path: path.resolve(destPath, "webpack.config.js"),
93
+ path: path.join(destPath, "webpack.config.js"),
94
94
  tokens: [
95
95
  {
96
96
  from: /"Empty"/g,
@@ -112,7 +112,7 @@ export async function updateWebpackFile(destPath, name, description, fnName) {
112
112
  * @param destPath - The path where the project will be created
113
113
  */
114
114
  export async function copyEmptyTemplateFiles(destPath) {
115
- await fs.copy(path.resolve(__dirname, "..", "..", "files", "empty-project"), destPath, {
115
+ await fs.copy(path.join(__dirname, "..", "..", "files", "empty-project"), destPath, {
116
116
  overwrite: true,
117
117
  filter: copyFilter,
118
118
  });
package/eslint.config.js CHANGED
@@ -10,7 +10,7 @@ export default defineConfig([
10
10
  {
11
11
  languageOptions: {
12
12
  parserOptions: {
13
- project: [path.resolve(__dirname, "src/tsconfig.json")],
13
+ project: [path.join(__dirname, "src", "tsconfig.json")],
14
14
  tsconfigRootDir: __dirname,
15
15
  sourceType: "module"
16
16
  }
@@ -84,7 +84,7 @@
84
84
  "prettier": "@tsparticles/prettier-config",
85
85
  "devDependencies": {
86
86
  "@babel/core": "^7.28.3",
87
- "@tsparticles/cli": "^3.0.8",
87
+ "@tsparticles/cli": "^3.0.9",
88
88
  "@tsparticles/eslint-config": "^3.0.5",
89
89
  "@tsparticles/prettier-config": "^3.0.1",
90
90
  "@tsparticles/tsconfig": "^3.0.5",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tsparticles/cli",
3
- "version": "3.0.8",
3
+ "version": "3.0.9",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "bin": {
@@ -71,7 +71,7 @@
71
71
  "compile:ci": "pnpm run build:ts",
72
72
  "build:ts": "pnpm run build:ts:cjs",
73
73
  "build:ts:cjs": "tsc -p src",
74
- "test": "vitest run",
74
+ "test": "vitest run --silent=false",
75
75
  "build": "pnpm run clear:dist && pnpm run prettify:src && pnpm run lint && pnpm run compile && pnpm run circular-deps && pnpm run prettify:readme && chmod +x dist/cli.js && chmod +x dist/build/build.js && chmod +x dist/create/create.js && chmod +x dist/create/preset/preset.js",
76
76
  "build:ci": "pnpm run clear:dist && pnpm run prettify:ci:src && pnpm run lint:ci && pnpm run compile:ci && pnpm run prettify:ci:readme",
77
77
  "clear:dist": "rimraf ./dist",
@@ -63,9 +63,7 @@ export async function getDistStats(basePath: string): Promise<IDistStats> {
63
63
  ? ((await import(path.join(distFolder, "package.json"))) as { jsdelivr?: string })
64
64
  : {},
65
65
  bundlePath =
66
- (await fs.exists(distFolder)) && pkgInfo.jsdelivr
67
- ? path.resolve(path.join(distFolder, pkgInfo.jsdelivr))
68
- : undefined;
66
+ (await fs.exists(distFolder)) && pkgInfo.jsdelivr ? path.join(distFolder, pkgInfo.jsdelivr) : undefined;
69
67
 
70
68
  return await getFolderStats(distFolder, bundlePath);
71
69
  }
@@ -22,7 +22,7 @@ async function updateIndexFile(destPath: string, name: string): Promise<void> {
22
22
  camelizedName = camelize(capitalizedName);
23
23
 
24
24
  await replaceTokensInFile({
25
- path: path.resolve(destPath, "src", "index.ts"),
25
+ path: path.join(destPath, "src", "index.ts"),
26
26
  tokens: [
27
27
  {
28
28
  from: /loadTemplatePlugin/g,
@@ -94,7 +94,7 @@ async function updatePluginPackageDistFile(
94
94
  * @param repoUrl - The repository url
95
95
  */
96
96
  async function updateReadmeFile(destPath: string, name: string, description: string, repoUrl: string): Promise<void> {
97
- const readmePath = path.resolve(destPath, "README.md"),
97
+ const readmePath = path.join(destPath, "README.md"),
98
98
  capitalizedName = capitalize(name, "-", " "),
99
99
  camelizedName = camelize(capitalizedName),
100
100
  dashedName = dash(camelizedName),
@@ -165,7 +165,7 @@ export async function createPluginTemplate(
165
165
  repoUrl: string,
166
166
  destPath: string,
167
167
  ): Promise<void> {
168
- const sourcePath = path.resolve(__dirname, "..", "..", "..", "files", "create-plugin");
168
+ const sourcePath = path.join(__dirname, "..", "..", "..", "files", "create-plugin");
169
169
 
170
170
  await copyEmptyTemplateFiles(destPath);
171
171
 
@@ -21,7 +21,7 @@ async function updateBundleFile(destPath: string, name: string): Promise<void> {
21
21
  const capitalizedName = capitalize(name, "-", " ");
22
22
 
23
23
  await replaceTokensInFile({
24
- path: path.resolve(destPath, "src", "bundle.ts"),
24
+ path: path.join(destPath, "src", "bundle.ts"),
25
25
  tokens: [
26
26
  {
27
27
  from: /loadTemplatePreset/g,
@@ -41,7 +41,7 @@ async function updateIndexFile(destPath: string, name: string): Promise<void> {
41
41
  camelizedName = camelize(capitalizedName);
42
42
 
43
43
  await replaceTokensInFile({
44
- path: path.resolve(destPath, "src", "index.ts"),
44
+ path: path.join(destPath, "src", "index.ts"),
45
45
  tokens: [
46
46
  {
47
47
  from: /loadTemplatePreset/g,
@@ -126,7 +126,7 @@ async function updateReadmeFile(destPath: string, name: string, description: str
126
126
  : "tsparticles/preset-template";
127
127
 
128
128
  await replaceTokensInFile({
129
- path: path.resolve(destPath, "README.md"),
129
+ path: path.join(destPath, "README.md"),
130
130
  tokens: [
131
131
  {
132
132
  from: /tsParticles Template Preset/g,
@@ -183,7 +183,7 @@ export async function createPresetTemplate(
183
183
  repoUrl: string,
184
184
  destPath: string,
185
185
  ): Promise<void> {
186
- const sourcePath = path.resolve(__dirname, "..", "..", "..", "files", "create-preset");
186
+ const sourcePath = path.join(__dirname, "..", "..", "..", "files", "create-preset");
187
187
 
188
188
  await copyEmptyTemplateFiles(destPath);
189
189
 
@@ -22,7 +22,7 @@ async function updateIndexFile(destPath: string, name: string): Promise<void> {
22
22
  camelizedName = camelize(capitalizedName);
23
23
 
24
24
  await replaceTokensInFile({
25
- path: path.resolve(destPath, "src", "index.ts"),
25
+ path: path.join(destPath, "src", "index.ts"),
26
26
  tokens: [
27
27
  {
28
28
  from: /loadTemplateShape/g,
@@ -107,7 +107,7 @@ async function updateReadmeFile(destPath: string, name: string, description: str
107
107
  : "tsparticles/shape-template";
108
108
 
109
109
  await replaceTokensInFile({
110
- path: path.resolve(destPath, "README.md"),
110
+ path: path.join(destPath, "README.md"),
111
111
  tokens: [
112
112
  {
113
113
  from: /tsParticles Template Shape/g,
@@ -164,7 +164,7 @@ export async function createShapeTemplate(
164
164
  repoUrl: string,
165
165
  destPath: string,
166
166
  ): Promise<void> {
167
- const sourcePath = path.resolve(__dirname, "..", "..", "..", "files", "create-shape");
167
+ const sourcePath = path.join(__dirname, "..", "..", "..", "files", "create-shape");
168
168
 
169
169
  await copyEmptyTemplateFiles(destPath);
170
170
 
@@ -19,7 +19,7 @@ export interface ReplaceTokensData {
19
19
  */
20
20
  export async function replaceTokensInFiles(options: ReplaceTokensOptions[]): Promise<void> {
21
21
  for (const item of options) {
22
- const filePath = path.resolve(item.path);
22
+ const filePath = item.path;
23
23
 
24
24
  let data = await fs.readFile(filePath, "utf-8");
25
25
 
@@ -47,7 +47,7 @@ export async function replaceTokensInFile(options: ReplaceTokensOptions): Promis
47
47
  * @returns the destination directory path
48
48
  */
49
49
  export async function getDestinationDir(destination: string): Promise<string> {
50
- const destPath = path.resolve(path.join(process.cwd(), destination)),
50
+ const destPath = path.join(process.cwd(), destination),
51
51
  destExists = await fs.pathExists(destPath);
52
52
 
53
53
  if (destExists) {
@@ -20,7 +20,7 @@ export async function updatePackageFile(
20
20
  repoUrl: string,
21
21
  ): Promise<void> {
22
22
  await replaceTokensInFile({
23
- path: path.resolve(destPath, "package.json"),
23
+ path: path.join(destPath, "package.json"),
24
24
  tokens: [
25
25
  {
26
26
  from: /"tsParticles empty template"/g,
@@ -66,7 +66,7 @@ export async function updatePackageDistFile(
66
66
  repoUrl: string,
67
67
  ): Promise<void> {
68
68
  await replaceTokensInFile({
69
- path: path.resolve(destPath, "package.dist.json"),
69
+ path: path.join(destPath, "package.dist.json"),
70
70
  tokens: [
71
71
  {
72
72
  from: /"tsParticles empty template"/g,
@@ -110,7 +110,7 @@ export async function updateWebpackFile(
110
110
  fnName: string,
111
111
  ): Promise<void> {
112
112
  await replaceTokensInFile({
113
- path: path.resolve(destPath, "webpack.config.js"),
113
+ path: path.join(destPath, "webpack.config.js"),
114
114
  tokens: [
115
115
  {
116
116
  from: /"Empty"/g,
@@ -133,7 +133,7 @@ export async function updateWebpackFile(
133
133
  * @param destPath - The path where the project will be created
134
134
  */
135
135
  export async function copyEmptyTemplateFiles(destPath: string): Promise<void> {
136
- await fs.copy(path.resolve(__dirname, "..", "..", "files", "empty-project"), destPath, {
136
+ await fs.copy(path.join(__dirname, "..", "..", "files", "empty-project"), destPath, {
137
137
  overwrite: true,
138
138
  filter: copyFilter,
139
139
  });
@@ -1,15 +1,18 @@
1
1
  import { describe, it, expect } from "vitest";
2
- import { createPluginTemplate } from "../src/create/plugin/create-plugin";
2
+ import { createPluginTemplate } from "../src/create/plugin/create-plugin.js";
3
3
  import path from "path";
4
4
  import fs from "fs-extra";
5
5
 
6
6
  describe("create-plugin", () => {
7
7
  it("should have created the plugin project", async () => {
8
- const destDir = path.resolve(path.join(__dirname, "tmp-files", "foo-plugin"));
8
+ const destDir = path.join(__dirname, "tmp-files", "foo-plugin"),
9
+ pkgPath = path.join(destDir, "package.json");
10
+
11
+ console.log("pkgPath - plugin", pkgPath);
9
12
 
10
13
  await createPluginTemplate("foo", "Foo", "", destDir);
11
14
 
12
- const pkgInfo = await fs.readJSON(path.join(destDir, "package.json"));
15
+ const pkgInfo = await fs.readJSON(pkgPath);
13
16
 
14
17
  expect(pkgInfo.name).toBe("tsparticles-plugin-foo");
15
18
 
@@ -17,11 +20,15 @@ describe("create-plugin", () => {
17
20
  });
18
21
 
19
22
  it("should have created the plugin project, w/ repo", async () => {
20
- const destDir = path.resolve(path.join(__dirname, "tmp-files", "bar-plugin"));
23
+ const destDir = path.join(__dirname,"tmp-files", "bar-plugin");
21
24
 
22
25
  await createPluginTemplate("bar", "Bar", "https://github.com/matteobruni/tsparticles", destDir);
23
26
 
24
- const pkgInfo = await fs.readJSON(path.join(destDir, "package.json"));
27
+ const pkgPath = path.join(destDir, "package.json");
28
+
29
+ console.log(pkgPath);
30
+
31
+ const pkgInfo = await fs.readJSON(pkgPath);
25
32
 
26
33
  expect(pkgInfo.name).toBe("tsparticles-plugin-bar");
27
34
 
@@ -1,15 +1,19 @@
1
1
  import { describe, it, expect } from "vitest";
2
- import { createPresetTemplate } from "../src/create/preset/create-preset";
2
+ import { createPresetTemplate } from "../src/create/preset/create-preset.js";
3
3
  import path from "path";
4
4
  import fs from "fs-extra";
5
5
 
6
6
  describe("create-preset", () => {
7
7
  it("should have created the preset project", async () => {
8
- const destDir = path.resolve(path.join(__dirname, "tmp-files", "foo-preset"));
8
+ const destDir = path.join(__dirname, "tmp-files", "foo-preset");
9
9
 
10
10
  await createPresetTemplate("foo", "Foo", "", destDir);
11
11
 
12
- const pkgInfo = await fs.readJSON(path.join(destDir, "package.json"));
12
+ const pkgPath = path.join(destDir, "package.json");
13
+
14
+ console.log(pkgPath);
15
+
16
+ const pkgInfo = await fs.readJSON(pkgPath);
13
17
 
14
18
  expect(pkgInfo.name).toBe("tsparticles-preset-foo");
15
19
 
@@ -17,11 +21,15 @@ describe("create-preset", () => {
17
21
  });
18
22
 
19
23
  it("should have created the preset project, w/ repo", async () => {
20
- const destDir = path.resolve(path.join(__dirname, "tmp-files", "bar-preset"));
24
+ const destDir = path.join(__dirname, "tmp-files", "bar-preset");
21
25
 
22
26
  await createPresetTemplate("bar", "Bar", "https://github.com/matteobruni/tsparticles", destDir);
23
27
 
24
- const pkgInfo = await fs.readJSON(path.join(destDir, "package.json"));
28
+ const pkgPath = path.join(destDir, "package.json");
29
+
30
+ console.log(pkgPath);
31
+
32
+ const pkgInfo = await fs.readJSON(pkgPath);
25
33
 
26
34
  expect(pkgInfo.name).toBe("tsparticles-preset-bar");
27
35
 
@@ -1,15 +1,19 @@
1
1
  import { describe, it, expect } from "vitest";
2
- import { createShapeTemplate } from "../src/create/shape/create-shape";
2
+ import { createShapeTemplate } from "../src/create/shape/create-shape.js";
3
3
  import path from "path";
4
4
  import fs from "fs-extra";
5
5
 
6
6
  describe("create-shape", () => {
7
7
  it("should have created the shape project", async () => {
8
- const destDir = path.resolve(path.join(__dirname, "tmp-files", "foo-shape"));
8
+ const destDir = path.join(__dirname, "tmp-files", "foo-shape");
9
9
 
10
10
  await createShapeTemplate("foo", "Foo", "", destDir);
11
11
 
12
- const pkgInfo = await fs.readJSON(path.join(destDir, "package.json"));
12
+ const pkgPath = path.join(destDir, "package.json");
13
+
14
+ console.log(pkgPath);
15
+
16
+ const pkgInfo = await fs.readJSON(pkgPath);
13
17
 
14
18
  expect(pkgInfo.name).toBe("tsparticles-shape-foo");
15
19
 
@@ -17,11 +21,15 @@ describe("create-shape", () => {
17
21
  });
18
22
 
19
23
  it("should have created the shape project, w/ repo", async () => {
20
- const destDir = path.resolve(path.join(__dirname, "tmp-files", "bar-shape"));
24
+ const destDir = path.join(__dirname, "tmp-files", "bar-shape");
21
25
 
22
26
  await createShapeTemplate("bar", "Bar", "https://github.com/matteobruni/tsparticles", destDir);
23
27
 
24
- const pkgInfo = await fs.readJSON(path.join(destDir, "package.json"));
28
+ const pkgPath = path.join(destDir, "package.json");
29
+
30
+ console.log(pkgPath);
31
+
32
+ const pkgInfo = await fs.readJSON(pkgPath);
25
33
 
26
34
  expect(pkgInfo.name).toBe("tsparticles-shape-bar");
27
35
 
@@ -1,4 +1,4 @@
1
- import { describe, it, expect, after } from "vitest";
1
+ import {afterAll, describe, it, expect} from "vitest";
2
2
  import fs from "fs-extra";
3
3
  import path from "path";
4
4
  import {
@@ -6,10 +6,10 @@ import {
6
6
  getRepositoryUrl,
7
7
  replaceTokensInFile,
8
8
  replaceTokensInFiles,
9
- } from "../src/utils/file-utils";
9
+ } from "../src/utils/file-utils.js";
10
10
 
11
11
  describe("file-utils", async () => {
12
- const baseDir = path.join(__dirname, "tmp-files");
12
+ const baseDir = path.resolve("tmp-files");
13
13
 
14
14
  await fs.ensureDir(baseDir);
15
15
 
@@ -59,14 +59,14 @@ describe("file-utils", async () => {
59
59
  });
60
60
 
61
61
  describe("get destination dir", async () => {
62
- const destDir = await getDestinationDir(path.join(baseDir, "baz"));
62
+ const destDir = await getDestinationDir(path.join("tmp-files", "baz"));
63
63
 
64
64
  it("should return the destination dir", () => {
65
65
  expect(destDir).toBe(path.join(baseDir, "baz"));
66
66
  });
67
67
 
68
68
  it("should return the destination dir", async () => {
69
- const destDir2 = await getDestinationDir(path.join(baseDir, "baz"));
69
+ const destDir2 = await getDestinationDir(path.join("tmp-files", "baz"));
70
70
 
71
71
  expect(destDir2).toBe(path.join(baseDir, "baz"));
72
72
  });
@@ -77,7 +77,7 @@ describe("file-utils", async () => {
77
77
  let ex = false;
78
78
 
79
79
  try {
80
- await getDestinationDir(path.join(baseDir, "baz"));
80
+ await getDestinationDir(path.join("tmp-files", "baz"));
81
81
 
82
82
  console.log("never");
83
83
  } catch {
@@ -94,7 +94,7 @@ describe("file-utils", async () => {
94
94
  });
95
95
  });
96
96
 
97
- after(async () => {
97
+ afterAll(async () => {
98
98
  await fs.remove(baseDir);
99
99
  });
100
100
  });
@@ -1,9 +1,11 @@
1
1
  import { describe, it, expect } from "vitest";
2
- import { camelize, capitalize, dash } from "../src/utils/string-utils";
2
+ import { camelize, capitalize, dash } from "../src/utils/string-utils.js";
3
3
 
4
4
  describe("capitalize", () => {
5
5
  describe("empty string", () => {
6
- expect(capitalize("")).toBe("");
6
+ it("should successfully compare empty strings", () => {
7
+ expect(capitalize("")).toBe("");
8
+ });
7
9
  });
8
10
 
9
11
  describe("lowercase string", () => {
@@ -49,7 +51,9 @@ describe("capitalize", () => {
49
51
 
50
52
  describe("camelize", () => {
51
53
  describe("empty string", () => {
52
- expect(camelize("")).toBe("");
54
+ it("should successfully compare empty strings", () => {
55
+ expect(camelize("")).toBe("");
56
+ });
53
57
  });
54
58
 
55
59
  describe("lowercase string", () => {
@@ -95,7 +99,9 @@ describe("camelize", () => {
95
99
 
96
100
  describe("dash", () => {
97
101
  describe("empty string", () => {
98
- expect(dash("")).toBe("");
102
+ it("should successfully compare empty strings", () => {
103
+ expect(dash("")).toBe("");
104
+ });
99
105
  });
100
106
 
101
107
  describe("lowercase string", () => {
package/vitest.config.ts CHANGED
@@ -5,7 +5,7 @@ export default defineConfig({
5
5
  globals: true,
6
6
  environment: "node",
7
7
  include: ["tests/**/*.test.ts"],
8
- testTimeout: 30000
8
+ testTimeout: 60000
9
9
  }
10
10
  });
11
11