Skip to content

Commit

Permalink
(chore): added husky
Browse files Browse the repository at this point in the history
  • Loading branch information
RozmarinUS committed May 29, 2024
1 parent 8f71e9e commit 32c34b9
Show file tree
Hide file tree
Showing 6 changed files with 3,781 additions and 2,900 deletions.
1 change: 1 addition & 0 deletions .github/husky/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
_
4 changes: 4 additions & 0 deletions .github/husky/commit-msg
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

npx commitlint --config .commitlintrc.json --edit $HUSKY_GIT_PARAMS
4 changes: 4 additions & 0 deletions .github/husky/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

npx lint-staged
31 changes: 31 additions & 0 deletions examples/stat-reporter/src/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
const { ShardingManager } = require('discord.js');
const path = require('path');

const manager = new ShardingManager(path.join(__dirname, 'main.js'), { token: process.env.DISCORD_TOKEN, totalShards: 'auto' });

manager.on('shardCreate', shard => console.log(`Launched shard ${shard.id}`));

manager.on('shardCreate', shard => {
shard.on('reconnecting', () => {
console.log(`Reconnecting shard: [${shard.id}]`);
});

shard.on('spawn', () => {
console.log(`Spawned shard: [${shard.id}]`);
});

shard.on('ready', () => {
console.log(` Shard [${shard.id}] is ready`);
});

shard.on('death', () => {
console.log(`Died shard: [${shard.id}]`);
});

shard.on('error', err => {
console.log(`Error in [${shard.id}] with : ${err} `);
shard.respawn();
});
});

manager.spawn();
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"publish:npm": "release-it",
"prepublish:dev": "npm run build",
"publish:dev": "npm publish --access public --tag dev",
"prepare": "husky install .github/husky",
"prepare": "husky ./.github/husky",
"format": "prettier --write \"packages/**/*.ts\"",
"lint": "eslint --ignore-path .gitignore packages/**/*.ts"
},
Expand Down
Loading

0 comments on commit 32c34b9

Please sign in to comment.