@tsparticles/cli 3.0.14 → 3.0.15
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.github/workflows/node.js-ci.yml +13 -7
- package/dist/build/build-bundle.d.ts +5 -0
- package/dist/build/build-circular-deps.d.ts +6 -0
- package/dist/build/build-clear.d.ts +5 -0
- package/dist/build/build-distfiles.d.ts +5 -0
- package/dist/build/build-distfiles.js +7 -8
- package/dist/build/build-diststats.d.ts +12 -0
- package/dist/build/build-eslint.d.ts +5 -0
- package/dist/build/build-eslint.js +1 -3
- package/dist/build/build-prettier.d.ts +25 -0
- package/dist/build/build-prettier.js +4 -4
- package/dist/build/build-tsc.d.ts +5 -0
- package/dist/build/build.d.ts +3 -0
- package/dist/cli.d.ts +2 -0
- package/dist/create/create.d.ts +3 -0
- package/dist/create/plugin/create-plugin.d.ts +8 -0
- package/dist/create/plugin/plugin.d.ts +3 -0
- package/dist/create/preset/create-preset.d.ts +8 -0
- package/dist/create/preset/preset.d.ts +3 -0
- package/dist/create/shape/create-shape.d.ts +8 -0
- package/dist/create/shape/shape.d.ts +3 -0
- package/dist/tsconfig.tsbuildinfo +1 -0
- package/dist/utils/file-utils.d.ts +28 -0
- package/dist/utils/string-utils.d.ts +20 -0
- package/dist/utils/template-utils.d.ts +47 -0
- package/files/create-plugin/src/PluginInstance.ts +4 -2
- package/files/create-plugin/src/index.ts +1 -1
- package/files/create-plugin/src/plugin.ts +6 -6
- package/files/empty-project/.browserslistrc +1 -1
- package/files/empty-project/package.dist.json +1 -1
- package/files/empty-project/package.json +9 -9
- package/files/empty-project/tsconfig.base.json +2 -1
- package/package.json +12 -12
- package/src/build/build-bundle.ts +34 -34
- package/src/build/build-circular-deps.ts +23 -23
- package/src/build/build-clear.ts +11 -11
- package/src/build/build-distfiles.ts +67 -70
- package/src/build/build-diststats.ts +41 -41
- package/src/build/build-eslint.ts +26 -28
- package/src/build/build-prettier.ts +166 -166
- package/src/build/build-tsc.ts +146 -149
- package/src/build/build.ts +116 -116
- package/src/cli.ts +3 -3
- package/src/create/plugin/create-plugin.ts +108 -111
- package/src/create/plugin/plugin.ts +31 -31
- package/src/create/preset/create-preset.ts +123 -126
- package/src/create/preset/preset.ts +31 -31
- package/src/create/shape/create-shape.ts +112 -115
- package/src/create/shape/shape.ts +31 -31
- package/src/tsconfig.json +7 -125
- package/src/utils/file-utils.ts +35 -35
- package/src/utils/string-utils.ts +13 -13
- package/src/utils/template-utils.ts +130 -130
- package/tests/create-plugin.test.ts +11 -3
- package/tests/create-preset.test.ts +10 -2
- package/tests/create-shape.test.ts +10 -2
- package/tests/tsconfig.json +3 -15
- package/tsconfig.json +53 -20
- package/.mocharc.json +0 -11
- package/tsconfig.eslint.json +0 -8
package/src/utils/file-utils.ts
CHANGED
|
@@ -4,13 +4,13 @@ import { lookpath } from "lookpath";
|
|
|
4
4
|
import path from "path";
|
|
5
5
|
|
|
6
6
|
export interface ReplaceTokensOptions {
|
|
7
|
-
|
|
8
|
-
|
|
7
|
+
path: string;
|
|
8
|
+
tokens: ReplaceTokensData[];
|
|
9
9
|
}
|
|
10
10
|
|
|
11
11
|
export interface ReplaceTokensData {
|
|
12
|
-
|
|
13
|
-
|
|
12
|
+
from: string | RegExp;
|
|
13
|
+
to: string;
|
|
14
14
|
}
|
|
15
15
|
|
|
16
16
|
/**
|
|
@@ -18,19 +18,19 @@ export interface ReplaceTokensData {
|
|
|
18
18
|
* @param options -
|
|
19
19
|
*/
|
|
20
20
|
export async function replaceTokensInFiles(options: ReplaceTokensOptions[]): Promise<void> {
|
|
21
|
-
|
|
22
|
-
|
|
21
|
+
for (const item of options) {
|
|
22
|
+
const filePath = item.path;
|
|
23
23
|
|
|
24
|
-
|
|
24
|
+
let data = await fs.readFile(filePath, "utf-8");
|
|
25
25
|
|
|
26
|
-
|
|
27
|
-
|
|
26
|
+
for (const token of item.tokens) {
|
|
27
|
+
const regex = new RegExp(token.from, "g");
|
|
28
28
|
|
|
29
|
-
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
await fs.writeFile(filePath, data);
|
|
29
|
+
data = data.replace(regex, token.to);
|
|
33
30
|
}
|
|
31
|
+
|
|
32
|
+
await fs.writeFile(filePath, data);
|
|
33
|
+
}
|
|
34
34
|
}
|
|
35
35
|
|
|
36
36
|
/**
|
|
@@ -38,7 +38,7 @@ export async function replaceTokensInFiles(options: ReplaceTokensOptions[]): Pro
|
|
|
38
38
|
* @param options -
|
|
39
39
|
*/
|
|
40
40
|
export async function replaceTokensInFile(options: ReplaceTokensOptions): Promise<void> {
|
|
41
|
-
|
|
41
|
+
await replaceTokensInFiles([options]);
|
|
42
42
|
}
|
|
43
43
|
|
|
44
44
|
/**
|
|
@@ -47,40 +47,40 @@ 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
|
-
|
|
51
|
-
|
|
50
|
+
const destPath = path.join(process.cwd(), destination),
|
|
51
|
+
destExists = await fs.pathExists(destPath);
|
|
52
52
|
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
53
|
+
if (destExists) {
|
|
54
|
+
const destContents = await fs.readdir(destPath),
|
|
55
|
+
destContentsNoGit = destContents.filter(t => t !== ".git" && t !== ".gitignore");
|
|
56
56
|
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
}
|
|
57
|
+
if (destContentsNoGit.length) {
|
|
58
|
+
throw new Error("Destination folder already exists and is not empty");
|
|
60
59
|
}
|
|
60
|
+
}
|
|
61
61
|
|
|
62
|
-
|
|
62
|
+
await fs.ensureDir(destPath);
|
|
63
63
|
|
|
64
|
-
|
|
64
|
+
return destPath;
|
|
65
65
|
}
|
|
66
66
|
|
|
67
67
|
/**
|
|
68
68
|
* @returns the repository URL
|
|
69
69
|
*/
|
|
70
70
|
export async function getRepositoryUrl(): Promise<string> {
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
71
|
+
if (!(await lookpath("git"))) {
|
|
72
|
+
return "";
|
|
73
|
+
}
|
|
74
74
|
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
75
|
+
return new Promise<string>((resolve, reject) => {
|
|
76
|
+
exec("git config --get remote.origin.url", (error, stdout) => {
|
|
77
|
+
if (error) {
|
|
78
|
+
reject(error);
|
|
79
79
|
|
|
80
|
-
|
|
81
|
-
|
|
80
|
+
return;
|
|
81
|
+
}
|
|
82
82
|
|
|
83
|
-
|
|
84
|
-
});
|
|
83
|
+
resolve(stdout);
|
|
85
84
|
});
|
|
85
|
+
});
|
|
86
86
|
}
|
|
@@ -5,16 +5,16 @@
|
|
|
5
5
|
* @returns the capitalized string
|
|
6
6
|
*/
|
|
7
7
|
export function capitalize(str: string, ...splits: string[]): string {
|
|
8
|
-
|
|
8
|
+
let res = str.replace(/./, c => c.toUpperCase());
|
|
9
9
|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
10
|
+
for (const split of splits) {
|
|
11
|
+
res = res
|
|
12
|
+
.split(split)
|
|
13
|
+
.map(w => w.replace(/./, c => c.toUpperCase()))
|
|
14
|
+
.join("");
|
|
15
|
+
}
|
|
16
16
|
|
|
17
|
-
|
|
17
|
+
return res;
|
|
18
18
|
}
|
|
19
19
|
|
|
20
20
|
/**
|
|
@@ -24,7 +24,7 @@ export function capitalize(str: string, ...splits: string[]): string {
|
|
|
24
24
|
* @returns the camelized string
|
|
25
25
|
*/
|
|
26
26
|
export function camelize(str: string, ...splits: string[]): string {
|
|
27
|
-
|
|
27
|
+
return capitalize(str, ...splits).replace(/./, c => c.toLowerCase());
|
|
28
28
|
}
|
|
29
29
|
|
|
30
30
|
/**
|
|
@@ -33,9 +33,9 @@ export function camelize(str: string, ...splits: string[]): string {
|
|
|
33
33
|
* @returns the dashed string
|
|
34
34
|
*/
|
|
35
35
|
export function dash(str: string): string {
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
36
|
+
const index = 0,
|
|
37
|
+
dashed = str.replace(/([A-Z])/g, g => `-${g[index]?.toLowerCase() ?? ""}`),
|
|
38
|
+
startPos = 1;
|
|
39
39
|
|
|
40
|
-
|
|
40
|
+
return dashed.startsWith("-") ? dashed.substring(startPos) : dashed;
|
|
41
41
|
}
|
|
@@ -13,41 +13,41 @@ import { replaceTokensInFile } from "./file-utils.js";
|
|
|
13
13
|
* @param repoUrl - The repository URL
|
|
14
14
|
*/
|
|
15
15
|
export async function updatePackageFile(
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
16
|
+
destPath: string,
|
|
17
|
+
packageName: string,
|
|
18
|
+
description: string,
|
|
19
|
+
fileName: string,
|
|
20
|
+
repoUrl: string,
|
|
21
21
|
): Promise<void> {
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
22
|
+
await replaceTokensInFile({
|
|
23
|
+
path: path.join(destPath, "package.json"),
|
|
24
|
+
tokens: [
|
|
25
|
+
{
|
|
26
|
+
from: /"tsParticles empty template"/g,
|
|
27
|
+
to: `"${description}"`,
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
from: /"tsparticles.empty.template.min.js"/g,
|
|
31
|
+
to: `"${fileName}"`,
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
from: /\s{4}"private": true,\r?\n?/g,
|
|
35
|
+
to: "",
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
from: /"@tsparticles\/empty-template"/g,
|
|
39
|
+
to: `"${packageName}"`,
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
from: /"url": "git\+https:\/\/github\.com\/tsparticles\/empty-template\.git"/g,
|
|
43
|
+
to: `"url": "git+${repoUrl}"`,
|
|
44
|
+
},
|
|
45
|
+
{
|
|
46
|
+
from: /"url": "https:\/\/github\.com\/tsparticles\/empty-template\/issues"/g,
|
|
47
|
+
to: `"url": "${repoUrl.replace(".git", "/issues")}"`,
|
|
48
|
+
},
|
|
49
|
+
],
|
|
50
|
+
});
|
|
51
51
|
}
|
|
52
52
|
|
|
53
53
|
/**
|
|
@@ -59,41 +59,41 @@ export async function updatePackageFile(
|
|
|
59
59
|
* @param repoUrl - The url of the repository
|
|
60
60
|
*/
|
|
61
61
|
export async function updatePackageDistFile(
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
62
|
+
destPath: string,
|
|
63
|
+
packageName: string,
|
|
64
|
+
description: string,
|
|
65
|
+
fileName: string,
|
|
66
|
+
repoUrl: string,
|
|
67
67
|
): Promise<void> {
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
68
|
+
await replaceTokensInFile({
|
|
69
|
+
path: path.join(destPath, "package.dist.json"),
|
|
70
|
+
tokens: [
|
|
71
|
+
{
|
|
72
|
+
from: /"tsParticles empty template"/g,
|
|
73
|
+
to: `"${description}"`,
|
|
74
|
+
},
|
|
75
|
+
{
|
|
76
|
+
from: /"tsparticles.empty.template.min.js"/g,
|
|
77
|
+
to: `"${fileName}"`,
|
|
78
|
+
},
|
|
79
|
+
{
|
|
80
|
+
from: /\s{4}"private": true,\r?\n?/g,
|
|
81
|
+
to: "",
|
|
82
|
+
},
|
|
83
|
+
{
|
|
84
|
+
from: /"@tsparticles\/empty-template"/g,
|
|
85
|
+
to: `"${packageName}"`,
|
|
86
|
+
},
|
|
87
|
+
{
|
|
88
|
+
from: /"url": "git\+https:\/\/github\.com\/tsparticles\/empty-template\.git"/g,
|
|
89
|
+
to: `"url": "git+${repoUrl}"`,
|
|
90
|
+
},
|
|
91
|
+
{
|
|
92
|
+
from: /"url": "https:\/\/github\.com\/tsparticles\/empty-template\/issues"/g,
|
|
93
|
+
to: `"url": "${repoUrl.replace(".git", "/issues")}"`,
|
|
94
|
+
},
|
|
95
|
+
],
|
|
96
|
+
});
|
|
97
97
|
}
|
|
98
98
|
|
|
99
99
|
/**
|
|
@@ -104,28 +104,28 @@ export async function updatePackageDistFile(
|
|
|
104
104
|
* @param fnName - The name of the function to load the template
|
|
105
105
|
*/
|
|
106
106
|
export async function updateWebpackFile(
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
107
|
+
destPath: string,
|
|
108
|
+
name: string,
|
|
109
|
+
description: string,
|
|
110
|
+
fnName: string,
|
|
111
111
|
): Promise<void> {
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
112
|
+
await replaceTokensInFile({
|
|
113
|
+
path: path.join(destPath, "webpack.config.js"),
|
|
114
|
+
tokens: [
|
|
115
|
+
{
|
|
116
|
+
from: /"Empty"/g,
|
|
117
|
+
to: `"${description}"`,
|
|
118
|
+
},
|
|
119
|
+
{
|
|
120
|
+
from: /"empty"/g,
|
|
121
|
+
to: `"${name}"`,
|
|
122
|
+
},
|
|
123
|
+
{
|
|
124
|
+
from: /loadParticlesTemplate/g,
|
|
125
|
+
to: fnName,
|
|
126
|
+
},
|
|
127
|
+
],
|
|
128
|
+
});
|
|
129
129
|
}
|
|
130
130
|
|
|
131
131
|
/**
|
|
@@ -133,10 +133,10 @@ 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
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
136
|
+
await fs.copy(path.join(__dirname, "..", "..", "files", "empty-project"), destPath, {
|
|
137
|
+
overwrite: true,
|
|
138
|
+
filter: copyFilter,
|
|
139
|
+
});
|
|
140
140
|
}
|
|
141
141
|
|
|
142
142
|
/**
|
|
@@ -145,7 +145,7 @@ export async function copyEmptyTemplateFiles(destPath: string): Promise<void> {
|
|
|
145
145
|
* @returns true if the file should be copied
|
|
146
146
|
*/
|
|
147
147
|
export function copyFilter(src: string): boolean {
|
|
148
|
-
|
|
148
|
+
return !(src.endsWith("node_modules") || src.endsWith("dist"));
|
|
149
149
|
}
|
|
150
150
|
|
|
151
151
|
/**
|
|
@@ -153,27 +153,27 @@ export function copyFilter(src: string): boolean {
|
|
|
153
153
|
* @param destPath - The path where the project will be created
|
|
154
154
|
*/
|
|
155
155
|
export async function runInstall(destPath: string): Promise<void> {
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
156
|
+
if (!(await lookpath("npm"))) {
|
|
157
|
+
return;
|
|
158
|
+
}
|
|
159
159
|
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
160
|
+
return new Promise((resolve, reject) => {
|
|
161
|
+
exec(
|
|
162
|
+
"npm install",
|
|
163
|
+
{
|
|
164
|
+
cwd: destPath,
|
|
165
|
+
},
|
|
166
|
+
error => {
|
|
167
|
+
if (error) {
|
|
168
|
+
reject(error);
|
|
169
169
|
|
|
170
|
-
|
|
171
|
-
|
|
170
|
+
return;
|
|
171
|
+
}
|
|
172
172
|
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
173
|
+
resolve();
|
|
174
|
+
},
|
|
175
|
+
);
|
|
176
|
+
});
|
|
177
177
|
}
|
|
178
178
|
|
|
179
179
|
/**
|
|
@@ -181,25 +181,25 @@ export async function runInstall(destPath: string): Promise<void> {
|
|
|
181
181
|
* @param destPath - The path where the project will be build
|
|
182
182
|
*/
|
|
183
183
|
export async function runBuild(destPath: string): Promise<void> {
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
184
|
+
if (!(await lookpath("npm"))) {
|
|
185
|
+
return;
|
|
186
|
+
}
|
|
187
187
|
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
188
|
+
return new Promise((resolve, reject) => {
|
|
189
|
+
exec(
|
|
190
|
+
"npm run build",
|
|
191
|
+
{
|
|
192
|
+
cwd: destPath,
|
|
193
|
+
},
|
|
194
|
+
error => {
|
|
195
|
+
if (error) {
|
|
196
|
+
reject(error);
|
|
197
197
|
|
|
198
|
-
|
|
199
|
-
|
|
198
|
+
return;
|
|
199
|
+
}
|
|
200
200
|
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
201
|
+
resolve();
|
|
202
|
+
},
|
|
203
|
+
);
|
|
204
|
+
});
|
|
205
205
|
}
|
|
@@ -8,7 +8,11 @@ describe("create-plugin", () => {
|
|
|
8
8
|
const destDir = path.join(__dirname, "tmp-files", "foo-plugin"),
|
|
9
9
|
pkgPath = path.join(destDir, "package.json");
|
|
10
10
|
|
|
11
|
-
|
|
11
|
+
try {
|
|
12
|
+
await createPluginTemplate("foo", "Foo", "", destDir);
|
|
13
|
+
} catch (e) {
|
|
14
|
+
console.error(e);
|
|
15
|
+
}
|
|
12
16
|
|
|
13
17
|
const pkgInfo = await fs.readJSON(pkgPath);
|
|
14
18
|
|
|
@@ -18,9 +22,13 @@ describe("create-plugin", () => {
|
|
|
18
22
|
});
|
|
19
23
|
|
|
20
24
|
it("should have created the plugin project, w/ repo", async () => {
|
|
21
|
-
const destDir = path.join(__dirname,"tmp-files", "bar-plugin");
|
|
25
|
+
const destDir = path.join(__dirname, "tmp-files", "bar-plugin");
|
|
22
26
|
|
|
23
|
-
|
|
27
|
+
try {
|
|
28
|
+
await createPluginTemplate("bar", "Bar", "https://github.com/matteobruni/tsparticles", destDir);
|
|
29
|
+
} catch (e) {
|
|
30
|
+
console.error(e);
|
|
31
|
+
}
|
|
24
32
|
|
|
25
33
|
const pkgPath = path.join(destDir, "package.json"),
|
|
26
34
|
pkgInfo = await fs.readJSON(pkgPath);
|
|
@@ -7,7 +7,11 @@ describe("create-preset", () => {
|
|
|
7
7
|
it("should have created the preset project", async () => {
|
|
8
8
|
const destDir = path.join(__dirname, "tmp-files", "foo-preset");
|
|
9
9
|
|
|
10
|
-
|
|
10
|
+
try {
|
|
11
|
+
await createPresetTemplate("foo", "Foo", "", destDir);
|
|
12
|
+
} catch (e) {
|
|
13
|
+
console.error(e);
|
|
14
|
+
}
|
|
11
15
|
|
|
12
16
|
const pkgPath = path.join(destDir, "package.json"),
|
|
13
17
|
pkgInfo = await fs.readJSON(pkgPath);
|
|
@@ -20,7 +24,11 @@ describe("create-preset", () => {
|
|
|
20
24
|
it("should have created the preset project, w/ repo", async () => {
|
|
21
25
|
const destDir = path.join(__dirname, "tmp-files", "bar-preset");
|
|
22
26
|
|
|
23
|
-
|
|
27
|
+
try {
|
|
28
|
+
await createPresetTemplate("bar", "Bar", "https://github.com/matteobruni/tsparticles", destDir);
|
|
29
|
+
} catch (e) {
|
|
30
|
+
console.error(e);
|
|
31
|
+
}
|
|
24
32
|
|
|
25
33
|
const pkgPath = path.join(destDir, "package.json"),
|
|
26
34
|
pkgInfo = await fs.readJSON(pkgPath);
|
|
@@ -7,7 +7,11 @@ describe("create-shape", () => {
|
|
|
7
7
|
it("should have created the shape project", async () => {
|
|
8
8
|
const destDir = path.join(__dirname, "tmp-files", "foo-shape");
|
|
9
9
|
|
|
10
|
-
|
|
10
|
+
try {
|
|
11
|
+
await createShapeTemplate("foo", "Foo", "", destDir);
|
|
12
|
+
} catch (e) {
|
|
13
|
+
console.error(e);
|
|
14
|
+
}
|
|
11
15
|
|
|
12
16
|
const pkgPath = path.join(destDir, "package.json"),
|
|
13
17
|
pkgInfo = await fs.readJSON(pkgPath);
|
|
@@ -20,7 +24,11 @@ describe("create-shape", () => {
|
|
|
20
24
|
it("should have created the shape project, w/ repo", async () => {
|
|
21
25
|
const destDir = path.join(__dirname, "tmp-files", "bar-shape");
|
|
22
26
|
|
|
23
|
-
|
|
27
|
+
try {
|
|
28
|
+
await createShapeTemplate("bar", "Bar", "https://github.com/matteobruni/tsparticles", destDir);
|
|
29
|
+
} catch (e) {
|
|
30
|
+
console.error(e);
|
|
31
|
+
}
|
|
24
32
|
|
|
25
33
|
const pkgPath = path.join(destDir, "package.json"),
|
|
26
34
|
pkgInfo = await fs.readJSON(pkgPath);
|
package/tests/tsconfig.json
CHANGED
|
@@ -1,24 +1,12 @@
|
|
|
1
1
|
{
|
|
2
|
+
"extends": "../tsconfig.json",
|
|
2
3
|
"compilerOptions": {
|
|
4
|
+
"rootDir": ".",
|
|
3
5
|
"target": "ES2021",
|
|
4
|
-
"module": "NodeNext",
|
|
5
|
-
"lib": ["ESNext", "ES2024", "ES2023", "ES2022", "ES2021", "ES2020", "ES2019", "ES2018", "ES2017", "ES2016", "ES2015", "DOM"],
|
|
6
|
-
"types": ["jsdom", "vitest", "node"],
|
|
7
6
|
"allowJs": true,
|
|
8
|
-
"rootDir": ".",
|
|
9
7
|
"declaration": false,
|
|
10
8
|
"removeComments": true,
|
|
11
|
-
"importHelpers": false
|
|
12
|
-
"strict": true,
|
|
13
|
-
"noImplicitAny": true,
|
|
14
|
-
"strictNullChecks": true,
|
|
15
|
-
"alwaysStrict": true,
|
|
16
|
-
"noFallthroughCasesInSwitch": true,
|
|
17
|
-
"moduleResolution": "NodeNext",
|
|
18
|
-
"allowSyntheticDefaultImports": true,
|
|
19
|
-
"esModuleInterop": true,
|
|
20
|
-
"experimentalDecorators": true,
|
|
21
|
-
"forceConsistentCasingInFileNames": true
|
|
9
|
+
"importHelpers": false
|
|
22
10
|
},
|
|
23
11
|
"references": [{ "path": "../src" }],
|
|
24
12
|
"include": ["**/*.ts"]
|
package/tsconfig.json
CHANGED
|
@@ -1,23 +1,56 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"rootDir": ".",
|
|
4
|
+
"outDir": ".",
|
|
5
|
+
"resolveJsonModule": true,
|
|
6
|
+
"composite": true,
|
|
7
|
+
"target": "ESNext",
|
|
8
|
+
"module": "NodeNext",
|
|
9
|
+
"moduleResolution": "NodeNext",
|
|
10
|
+
"lib": [
|
|
11
|
+
"ESNext",
|
|
12
|
+
"ES2024",
|
|
13
|
+
"ES2023",
|
|
14
|
+
"ES2022",
|
|
15
|
+
"ES2021",
|
|
16
|
+
"ES2020",
|
|
17
|
+
"ES2019",
|
|
18
|
+
"ES2018",
|
|
19
|
+
"ES2017",
|
|
20
|
+
"ES2016",
|
|
21
|
+
"ES2015"
|
|
22
|
+
],
|
|
23
|
+
"types": [
|
|
24
|
+
"node",
|
|
25
|
+
"fs-extra",
|
|
26
|
+
"klaw",
|
|
27
|
+
"madge",
|
|
28
|
+
"prompts",
|
|
29
|
+
"eslint",
|
|
30
|
+
"vitest"
|
|
31
|
+
],
|
|
32
|
+
"strict": true,
|
|
33
|
+
"noImplicitAny": true,
|
|
34
|
+
"strictNullChecks": true,
|
|
35
|
+
"strictFunctionTypes": true,
|
|
36
|
+
"strictBindCallApply": true,
|
|
37
|
+
"strictPropertyInitialization": true,
|
|
38
|
+
"noImplicitThis": true,
|
|
39
|
+
"useUnknownInCatchVariables": true,
|
|
40
|
+
"alwaysStrict": true,
|
|
41
|
+
"noUnusedLocals": true,
|
|
42
|
+
"noUnusedParameters": true,
|
|
43
|
+
"exactOptionalPropertyTypes": true,
|
|
44
|
+
"noImplicitReturns": true,
|
|
45
|
+
"noFallthroughCasesInSwitch": true,
|
|
46
|
+
"noUncheckedIndexedAccess": true,
|
|
47
|
+
"noImplicitOverride": true,
|
|
48
|
+
"noPropertyAccessFromIndexSignature": true,
|
|
49
|
+
"esModuleInterop": true,
|
|
50
|
+
"forceConsistentCasingInFileNames": true,
|
|
51
|
+
"allowSyntheticDefaultImports": true
|
|
52
|
+
},
|
|
53
|
+
"include": [
|
|
54
|
+
"src/**/*"
|
|
16
55
|
]
|
|
17
|
-
},
|
|
18
|
-
"include": [
|
|
19
|
-
"src/**/*",
|
|
20
|
-
"tests/**/*",
|
|
21
|
-
"files/**/*"
|
|
22
|
-
]
|
|
23
56
|
}
|