Skip to content

Commit

Permalink
refactor date utils (#237)
Browse files Browse the repository at this point in the history
* refactor: rename date-utils to utils/date

* docs: update pnpm commands
  • Loading branch information
samhwang authored Apr 13, 2024
1 parent d48514f commit ace03af
Show file tree
Hide file tree
Showing 12 changed files with 18 additions and 18 deletions.
16 changes: 8 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -121,9 +121,9 @@ Run these commands at the root of the project
docker compose up -d db

pnpm install
pnpm prisma:gen
pnpm deploy:command
pnpm start
pnpm run prisma:gen
pnpm run deploy:command
pnpm run start
```

---
Expand All @@ -133,8 +133,8 @@ pnpm start
### DB migration & Client Generation

```bash
pnpm prisma:migrate
pnpm prisma:gen
pnpm run prisma:migrate
pnpm run prisma:gen
```

### DB GUI
Expand All @@ -158,7 +158,7 @@ export const commandList: Command[] = [yourCommand];
- Run the `deploy:command` command.

```bash
pnpm deploy:command
pnpm run deploy:command
```

- **IMPORTANT:** You should only deploy your commands **ONCE ONLY** after
Expand All @@ -182,8 +182,8 @@ pnpm deploy:command
### Running lints and tests

```bash
pnpm format
pnpm test
pnpm run format
pnpm run test
```

---
Expand Down
2 changes: 1 addition & 1 deletion bin/broadcast-reminder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { Result } from 'oxide.ts';
import { getDiscordClient } from '../src/clients';
import { formatReminderMessage, getReminderByTime, removeReminders } from '../src/commands/reminder/utils';
import { getReminderChannel } from '../src/commands/serverSettings/utils';
import { getCurrentUnixTime } from '../src/utils/date-utils';
import { getCurrentUnixTime } from '../src/utils/date';
import { loadEnv } from '../src/utils/load-env';
import { logger } from '../src/utils/logger';

Expand Down
2 changes: 1 addition & 1 deletion scripts/delete-guild-commands.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Result } from 'oxide.ts';
import { deployGuildCommands } from '../src/commands/deploy-command';
import { getCurrentUnixTime } from '../src/utils/date-utils';
import { getCurrentUnixTime } from '../src/utils/date';
import { loadEnv } from '../src/utils/load-env';
import { logger } from '../src/utils/logger';

Expand Down
2 changes: 1 addition & 1 deletion scripts/deploy-guild-commands.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Result } from 'oxide.ts';
import { commandList, contextMenuCommandList } from '../src/commands';
import { deployGuildCommands } from '../src/commands/deploy-command';
import { getCurrentUnixTime } from '../src/utils/date-utils';
import { getCurrentUnixTime } from '../src/utils/date';
import { loadEnv } from '../src/utils/load-env';
import { logger } from '../src/utils/logger';

Expand Down
2 changes: 1 addition & 1 deletion src/commands/referral/parseDate.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { isAfter, isEqual, isValid, parse } from 'date-fns';
import { DAY_MONTH_YEAR_FORMAT } from '../../utils/date-utils';
import { DAY_MONTH_YEAR_FORMAT } from '../../utils/date';

type ParseInvalidDateError = ['INVALID_DATE'];
type ParseExpiredDateError = ['EXPIRED_DATE'];
Expand Down
2 changes: 1 addition & 1 deletion src/commands/reminder/list.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { getYear } from 'date-fns';
import type { ChatInputCommandInteraction } from 'discord.js';
import { beforeEach, describe, expect, it, vi } from 'vitest';
import { mockDeep, mockReset } from 'vitest-mock-extended';
import { convertDateToEpoch } from '../../utils/date-utils';
import { convertDateToEpoch } from '../../utils/date';
import { execute } from './list';
import { getUserReminders } from './utils';

Expand Down
2 changes: 1 addition & 1 deletion src/commands/reminder/remind-duration.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { addSeconds, getUnixTime, parse } from 'date-fns';
import type { ChatInputCommandInteraction } from 'discord.js';
import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';
import { mockDeep, mockReset } from 'vitest-mock-extended';
import { DAY_MONTH_YEAR_HOUR_MINUTE_FORMAT } from '../../utils/date-utils';
import { DAY_MONTH_YEAR_HOUR_MINUTE_FORMAT } from '../../utils/date';
import { execute } from './remind-duration';
import { saveReminder } from './utils';

Expand Down
2 changes: 1 addition & 1 deletion src/commands/reminder/remind-on-date.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { getYear } from 'date-fns';
import type { ChatInputCommandInteraction } from 'discord.js';
import { beforeEach, describe, expect, it, vi } from 'vitest';
import { mockDeep, mockReset } from 'vitest-mock-extended';
import { convertDateToEpoch } from '../../utils/date-utils';
import { convertDateToEpoch } from '../../utils/date';
import { execute } from './remind-on-date';
import { saveReminder } from './utils';

Expand Down
2 changes: 1 addition & 1 deletion src/commands/reminder/remind-on-date.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { SlashCommandSubcommandBuilder } from 'discord.js';
import { Result } from 'oxide.ts';
import { convertDateToEpoch } from '../../utils/date-utils';
import { convertDateToEpoch } from '../../utils/date';
import type { CommandHandler, Subcommand } from '../builder';
import { saveReminder } from './utils';

Expand Down
2 changes: 1 addition & 1 deletion src/commands/reminder/update.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { getYear } from 'date-fns';
import type { ChatInputCommandInteraction } from 'discord.js';
import { beforeEach, describe, expect, it, vi } from 'vitest';
import { mockDeep, mockReset } from 'vitest-mock-extended';
import { convertDateToEpoch } from '../../utils/date-utils';
import { convertDateToEpoch } from '../../utils/date';
import { execute } from './update';
import { updateReminder } from './utils';

Expand Down
2 changes: 1 addition & 1 deletion src/commands/reminder/update.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { SlashCommandSubcommandBuilder } from 'discord.js';
import { Result } from 'oxide.ts';
import { convertDateToEpoch } from '../../utils/date-utils';
import { convertDateToEpoch } from '../../utils/date';
import type { CommandHandler, Subcommand } from '../builder';
import { updateReminder } from './utils';

Expand Down
File renamed without changes.

0 comments on commit ace03af

Please sign in to comment.