@tsparticles/cli 1.11.0 → 1.12.0
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/dist/create/plugin/create-plugin.js +2 -2
- package/dist/create/preset/create-preset.js +2 -2
- package/dist/create/shape/create-shape.js +2 -2
- package/dist/utils/template-utils.js +1 -1
- package/files/create-preset/README.md +3 -3
- package/files/empty-project/package.dist.json +1 -1
- package/files/empty-project/package.json +2 -2
- package/package.json +1 -1
- package/scripts/postversion.js +1 -1
- package/src/create/plugin/create-plugin.ts +2 -2
- package/src/create/preset/create-preset.ts +2 -2
- package/src/create/shape/create-shape.ts +2 -2
- package/src/utils/template-utils.ts +4 -4
|
@@ -26,7 +26,7 @@ async function updateIndexFile(destPath, name) {
|
|
|
26
26
|
*/
|
|
27
27
|
async function updatePluginPackageFile(destPath, name, description, repoUrl) {
|
|
28
28
|
const camelizedName = (0, string_utils_1.camelize)((0, string_utils_1.camelize)(name, "-"), " "), dashedName = (0, string_utils_1.dash)(camelizedName);
|
|
29
|
-
(0, template_utils_1.updatePackageFile)(destPath, `"tsparticles-plugin-${dashedName}"`, description, `"tsparticles.plugin.${camelizedName}.min.js"`, repoUrl);
|
|
29
|
+
await (0, template_utils_1.updatePackageFile)(destPath, `"tsparticles-plugin-${dashedName}"`, description, `"tsparticles.plugin.${camelizedName}.min.js"`, repoUrl);
|
|
30
30
|
}
|
|
31
31
|
/**
|
|
32
32
|
* Updates the plugin package dist file
|
|
@@ -59,7 +59,7 @@ async function updateReadmeFile(destPath, name, description, repoUrl) {
|
|
|
59
59
|
* @param description - The description of the project
|
|
60
60
|
*/
|
|
61
61
|
async function updatePluginWebpackFile(destPath, name, description) {
|
|
62
|
-
await (0, template_utils_1.updateWebpackFile)(destPath, (0, string_utils_1.camelize)((0, string_utils_1.capitalize)((0, string_utils_1.capitalize)(name, "-"), " ")),
|
|
62
|
+
await (0, template_utils_1.updateWebpackFile)(destPath, (0, string_utils_1.camelize)((0, string_utils_1.capitalize)((0, string_utils_1.capitalize)(name, "-"), " ")), description, "loadParticlesPlugin");
|
|
63
63
|
}
|
|
64
64
|
/**
|
|
65
65
|
* Creates the plugin project
|
|
@@ -46,7 +46,7 @@ async function updatePresetPackageFile(destPath, name, description, repoUrl) {
|
|
|
46
46
|
*/
|
|
47
47
|
async function updatePresetPackageDistFile(destPath, name, description, repoUrl) {
|
|
48
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);
|
|
49
|
+
await (0, template_utils_1.updatePackageDistFile)(destPath, `"tsparticles-preset-${dashedName}"`, description, `"tsparticles.preset.${camelizedName}.min.js"`, repoUrl);
|
|
50
50
|
}
|
|
51
51
|
/**
|
|
52
52
|
* Updates the preset readme file
|
|
@@ -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, "-"), " ")),
|
|
71
|
+
await (0, template_utils_1.updateWebpackFile)(destPath, (0, string_utils_1.camelize)((0, string_utils_1.capitalize)((0, string_utils_1.capitalize)(name, "-"), " ")), description, "loadParticlesPreset");
|
|
72
72
|
}
|
|
73
73
|
/**
|
|
74
74
|
* Creates the preset project
|
|
@@ -37,7 +37,7 @@ async function updateShapePackageFile(destPath, name, description, repoUrl) {
|
|
|
37
37
|
*/
|
|
38
38
|
async function updateShapePackageDistFile(destPath, name, description, repoUrl) {
|
|
39
39
|
const camelizedName = (0, string_utils_1.camelize)((0, string_utils_1.camelize)(name, "-"), " "), dashedName = (0, string_utils_1.dash)(camelizedName);
|
|
40
|
-
(0, template_utils_1.updatePackageDistFile)(destPath, `"tsparticles-shape-${dashedName}"`, description, `"tsparticles.shape.${camelizedName}.min.js"`, repoUrl);
|
|
40
|
+
await (0, template_utils_1.updatePackageDistFile)(destPath, `"tsparticles-shape-${dashedName}"`, description, `"tsparticles.shape.${camelizedName}.min.js"`, repoUrl);
|
|
41
41
|
}
|
|
42
42
|
/**
|
|
43
43
|
* Updates the shape readme file
|
|
@@ -59,7 +59,7 @@ async function updateReadmeFile(destPath, name, description, repoUrl) {
|
|
|
59
59
|
* @param description - The description of the project
|
|
60
60
|
*/
|
|
61
61
|
async function updateShapeWebpackFile(destPath, name, description) {
|
|
62
|
-
await (0, template_utils_1.updateWebpackFile)(destPath, (0, string_utils_1.camelize)((0, string_utils_1.capitalize)((0, string_utils_1.capitalize)(name, "-"), " ")),
|
|
62
|
+
await (0, template_utils_1.updateWebpackFile)(destPath, (0, string_utils_1.camelize)((0, string_utils_1.capitalize)((0, string_utils_1.capitalize)(name, "-"), " ")), description, "loadParticlesShape");
|
|
63
63
|
}
|
|
64
64
|
/**
|
|
65
65
|
* Creates the shape project
|
|
@@ -41,7 +41,7 @@ exports.updatePackageDistFile = updatePackageDistFile;
|
|
|
41
41
|
* @param fnName - The name of the function to load the template
|
|
42
42
|
*/
|
|
43
43
|
async function updateWebpackFile(destPath, name, description, fnName) {
|
|
44
|
-
const webpackPath = path_1.default.resolve(destPath, "webpack.config.js"), webpack = await fs_extra_1.default.readFile(webpackPath, "utf-8"), webpackDescriptionRegex = /
|
|
44
|
+
const webpackPath = path_1.default.resolve(destPath, "webpack.config.js"), webpack = await fs_extra_1.default.readFile(webpackPath, "utf-8"), webpackDescriptionRegex = /"Empty"/g, replacedDescriptionText = webpack.replace(webpackDescriptionRegex, `"${description}"`), webpackEntryRegex = /"empty"/g, replacedNameText = replacedDescriptionText.replace(webpackEntryRegex, `"${name}"`), webpackFunctionNameRegex = /loadParticlesTemplate/g, replacedFunctionNameText = replacedNameText.replace(webpackFunctionNameRegex, fnName);
|
|
45
45
|
await fs_extra_1.default.writeFile(webpackPath, replacedFunctionNameText);
|
|
46
46
|
}
|
|
47
47
|
exports.updateWebpackFile = updateWebpackFile;
|
|
@@ -21,8 +21,8 @@ Once installed you need one more script to be included in your page (or you can
|
|
|
21
21
|
from [jsDelivr](https://www.jsdelivr.com/package/npm/tsparticles-preset-template):
|
|
22
22
|
|
|
23
23
|
```html
|
|
24
|
-
<script src="https://cdn.jsdelivr.net/npm/tsparticles@
|
|
25
|
-
<script src="https://cdn.jsdelivr.net/npm/tsparticles-preset-template
|
|
24
|
+
<script src="https://cdn.jsdelivr.net/npm/tsparticles-engine@2/tsparticles.engine.min.js"></script>
|
|
25
|
+
<script src="https://cdn.jsdelivr.net/npm/tsparticles-preset-template/tsparticles.preset.template.min.js"></script>
|
|
26
26
|
```
|
|
27
27
|
|
|
28
28
|
This script **MUST** be placed after the `tsParticles` one.
|
|
@@ -32,7 +32,7 @@ This script **MUST** be placed after the `tsParticles` one.
|
|
|
32
32
|
A bundled script can also be used, this will include every needed plugin needed by the preset.
|
|
33
33
|
|
|
34
34
|
```html
|
|
35
|
-
<script src="https://cdn.jsdelivr.net/npm/tsparticles-preset-template
|
|
35
|
+
<script src="https://cdn.jsdelivr.net/npm/tsparticles-preset-template/tsparticles.preset.template.bundle.min.js"></script>
|
|
36
36
|
```
|
|
37
37
|
|
|
38
38
|
### Usage
|
|
@@ -83,7 +83,7 @@
|
|
|
83
83
|
"prettier": "@tsparticles/prettier-config",
|
|
84
84
|
"devDependencies": {
|
|
85
85
|
"@babel/core": "^7.22.9",
|
|
86
|
-
"@tsparticles/cli": "1.
|
|
86
|
+
"@tsparticles/cli": "^1.12.0",
|
|
87
87
|
"@tsparticles/eslint-config": "^1.19.0",
|
|
88
88
|
"@tsparticles/prettier-config": "^1.12.0",
|
|
89
89
|
"@tsparticles/tsconfig": "^1.14.0",
|
|
@@ -105,6 +105,6 @@
|
|
|
105
105
|
"webpack-cli": "^5.1.4"
|
|
106
106
|
},
|
|
107
107
|
"dependencies": {
|
|
108
|
-
"tsparticles-engine": "^2.
|
|
108
|
+
"tsparticles-engine": "^2.12.0"
|
|
109
109
|
}
|
|
110
110
|
}
|
package/package.json
CHANGED
package/scripts/postversion.js
CHANGED
|
@@ -14,7 +14,7 @@ const emptyProjectPkgPath = path.join(__dirname, "..", "files", "empty-project",
|
|
|
14
14
|
|
|
15
15
|
const obj = JSON.parse(data);
|
|
16
16
|
|
|
17
|
-
obj["devDependencies"]["@tsparticles/cli"] = pkg.version
|
|
17
|
+
obj["devDependencies"]["@tsparticles/cli"] = `^${pkg.version}`;
|
|
18
18
|
|
|
19
19
|
const result = JSON.stringify(obj, undefined, 2);
|
|
20
20
|
|
|
@@ -45,7 +45,7 @@ async function updatePluginPackageFile(
|
|
|
45
45
|
const camelizedName = camelize(camelize(name, "-"), " "),
|
|
46
46
|
dashedName = dash(camelizedName);
|
|
47
47
|
|
|
48
|
-
updatePackageFile(
|
|
48
|
+
await updatePackageFile(
|
|
49
49
|
destPath,
|
|
50
50
|
`"tsparticles-plugin-${dashedName}"`,
|
|
51
51
|
description,
|
|
@@ -140,7 +140,7 @@ async function updatePluginWebpackFile(destPath: string, name: string, descripti
|
|
|
140
140
|
await updateWebpackFile(
|
|
141
141
|
destPath,
|
|
142
142
|
camelize(capitalize(capitalize(name, "-"), " ")),
|
|
143
|
-
|
|
143
|
+
description,
|
|
144
144
|
"loadParticlesPlugin",
|
|
145
145
|
);
|
|
146
146
|
}
|
|
@@ -85,7 +85,7 @@ async function updatePresetPackageDistFile(
|
|
|
85
85
|
const camelizedName = camelize(camelize(name, "-"), " "),
|
|
86
86
|
dashedName = dash(camelizedName);
|
|
87
87
|
|
|
88
|
-
updatePackageDistFile(
|
|
88
|
+
await updatePackageDistFile(
|
|
89
89
|
destPath,
|
|
90
90
|
`"tsparticles-preset-${dashedName}"`,
|
|
91
91
|
description,
|
|
@@ -155,7 +155,7 @@ async function updatePresetWebpackFile(destPath: string, name: string, descripti
|
|
|
155
155
|
await updateWebpackFile(
|
|
156
156
|
destPath,
|
|
157
157
|
camelize(capitalize(capitalize(name, "-"), " ")),
|
|
158
|
-
|
|
158
|
+
description,
|
|
159
159
|
"loadParticlesPreset",
|
|
160
160
|
);
|
|
161
161
|
}
|
|
@@ -70,7 +70,7 @@ async function updateShapePackageDistFile(
|
|
|
70
70
|
const camelizedName = camelize(camelize(name, "-"), " "),
|
|
71
71
|
dashedName = dash(camelizedName);
|
|
72
72
|
|
|
73
|
-
updatePackageDistFile(
|
|
73
|
+
await updatePackageDistFile(
|
|
74
74
|
destPath,
|
|
75
75
|
`"tsparticles-shape-${dashedName}"`,
|
|
76
76
|
description,
|
|
@@ -137,7 +137,7 @@ async function updateShapeWebpackFile(destPath: string, name: string, descriptio
|
|
|
137
137
|
await updateWebpackFile(
|
|
138
138
|
destPath,
|
|
139
139
|
camelize(capitalize(capitalize(name, "-"), " ")),
|
|
140
|
-
|
|
140
|
+
description,
|
|
141
141
|
"loadParticlesShape",
|
|
142
142
|
);
|
|
143
143
|
}
|
|
@@ -83,10 +83,10 @@ export async function updateWebpackFile(
|
|
|
83
83
|
): Promise<void> {
|
|
84
84
|
const webpackPath = path.resolve(destPath, "webpack.config.js"),
|
|
85
85
|
webpack = await fs.readFile(webpackPath, "utf-8"),
|
|
86
|
-
webpackDescriptionRegex = /
|
|
87
|
-
replacedDescriptionText = webpack.replace(webpackDescriptionRegex, description),
|
|
88
|
-
webpackEntryRegex = /"
|
|
89
|
-
replacedNameText = replacedDescriptionText.replace(webpackEntryRegex, `"${name}
|
|
86
|
+
webpackDescriptionRegex = /"Empty"/g,
|
|
87
|
+
replacedDescriptionText = webpack.replace(webpackDescriptionRegex, `"${description}"`),
|
|
88
|
+
webpackEntryRegex = /"empty"/g,
|
|
89
|
+
replacedNameText = replacedDescriptionText.replace(webpackEntryRegex, `"${name}"`),
|
|
90
90
|
webpackFunctionNameRegex = /loadParticlesTemplate/g,
|
|
91
91
|
replacedFunctionNameText = replacedNameText.replace(webpackFunctionNameRegex, fnName);
|
|
92
92
|
|