create-reciple 9.12.0 → 10.0.1-dev.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.
Files changed (59) hide show
  1. package/LICENSE +155 -674
  2. package/dist/index.mjs +10 -0
  3. package/dist/index.mjs.map +1 -0
  4. package/package.json +17 -46
  5. package/README.md +0 -44
  6. package/assets/README.md +0 -29
  7. package/dist/bin.d.ts +0 -2
  8. package/dist/bin.js +0 -58
  9. package/dist/bin.js.map +0 -1
  10. package/dist/classes/Addon.d.ts +0 -68
  11. package/dist/classes/Addon.js +0 -111
  12. package/dist/classes/Addon.js.map +0 -1
  13. package/dist/classes/Config.d.ts +0 -31
  14. package/dist/classes/Config.js +0 -61
  15. package/dist/classes/Config.js.map +0 -1
  16. package/dist/classes/Setup.d.ts +0 -43
  17. package/dist/classes/Setup.js +0 -149
  18. package/dist/classes/Setup.js.map +0 -1
  19. package/dist/classes/TemplateBuilder.d.ts +0 -94
  20. package/dist/classes/TemplateBuilder.js +0 -244
  21. package/dist/classes/TemplateBuilder.js.map +0 -1
  22. package/dist/index.d.ts +0 -7
  23. package/dist/index.js +0 -8
  24. package/dist/index.js.map +0 -1
  25. package/dist/utils/constants.d.ts +0 -13
  26. package/dist/utils/constants.js +0 -75
  27. package/dist/utils/constants.js.map +0 -1
  28. package/dist/utils/helpers.d.ts +0 -32
  29. package/dist/utils/helpers.js +0 -88
  30. package/dist/utils/helpers.js.map +0 -1
  31. package/dist/utils/types.d.ts +0 -20
  32. package/dist/utils/types.js +0 -2
  33. package/dist/utils/types.js.map +0 -1
  34. package/templates/javascript/dot.gitignore +0 -130
  35. package/templates/javascript/modules/commands/PingCommand.js +0 -68
  36. package/templates/javascript/modules/events/WelcomeEvent.js +0 -54
  37. package/templates/javascript/modules/halts/CommandErrorHalt.js +0 -59
  38. package/templates/javascript/modules/preconditions/ExamplePrecondition.js +0 -27
  39. package/templates/javascript/nodemon.json +0 -16
  40. package/templates/javascript/package.json +0 -18
  41. package/templates/javascript/template.json +0 -4
  42. package/templates/typescript/dot.gitignore +0 -133
  43. package/templates/typescript/nodemon.json +0 -17
  44. package/templates/typescript/package.json +0 -21
  45. package/templates/typescript/src/commands/PingCommand.ts +0 -52
  46. package/templates/typescript/src/events/WelcomeEvent.ts +0 -39
  47. package/templates/typescript/src/halts/CommandErrorHalt.ts +0 -44
  48. package/templates/typescript/src/preconditions/ExamplePrecondition.ts +0 -18
  49. package/templates/typescript/template.json +0 -4
  50. package/templates/typescript/tsconfig.json +0 -19
  51. package/templates/typescript-decorators/dot.gitignore +0 -133
  52. package/templates/typescript-decorators/nodemon.json +0 -17
  53. package/templates/typescript-decorators/package.json +0 -22
  54. package/templates/typescript-decorators/src/commands/PingCommand.ts +0 -45
  55. package/templates/typescript-decorators/src/events/WelcomeEvent.ts +0 -37
  56. package/templates/typescript-decorators/src/halts/CommandErrorHalt.ts +0 -44
  57. package/templates/typescript-decorators/src/preconditions/ExamplePrecondition.ts +0 -18
  58. package/templates/typescript-decorators/template.json +0 -4
  59. package/templates/typescript-decorators/tsconfig.json +0 -19
@@ -1,32 +0,0 @@
1
- import type { TemplateMetadata } from './types.js';
2
- /**
3
- * Retrieves and returns template metadata from the specified directory.
4
- *
5
- * @param {string} dir - The directory path to retrieve templates from.
6
- * @return {Promise<TemplateMetadata[]>} An array of template metadata objects.
7
- */
8
- export declare function getTemplates(dir: string): Promise<TemplateMetadata[]>;
9
- /**
10
- * Recursively copies files from one directory to another.
11
- *
12
- * @param {string} from - The source directory path.
13
- * @param {string} to - The destination directory path.
14
- * @param {(f: string) => string} [rename] - An optional function to rename files during the copy process.
15
- * @return {Promise<void>} A promise that resolves when the copy is complete.
16
- */
17
- export declare function recursiveCopyFiles(from: string, to: string, rename?: (f: string) => string): Promise<void>;
18
- /**
19
- * Executes a shell command and logs the command before running it. If the command fails, the process exits with a status code of 1.
20
- *
21
- * @param {string} command - The shell command to execute.
22
- * @param {string} [cwd] - The current working directory in which to execute the command. Defaults to the current working directory.
23
- * @return {Promise<void>} A promise that resolves when the command has completed.
24
- */
25
- export declare function runScript(command: string, cwd?: string): Promise<void>;
26
- /**
27
- * Checks if a directory is empty by filtering out hidden files.
28
- *
29
- * @param {string} dir - The directory path to check.
30
- * @return {Promise<boolean>} True if the directory is empty, false otherwise.
31
- */
32
- export declare function isDirEmpty(dir: string): Promise<boolean>;
@@ -1,88 +0,0 @@
1
- import { copyFile, mkdir, readFile, readdir, stat } from 'node:fs/promises';
2
- import { kleur } from 'fallout-utility/strings';
3
- import { execSync } from 'node:child_process';
4
- import { existsAsync } from '@reciple/utils';
5
- import path from 'node:path';
6
- /**
7
- * Retrieves and returns template metadata from the specified directory.
8
- *
9
- * @param {string} dir - The directory path to retrieve templates from.
10
- * @return {Promise<TemplateMetadata[]>} An array of template metadata objects.
11
- */
12
- export async function getTemplates(dir) {
13
- if (!await existsAsync(dir)) {
14
- await mkdir(dir, { recursive: true });
15
- return [];
16
- }
17
- const templates = [];
18
- const contents = (await readdir(dir)).map(d => path.join(dir, d));
19
- for (const file of contents) {
20
- const statData = await stat(file);
21
- if (!statData.isDirectory())
22
- continue;
23
- const id = path.basename(file);
24
- const files = (await readdir(file)).map(d => path.join(file, d));
25
- if (!files.includes(path.join(file, 'template.json')) || !files.includes(path.join(file, 'package.json')))
26
- continue;
27
- const metadata = JSON.parse(await readFile(path.join(file, 'template.json'), 'utf-8'));
28
- const data = {
29
- id,
30
- name: metadata.name,
31
- language: metadata.language,
32
- files: files.filter(f => !f.endsWith('template.json')),
33
- path: file
34
- };
35
- templates.push(data);
36
- }
37
- return templates;
38
- }
39
- /**
40
- * Recursively copies files from one directory to another.
41
- *
42
- * @param {string} from - The source directory path.
43
- * @param {string} to - The destination directory path.
44
- * @param {(f: string) => string} [rename] - An optional function to rename files during the copy process.
45
- * @return {Promise<void>} A promise that resolves when the copy is complete.
46
- */
47
- export async function recursiveCopyFiles(from, to, rename) {
48
- if ((await stat(from)).isDirectory()) {
49
- const contents = await readdir(from);
50
- for (const content of contents) {
51
- await recursiveCopyFiles(path.join(from, content), path.join(to, rename ? rename(content) : content));
52
- }
53
- return;
54
- }
55
- if (to.endsWith('template.json'))
56
- return;
57
- await mkdir(path.dirname(to), { recursive: true });
58
- await copyFile(from, to);
59
- }
60
- /**
61
- * Executes a shell command and logs the command before running it. If the command fails, the process exits with a status code of 1.
62
- *
63
- * @param {string} command - The shell command to execute.
64
- * @param {string} [cwd] - The current working directory in which to execute the command. Defaults to the current working directory.
65
- * @return {Promise<void>} A promise that resolves when the command has completed.
66
- */
67
- export async function runScript(command, cwd) {
68
- console.log(kleur.gray(kleur.bold('$') + ' ' + command));
69
- try {
70
- execSync(`${command}`, { cwd, env: { ...process.env, FORCE_COLOR: '1' }, stdio: ['inherit', 'inherit', 'inherit'] });
71
- }
72
- catch (error) {
73
- process.exit(1);
74
- }
75
- }
76
- /**
77
- * Checks if a directory is empty by filtering out hidden files.
78
- *
79
- * @param {string} dir - The directory path to check.
80
- * @return {Promise<boolean>} True if the directory is empty, false otherwise.
81
- */
82
- export async function isDirEmpty(dir) {
83
- if (!await existsAsync(dir))
84
- return true;
85
- const contents = (await readdir(dir)).filter(f => !f.startsWith('.'));
86
- return contents.length === 0;
87
- }
88
- //# sourceMappingURL=helpers.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"helpers.js","sourceRoot":"","sources":["../../src/utils/helpers.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,QAAQ,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AAE5E,OAAO,EAAE,KAAK,EAAE,MAAM,yBAAyB,CAAC;AAChD,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAC9C,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC7C,OAAO,IAAI,MAAM,WAAW,CAAC;AAE7B;;;;;GAKG;AACH,MAAM,CAAC,KAAK,UAAU,YAAY,CAAC,GAAW;IA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AC,CAAC;IACzD,IAAI,CAAC;QACD,QAAQ,CAAC,GAAG,OAAO,EAAE,EAAE,EAAE,GAAG,EAAE,GAAG,EAAE,EAAE,GAAG,OAAO,CAAC,GAAG,EAAE,WAAW,EAAE,GAAG,EAAE,EAAE,KAAK,EAAE,CAAC,SAAS,EAAE,SAAS,EAAE,SAAS,CAAC,EAAE,CAAC,CAAC;IACzH,CAAC;IAAC,OAAM,KAAK,EAAE,CAAC;QACZ,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IACpB,CAAC;AACL,CAAC;AAED;;;;;GAKG;AACH,MAAM,CAAC,KAAK,UAAU,UAAU,CAAC,GAAW;IACxC,IAAI,CAAC,MAAM,WAAW,CAAC,GAAG,CAAC;QAAE,OAAO,IAAI,CAAC;IAEzC,MAAM,QAAQ,GAAG,CAAC,MAAM,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,CAAC;IACtE,OAAO,QAAQ,CAAC,MAAM,KAAK,CAAC,CAAC;AACjC,CAAC"}
@@ -1,20 +0,0 @@
1
- import type { PackageManager } from '@reciple/utils';
2
- export interface CliOptions {
3
- force: boolean;
4
- typescript: boolean | 'null';
5
- esm: boolean | 'null';
6
- commonjs: boolean | 'null';
7
- packageManager: PackageManager | 'null';
8
- token?: string;
9
- addons: string[] | boolean;
10
- [k: string]: any;
11
- }
12
- export interface TemplateMetadata extends TemplateJson {
13
- id: string;
14
- path: string;
15
- files: string[];
16
- }
17
- export interface TemplateJson {
18
- name: string;
19
- language: 'Javascript' | 'Typescript';
20
- }
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=types.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/utils/types.ts"],"names":[],"mappings":""}
@@ -1,130 +0,0 @@
1
- # Logs
2
- logs
3
- *.log
4
- npm-debug.log*
5
- yarn-debug.log*
6
- yarn-error.log*
7
- lerna-debug.log*
8
- .pnpm-debug.log*
9
-
10
- # Diagnostic reports (https://nodejs.org/api/report.html)
11
- report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json
12
-
13
- # Runtime data
14
- pids
15
- *.pid
16
- *.seed
17
- *.pid.lock
18
-
19
- # Directory for instrumented libs generated by jscoverage/JSCover
20
- lib-cov
21
-
22
- # Docs files
23
- docs.json
24
-
25
- # Coverage directory used by tools like istanbul
26
- coverage
27
- *.lcov
28
-
29
- # nyc test coverage
30
- .nyc_output
31
-
32
- # Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
33
- .grunt
34
-
35
- # Bower dependency directory (https://bower.io/)
36
- bower_components
37
-
38
- # node-waf configuration
39
- .lock-wscript
40
-
41
- # Compiled binary addons (https://nodejs.org/api/addons.html)
42
- build/Release
43
-
44
- # Dependency directories
45
- node_modules/
46
- jspm_packages/
47
-
48
- # Snowpack dependency directory (https://snowpack.dev/)
49
- web_modules/
50
-
51
- # TypeScript cache
52
- *.tsbuildinfo
53
-
54
- # Optional npm cache directory
55
- .npm
56
-
57
- # Optional eslint cache
58
- .eslintcache
59
-
60
- # Optional stylelint cache
61
- .stylelintcache
62
-
63
- # Microbundle cache
64
- .rpt2_cache/
65
- .rts2_cache_cjs/
66
- .rts2_cache_es/
67
- .rts2_cache_umd/
68
-
69
- # Optional REPL history
70
- .node_repl_history
71
-
72
- # Output of 'npm pack'
73
- *.tgz
74
-
75
- # Yarn Integrity file
76
- .yarn-integrity
77
-
78
- # dotenv environment variable files
79
- .env
80
- .env.development.local
81
- .env.test.local
82
- .env.production.local
83
- .env.local
84
-
85
- # parcel-bundler cache (https://parceljs.org/)
86
- .cache
87
- .parcel-cache
88
-
89
- # Next.js build output
90
- .next
91
- out
92
-
93
- # Nuxt.js build / generate output
94
- .nuxt
95
- dist
96
-
97
- # Gatsby files
98
- .cache/
99
- # Comment in the public line in if your project uses Gatsby and not Next.js
100
- # https://nextjs.org/blog/next-9-1#public-directory-support
101
- # public
102
-
103
- # vuepress build output
104
- .vuepress/dist
105
-
106
- # vuepress v2.x temp and cache directory
107
- .temp
108
- .cache
109
-
110
- # Serverless directories
111
- .serverless/
112
-
113
- # FuseBox cache
114
- .fusebox/
115
-
116
- # DynamoDB Local files
117
- .dynamodb/
118
-
119
- # TernJS port file
120
- .tern-port
121
-
122
- # Stores VSCode versions used for testing VSCode extensions
123
- .vscode-test
124
-
125
- # yarn v2
126
- .yarn/cache
127
- .yarn/unplugged
128
- .yarn/build-state.yml
129
- .yarn/install-state.gz
130
- .pnp.*
@@ -1,68 +0,0 @@
1
- // @ts-check
2
- import { CommandType, ContextMenuCommandBuilder, MessageCommandBuilder, SlashCommandBuilder } from "reciple";
3
-
4
- export class PingCommand {
5
- /**
6
- * The module commands.
7
- * @typedef {import("reciple").AnyCommandResolvable[]}
8
- */
9
- commands = [
10
- new SlashCommandBuilder()
11
- .setName('ping')
12
- .setDescription('Replies with pong!')
13
- .setExecute(data => this.handleCommandExecute(data)),
14
-
15
- new ContextMenuCommandBuilder()
16
- .setName('ping')
17
- .setType('Message')
18
- .setExecute(data => this.handleCommandExecute(data)),
19
-
20
- new MessageCommandBuilder()
21
- .setName('ping')
22
- .setDescription('Replies with pong!')
23
- .setExecute(data => this.handleCommandExecute(data))
24
- ];
25
-
26
- /**
27
- * Executed when module is started (Bot is not logged in).
28
- *
29
- * @return {Promise<boolean>}
30
- */
31
- async onStart() {
32
- return true;
33
- }
34
-
35
- /**
36
- * Executes when the module is loaded (Bot is logged in).
37
- *
38
- * @return {Promise<void>}
39
- */
40
- async onLoad() {}
41
-
42
- /**
43
- * Executes when the module is unloaded (Bot is pre log out).
44
- *
45
- * @return {Promise<void>}
46
- */
47
- async onUnload() {}
48
-
49
- /**
50
- * Called by the command builder when a command is executed.
51
- *
52
- * @param {import("reciple").AnyCommandExecuteData} data
53
- * @returns {Promise<void>}
54
- */
55
- async handleCommandExecute(data) {
56
- switch (data.type) {
57
- case CommandType.ContextMenuCommand:
58
- case CommandType.SlashCommand:
59
- await data.interaction.reply('Pong!');
60
- return;
61
- case CommandType.MessageCommand:
62
- await data.message.reply('Pong!');
63
- return;
64
- }
65
- }
66
- }
67
-
68
- export default new PingCommand();
@@ -1,54 +0,0 @@
1
- // @ts-check
2
-
3
- import { GuildMember } from "discord.js";
4
-
5
- export class WelcomeEvent {
6
- constructor() {
7
- // Make sure `handleWelcomeEvent` is bound to `this`
8
- this.handleWelcomeEvent = this.handleWelcomeEvent.bind(this);
9
- }
10
-
11
- /**
12
- * Executed when module is started (Bot is not logged in).
13
- *
14
- * @return {Promise<boolean>}
15
- */
16
- async onStart() {
17
- return true;
18
- }
19
-
20
- /**
21
- * Executes when the module is loaded (Bot is logged in).
22
- *
23
- * @param {import("reciple").RecipleModuleLoadData} param0
24
- * @return {Promise<void>}
25
- */
26
- async onLoad({ client }) {
27
- // Add the listener to the client
28
- client.on('guildMemberAdd', this.handleWelcomeEvent);
29
- }
30
-
31
- /**
32
- * Executes when the module is unloaded (Bot is pre log out).
33
- *
34
- * @param {import("reciple").RecipleModuleUnloadData} param0
35
- * @return {Promise<void>}
36
- */
37
- async onUnload({ client }) {
38
- // Properly remove the listener from the client
39
- client.removeListener('guildMemberAdd', this.handleWelcomeEvent);
40
- }
41
-
42
- /**
43
- * Called when a user joins the server.
44
- *
45
- * @param {GuildMember} member
46
- * @return {Promise<void>}
47
- */
48
- async handleWelcomeEvent(member) {
49
- await member.send(`Welcome to **${member.guild.name}** server!`)
50
- .catch(() => null);
51
- }
52
- }
53
-
54
- export default new WelcomeEvent();
@@ -1,59 +0,0 @@
1
- // @ts-check
2
-
3
- import { CommandHaltReason, CommandType } from 'reciple';
4
-
5
- export class CommandErrorHalt {
6
- id = 'my.reciple.js.commanderrorhalt';
7
- disabled = false;
8
-
9
- /**
10
- * @param {import('reciple').ContextMenuCommandHaltTriggerData} data
11
- */
12
- contextMenuCommandHalt(data) {
13
- return this.halt(data);
14
- }
15
-
16
- /**
17
- * @param {import('reciple').MessageCommandHaltTriggerData} data
18
- */
19
- messageCommandHalt(data) {
20
- return this.halt(data);
21
- }
22
-
23
- /**
24
- * @param {import('reciple').SlashCommandHaltTriggerData} data
25
- */
26
- slashCommandHalt(data) {
27
- return this.halt(data);
28
- }
29
-
30
- /**
31
- * @param {import('reciple').AnyCommandHaltTriggerData} data
32
- * @returns
33
- */
34
- async halt(data) {
35
- if (data.reason !== CommandHaltReason.Error) return;
36
-
37
- const content = `An error occured while executing this command`;
38
-
39
- switch (data.commandType) {
40
- case CommandType.ContextMenuCommand:
41
- case CommandType.SlashCommand:
42
- const interaction = data.executeData.interaction;
43
-
44
- if (interaction.replied || interaction.deferred) {
45
- await interaction.editReply(content);
46
- } else {
47
- await interaction.reply(content);
48
- }
49
- break;
50
- case CommandType.MessageCommand:
51
- await data.executeData.message.reply(content);
52
- break;
53
- }
54
-
55
- reciple.logger?.error(data.error);
56
-
57
- return true;
58
- }
59
- }
@@ -1,27 +0,0 @@
1
- // @ts-check
2
-
3
- export class ExamplePrecondition {
4
- id = 'my.reciple.js.exampleprecondition';
5
- disabled = false;
6
-
7
- /**
8
- * @param {import("reciple").ContextMenuCommandExecuteData} execute
9
- */
10
- contextMenuCommandExecute(execute) {
11
- return true;
12
- }
13
-
14
- /**
15
- * @param {import("reciple").MessageCommandExecuteData} excute
16
- */
17
- messageCommandExecute(excute) {
18
- return true;
19
- }
20
-
21
- /**
22
- * @param {import("reciple").SlashCommandExecuteData} execute
23
- */
24
- slashCommandExecute(execute) {
25
- return true;
26
- }
27
- };
@@ -1,16 +0,0 @@
1
- {
2
- "$schema": "https://raw.githubusercontent.com/SchemaStore/schemastore/master/src/schemas/json/nodemon.json",
3
- "restartable": "r",
4
- "ext": "js,mjs,json",
5
- "signal": "SIGHUP",
6
- "ignore": [
7
- ".git",
8
- "node_modules/**"
9
- ],
10
- "watch": [
11
- "src",
12
- "reciple.mjs",
13
- ".env"
14
- ],
15
- "exec": "reciple start"
16
- }
@@ -1,18 +0,0 @@
1
- {
2
- "name": "reciple-app",
3
- "type": "module",
4
- "private": true,
5
- "scripts": {
6
- "start": "reciple start -c reciple.mjs",
7
- "dev": "nodemon --config nodemon.json"
8
- },
9
- "dependencies": {
10
- "@reciple/core": "RECIPLE_CORE",
11
- "discord.js": "DISCORDJS",
12
- "reciple": "RECIPLE"
13
- },
14
- "devDependencies": {
15
- "@types/node": "TYPES_NODE",
16
- "nodemon": "NODEMON"
17
- }
18
- }
@@ -1,4 +0,0 @@
1
- {
2
- "name": "Javascript",
3
- "language": "Javascript"
4
- }
@@ -1,133 +0,0 @@
1
- # Logs
2
- logs
3
- *.log
4
- npm-debug.log*
5
- yarn-debug.log*
6
- yarn-error.log*
7
- lerna-debug.log*
8
- .pnpm-debug.log*
9
-
10
- # Diagnostic reports (https://nodejs.org/api/report.html)
11
- report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json
12
-
13
- # Runtime data
14
- pids
15
- *.pid
16
- *.seed
17
- *.pid.lock
18
-
19
- # Directory for instrumented libs generated by jscoverage/JSCover
20
- lib-cov
21
-
22
- # Docs files
23
- docs.json
24
-
25
- # Coverage directory used by tools like istanbul
26
- coverage
27
- *.lcov
28
-
29
- # nyc test coverage
30
- .nyc_output
31
-
32
- # Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
33
- .grunt
34
-
35
- # Bower dependency directory (https://bower.io/)
36
- bower_components
37
-
38
- # node-waf configuration
39
- .lock-wscript
40
-
41
- # Compiled binary addons (https://nodejs.org/api/addons.html)
42
- build/Release
43
-
44
- # Dependency directories
45
- node_modules/
46
- jspm_packages/
47
-
48
- # Snowpack dependency directory (https://snowpack.dev/)
49
- web_modules/
50
-
51
- # TypeScript cache
52
- *.tsbuildinfo
53
-
54
- # Optional npm cache directory
55
- .npm
56
-
57
- # Optional eslint cache
58
- .eslintcache
59
-
60
- # Optional stylelint cache
61
- .stylelintcache
62
-
63
- # Microbundle cache
64
- .rpt2_cache/
65
- .rts2_cache_cjs/
66
- .rts2_cache_es/
67
- .rts2_cache_umd/
68
-
69
- # Optional REPL history
70
- .node_repl_history
71
-
72
- # Output of 'npm pack'
73
- *.tgz
74
-
75
- # Yarn Integrity file
76
- .yarn-integrity
77
-
78
- # dotenv environment variable files
79
- .env
80
- .env.development.local
81
- .env.test.local
82
- .env.production.local
83
- .env.local
84
-
85
- # parcel-bundler cache (https://parceljs.org/)
86
- .cache
87
- .parcel-cache
88
-
89
- # Next.js build output
90
- .next
91
- out
92
-
93
- # Nuxt.js build / generate output
94
- .nuxt
95
- dist
96
-
97
- # Gatsby files
98
- .cache/
99
- # Comment in the public line in if your project uses Gatsby and not Next.js
100
- # https://nextjs.org/blog/next-9-1#public-directory-support
101
- # public
102
-
103
- # vuepress build output
104
- .vuepress/dist
105
-
106
- # vuepress v2.x temp and cache directory
107
- .temp
108
- .cache
109
-
110
- # Serverless directories
111
- .serverless/
112
-
113
- # FuseBox cache
114
- .fusebox/
115
-
116
- # DynamoDB Local files
117
- .dynamodb/
118
-
119
- # TernJS port file
120
- .tern-port
121
-
122
- # Stores VSCode versions used for testing VSCode extensions
123
- .vscode-test
124
-
125
- # yarn v2
126
- .yarn/cache
127
- .yarn/unplugged
128
- .yarn/build-state.yml
129
- .yarn/install-state.gz
130
- .pnp.*
131
-
132
- # Output files
133
- modules
@@ -1,17 +0,0 @@
1
- {
2
- "$schema": "https://raw.githubusercontent.com/SchemaStore/schemastore/master/src/schemas/json/nodemon.json",
3
- "restartable": "r",
4
- "ext": "ts,mts,mjs,json",
5
- "signal": "SIGHUP",
6
- "ignore": [
7
- ".git",
8
- "node_modules/**",
9
- "modules"
10
- ],
11
- "watch": [
12
- "src",
13
- "reciple.mjs",
14
- ".env"
15
- ],
16
- "exec": "rimraf ./modules && tsc && reciple start"
17
- }