@tsparticles/cli 2.0.0-beta.9 → 2.0.1
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/build/build-bundle.js +2 -2
- package/dist/build/build-distfiles.js +3 -3
- package/dist/build/build-diststats.js +1 -1
- package/dist/build/build-prettier.js +3 -3
- package/dist/build/build-tsc.js +0 -1
- package/dist/create/plugin/plugin.js +2 -2
- package/dist/create/preset/preset.js +2 -2
- package/dist/create/shape/shape.js +2 -2
- package/files/create-shape/src/ShapeDrawer.ts +3 -8
- package/files/empty-project/package.dist.json +1 -1
- package/files/empty-project/package.json +16 -16
- package/package.json +23 -22
- package/src/build/build-bundle.ts +2 -2
- package/src/build/build-distfiles.ts +10 -5
- package/src/build/build-diststats.ts +1 -1
- package/src/build/build-prettier.ts +3 -3
- package/src/build/build-tsc.ts +0 -2
- package/src/create/plugin/plugin.ts +6 -2
- package/src/create/preset/preset.ts +6 -2
- package/src/create/shape/shape.ts +6 -2
- package/src/utils/file-utils.ts +4 -4
|
@@ -37,11 +37,11 @@ async function bundle(basePath) {
|
|
|
37
37
|
console.log("Bundling started");
|
|
38
38
|
let res = false;
|
|
39
39
|
try {
|
|
40
|
-
const options = await Promise.resolve(`${path_1.default.join(basePath, "webpack.config.js")}`).then(s => __importStar(require(s)));
|
|
40
|
+
const options = (await Promise.resolve(`${path_1.default.join(basePath, "webpack.config.js")}`).then(s => __importStar(require(s))));
|
|
41
41
|
res = await new Promise((resolve, reject) => {
|
|
42
42
|
(0, webpack_1.default)(options.default, (err, stats) => {
|
|
43
43
|
if (err) {
|
|
44
|
-
console.error(err.stack
|
|
44
|
+
console.error(err.stack ?? err);
|
|
45
45
|
reject(err);
|
|
46
46
|
return;
|
|
47
47
|
}
|
|
@@ -38,7 +38,7 @@ async function buildDistFiles(basePath) {
|
|
|
38
38
|
console.log("Build - started on dist files");
|
|
39
39
|
let res;
|
|
40
40
|
try {
|
|
41
|
-
const pkgInfo = await Promise.resolve(`${path_1.default.join(basePath, "package.json")}`).then(s => __importStar(require(s))), libPackage = path_1.default.join(basePath, "package.dist.json"), distPath = path_1.default.join(basePath, pkgInfo.publishConfig?.directory
|
|
41
|
+
const pkgInfo = (await Promise.resolve(`${path_1.default.join(basePath, "package.json")}`).then(s => __importStar(require(s)))), libPackage = path_1.default.join(basePath, "package.dist.json"), distPath = path_1.default.join(basePath, pkgInfo.publishConfig?.directory ?? "dist");
|
|
42
42
|
const data = await fs_extra_1.default.readFile(libPackage), text = data.toString(), libObj = JSON.parse(text);
|
|
43
43
|
libObj.version = pkgInfo.version;
|
|
44
44
|
if (pkgInfo.dependencies) {
|
|
@@ -76,13 +76,13 @@ 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 klaw(path.join(distPath, "cjs"))) {
|
|
79
|
+
/* for await (const file of klaw(path.join(distPath, "cjs"))) {
|
|
80
80
|
await fs.rename(file.path, file.path.replace(/\.js$/, ".cjs"));
|
|
81
81
|
}
|
|
82
82
|
|
|
83
83
|
for await (const file of klaw(path.join(distPath, "esm"))) {
|
|
84
84
|
await fs.rename(file.path, file.path.replace(/\.js$/, ".mjs"));
|
|
85
|
-
}*/
|
|
85
|
+
} */
|
|
86
86
|
await fs_extra_1.default.writeFile(path_1.default.join(distPath, "cjs", "package.json"), `{ "type": "commonjs" }`);
|
|
87
87
|
await fs_extra_1.default.writeFile(path_1.default.join(distPath, "esm", "package.json"), `{ "type": "module" }`);
|
|
88
88
|
await fs_extra_1.default.writeFile(path_1.default.join(distPath, "browser", "package.json"), `{ "type": "module" }`);
|
|
@@ -70,7 +70,7 @@ async function getFolderStats(folderPath, bundlePath) {
|
|
|
70
70
|
*/
|
|
71
71
|
async function getDistStats(basePath) {
|
|
72
72
|
const distFolder = path_1.default.join(basePath, "dist"), pkgInfo = (await fs_extra_1.default.exists(path_1.default.join(distFolder, "package.json")))
|
|
73
|
-
? await Promise.resolve(`${path_1.default.join(distFolder, "package.json")}`).then(s => __importStar(require(s)))
|
|
73
|
+
? (await Promise.resolve(`${path_1.default.join(distFolder, "package.json")}`).then(s => __importStar(require(s))))
|
|
74
74
|
: {}, bundlePath = (await fs_extra_1.default.exists(distFolder)) && pkgInfo.jsdelivr
|
|
75
75
|
? path_1.default.resolve(path_1.default.join(distFolder, pkgInfo.jsdelivr))
|
|
76
76
|
: undefined;
|
|
@@ -95,14 +95,14 @@ async function prettifyPackageDistJson(basePath, _ci) {
|
|
|
95
95
|
options.endOfLine = "lf";
|
|
96
96
|
options.parser = "json";
|
|
97
97
|
// TODO: disabled this check until "prettier-plugin-multiline-arrays" package is compatible with Prettier 3.0.0
|
|
98
|
-
/*if (ci) {
|
|
98
|
+
/* if (ci) {
|
|
99
99
|
if (!(await prettier.check(contents, options))) {
|
|
100
100
|
throw new Error(`package.dist.json is not formatted correctly`);
|
|
101
101
|
}
|
|
102
|
-
} else {*/
|
|
102
|
+
} else { */
|
|
103
103
|
const formatted = await prettier_1.default.format(contents, options);
|
|
104
104
|
await fs_extra_1.default.writeFile("package.dist.json", formatted, "utf8");
|
|
105
|
-
//}
|
|
105
|
+
// }
|
|
106
106
|
res = true;
|
|
107
107
|
}
|
|
108
108
|
catch (e) {
|
package/dist/build/build-tsc.js
CHANGED
|
@@ -29,7 +29,7 @@ pluginCommand.action(async (destination) => {
|
|
|
29
29
|
name: "description",
|
|
30
30
|
message: "What is the description of the plugin?",
|
|
31
31
|
validate: (value) => (value ? true : "The description can't be empty"),
|
|
32
|
-
initial: (0, string_utils_1.capitalize)(initialName
|
|
32
|
+
initial: (0, string_utils_1.capitalize)(initialName ?? ""),
|
|
33
33
|
},
|
|
34
34
|
{
|
|
35
35
|
type: "text",
|
|
@@ -38,6 +38,6 @@ pluginCommand.action(async (destination) => {
|
|
|
38
38
|
initial: repoUrl.trim(),
|
|
39
39
|
},
|
|
40
40
|
];
|
|
41
|
-
const { name, description, repositoryUrl } = await (0, prompts_1.default)(questions);
|
|
41
|
+
const { name, description, repositoryUrl } = (await (0, prompts_1.default)(questions));
|
|
42
42
|
await (0, create_plugin_1.createPluginTemplate)(name.trim(), description.trim(), repositoryUrl.trim(), destPath);
|
|
43
43
|
});
|
|
@@ -29,7 +29,7 @@ presetCommand.action(async (destination) => {
|
|
|
29
29
|
name: "description",
|
|
30
30
|
message: "What is the description of the preset?",
|
|
31
31
|
validate: (value) => (value ? true : "The description can't be empty"),
|
|
32
|
-
initial: (0, string_utils_1.capitalize)(initialName
|
|
32
|
+
initial: (0, string_utils_1.capitalize)(initialName ?? ""),
|
|
33
33
|
},
|
|
34
34
|
{
|
|
35
35
|
type: "text",
|
|
@@ -38,6 +38,6 @@ presetCommand.action(async (destination) => {
|
|
|
38
38
|
initial: repoUrl.trim(),
|
|
39
39
|
},
|
|
40
40
|
];
|
|
41
|
-
const { name, description, repositoryUrl } = await (0, prompts_1.default)(questions);
|
|
41
|
+
const { name, description, repositoryUrl } = (await (0, prompts_1.default)(questions));
|
|
42
42
|
await (0, create_preset_1.createPresetTemplate)(name.trim(), description.trim(), repositoryUrl.trim(), destPath);
|
|
43
43
|
});
|
|
@@ -29,7 +29,7 @@ shapeCommand.action(async (destination) => {
|
|
|
29
29
|
name: "description",
|
|
30
30
|
message: "What is the description of the shape?",
|
|
31
31
|
validate: (value) => (value ? true : "The description can't be empty"),
|
|
32
|
-
initial: (0, string_utils_1.capitalize)(initialName
|
|
32
|
+
initial: (0, string_utils_1.capitalize)(initialName ?? ""),
|
|
33
33
|
},
|
|
34
34
|
{
|
|
35
35
|
type: "text",
|
|
@@ -38,6 +38,6 @@ shapeCommand.action(async (destination) => {
|
|
|
38
38
|
initial: repoUrl.trim(),
|
|
39
39
|
},
|
|
40
40
|
];
|
|
41
|
-
const { name, description, repositoryUrl } = await (0, prompts_1.default)(questions);
|
|
41
|
+
const { name, description, repositoryUrl } = (await (0, prompts_1.default)(questions));
|
|
42
42
|
await (0, create_shape_1.createShapeTemplate)(name.trim(), description.trim(), repositoryUrl.trim(), destPath);
|
|
43
43
|
});
|
|
@@ -1,15 +1,10 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { IShapeDrawData, IShapeDrawer } from "@tsparticles/engine";
|
|
2
2
|
|
|
3
3
|
export class ShapeDrawer implements IShapeDrawer {
|
|
4
|
-
draw(
|
|
5
|
-
_particle: Particle,
|
|
6
|
-
_radius: number,
|
|
7
|
-
_opacity: number,
|
|
8
|
-
_delta: IDelta,
|
|
9
|
-
_pixelRatio: number): void {
|
|
4
|
+
draw(_data: IShapeDrawData): void {
|
|
10
5
|
// draw the particle using the context
|
|
11
6
|
// which is already centered in the particle position
|
|
12
|
-
// colors are already
|
|
7
|
+
// colors are already handled, just draw the shape
|
|
13
8
|
// the bounds are -radius to radius
|
|
14
9
|
// delta is the frame time difference between the last frame and this one, in ms, use it for animated shapes
|
|
15
10
|
// pixelRatio is the canvas ratio used by the tsParticles instance, you may need it for density-independent shapes
|
|
@@ -82,29 +82,29 @@
|
|
|
82
82
|
"types": "dist/types/index.d.ts",
|
|
83
83
|
"prettier": "@tsparticles/prettier-config",
|
|
84
84
|
"devDependencies": {
|
|
85
|
-
"@babel/core": "^7.23.
|
|
86
|
-
"@tsparticles/cli": "^2.0.
|
|
87
|
-
"@tsparticles/eslint-config": "^2.0.
|
|
88
|
-
"@tsparticles/prettier-config": "^2.0.
|
|
89
|
-
"@tsparticles/tsconfig": "^2.0.
|
|
90
|
-
"@tsparticles/webpack-plugin": "^2.0.
|
|
91
|
-
"@types/webpack-env": "^1.18.
|
|
92
|
-
"@typescript-eslint/eslint-plugin": "^6.
|
|
93
|
-
"@typescript-eslint/parser": "^6.
|
|
85
|
+
"@babel/core": "^7.23.6",
|
|
86
|
+
"@tsparticles/cli": "^2.0.1",
|
|
87
|
+
"@tsparticles/eslint-config": "^2.0.1",
|
|
88
|
+
"@tsparticles/prettier-config": "^2.0.1",
|
|
89
|
+
"@tsparticles/tsconfig": "^2.0.1",
|
|
90
|
+
"@tsparticles/webpack-plugin": "^2.0.1",
|
|
91
|
+
"@types/webpack-env": "^1.18.4",
|
|
92
|
+
"@typescript-eslint/eslint-plugin": "^6.14.0",
|
|
93
|
+
"@typescript-eslint/parser": "^6.14.0",
|
|
94
94
|
"babel-loader": "^9.1.3",
|
|
95
95
|
"browserslist": "^4.22.1",
|
|
96
96
|
"copyfiles": "^2.4.1",
|
|
97
|
-
"eslint": "^8.
|
|
98
|
-
"eslint-config-prettier": "^9.
|
|
99
|
-
"prettier": "^3.
|
|
97
|
+
"eslint": "^8.55.0",
|
|
98
|
+
"eslint-config-prettier": "^9.1.0",
|
|
99
|
+
"prettier": "^3.1.1",
|
|
100
100
|
"rimraf": "^5.0.5",
|
|
101
101
|
"terser-webpack-plugin": "^5.3.9",
|
|
102
|
-
"typescript": "^5.
|
|
103
|
-
"webpack": "^5.
|
|
104
|
-
"webpack-bundle-analyzer": "^4.
|
|
102
|
+
"typescript": "^5.3.3",
|
|
103
|
+
"webpack": "^5.89.0",
|
|
104
|
+
"webpack-bundle-analyzer": "^4.10.0",
|
|
105
105
|
"webpack-cli": "^5.1.4"
|
|
106
106
|
},
|
|
107
107
|
"dependencies": {
|
|
108
|
-
"@tsparticles/engine": "^3.0.
|
|
108
|
+
"@tsparticles/engine": "^3.0.2"
|
|
109
109
|
}
|
|
110
110
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tsparticles/cli",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.1",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"bin": {
|
|
6
6
|
"tsparticles-cli": "dist/cli.js"
|
|
@@ -10,39 +10,40 @@
|
|
|
10
10
|
},
|
|
11
11
|
"prettier": "@tsparticles/prettier-config",
|
|
12
12
|
"dependencies": {
|
|
13
|
-
"@tsparticles/eslint-config": "^2.0.
|
|
14
|
-
"@tsparticles/prettier-config": "^2.0.
|
|
15
|
-
"@tsparticles/tsconfig": "^2.0.
|
|
16
|
-
"@tsparticles/webpack-plugin": "^2.0.
|
|
17
|
-
"@typescript-eslint/eslint-plugin": "^6.
|
|
18
|
-
"@typescript-eslint/parser": "^6.
|
|
19
|
-
"commander": "^11.
|
|
20
|
-
"eslint": "^8.
|
|
21
|
-
"eslint-config-prettier": "^9.
|
|
22
|
-
"eslint-plugin-jsdoc": "^46.
|
|
13
|
+
"@tsparticles/eslint-config": "^2.0.1",
|
|
14
|
+
"@tsparticles/prettier-config": "^2.0.1",
|
|
15
|
+
"@tsparticles/tsconfig": "^2.0.1",
|
|
16
|
+
"@tsparticles/webpack-plugin": "^2.0.1",
|
|
17
|
+
"@typescript-eslint/eslint-plugin": "^6.14.0",
|
|
18
|
+
"@typescript-eslint/parser": "^6.14.0",
|
|
19
|
+
"commander": "^11.1.0",
|
|
20
|
+
"eslint": "^8.55.0",
|
|
21
|
+
"eslint-config-prettier": "^9.1.0",
|
|
22
|
+
"eslint-plugin-jsdoc": "^46.9.0",
|
|
23
23
|
"eslint-plugin-tsdoc": "^0.2.17",
|
|
24
|
-
"fs-extra": "^11.
|
|
24
|
+
"fs-extra": "^11.2.0",
|
|
25
25
|
"klaw": "^4.1.0",
|
|
26
26
|
"lookpath": "^1.2.2",
|
|
27
27
|
"path-scurry": "^1.10.1",
|
|
28
|
-
"prettier": "^3.
|
|
28
|
+
"prettier": "^3.1.1",
|
|
29
|
+
"prettier-plugin-multiline-arrays": "^3.0.1",
|
|
29
30
|
"prompts": "^2.4.2",
|
|
30
31
|
"rimraf": "^5.0.5",
|
|
31
|
-
"typescript": "^5.
|
|
32
|
-
"webpack": "^5.
|
|
32
|
+
"typescript": "^5.3.3",
|
|
33
|
+
"webpack": "^5.89.0"
|
|
33
34
|
},
|
|
34
35
|
"devDependencies": {
|
|
35
|
-
"@types/chai": "^4.3.
|
|
36
|
-
"@types/fs-extra": "^11.0.
|
|
37
|
-
"@types/klaw": "^3.0.
|
|
38
|
-
"@types/mocha": "^10.0.
|
|
39
|
-
"@types/node": "^20.
|
|
40
|
-
"@types/prompts": "^2.4.
|
|
36
|
+
"@types/chai": "^4.3.11",
|
|
37
|
+
"@types/fs-extra": "^11.0.4",
|
|
38
|
+
"@types/klaw": "^3.0.6",
|
|
39
|
+
"@types/mocha": "^10.0.6",
|
|
40
|
+
"@types/node": "^20.10.4",
|
|
41
|
+
"@types/prompts": "^2.4.9",
|
|
41
42
|
"chai": "^4.3.10",
|
|
42
43
|
"cross-env": "^7.0.3",
|
|
43
44
|
"mocha": "^10.2.0",
|
|
44
45
|
"nyc": "^15.1.0",
|
|
45
|
-
"ts-node": "^10.9.
|
|
46
|
+
"ts-node": "^10.9.2"
|
|
46
47
|
},
|
|
47
48
|
"description": "tsParticles CLI",
|
|
48
49
|
"main": ".eslintrc.js",
|
|
@@ -11,12 +11,12 @@ export async function bundle(basePath: string): Promise<boolean> {
|
|
|
11
11
|
let res = false;
|
|
12
12
|
|
|
13
13
|
try {
|
|
14
|
-
const options = await import(path.join(basePath, "webpack.config.js"));
|
|
14
|
+
const options = (await import(path.join(basePath, "webpack.config.js"))) as { default: webpack.Configuration };
|
|
15
15
|
|
|
16
16
|
res = await new Promise<boolean>((resolve, reject) => {
|
|
17
17
|
webpack(options.default, (err, stats) => {
|
|
18
18
|
if (err) {
|
|
19
|
-
console.error(err.stack
|
|
19
|
+
console.error(err.stack ?? err);
|
|
20
20
|
|
|
21
21
|
reject(err);
|
|
22
22
|
|
|
@@ -12,13 +12,18 @@ export async function buildDistFiles(basePath: string): Promise<boolean> {
|
|
|
12
12
|
let res: boolean;
|
|
13
13
|
|
|
14
14
|
try {
|
|
15
|
-
const pkgInfo = await import(path.join(basePath, "package.json"))
|
|
15
|
+
const pkgInfo = (await import(path.join(basePath, "package.json"))) as {
|
|
16
|
+
dependencies?: Record<string, string>;
|
|
17
|
+
peerDependencies?: Record<string, string>;
|
|
18
|
+
publishConfig?: { directory?: string };
|
|
19
|
+
version: string;
|
|
20
|
+
},
|
|
16
21
|
libPackage = path.join(basePath, "package.dist.json"),
|
|
17
|
-
distPath = path.join(basePath, pkgInfo.publishConfig?.directory
|
|
22
|
+
distPath = path.join(basePath, pkgInfo.publishConfig?.directory ?? "dist");
|
|
18
23
|
|
|
19
24
|
const data = await fs.readFile(libPackage),
|
|
20
25
|
text = data.toString(),
|
|
21
|
-
libObj = JSON.parse(text)
|
|
26
|
+
libObj = JSON.parse(text) as Record<string, unknown>;
|
|
22
27
|
|
|
23
28
|
libObj.version = pkgInfo.version;
|
|
24
29
|
|
|
@@ -71,13 +76,13 @@ export async function buildDistFiles(basePath: string): Promise<boolean> {
|
|
|
71
76
|
await fs.writeFile(file.path, contents.replaceAll("__VERSION__", `"${pkgInfo.version}"`), "utf8");
|
|
72
77
|
}
|
|
73
78
|
|
|
74
|
-
/*for await (const file of klaw(path.join(distPath, "cjs"))) {
|
|
79
|
+
/* for await (const file of klaw(path.join(distPath, "cjs"))) {
|
|
75
80
|
await fs.rename(file.path, file.path.replace(/\.js$/, ".cjs"));
|
|
76
81
|
}
|
|
77
82
|
|
|
78
83
|
for await (const file of klaw(path.join(distPath, "esm"))) {
|
|
79
84
|
await fs.rename(file.path, file.path.replace(/\.js$/, ".mjs"));
|
|
80
|
-
}*/
|
|
85
|
+
} */
|
|
81
86
|
|
|
82
87
|
await fs.writeFile(path.join(distPath, "cjs", "package.json"), `{ "type": "commonjs" }`);
|
|
83
88
|
await fs.writeFile(path.join(distPath, "esm", "package.json"), `{ "type": "module" }`);
|
|
@@ -57,7 +57,7 @@ async function getFolderStats(folderPath: string, bundlePath?: string): Promise<
|
|
|
57
57
|
export async function getDistStats(basePath: string): Promise<IDistStats> {
|
|
58
58
|
const distFolder = path.join(basePath, "dist"),
|
|
59
59
|
pkgInfo = (await fs.exists(path.join(distFolder, "package.json")))
|
|
60
|
-
? await import(path.join(distFolder, "package.json"))
|
|
60
|
+
? ((await import(path.join(distFolder, "package.json"))) as { jsdelivr?: string })
|
|
61
61
|
: {},
|
|
62
62
|
bundlePath =
|
|
63
63
|
(await fs.exists(distFolder)) && pkgInfo.jsdelivr
|
|
@@ -113,15 +113,15 @@ export async function prettifyPackageDistJson(basePath: string, _ci: boolean): P
|
|
|
113
113
|
|
|
114
114
|
// TODO: disabled this check until "prettier-plugin-multiline-arrays" package is compatible with Prettier 3.0.0
|
|
115
115
|
|
|
116
|
-
/*if (ci) {
|
|
116
|
+
/* if (ci) {
|
|
117
117
|
if (!(await prettier.check(contents, options))) {
|
|
118
118
|
throw new Error(`package.dist.json is not formatted correctly`);
|
|
119
119
|
}
|
|
120
|
-
} else {*/
|
|
120
|
+
} else { */
|
|
121
121
|
const formatted = await prettier.format(contents, options);
|
|
122
122
|
|
|
123
123
|
await fs.writeFile("package.dist.json", formatted, "utf8");
|
|
124
|
-
//}
|
|
124
|
+
// }
|
|
125
125
|
|
|
126
126
|
res = true;
|
|
127
127
|
} catch (e) {
|
package/src/build/build-tsc.ts
CHANGED
|
@@ -27,7 +27,7 @@ pluginCommand.action(async (destination: string) => {
|
|
|
27
27
|
name: "description",
|
|
28
28
|
message: "What is the description of the plugin?",
|
|
29
29
|
validate: (value: string) => (value ? true : "The description can't be empty"),
|
|
30
|
-
initial: capitalize(initialName
|
|
30
|
+
initial: capitalize(initialName ?? ""),
|
|
31
31
|
},
|
|
32
32
|
{
|
|
33
33
|
type: "text",
|
|
@@ -37,7 +37,11 @@ pluginCommand.action(async (destination: string) => {
|
|
|
37
37
|
},
|
|
38
38
|
];
|
|
39
39
|
|
|
40
|
-
const { name, description, repositoryUrl } = await prompts(questions)
|
|
40
|
+
const { name, description, repositoryUrl } = (await prompts(questions)) as {
|
|
41
|
+
description: string;
|
|
42
|
+
name: string;
|
|
43
|
+
repositoryUrl: string;
|
|
44
|
+
};
|
|
41
45
|
|
|
42
46
|
await createPluginTemplate(name.trim(), description.trim(), repositoryUrl.trim(), destPath);
|
|
43
47
|
});
|
|
@@ -27,7 +27,7 @@ presetCommand.action(async (destination: string) => {
|
|
|
27
27
|
name: "description",
|
|
28
28
|
message: "What is the description of the preset?",
|
|
29
29
|
validate: (value: string) => (value ? true : "The description can't be empty"),
|
|
30
|
-
initial: capitalize(initialName
|
|
30
|
+
initial: capitalize(initialName ?? ""),
|
|
31
31
|
},
|
|
32
32
|
{
|
|
33
33
|
type: "text",
|
|
@@ -37,7 +37,11 @@ presetCommand.action(async (destination: string) => {
|
|
|
37
37
|
},
|
|
38
38
|
];
|
|
39
39
|
|
|
40
|
-
const { name, description, repositoryUrl } = await prompts(questions)
|
|
40
|
+
const { name, description, repositoryUrl } = (await prompts(questions)) as {
|
|
41
|
+
description: string;
|
|
42
|
+
name: string;
|
|
43
|
+
repositoryUrl: string;
|
|
44
|
+
};
|
|
41
45
|
|
|
42
46
|
await createPresetTemplate(name.trim(), description.trim(), repositoryUrl.trim(), destPath);
|
|
43
47
|
});
|
|
@@ -27,7 +27,7 @@ shapeCommand.action(async (destination: string) => {
|
|
|
27
27
|
name: "description",
|
|
28
28
|
message: "What is the description of the shape?",
|
|
29
29
|
validate: (value: string) => (value ? true : "The description can't be empty"),
|
|
30
|
-
initial: capitalize(initialName
|
|
30
|
+
initial: capitalize(initialName ?? ""),
|
|
31
31
|
},
|
|
32
32
|
{
|
|
33
33
|
type: "text",
|
|
@@ -37,7 +37,11 @@ shapeCommand.action(async (destination: string) => {
|
|
|
37
37
|
},
|
|
38
38
|
];
|
|
39
39
|
|
|
40
|
-
const { name, description, repositoryUrl } = await prompts(questions)
|
|
40
|
+
const { name, description, repositoryUrl } = (await prompts(questions)) as {
|
|
41
|
+
description: string;
|
|
42
|
+
name: string;
|
|
43
|
+
repositoryUrl: string;
|
|
44
|
+
};
|
|
41
45
|
|
|
42
46
|
await createShapeTemplate(name.trim(), description.trim(), repositoryUrl.trim(), destPath);
|
|
43
47
|
});
|
package/src/utils/file-utils.ts
CHANGED
|
@@ -3,15 +3,15 @@ import fs from "fs-extra";
|
|
|
3
3
|
import { lookpath } from "lookpath";
|
|
4
4
|
import path from "path";
|
|
5
5
|
|
|
6
|
-
export
|
|
6
|
+
export interface ReplaceTokensOptions {
|
|
7
7
|
path: string;
|
|
8
8
|
tokens: ReplaceTokensData[];
|
|
9
|
-
}
|
|
9
|
+
}
|
|
10
10
|
|
|
11
|
-
export
|
|
11
|
+
export interface ReplaceTokensData {
|
|
12
12
|
from: string | RegExp;
|
|
13
13
|
to: string;
|
|
14
|
-
}
|
|
14
|
+
}
|
|
15
15
|
|
|
16
16
|
/**
|
|
17
17
|
*
|