zumito-framework 1.1.45 → 1.1.46

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.
Files changed (55) hide show
  1. package/dist/TranslationManager.d.ts +15 -15
  2. package/dist/TranslationManager.js +41 -41
  3. package/dist/ZumitoFramework.d.ts +51 -51
  4. package/dist/ZumitoFramework.js +312 -312
  5. package/dist/baseModule/BaseModule.d.ts +6 -6
  6. package/dist/baseModule/BaseModule.js +16 -16
  7. package/dist/baseModule/events/discord/interactionCreate.d.ts +6 -6
  8. package/dist/baseModule/events/discord/interactionCreate.js +50 -50
  9. package/dist/baseModule/events/discord/messageCreate.d.ts +16 -16
  10. package/dist/baseModule/events/discord/messageCreate.js +233 -233
  11. package/dist/baseModule/index.d.ts +6 -6
  12. package/dist/baseModule/index.js +15 -15
  13. package/dist/baseModule/models/errors.json +13 -13
  14. package/dist/baseModule/models/guild.json +22 -22
  15. package/dist/definitions/ApiResponse.d.ts +4 -4
  16. package/dist/definitions/ApiResponse.js +16 -16
  17. package/dist/index.d.ts +17 -17
  18. package/dist/index.js +12 -12
  19. package/dist/managers/EmojiManager.d.ts +11 -11
  20. package/dist/managers/EmojiManager.js +32 -32
  21. package/dist/types/Command.d.ts +24 -24
  22. package/dist/types/Command.js +25 -25
  23. package/dist/types/CommandArgDefinition.d.ts +7 -7
  24. package/dist/types/CommandArgDefinition.js +1 -1
  25. package/dist/types/CommandArguments.d.ts +8 -8
  26. package/dist/types/CommandArguments.js +15 -15
  27. package/dist/types/CommandChoiceDefinition.d.ts +4 -4
  28. package/dist/types/CommandChoiceDefinition.js +1 -1
  29. package/dist/types/CommandParameters.d.ts +18 -18
  30. package/dist/types/CommandParameters.js +1 -1
  31. package/dist/types/CommandType.d.ts +6 -6
  32. package/dist/types/CommandType.js +6 -6
  33. package/dist/types/Commands.d.ts +23 -23
  34. package/dist/types/Commands.js +26 -26
  35. package/dist/types/EventParameters.d.ts +8 -8
  36. package/dist/types/EventParameters.js +1 -1
  37. package/dist/types/FrameworkEvent.d.ts +5 -5
  38. package/dist/types/FrameworkEvent.js +4 -4
  39. package/dist/types/FrameworkSettings.d.ts +11 -11
  40. package/dist/types/FrameworkSettings.js +1 -1
  41. package/dist/types/Module.d.ts +25 -25
  42. package/dist/types/Module.js +191 -191
  43. package/dist/types/SelectMenuParameters.d.ts +9 -9
  44. package/dist/types/SelectMenuParameters.js +1 -1
  45. package/dist/types/Translation.d.ts +9 -9
  46. package/dist/types/Translation.js +31 -31
  47. package/dist/utils/EmojiFallback.d.ts +6 -6
  48. package/dist/utils/EmojiFallback.js +14 -14
  49. package/dist/utils/TextFormatter.d.ts +26 -26
  50. package/dist/utils/TextFormatter.js +82 -82
  51. package/package.json +1 -1
  52. package/plop-templates/command.js.hbs +16 -16
  53. package/plop-templates/translation.json.hbs +7 -7
  54. package/plopfile.js +88 -88
  55. package/templateGenerator.mjs +25 -25
@@ -1,31 +1,31 @@
1
- export class Translation {
2
- text = new Map();
3
- constructor() { }
4
- get(language, params) {
5
- let text;
6
- if (this.has(language)) {
7
- text = this.text.get(language);
8
- }
9
- else {
10
- text = this.text.get('en');
11
- }
12
- if (params) {
13
- Object.keys(params).forEach(key => {
14
- text = text.replace(`{${key}}`, params[key]);
15
- });
16
- }
17
- return text;
18
- }
19
- set(language, text) {
20
- this.text.set(language, text);
21
- }
22
- has(language) {
23
- return this.text.has(language);
24
- }
25
- getAll() {
26
- return this.text;
27
- }
28
- setAll(text) {
29
- this.text = text;
30
- }
31
- }
1
+ export class Translation {
2
+ text = new Map();
3
+ constructor() { }
4
+ get(language, params) {
5
+ let text;
6
+ if (this.has(language)) {
7
+ text = this.text.get(language);
8
+ }
9
+ else {
10
+ text = this.text.get('en');
11
+ }
12
+ if (params) {
13
+ Object.keys(params).forEach(key => {
14
+ text = text.replace(`{${key}}`, params[key]);
15
+ });
16
+ }
17
+ return text;
18
+ }
19
+ set(language, text) {
20
+ this.text.set(language, text);
21
+ }
22
+ has(language) {
23
+ return this.text.has(language);
24
+ }
25
+ getAll() {
26
+ return this.text;
27
+ }
28
+ setAll(text) {
29
+ this.text = text;
30
+ }
31
+ }
@@ -1,6 +1,6 @@
1
- import { Client } from "discord.js";
2
- export declare class EmojiFallback {
3
- static getEmoji(client: Client, emojiId: string, fallbackEmoji: any): any;
4
- static getEmojiByName(client: Client, emojiName: string, fallbackEmoji: any): any;
5
- static getEmojiByIdentifier(client: Client, emojiId: string, fallbackEmoji: any): any;
6
- }
1
+ import { Client } from "discord.js";
2
+ export declare class EmojiFallback {
3
+ static getEmoji(client: Client, emojiId: string, fallbackEmoji: any): any;
4
+ static getEmojiByName(client: Client, emojiName: string, fallbackEmoji: any): any;
5
+ static getEmojiByIdentifier(client: Client, emojiId: string, fallbackEmoji: any): any;
6
+ }
@@ -1,14 +1,14 @@
1
- export class EmojiFallback {
2
- static getEmoji(client, emojiId, fallbackEmoji) {
3
- const emoji = client.emojis.cache.get(emojiId);
4
- return emoji?.toString() || fallbackEmoji;
5
- }
6
- static getEmojiByName(client, emojiName, fallbackEmoji) {
7
- const emoji = client.emojis.cache.find(emoji => emoji.name === emojiName);
8
- return emoji?.toString() || fallbackEmoji;
9
- }
10
- static getEmojiByIdentifier(client, emojiId, fallbackEmoji) {
11
- const emoji = client.emojis.cache.find(emoji => emoji.id === emojiId);
12
- return emoji?.toString() || fallbackEmoji;
13
- }
14
- }
1
+ export class EmojiFallback {
2
+ static getEmoji(client, emojiId, fallbackEmoji) {
3
+ const emoji = client.emojis.cache.get(emojiId);
4
+ return emoji?.toString() || fallbackEmoji;
5
+ }
6
+ static getEmojiByName(client, emojiName, fallbackEmoji) {
7
+ const emoji = client.emojis.cache.find(emoji => emoji.name === emojiName);
8
+ return emoji?.toString() || fallbackEmoji;
9
+ }
10
+ static getEmojiByIdentifier(client, emojiId, fallbackEmoji) {
11
+ const emoji = client.emojis.cache.find(emoji => emoji.id === emojiId);
12
+ return emoji?.toString() || fallbackEmoji;
13
+ }
14
+ }
@@ -1,26 +1,26 @@
1
- export declare class TextFormatter {
2
- static getUser(userId: string): string;
3
- static getChannel(channelId: string): string;
4
- static getRole(roleId: string): string;
5
- static getEmoji(emojiId: string): string;
6
- static getEmojiAnimated(emojiId: string): string;
7
- static getMember(memberId: string): string;
8
- static getTimestamp(timestamp: number, format: string): string;
9
- static getTimestampFromDate(date: Date, format: string): string;
10
- static getTimestampFromNow(format: string): string;
11
- static getCodeBlock(code: string, language: string): string;
12
- static getInlineCodeBlock(code: string): string;
13
- static getBold(text: string): string;
14
- static getItalic(text: string): string;
15
- static getUnderline(text: string): string;
16
- static getStrikethrough(text: string): string;
17
- static getSpoiler(text: string): string;
18
- static getQuote(text: string): string;
19
- static getBlockQuote(text: string): string;
20
- static getHyperlink(text: string, url: string): string;
21
- static getHyperlinkWithTooltip(text: string, url: string, tooltip: string): string;
22
- static getHyperlinkWithTooltipAndImage(text: string, url: string, tooltip: string, imageUrl: string): string;
23
- static getHyperlinkWithImage(text: string, url: string, imageUrl: string): string;
24
- static getProgressbar(progress: number, max: number, length: number, filled: string, empty: string): string;
25
- static getProgressbarWithText(progress: number, max: number, length: number, filled: string, empty: string, text: string): string;
26
- }
1
+ export declare class TextFormatter {
2
+ static getUser(userId: string): string;
3
+ static getChannel(channelId: string): string;
4
+ static getRole(roleId: string): string;
5
+ static getEmoji(emojiId: string): string;
6
+ static getEmojiAnimated(emojiId: string): string;
7
+ static getMember(memberId: string): string;
8
+ static getTimestamp(timestamp: number, format: string): string;
9
+ static getTimestampFromDate(date: Date, format: string): string;
10
+ static getTimestampFromNow(format: string): string;
11
+ static getCodeBlock(code: string, language: string): string;
12
+ static getInlineCodeBlock(code: string): string;
13
+ static getBold(text: string): string;
14
+ static getItalic(text: string): string;
15
+ static getUnderline(text: string): string;
16
+ static getStrikethrough(text: string): string;
17
+ static getSpoiler(text: string): string;
18
+ static getQuote(text: string): string;
19
+ static getBlockQuote(text: string): string;
20
+ static getHyperlink(text: string, url: string): string;
21
+ static getHyperlinkWithTooltip(text: string, url: string, tooltip: string): string;
22
+ static getHyperlinkWithTooltipAndImage(text: string, url: string, tooltip: string, imageUrl: string): string;
23
+ static getHyperlinkWithImage(text: string, url: string, imageUrl: string): string;
24
+ static getProgressbar(progress: number, max: number, length: number, filled: string, empty: string): string;
25
+ static getProgressbarWithText(progress: number, max: number, length: number, filled: string, empty: string, text: string): string;
26
+ }
@@ -1,82 +1,82 @@
1
- export class TextFormatter {
2
- static getUser(userId) {
3
- return `<@${userId}>`;
4
- }
5
- static getChannel(channelId) {
6
- return `<#${channelId}>`;
7
- }
8
- static getRole(roleId) {
9
- return `<@&${roleId}>`;
10
- }
11
- static getEmoji(emojiId) {
12
- return `<:${emojiId}>`;
13
- }
14
- static getEmojiAnimated(emojiId) {
15
- return `<a:${emojiId}>`;
16
- }
17
- static getMember(memberId) {
18
- return `<@!${memberId}>`;
19
- }
20
- // Formats: https://discord.com/developers/docs/reference#message-formatting-formats
21
- static getTimestamp(timestamp, format) {
22
- return `<t:${timestamp}:${format}>`;
23
- }
24
- // Formats: https://discord.com/developers/docs/reference#message-formatting-formats
25
- static getTimestampFromDate(date, format) {
26
- return `<t:${Math.trunc(date.getTime() / 1000)}:${format}>`;
27
- }
28
- // Formats: https://discord.com/developers/docs/reference#message-formatting-formats
29
- static getTimestampFromNow(format) {
30
- return `<t:${Math.trunc(Math.floor(Date.now() / 1000))}:${format}>`;
31
- }
32
- static getCodeBlock(code, language) {
33
- return `\`\`\`${language}
34
- ${code}
35
- \`\`\``;
36
- }
37
- static getInlineCodeBlock(code) {
38
- return `\`${code}\``;
39
- }
40
- static getBold(text) {
41
- return `**${text}**`;
42
- }
43
- static getItalic(text) {
44
- return `*${text}*`;
45
- }
46
- static getUnderline(text) {
47
- return `__${text}__`;
48
- }
49
- static getStrikethrough(text) {
50
- return `~~${text}~~`;
51
- }
52
- static getSpoiler(text) {
53
- return `||${text}||`;
54
- }
55
- static getQuote(text) {
56
- return `> ${text}`;
57
- }
58
- static getBlockQuote(text) {
59
- return `>>> ${text}`;
60
- }
61
- static getHyperlink(text, url) {
62
- return `[${text}](${url})`;
63
- }
64
- static getHyperlinkWithTooltip(text, url, tooltip) {
65
- return `[${text}](${url} "${tooltip}")`;
66
- }
67
- static getHyperlinkWithTooltipAndImage(text, url, tooltip, imageUrl) {
68
- return `[${text}](${url} "${tooltip}":${imageUrl})`;
69
- }
70
- static getHyperlinkWithImage(text, url, imageUrl) {
71
- return `[${text}](${url}:${imageUrl})`;
72
- }
73
- static getProgressbar(progress, max, length, filled, empty) {
74
- const percentage = progress / max;
75
- const filledLength = Math.round(length * percentage);
76
- const emptyLength = length - filledLength;
77
- return filled.repeat(filledLength) + empty.repeat(emptyLength);
78
- }
79
- static getProgressbarWithText(progress, max, length, filled, empty, text) {
80
- return `${this.getProgressbar(progress, max, length, filled, empty)} ${text}`;
81
- }
82
- }
1
+ export class TextFormatter {
2
+ static getUser(userId) {
3
+ return `<@${userId}>`;
4
+ }
5
+ static getChannel(channelId) {
6
+ return `<#${channelId}>`;
7
+ }
8
+ static getRole(roleId) {
9
+ return `<@&${roleId}>`;
10
+ }
11
+ static getEmoji(emojiId) {
12
+ return `<:${emojiId}>`;
13
+ }
14
+ static getEmojiAnimated(emojiId) {
15
+ return `<a:${emojiId}>`;
16
+ }
17
+ static getMember(memberId) {
18
+ return `<@!${memberId}>`;
19
+ }
20
+ // Formats: https://discord.com/developers/docs/reference#message-formatting-formats
21
+ static getTimestamp(timestamp, format) {
22
+ return `<t:${timestamp}:${format}>`;
23
+ }
24
+ // Formats: https://discord.com/developers/docs/reference#message-formatting-formats
25
+ static getTimestampFromDate(date, format) {
26
+ return `<t:${Math.trunc(date.getTime() / 1000)}:${format}>`;
27
+ }
28
+ // Formats: https://discord.com/developers/docs/reference#message-formatting-formats
29
+ static getTimestampFromNow(format) {
30
+ return `<t:${Math.trunc(Math.floor(Date.now() / 1000))}:${format}>`;
31
+ }
32
+ static getCodeBlock(code, language) {
33
+ return `\`\`\`${language}
34
+ ${code}
35
+ \`\`\``;
36
+ }
37
+ static getInlineCodeBlock(code) {
38
+ return `\`${code}\``;
39
+ }
40
+ static getBold(text) {
41
+ return `**${text}**`;
42
+ }
43
+ static getItalic(text) {
44
+ return `*${text}*`;
45
+ }
46
+ static getUnderline(text) {
47
+ return `__${text}__`;
48
+ }
49
+ static getStrikethrough(text) {
50
+ return `~~${text}~~`;
51
+ }
52
+ static getSpoiler(text) {
53
+ return `||${text}||`;
54
+ }
55
+ static getQuote(text) {
56
+ return `> ${text}`;
57
+ }
58
+ static getBlockQuote(text) {
59
+ return `>>> ${text}`;
60
+ }
61
+ static getHyperlink(text, url) {
62
+ return `[${text}](${url})`;
63
+ }
64
+ static getHyperlinkWithTooltip(text, url, tooltip) {
65
+ return `[${text}](${url} "${tooltip}")`;
66
+ }
67
+ static getHyperlinkWithTooltipAndImage(text, url, tooltip, imageUrl) {
68
+ return `[${text}](${url} "${tooltip}":${imageUrl})`;
69
+ }
70
+ static getHyperlinkWithImage(text, url, imageUrl) {
71
+ return `[${text}](${url}:${imageUrl})`;
72
+ }
73
+ static getProgressbar(progress, max, length, filled, empty) {
74
+ const percentage = progress / max;
75
+ const filledLength = Math.round(length * percentage);
76
+ const emptyLength = length - filledLength;
77
+ return filled.repeat(filledLength) + empty.repeat(emptyLength);
78
+ }
79
+ static getProgressbarWithText(progress, max, length, filled, empty, text) {
80
+ return `${this.getProgressbar(progress, max, length, filled, empty)} ${text}`;
81
+ }
82
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "zumito-framework",
3
- "version": "1.1.45",
3
+ "version": "1.1.46",
4
4
  "description": "Discord.js bot framework",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -1,17 +1,17 @@
1
- import { Command, CommandParameters } from "zumito-framework";
2
-
3
- export class {{capitalize command}} extends Command {
4
-
5
- execute({ message, interaction, args, client, framework, guildSettings }: CommandParameters): void {
6
- (message || interaction!).reply({
7
- content: "Message content",
8
- });
9
- }
10
-
11
- async selectMenu({ path, interaction, client, framework }: SelectMenuParameters): Promise<void> {
12
- await interaction.deferUpdate();
13
- await interaction.editReply({
14
- content: "Select menu content",
15
- });
16
- }
1
+ import { Command, CommandParameters } from "zumito-framework";
2
+
3
+ export class {{capitalize command}} extends Command {
4
+
5
+ execute({ message, interaction, args, client, framework, guildSettings }: CommandParameters): void {
6
+ (message || interaction!).reply({
7
+ content: "Message content",
8
+ });
9
+ }
10
+
11
+ async selectMenu({ path, interaction, client, framework }: SelectMenuParameters): Promise<void> {
12
+ await interaction.deferUpdate();
13
+ await interaction.editReply({
14
+ content: "Select menu content",
15
+ });
16
+ }
17
17
  }
@@ -1,8 +1,8 @@
1
- {
2
- "command": {
3
-
4
- },
5
- "global": {
6
-
7
- }
1
+ {
2
+ "command": {
3
+
4
+ },
5
+ "global": {
6
+
7
+ }
8
8
  }
package/plopfile.js CHANGED
@@ -1,89 +1,89 @@
1
- module.exports = function (plop) {
2
- plop.setHelper('capitalize', function (text) {
3
- return text.charAt(0).toUpperCase() + text.slice(1);
4
- });
5
- // create your generators here
6
- plop.setGenerator('command', {
7
- description: 'this is a skeleton command file',
8
- prompts: [{
9
- type: 'input',
10
- name: 'module',
11
- message: 'Name of the module',
12
- }, {
13
- type: 'input',
14
- name: 'command',
15
- message: 'Name of the command',
16
- }],
17
- actions: [{
18
- type: 'add',
19
- path: 'src/modules/{{module}}/commands/{{command}}.js',
20
- templateFile: 'plop-templates/command.js.hbs',
21
- }],
22
- });
23
- plop.setGenerator('translation', {
24
- description: 'This generate translation file for a module',
25
- prompts: [{
26
- type: 'input',
27
- name: 'module',
28
- message: 'Name of the module',
29
- }, {
30
- type: 'choice',
31
- name: 'language',
32
- message: 'Language of the translations',
33
- choices: [{
34
- name: 'English',
35
- value: 'en',
36
- }, {
37
- name: 'Spanish',
38
- value: 'es',
39
- }, {
40
- name: 'French',
41
- value: 'fr',
42
- }, {
43
- name: 'German',
44
- value: 'de',
45
- }, {
46
- name: 'Italian',
47
- value: 'it',
48
- }, {
49
- name: 'Portuguese',
50
- value: 'pt',
51
- }, {
52
- name: 'Russian',
53
- value: 'ru',
54
- }, {
55
- name: 'Turkish',
56
- value: 'tr',
57
- }, {
58
- name: 'Chinese',
59
- value: 'zh',
60
- }, {
61
- name: 'Japanese',
62
- value: 'ja',
63
- }, {
64
- name: 'Korean',
65
- value: 'ko',
66
- }, {
67
- name: 'Polish',
68
- value: 'pl',
69
- }, {
70
- name: 'Romanian',
71
- value: 'ro',
72
- }, {
73
- name: 'Russian',
74
- value: 'ru',
75
- }, {
76
- name: 'Ukrainian',
77
- value: 'uk',
78
- }, {
79
- name: 'Vietnamese',
80
- value: 'vi',
81
- }],
82
- }],
83
- actions: [{
84
- type: 'add',
85
- path: 'src/modules/{{module}}/translations/{{language}}.json',
86
- templateFile: 'plop-templates/translation.json.hbs',
87
- }],
88
- });
1
+ module.exports = function (plop) {
2
+ plop.setHelper('capitalize', function (text) {
3
+ return text.charAt(0).toUpperCase() + text.slice(1);
4
+ });
5
+ // create your generators here
6
+ plop.setGenerator('command', {
7
+ description: 'this is a skeleton command file',
8
+ prompts: [{
9
+ type: 'input',
10
+ name: 'module',
11
+ message: 'Name of the module',
12
+ }, {
13
+ type: 'input',
14
+ name: 'command',
15
+ message: 'Name of the command',
16
+ }],
17
+ actions: [{
18
+ type: 'add',
19
+ path: 'src/modules/{{module}}/commands/{{command}}.js',
20
+ templateFile: 'plop-templates/command.js.hbs',
21
+ }],
22
+ });
23
+ plop.setGenerator('translation', {
24
+ description: 'This generate translation file for a module',
25
+ prompts: [{
26
+ type: 'input',
27
+ name: 'module',
28
+ message: 'Name of the module',
29
+ }, {
30
+ type: 'choice',
31
+ name: 'language',
32
+ message: 'Language of the translations',
33
+ choices: [{
34
+ name: 'English',
35
+ value: 'en',
36
+ }, {
37
+ name: 'Spanish',
38
+ value: 'es',
39
+ }, {
40
+ name: 'French',
41
+ value: 'fr',
42
+ }, {
43
+ name: 'German',
44
+ value: 'de',
45
+ }, {
46
+ name: 'Italian',
47
+ value: 'it',
48
+ }, {
49
+ name: 'Portuguese',
50
+ value: 'pt',
51
+ }, {
52
+ name: 'Russian',
53
+ value: 'ru',
54
+ }, {
55
+ name: 'Turkish',
56
+ value: 'tr',
57
+ }, {
58
+ name: 'Chinese',
59
+ value: 'zh',
60
+ }, {
61
+ name: 'Japanese',
62
+ value: 'ja',
63
+ }, {
64
+ name: 'Korean',
65
+ value: 'ko',
66
+ }, {
67
+ name: 'Polish',
68
+ value: 'pl',
69
+ }, {
70
+ name: 'Romanian',
71
+ value: 'ro',
72
+ }, {
73
+ name: 'Russian',
74
+ value: 'ru',
75
+ }, {
76
+ name: 'Ukrainian',
77
+ value: 'uk',
78
+ }, {
79
+ name: 'Vietnamese',
80
+ value: 'vi',
81
+ }],
82
+ }],
83
+ actions: [{
84
+ type: 'add',
85
+ path: 'src/modules/{{module}}/translations/{{language}}.json',
86
+ templateFile: 'plop-templates/translation.json.hbs',
87
+ }],
88
+ });
89
89
  };
@@ -1,26 +1,26 @@
1
- #!/usr/bin/env node --experimental-modules --no-warnings
2
- import path from "node:path";
3
- import minimist from "minimist";
4
- import { Plop, run } from "plop";
5
-
6
- const args = process.argv.slice(2);
7
- const argv = minimist(args);
8
-
9
- import { dirname } from "node:path";
10
- import { fileURLToPath } from "node:url";
11
-
12
- const __dirname = dirname(fileURLToPath(import.meta.url));
13
-
14
- Plop.prepare({
15
- cwd: process.cwd(),
16
- configPath: path.join(__dirname, 'plopfile.js'),
17
- preload: argv.preload || [],
18
- completion: argv.completion,
19
- dest: process.cwd()
20
- }, env => Plop.execute(env, (env) => {
21
- const options = {
22
- ...env,
23
- dest: process.cwd() // this will make the destination path to be based on the cwd when calling the wrapper
24
- }
25
- return run(options, undefined, true)
1
+ #!/usr/bin/env node --experimental-modules --no-warnings
2
+ import path from "node:path";
3
+ import minimist from "minimist";
4
+ import { Plop, run } from "plop";
5
+
6
+ const args = process.argv.slice(2);
7
+ const argv = minimist(args);
8
+
9
+ import { dirname } from "node:path";
10
+ import { fileURLToPath } from "node:url";
11
+
12
+ const __dirname = dirname(fileURLToPath(import.meta.url));
13
+
14
+ Plop.prepare({
15
+ cwd: process.cwd(),
16
+ configPath: path.join(__dirname, 'plopfile.js'),
17
+ preload: argv.preload || [],
18
+ completion: argv.completion,
19
+ dest: process.cwd()
20
+ }, env => Plop.execute(env, (env) => {
21
+ const options = {
22
+ ...env,
23
+ dest: process.cwd() // this will make the destination path to be based on the cwd when calling the wrapper
24
+ }
25
+ return run(options, undefined, true)
26
26
  }));