diff --git a/.all-contributorsrc b/.all-contributorsrc
index 901928e9bc..b349d2dfca 100644
--- a/.all-contributorsrc
+++ b/.all-contributorsrc
@@ -5,9 +5,11 @@
"repoHost": "https://github.com",
"files": [
"packages/async-queue/README.md",
+ "packages/cron/README.md",
"packages/decorators/README.md",
"packages/discord-utilities/README.md",
"packages/discord.js-utilities/README.md",
+ "packages/duration/README.md",
"packages/eslint-config/README.md",
"packages/event-iterator/README.md",
"packages/fetch/README.md",
@@ -19,6 +21,8 @@
"packages/snowflake/README.md",
"packages/stopwatch/README.md",
"packages/time-utilities/README.md",
+ "packages/timer-manager/README.md",
+ "packages/timestamp/README.md",
"packages/ts-config/README.md",
"packages/utilities/README.md",
"README.md"
diff --git a/.eslintignore b/.eslintignore
index 4a7bd0aa1e..73ad9149a4 100644
--- a/.eslintignore
+++ b/.eslintignore
@@ -1,5 +1,4 @@
node_modules/
**/dist/
**/docs/
-**/build/
-**/*.d.ts
\ No newline at end of file
+**/*.d.ts
diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS
index 062f8e2a1f..b9cd33a5da 100644
--- a/.github/CODEOWNERS
+++ b/.github/CODEOWNERS
@@ -1,3 +1,7 @@
+/package/cron/**/*.ts @favna @kyranet @vladfrangu
+/package/duration/**/*.ts @favna @kyranet @vladfrangu
+/package/timer-manager/**/*.ts @favna @kyranet @vladfrangu
+/package/timestamp/**/*.ts @favna @kyranet @vladfrangu
/packages/async-queue/**/*.ts @vladfrangu @kyranet @favna
/packages/decorators/**/*.ts @vladfrangu @kyranet @favna
/packages/discord-utilities/**/*.ts @favna
@@ -11,7 +15,7 @@
/packages/ratelimits/**/*.ts @kyranet @vladfrangu @favna
/packages/result/**/*.ts @kyranet @vladfrangu @favna
/packages/snowflake/**/*.ts @favna @vladfrangu @kyranet
-/packages/stopwatch/**/*.ts @Stitch07 @kyranet @vladfrangu
-/packages/time-utilities/**/*.ts @favna @Stitch07 @kyranet @vladfrangu
+/packages/stopwatch/**/*.ts @kyranet @vladfrangu
+/packages/time-utilities/**/*.ts @favna @kyranet @vladfrangu
/packages/ts-config/**/*.ts @favna
/packages/utilities/**/*.ts @favna @kyranet @vladfrangu
diff --git a/.github/labels.yml b/.github/labels.yml
index 872b6cdad4..3b293df400 100644
--- a/.github/labels.yml
+++ b/.github/labels.yml
@@ -40,12 +40,16 @@
color: '24853c'
- name: packages:async-queue
color: 'fbca04'
+- name: packages:cron
+ color: 'fbca04'
- name: packages:decorators
color: 'fbca04'
- name: packages:discord-utilities
color: 'fbca04'
- name: packages:discord.js-utilities
color: 'fbca04'
+- name: packages:duration
+ color: 'fbca04'
- name: packages:eslint-config
color: 'fbca04'
- name: packages:event-iterator
@@ -70,6 +74,10 @@
color: 'fbca04'
- name: packages:time-utilities
color: 'fbca04'
+- name: packages:timer-manager
+ color: 'fbca04'
+- name: packages:timestamp
+ color: 'fbca04'
- name: packages:ts-config
color: 'fbca04'
- name: packages:utilities
diff --git a/.github/workflows/auto-updater.yml b/.github/workflows/auto-updater.yml
index a7fa0c879d..130ec4bb9e 100644
--- a/.github/workflows/auto-updater.yml
+++ b/.github/workflows/auto-updater.yml
@@ -22,7 +22,7 @@ jobs:
- name: Install Dependencies
run: yarn --immutable
- name: Build packages for script
- run: yarn turbo run build --filter=@sapphire/time-utilities --filter=@sapphire/fetch --filter=@sapphire/prettier-config
+ run: yarn turbo run build --filter=@sapphire/timestamp --filter=@sapphire/fetch --filter=@sapphire/prettier-config
- name: Run updater
run: node --experimental-json-modules scripts/twemoji-regex-updater.mjs
- name: Run prettier on the code
diff --git a/.github/workflows/continuous-integration.yml b/.github/workflows/continuous-integration.yml
index e06f671742..cccb180764 100644
--- a/.github/workflows/continuous-integration.yml
+++ b/.github/workflows/continuous-integration.yml
@@ -25,7 +25,7 @@ jobs:
- name: Install Dependencies
run: yarn --immutable
- name: Build ESLint, Prettier and Utilities
- run: yarn turbo run build --filter=@sapphire/eslint-config --filter=@sapphire/prettier-config --filter=@sapphire/utilities --no-deps
+ run: yarn turbo run build --filter=@sapphire/eslint-config --filter=@sapphire/prettier-config --filter=@sapphire/utilities --filter=@sapphire/duration --no-deps
- name: Run ESLint
run: yarn lint --fix=false
@@ -47,7 +47,7 @@ jobs:
- name: Install Dependencies
run: yarn --immutable
- name: Build test dependencies
- run: yarn turbo run build --filter=@sapphire/async-queue --filter=@sapphire/*utilities --filter=@sapphire/ratelimits --filter=@sapphire/fetch --filter=@sapphire/result --filter=@sapphire/lexure --no-deps
+ run: yarn turbo run build --filter=@sapphire/async-queue --filter=@sapphire/*utilities --filter=@sapphire/duration --filter=@sapphire/fetch --filter=@sapphire/lexure --filter=@sapphire/ratelimits --filter=@sapphire/result --filter=@sapphire/timer-manager --no-deps
- name: Run tests
run: yarn test
- name: Store code coverage report
diff --git a/.github/workflows/documentation.yml b/.github/workflows/documentation.yml
index 6350693793..2768743665 100644
--- a/.github/workflows/documentation.yml
+++ b/.github/workflows/documentation.yml
@@ -57,9 +57,11 @@ jobs:
matrix:
package:
- async-queue
+ - cron
- decorators
- discord-utilities
- discord.js-utilities
+ - duration
- event-iterator
- fetch
- lexure
@@ -69,6 +71,8 @@ jobs:
- snowflake
- stopwatch
- time-utilities
+ - timer-manager
+ - timestamp
- utilities
runs-on: ubuntu-latest
env:
diff --git a/.gitignore b/.gitignore
index e2cf69aef6..d73c6cb2a5 100644
--- a/.gitignore
+++ b/.gitignore
@@ -17,7 +17,6 @@ node_modules/
# Build Artifacts
dist/
-build/
docs/
test_out/
*.tsbuildinfo
diff --git a/.npm-deprecaterc.yml b/.npm-deprecaterc.yml
index 8cd5882add..3ddb21a6bf 100644
--- a/.npm-deprecaterc.yml
+++ b/.npm-deprecaterc.yml
@@ -2,18 +2,22 @@ name: '*next*'
verbose: true
package:
- '@sapphire/async-queue'
+ - '@sapphire/cron'
- '@sapphire/decorators'
- '@sapphire/discord-utilities'
- '@sapphire/discord.js-utilities'
+ - '@sapphire/duration'
- '@sapphire/eslint-config'
- '@sapphire/event-iterator'
- '@sapphire/fetch'
+ - '@sapphire/phisherman'
- '@sapphire/prettier-config'
- '@sapphire/ratelimits'
- '@sapphire/result'
- '@sapphire/snowflake'
- '@sapphire/stopwatch'
- '@sapphire/time-utilities'
+ - '@sapphire/timer-manager'
+ - '@sapphire/timestamp'
- '@sapphire/ts-config'
- '@sapphire/utilities'
- - '@sapphire/phisherman'
diff --git a/.prettierignore b/.prettierignore
index 41a949ecbc..907dc6fb43 100644
--- a/.prettierignore
+++ b/.prettierignore
@@ -2,3 +2,4 @@ CHANGELOG.md
.turbo
dist/
coverage/
+.yarn/
diff --git a/README.md b/README.md
index e9d042cf64..01b6d06510 100644
--- a/README.md
+++ b/README.md
@@ -12,22 +12,26 @@
**Packages**
[![npm](https://img.shields.io/npm/v/@sapphire/async-queue?color=crimson&logo=npm&style=flat-square&label=@sapphire/async-queue)](https://www.npmjs.com/package/@sapphire/async-queue)
+[![npm](https://img.shields.io/npm/v/@sapphire/cron?color=crimson&logo=npm&style=flat-square&label=@sapphire/cron)](https://www.npmjs.com/package/@sapphire/cron)
[![npm](https://img.shields.io/npm/v/@sapphire/decorators?color=crimson&logo=npm&style=flat-square&label=@sapphire/decorators)](https://www.npmjs.com/package/@sapphire/decorators)
[![npm](https://img.shields.io/npm/v/@sapphire/discord-utilities?color=crimson&logo=npm&style=flat-square&label=@sapphire/discord-utilities)](https://www.npmjs.com/package/@sapphire/discord-utilities)
[![npm](https://img.shields.io/npm/v/@sapphire/discord.js-utilities?color=crimson&logo=npm&style=flat-square&label=@sapphire/discord.js-utilities)](https://www.npmjs.com/package/@sapphire/discord.js-utilities)
+[![npm](https://img.shields.io/npm/v/@sapphire/duration?color=crimson&logo=npm&style=flat-square&label=@sapphire/duration)](https://www.npmjs.com/package/@sapphire/duration)
[![npm](https://img.shields.io/npm/v/@sapphire/eslint-config?color=crimson&logo=npm&style=flat-square&label=@sapphire/eslint-config)](https://www.npmjs.com/package/@sapphire/eslint-config)
[![npm](https://img.shields.io/npm/v/@sapphire/event-iterator?color=crimson&logo=npm&style=flat-square&label=@sapphire/event-iterator)](https://www.npmjs.com/package/@sapphire/event-iterator)
-[![npm](https://img.shields.io/npm/v/@sapphire/prettier-config?color=crimson&logo=npm&style=flat-square&label=@sapphire/prettier-config)](https://www.npmjs.com/package/@sapphire/prettier-config)
[![npm](https://img.shields.io/npm/v/@sapphire/fetch?color=crimson&logo=npm&style=flat-square&label=@sapphire/fetch)](https://www.npmjs.com/package/@sapphire/fetch)
+[![npm](https://img.shields.io/npm/v/@sapphire/lexure?color=crimson&logo=npm&style=flat-square&label=@sapphire/lexure)](https://www.npmjs.com/package/@sapphire/lexure)
+[![npm](https://img.shields.io/npm/v/@sapphire/phisherman?color=crimson&logo=npm&style=flat-square&label=@sapphire/phisherman)](https://www.npmjs.com/package/@sapphire/phisherman)
+[![npm](https://img.shields.io/npm/v/@sapphire/prettier-config?color=crimson&logo=npm&style=flat-square&label=@sapphire/prettier-config)](https://www.npmjs.com/package/@sapphire/prettier-config)
[![npm](https://img.shields.io/npm/v/@sapphire/ratelimits?color=crimson&logo=npm&style=flat-square&label=@sapphire/ratelimits)](https://www.npmjs.com/package/@sapphire/ratelimits)
[![npm](https://img.shields.io/npm/v/@sapphire/result?color=crimson&logo=npm&style=flat-square&label=@sapphire/result)](https://www.npmjs.com/package/@sapphire/result)
-[![npm](https://img.shields.io/npm/v/@sapphire/stopwatch?color=crimson&logo=npm&style=flat-square&label=@sapphire/stopwatch)](https://www.npmjs.com/package/@sapphire/stopwatch)
[![npm](https://img.shields.io/npm/v/@sapphire/snowflake?color=crimson&logo=npm&style=flat-square&label=@sapphire/snowflake)](https://www.npmjs.com/package/@sapphire/snowflake)
+[![npm](https://img.shields.io/npm/v/@sapphire/stopwatch?color=crimson&logo=npm&style=flat-square&label=@sapphire/stopwatch)](https://www.npmjs.com/package/@sapphire/stopwatch)
[![npm](https://img.shields.io/npm/v/@sapphire/time-utilities?color=crimson&logo=npm&style=flat-square&label=@sapphire/time-utilities)](https://www.npmjs.com/package/@sapphire/time-utilities)
+[![npm](https://img.shields.io/npm/v/@sapphire/timer-manager?color=crimson&logo=npm&style=flat-square&label=@sapphire/timer-manager)](https://www.npmjs.com/package/@sapphire/timer-manager)
+[![npm](https://img.shields.io/npm/v/@sapphire/timestamp?color=crimson&logo=npm&style=flat-square&label=@sapphire/timestamp)](https://www.npmjs.com/package/@sapphire/timestamp)
[![npm](https://img.shields.io/npm/v/@sapphire/ts-config?color=crimson&logo=npm&style=flat-square&label=@sapphire/ts-config)](https://www.npmjs.com/package/@sapphire/ts-config)
[![npm](https://img.shields.io/npm/v/@sapphire/utilities?color=crimson&logo=npm&style=flat-square&label=@sapphire/utilities)](https://www.npmjs.com/package/@sapphire/utilities)
-[![npm](https://img.shields.io/npm/v/@sapphire/phisherman?color=crimson&logo=npm&style=flat-square&label=@sapphire/phisherman)](https://www.npmjs.com/package/@sapphire/phisherman)
-[![npm](https://img.shields.io/npm/v/@sapphire/lexure?color=crimson&logo=npm&style=flat-square&label=@sapphire/lexure)](https://www.npmjs.com/package/@sapphire/lexure)
diff --git a/packages/async-queue/tests/tsconfig.json b/packages/async-queue/tests/tsconfig.json
index 371ce4b21a..d6ac0596a8 100644
--- a/packages/async-queue/tests/tsconfig.json
+++ b/packages/async-queue/tests/tsconfig.json
@@ -2,9 +2,8 @@
"extends": "../../ts-config/extra-strict-without-decorators.json",
"compilerOptions": {
"target": "ES2020",
- "rootDir": "./",
- "outDir": "./build",
- "tsBuildInfoFile": "./build/.tsbuildinfo",
+ "noEmit": true,
+ "incremental": false,
"types": ["vitest/globals"]
},
"include": ["./"]
diff --git a/packages/cron/.cliff-jumperrc.yml b/packages/cron/.cliff-jumperrc.yml
new file mode 100644
index 0000000000..dcc07650ab
--- /dev/null
+++ b/packages/cron/.cliff-jumperrc.yml
@@ -0,0 +1,3 @@
+name: cron
+org: sapphire
+packagePath: packages/cron
diff --git a/packages/cron/.typedoc-json-parserrc.yml b/packages/cron/.typedoc-json-parserrc.yml
new file mode 100644
index 0000000000..92d0e01d7e
--- /dev/null
+++ b/packages/cron/.typedoc-json-parserrc.yml
@@ -0,0 +1 @@
+json: 'docs/api.json'
diff --git a/packages/cron/CHANGELOG.md b/packages/cron/CHANGELOG.md
new file mode 100644
index 0000000000..e69de29bb2
diff --git a/packages/cron/README.md b/packages/cron/README.md
new file mode 100644
index 0000000000..70dc217cb6
--- /dev/null
+++ b/packages/cron/README.md
@@ -0,0 +1,119 @@
+
+
+![Sapphire Logo](https://cdn.skyra.pw/gh-assets/sapphire-banner.png)
+
+# @sapphire/cron
+
+**Cron utilities for JavaScript.**
+
+[![GitHub](https://img.shields.io/github/license/sapphiredev/utilities)](https://github.com/sapphiredev/utilities/blob/main/LICENSE.md)
+[![codecov](https://codecov.io/gh/sapphiredev/utilities/branch/main/graph/badge.svg?token=OEGIV6RFDO)](https://codecov.io/gh/sapphiredev/utilities)
+[![npm bundle size](https://img.shields.io/bundlephobia/min/@sapphire/cron?logo=webpack&style=flat-square)](https://bundlephobia.com/result?p=@sapphire/cron)
+[![npm](https://img.shields.io/npm/v/@sapphire/cron?color=crimson&logo=npm&style=flat-square)](https://www.npmjs.com/package/@sapphire/cron)
+
+
+
+**Table of Contents**
+
+- [Features](#features)
+- [Installation](#installation)
+- [Usage](#usage)
+ - [Basic Usage](#basic-usage)
+- [Buy us some doughnuts](#buy-us-some-doughnuts)
+- [Contributors β¨](#contributors-%E2%9C%A8)
+
+## Features
+
+- Written in TypeScript
+- Bundled with esbuild so it can be used in NodeJS and browsers
+- Offers CommonJS, ESM and UMD bundles
+- Fully tested
+
+## Installation
+
+You can use the following command to install this package, or replace `npm install` with your package manager of choice.
+
+```sh
+npm install @sapphire/cron
+```
+
+## Buy us some doughnuts
+
+Sapphire Community is and always will be open source, even if we don't get donations. That being said, we know there are amazing people who may still want to donate just to show their appreciation. Thank you very much in advance!
+
+We accept donations through Open Collective, Ko-fi, PayPal, Patreon and GitHub Sponsorships. You can use the buttons below to donate through your method of choice.
+
+| Donate With | Address |
+| :-------------: | :-------------------------------------------------: |
+| Open Collective | [Click Here](https://sapphirejs.dev/opencollective) |
+| Ko-fi | [Click Here](https://sapphirejs.dev/kofi) |
+| Patreon | [Click Here](https://sapphirejs.dev/patreon) |
+| PayPal | [Click Here](https://sapphirejs.dev/paypal) |
+
+## Contributors β¨
+
+Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/docs/en/emoji-key)):
+
+
+
+
+
+
+
+
+
+
+
+This project follows the [all-contributors](https://github.com/all-contributors/all-contributors) specification. Contributions of any kind welcome!
diff --git a/packages/cron/cliff.toml b/packages/cron/cliff.toml
new file mode 100644
index 0000000000..19af21a631
--- /dev/null
+++ b/packages/cron/cliff.toml
@@ -0,0 +1,63 @@
+[changelog]
+header = """
+# Changelog
+
+All notable changes to this project will be documented in this file.\n
+"""
+body = """
+{% if version %}\
+ # [{{ version | trim_start_matches(pat="v") }}]\
+ {% if previous %}\
+ {% if previous.version %}\
+ (https://github.com/sapphiredev/utilities/compare/{{ previous.version }}...{{ version }})\
+ {% else %}\
+ (https://github.com/sapphiredev/utilities/tree/{{ version }})\
+ {% endif %}\
+ {% endif %} \
+ - ({{ timestamp | date(format="%Y-%m-%d") }})
+{% else %}\
+ # [unreleased]
+{% endif %}\
+{% for group, commits in commits | group_by(attribute="group") %}
+ ## {{ group | upper_first }}
+ {% for commit in commits %}
+ - {% if commit.scope %}\
+ **{{commit.scope}}:** \
+ {% endif %}\
+ {{ commit.message | upper_first }} ([{{ commit.id | truncate(length=7, end="") }}](https://github.com/sapphiredev/utilities/commit/{{ commit.id }}))\
+ {% if commit.breaking %}\
+ {% for breakingChange in commit.footers %}\
+ \n{% raw %} {% endraw %}- π₯ **{{ breakingChange.token }}{{ breakingChange.separator }}** {{ breakingChange.value }}\
+ {% endfor %}\
+ {% endif %}\
+ {% endfor %}
+{% endfor %}\n
+"""
+trim = true
+footer = ""
+
+[git]
+conventional_commits = true
+filter_unconventional = true
+commit_parsers = [
+ { message = "^feat", group = "π Features"},
+ { message = "^fix", group = "π Bug Fixes"},
+ { message = "^docs", group = "π Documentation"},
+ { message = "^perf", group = "π Performance"},
+ { message = "^refactor", group = "π Refactor"},
+ { message = "^typings", group = "β¨οΈ Typings"},
+ { message = "^types", group = "β¨οΈ Typings"},
+ { message = ".*deprecated", body = ".*deprecated", group = "π¨ Deprecation"},
+ { message = "^revert", skip = true},
+ { message = "^style", group = "πͺ Styling"},
+ { message = "^test", group = "π§ͺ Testing"},
+ { message = "^chore", skip = true},
+ { message = "^ci", skip = true},
+ { message = "^build", skip = true},
+ { body = ".*security", group = "π‘οΈ Security"},
+]
+filter_commits = true
+tag_pattern = "@sapphire/cron@[0-9]*"
+ignore_tags = ""
+topo_order = false
+sort_commits = "newest"
diff --git a/packages/cron/package.json b/packages/cron/package.json
new file mode 100644
index 0000000000..76cfa62231
--- /dev/null
+++ b/packages/cron/package.json
@@ -0,0 +1,71 @@
+{
+ "name": "@sapphire/cron",
+ "version": "1.0.0",
+ "description": "A cron utility library for JavaScript.",
+ "author": "@sapphire",
+ "license": "MIT",
+ "main": "dist/index.js",
+ "module": "dist/index.mjs",
+ "browser": "dist/index.global.js",
+ "unpkg": "dist/index.global.js",
+ "types": "dist/index.d.ts",
+ "exports": {
+ "import": "./dist/index.mjs",
+ "require": "./dist/index.js",
+ "types": "./dist/index.d.ts"
+ },
+ "sideEffects": false,
+ "homepage": "https://github.com/sapphiredev/utilities/tree/main/packages/cron",
+ "scripts": {
+ "test": "vitest run",
+ "lint": "eslint src tests --ext ts --fix -c ../../.eslintrc",
+ "build": "tsup",
+ "docs": "typedoc-json-parser",
+ "prepack": "yarn build",
+ "bump": "cliff-jumper",
+ "check-update": "cliff-jumper --dry-run"
+ },
+ "repository": {
+ "type": "git",
+ "url": "git+https://github.com/sapphiredev/utilities.git",
+ "directory": "packages/cron"
+ },
+ "files": [
+ "dist/**/*.js*",
+ "dist/**/*.mjs*",
+ "dist/**/*.d*"
+ ],
+ "engines": {
+ "node": ">=v14.0.0",
+ "npm": ">=7.0.0"
+ },
+ "keywords": [
+ "@sapphire/cron",
+ "cron",
+ "bot",
+ "typescript",
+ "ts",
+ "yarn",
+ "discord",
+ "sapphire",
+ "standalone"
+ ],
+ "bugs": {
+ "url": "https://github.com/sapphiredev/utilities/issues"
+ },
+ "publishConfig": {
+ "access": "public"
+ },
+ "dependencies": {
+ "@sapphire/utilities": "workspace:^"
+ },
+ "devDependencies": {
+ "@favware/cliff-jumper": "^1.8.7",
+ "@vitest/coverage-c8": "^0.23.4",
+ "tsup": "^6.2.3",
+ "typedoc": "^0.23.14",
+ "typedoc-json-parser": "^4.0.0",
+ "typescript": "^4.8.3",
+ "vitest": "^0.23.4"
+ }
+}
diff --git a/packages/cron/src/index.ts b/packages/cron/src/index.ts
new file mode 100644
index 0000000000..82cd9657ac
--- /dev/null
+++ b/packages/cron/src/index.ts
@@ -0,0 +1,2 @@
+export * from './lib/constants';
+export * from './lib/Cron';
diff --git a/packages/time-utilities/src/lib/Cron.ts b/packages/cron/src/lib/Cron.ts
similarity index 100%
rename from packages/time-utilities/src/lib/Cron.ts
rename to packages/cron/src/lib/Cron.ts
diff --git a/packages/cron/src/lib/constants.ts b/packages/cron/src/lib/constants.ts
new file mode 100644
index 0000000000..60b558f943
--- /dev/null
+++ b/packages/cron/src/lib/constants.ts
@@ -0,0 +1,54 @@
+export enum Time {
+ Millisecond = 1,
+ Second = 1000,
+ Minute = 1000 * 60,
+ Hour = 1000 * 60 * 60,
+ Day = 1000 * 60 * 60 * 24,
+ Month = 1000 * 60 * 60 * 24 * (365 / 12),
+ Year = 1000 * 60 * 60 * 24 * 365
+}
+
+export const partRegex = /^(?:(\*)|(\d+)(?:-(\d+))?)(?:\/(\d+))?$/;
+
+export const wildcardRegex = /\bh\b|\B\?\B/g;
+
+export const allowedNum = [
+ [0, 59],
+ [0, 23],
+ [1, 31],
+ [1, 12],
+ [0, 6]
+];
+
+export const predefined = {
+ '@annually': '0 0 1 1 *',
+ '@yearly': '0 0 1 1 *',
+ '@monthly': '0 0 1 * *',
+ '@weekly': '0 0 * * 0',
+ '@daily': '0 0 * * *',
+ '@hourly': '0 * * * *'
+} as const;
+
+export const cronTokens = {
+ jan: 1,
+ feb: 2,
+ mar: 3,
+ apr: 4,
+ may: 5,
+ jun: 6,
+ jul: 7,
+ aug: 8,
+ sep: 9,
+ oct: 10,
+ nov: 11,
+ dec: 12,
+ sun: 0,
+ mon: 1,
+ tue: 2,
+ wed: 3,
+ thu: 4,
+ fri: 5,
+ sat: 6
+} as const;
+
+export const tokensRegex = new RegExp(Object.keys(cronTokens).join('|'), 'g');
diff --git a/packages/cron/src/tsconfig.json b/packages/cron/src/tsconfig.json
new file mode 100644
index 0000000000..89170e53e9
--- /dev/null
+++ b/packages/cron/src/tsconfig.json
@@ -0,0 +1,9 @@
+{
+ "extends": "../../ts-config/extra-strict-without-decorators.json",
+ "compilerOptions": {
+ "rootDir": "./",
+ "outDir": "../dist",
+ "incremental": false
+ },
+ "include": ["."]
+}
diff --git a/packages/time-utilities/tests/lib/cron/Cron.test.ts b/packages/cron/tests/lib/Cron.test.ts
similarity index 99%
rename from packages/time-utilities/tests/lib/cron/Cron.test.ts
rename to packages/cron/tests/lib/Cron.test.ts
index 6862136629..f834477b5b 100644
--- a/packages/time-utilities/tests/lib/cron/Cron.test.ts
+++ b/packages/cron/tests/lib/Cron.test.ts
@@ -1,4 +1,4 @@
-import { Cron } from '../../../src';
+import { Cron } from '../../src';
describe('Cron', () => {
test('pre-defined @hourly', () => {
diff --git a/packages/time-utilities/tests/tsconfig.json b/packages/cron/tests/tsconfig.json
similarity index 66%
rename from packages/time-utilities/tests/tsconfig.json
rename to packages/cron/tests/tsconfig.json
index 371ce4b21a..d6ac0596a8 100644
--- a/packages/time-utilities/tests/tsconfig.json
+++ b/packages/cron/tests/tsconfig.json
@@ -2,9 +2,8 @@
"extends": "../../ts-config/extra-strict-without-decorators.json",
"compilerOptions": {
"target": "ES2020",
- "rootDir": "./",
- "outDir": "./build",
- "tsBuildInfoFile": "./build/.tsbuildinfo",
+ "noEmit": true,
+ "incremental": false,
"types": ["vitest/globals"]
},
"include": ["./"]
diff --git a/packages/cron/tsconfig.eslint.json b/packages/cron/tsconfig.eslint.json
new file mode 100644
index 0000000000..2151f9bd19
--- /dev/null
+++ b/packages/cron/tsconfig.eslint.json
@@ -0,0 +1,8 @@
+{
+ "extends": "../ts-config/extra-strict-without-decorators.json",
+ "compilerOptions": {
+ "allowJs": true,
+ "checkJs": true
+ },
+ "include": ["src", "tests"]
+}
diff --git a/packages/cron/tsup.config.ts b/packages/cron/tsup.config.ts
new file mode 100644
index 0000000000..ce87d8b816
--- /dev/null
+++ b/packages/cron/tsup.config.ts
@@ -0,0 +1,3 @@
+import { createTsupConfig } from '../../scripts/tsup.config';
+
+export default createTsupConfig({ globalName: 'SapphireCron', target: 'es2020' });
diff --git a/packages/cron/typedoc.json b/packages/cron/typedoc.json
new file mode 100644
index 0000000000..8c791b5134
--- /dev/null
+++ b/packages/cron/typedoc.json
@@ -0,0 +1,6 @@
+{
+ "$schema": "https://typedoc.org/schema.json",
+ "entryPoints": ["src/index.ts"],
+ "json": "docs/api.json",
+ "tsconfig": "src/tsconfig.json"
+}
diff --git a/packages/time-utilities/vitest.config.ts b/packages/cron/vitest.config.ts
similarity index 100%
rename from packages/time-utilities/vitest.config.ts
rename to packages/cron/vitest.config.ts
diff --git a/packages/decorators/tests/tsconfig.json b/packages/decorators/tests/tsconfig.json
index b1de326d3b..558da6563d 100644
--- a/packages/decorators/tests/tsconfig.json
+++ b/packages/decorators/tests/tsconfig.json
@@ -1,9 +1,8 @@
{
"extends": "../../ts-config/extra-strict.json",
"compilerOptions": {
- "rootDir": ".",
- "outDir": "../test-dist",
- "tsBuildInfoFile": "../test-dist/.tsbuildinfo",
+ "noEmit": true,
+ "incremental": false,
"types": ["vitest/globals"]
},
"include": ["."]
diff --git a/packages/discord.js-utilities/package.json b/packages/discord.js-utilities/package.json
index 002dccbabc..f96139f7df 100644
--- a/packages/discord.js-utilities/package.json
+++ b/packages/discord.js-utilities/package.json
@@ -55,7 +55,7 @@
},
"dependencies": {
"@sapphire/discord-utilities": "workspace:^",
- "@sapphire/time-utilities": "workspace:^",
+ "@sapphire/duration": "workspace:^",
"@sapphire/utilities": "workspace:^",
"tslib": "^2.4.0"
},
diff --git a/packages/discord.js-utilities/src/lib/PaginatedMessages/PaginatedMessage.ts b/packages/discord.js-utilities/src/lib/PaginatedMessages/PaginatedMessage.ts
index 86d04bdbd9..c170717bc2 100644
--- a/packages/discord.js-utilities/src/lib/PaginatedMessages/PaginatedMessage.ts
+++ b/packages/discord.js-utilities/src/lib/PaginatedMessages/PaginatedMessage.ts
@@ -1,4 +1,4 @@
-import { Time } from '@sapphire/time-utilities';
+import { Time } from '@sapphire/duration';
import { deepClone, isFunction, isNullish, isObject } from '@sapphire/utilities';
import type { APIMessage } from 'discord-api-types/v9';
import {
diff --git a/packages/duration/.cliff-jumperrc.yml b/packages/duration/.cliff-jumperrc.yml
new file mode 100644
index 0000000000..5b9ed4db68
--- /dev/null
+++ b/packages/duration/.cliff-jumperrc.yml
@@ -0,0 +1,3 @@
+name: duration
+org: sapphire
+packagePath: packages/duration
diff --git a/packages/duration/.typedoc-json-parserrc.yml b/packages/duration/.typedoc-json-parserrc.yml
new file mode 100644
index 0000000000..92d0e01d7e
--- /dev/null
+++ b/packages/duration/.typedoc-json-parserrc.yml
@@ -0,0 +1 @@
+json: 'docs/api.json'
diff --git a/packages/duration/CHANGELOG.md b/packages/duration/CHANGELOG.md
new file mode 100644
index 0000000000..e69de29bb2
diff --git a/packages/duration/README.md b/packages/duration/README.md
new file mode 100644
index 0000000000..aa7a20499b
--- /dev/null
+++ b/packages/duration/README.md
@@ -0,0 +1,119 @@
+
+
+![Sapphire Logo](https://cdn.skyra.pw/gh-assets/sapphire-banner.png)
+
+# @sapphire/duration
+
+**Duration utilities for JavaScript.**
+
+[![GitHub](https://img.shields.io/github/license/sapphiredev/utilities)](https://github.com/sapphiredev/utilities/blob/main/LICENSE.md)
+[![codecov](https://codecov.io/gh/sapphiredev/utilities/branch/main/graph/badge.svg?token=OEGIV6RFDO)](https://codecov.io/gh/sapphiredev/utilities)
+[![npm bundle size](https://img.shields.io/bundlephobia/min/@sapphire/duration?logo=webpack&style=flat-square)](https://bundlephobia.com/result?p=@sapphire/duration)
+[![npm](https://img.shields.io/npm/v/@sapphire/duration?color=crimson&logo=npm&style=flat-square)](https://www.npmjs.com/package/@sapphire/duration)
+
+
+
+**Table of Contents**
+
+- [Features](#features)
+- [Installation](#installation)
+- [Usage](#usage)
+ - [Basic Usage](#basic-usage)
+- [Buy us some doughnuts](#buy-us-some-doughnuts)
+- [Contributors β¨](#contributors-%E2%9C%A8)
+
+## Features
+
+- Written in TypeScript
+- Bundled with esbuild so it can be used in NodeJS and browsers
+- Offers CommonJS, ESM and UMD bundles
+- Fully tested
+
+## Installation
+
+You can use the following command to install this package, or replace `npm install` with your package manager of choice.
+
+```sh
+npm install @sapphire/duration
+```
+
+## Buy us some doughnuts
+
+Sapphire Community is and always will be open source, even if we don't get donations. That being said, we know there are amazing people who may still want to donate just to show their appreciation. Thank you very much in advance!
+
+We accept donations through Open Collective, Ko-fi, PayPal, Patreon and GitHub Sponsorships. You can use the buttons below to donate through your method of choice.
+
+| Donate With | Address |
+| :-------------: | :-------------------------------------------------: |
+| Open Collective | [Click Here](https://sapphirejs.dev/opencollective) |
+| Ko-fi | [Click Here](https://sapphirejs.dev/kofi) |
+| Patreon | [Click Here](https://sapphirejs.dev/patreon) |
+| PayPal | [Click Here](https://sapphirejs.dev/paypal) |
+
+## Contributors β¨
+
+Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/docs/en/emoji-key)):
+
+
+
+
+
+
+
+
+
+
+
+This project follows the [all-contributors](https://github.com/all-contributors/all-contributors) specification. Contributions of any kind welcome!
diff --git a/packages/duration/cliff.toml b/packages/duration/cliff.toml
new file mode 100644
index 0000000000..6249989745
--- /dev/null
+++ b/packages/duration/cliff.toml
@@ -0,0 +1,63 @@
+[changelog]
+header = """
+# Changelog
+
+All notable changes to this project will be documented in this file.\n
+"""
+body = """
+{% if version %}\
+ # [{{ version | trim_start_matches(pat="v") }}]\
+ {% if previous %}\
+ {% if previous.version %}\
+ (https://github.com/sapphiredev/utilities/compare/{{ previous.version }}...{{ version }})\
+ {% else %}\
+ (https://github.com/sapphiredev/utilities/tree/{{ version }})\
+ {% endif %}\
+ {% endif %} \
+ - ({{ timestamp | date(format="%Y-%m-%d") }})
+{% else %}\
+ # [unreleased]
+{% endif %}\
+{% for group, commits in commits | group_by(attribute="group") %}
+ ## {{ group | upper_first }}
+ {% for commit in commits %}
+ - {% if commit.scope %}\
+ **{{commit.scope}}:** \
+ {% endif %}\
+ {{ commit.message | upper_first }} ([{{ commit.id | truncate(length=7, end="") }}](https://github.com/sapphiredev/utilities/commit/{{ commit.id }}))\
+ {% if commit.breaking %}\
+ {% for breakingChange in commit.footers %}\
+ \n{% raw %} {% endraw %}- π₯ **{{ breakingChange.token }}{{ breakingChange.separator }}** {{ breakingChange.value }}\
+ {% endfor %}\
+ {% endif %}\
+ {% endfor %}
+{% endfor %}\n
+"""
+trim = true
+footer = ""
+
+[git]
+conventional_commits = true
+filter_unconventional = true
+commit_parsers = [
+ { message = "^feat", group = "π Features"},
+ { message = "^fix", group = "π Bug Fixes"},
+ { message = "^docs", group = "π Documentation"},
+ { message = "^perf", group = "π Performance"},
+ { message = "^refactor", group = "π Refactor"},
+ { message = "^typings", group = "β¨οΈ Typings"},
+ { message = "^types", group = "β¨οΈ Typings"},
+ { message = ".*deprecated", body = ".*deprecated", group = "π¨ Deprecation"},
+ { message = "^revert", skip = true},
+ { message = "^style", group = "πͺ Styling"},
+ { message = "^test", group = "π§ͺ Testing"},
+ { message = "^chore", skip = true},
+ { message = "^ci", skip = true},
+ { message = "^build", skip = true},
+ { body = ".*security", group = "π‘οΈ Security"},
+]
+filter_commits = true
+tag_pattern = "@sapphire/duration@[0-9]*"
+ignore_tags = ""
+topo_order = false
+sort_commits = "newest"
diff --git a/packages/duration/package.json b/packages/duration/package.json
new file mode 100644
index 0000000000..bba8d91aec
--- /dev/null
+++ b/packages/duration/package.json
@@ -0,0 +1,68 @@
+{
+ "name": "@sapphire/duration",
+ "version": "1.0.0",
+ "description": "A time duration utility library for JavaScript.",
+ "author": "@sapphire",
+ "license": "MIT",
+ "main": "dist/index.js",
+ "module": "dist/index.mjs",
+ "browser": "dist/index.global.js",
+ "unpkg": "dist/index.global.js",
+ "types": "dist/index.d.ts",
+ "exports": {
+ "import": "./dist/index.mjs",
+ "require": "./dist/index.js",
+ "types": "./dist/index.d.ts"
+ },
+ "sideEffects": false,
+ "homepage": "https://github.com/sapphiredev/utilities/tree/main/packages/duration",
+ "scripts": {
+ "test": "vitest run",
+ "lint": "eslint src tests --ext ts --fix -c ../../.eslintrc",
+ "build": "tsup",
+ "docs": "typedoc-json-parser",
+ "prepack": "yarn build",
+ "bump": "cliff-jumper",
+ "check-update": "cliff-jumper --dry-run"
+ },
+ "repository": {
+ "type": "git",
+ "url": "git+https://github.com/sapphiredev/utilities.git",
+ "directory": "packages/duration"
+ },
+ "files": [
+ "dist/**/*.js*",
+ "dist/**/*.mjs*",
+ "dist/**/*.d*"
+ ],
+ "engines": {
+ "node": ">=v14.0.0",
+ "npm": ">=7.0.0"
+ },
+ "keywords": [
+ "@sapphire/duration",
+ "duration",
+ "bot",
+ "typescript",
+ "ts",
+ "yarn",
+ "discord",
+ "sapphire",
+ "standalone"
+ ],
+ "bugs": {
+ "url": "https://github.com/sapphiredev/utilities/issues"
+ },
+ "publishConfig": {
+ "access": "public"
+ },
+ "devDependencies": {
+ "@favware/cliff-jumper": "^1.8.7",
+ "@vitest/coverage-c8": "^0.23.4",
+ "tsup": "^6.2.3",
+ "typedoc": "^0.23.14",
+ "typedoc-json-parser": "^4.0.0",
+ "typescript": "^4.8.3",
+ "vitest": "^0.23.4"
+ }
+}
diff --git a/packages/duration/src/index.ts b/packages/duration/src/index.ts
new file mode 100644
index 0000000000..355aee2158
--- /dev/null
+++ b/packages/duration/src/index.ts
@@ -0,0 +1,3 @@
+export * from './lib/constants';
+export * from './lib/Duration';
+export * from './lib/DurationFormatter';
diff --git a/packages/time-utilities/src/lib/Duration.ts b/packages/duration/src/lib/Duration.ts
similarity index 100%
rename from packages/time-utilities/src/lib/Duration.ts
rename to packages/duration/src/lib/Duration.ts
diff --git a/packages/time-utilities/src/lib/DurationFormatter.ts b/packages/duration/src/lib/DurationFormatter.ts
similarity index 100%
rename from packages/time-utilities/src/lib/DurationFormatter.ts
rename to packages/duration/src/lib/DurationFormatter.ts
diff --git a/packages/duration/src/lib/constants.ts b/packages/duration/src/lib/constants.ts
new file mode 100644
index 0000000000..60793f92c9
--- /dev/null
+++ b/packages/duration/src/lib/constants.ts
@@ -0,0 +1,60 @@
+import type { DurationFormatAssetsTime, DurationFormatSeparators } from './DurationFormatter';
+
+export enum Time {
+ Millisecond = 1,
+ Second = 1000,
+ Minute = 1000 * 60,
+ Hour = 1000 * 60 * 60,
+ Day = 1000 * 60 * 60 * 24,
+ Month = 1000 * 60 * 60 * 24 * (365 / 12),
+ Year = 1000 * 60 * 60 * 24 * 365
+}
+
+/**
+ * The supported time types
+ */
+export enum TimeTypes {
+ Second = 'second',
+ Minute = 'minute',
+ Hour = 'hour',
+ Day = 'day',
+ Week = 'week',
+ Month = 'month',
+ Year = 'year'
+}
+
+export const DEFAULT_UNITS: DurationFormatAssetsTime = {
+ [TimeTypes.Year]: {
+ 1: 'year',
+ DEFAULT: 'years'
+ },
+ [TimeTypes.Month]: {
+ 1: 'month',
+ DEFAULT: 'months'
+ },
+ [TimeTypes.Week]: {
+ 1: 'week',
+ DEFAULT: 'weeks'
+ },
+ [TimeTypes.Day]: {
+ 1: 'day',
+ DEFAULT: 'days'
+ },
+ [TimeTypes.Hour]: {
+ 1: 'hour',
+ DEFAULT: 'hours'
+ },
+ [TimeTypes.Minute]: {
+ 1: 'minute',
+ DEFAULT: 'minutes'
+ },
+ [TimeTypes.Second]: {
+ 1: 'second',
+ DEFAULT: 'seconds'
+ }
+};
+
+export const DEFAULT_SEPARATORS: DurationFormatSeparators = {
+ left: ' ',
+ right: ' '
+};
diff --git a/packages/duration/src/tsconfig.json b/packages/duration/src/tsconfig.json
new file mode 100644
index 0000000000..89170e53e9
--- /dev/null
+++ b/packages/duration/src/tsconfig.json
@@ -0,0 +1,9 @@
+{
+ "extends": "../../ts-config/extra-strict-without-decorators.json",
+ "compilerOptions": {
+ "rootDir": "./",
+ "outDir": "../dist",
+ "incremental": false
+ },
+ "include": ["."]
+}
diff --git a/packages/time-utilities/tests/lib/duration/Duration.test.ts b/packages/duration/tests/lib/Duration.test.ts
similarity index 94%
rename from packages/time-utilities/tests/lib/duration/Duration.test.ts
rename to packages/duration/tests/lib/Duration.test.ts
index fc4e12eb81..3a7031f308 100644
--- a/packages/time-utilities/tests/lib/duration/Duration.test.ts
+++ b/packages/duration/tests/lib/Duration.test.ts
@@ -1,4 +1,4 @@
-import { Duration } from '../../../src';
+import { Duration } from '../../src';
describe('Duration', () => {
test('GIVEN duration with an offset of 0s, THEN shows 0ms', () => {
diff --git a/packages/time-utilities/tests/lib/duration/DurationFormatter.test.ts b/packages/duration/tests/lib/DurationFormatter.test.ts
similarity index 90%
rename from packages/time-utilities/tests/lib/duration/DurationFormatter.test.ts
rename to packages/duration/tests/lib/DurationFormatter.test.ts
index 3d99ee3fb0..a756c0c05f 100644
--- a/packages/time-utilities/tests/lib/duration/DurationFormatter.test.ts
+++ b/packages/duration/tests/lib/DurationFormatter.test.ts
@@ -1,5 +1,11 @@
/* eslint-disable @typescript-eslint/restrict-plus-operands, @typescript-eslint/naming-convention */
-import { DurationFormatter, Time } from '../../../src';
+import { DurationFormatter } from '../../src';
+
+enum Time {
+ Minute = 1000 * 60,
+ Hour = 1000 * 60 * 60,
+ Day = 1000 * 60 * 60 * 24
+}
const formatter = new DurationFormatter();
diff --git a/packages/duration/tests/tsconfig.json b/packages/duration/tests/tsconfig.json
new file mode 100644
index 0000000000..d6ac0596a8
--- /dev/null
+++ b/packages/duration/tests/tsconfig.json
@@ -0,0 +1,10 @@
+{
+ "extends": "../../ts-config/extra-strict-without-decorators.json",
+ "compilerOptions": {
+ "target": "ES2020",
+ "noEmit": true,
+ "incremental": false,
+ "types": ["vitest/globals"]
+ },
+ "include": ["./"]
+}
diff --git a/packages/duration/tsconfig.eslint.json b/packages/duration/tsconfig.eslint.json
new file mode 100644
index 0000000000..2151f9bd19
--- /dev/null
+++ b/packages/duration/tsconfig.eslint.json
@@ -0,0 +1,8 @@
+{
+ "extends": "../ts-config/extra-strict-without-decorators.json",
+ "compilerOptions": {
+ "allowJs": true,
+ "checkJs": true
+ },
+ "include": ["src", "tests"]
+}
diff --git a/packages/duration/tsup.config.ts b/packages/duration/tsup.config.ts
new file mode 100644
index 0000000000..1e1bb4457a
--- /dev/null
+++ b/packages/duration/tsup.config.ts
@@ -0,0 +1,3 @@
+import { createTsupConfig } from '../../scripts/tsup.config';
+
+export default createTsupConfig({ globalName: 'SapphireDuration', target: 'es2020' });
diff --git a/packages/duration/typedoc.json b/packages/duration/typedoc.json
new file mode 100644
index 0000000000..8c791b5134
--- /dev/null
+++ b/packages/duration/typedoc.json
@@ -0,0 +1,6 @@
+{
+ "$schema": "https://typedoc.org/schema.json",
+ "entryPoints": ["src/index.ts"],
+ "json": "docs/api.json",
+ "tsconfig": "src/tsconfig.json"
+}
diff --git a/packages/duration/vitest.config.ts b/packages/duration/vitest.config.ts
new file mode 100644
index 0000000000..19a1400c7f
--- /dev/null
+++ b/packages/duration/vitest.config.ts
@@ -0,0 +1,7 @@
+import { createVitestConfig } from '../../scripts/vitest.config';
+
+export default createVitestConfig({
+ esbuild: {
+ target: 'es2020'
+ }
+});
diff --git a/packages/eslint-config/tests/tsconfig.json b/packages/eslint-config/tests/tsconfig.json
index 28492a5a98..d0d5c3eee6 100644
--- a/packages/eslint-config/tests/tsconfig.json
+++ b/packages/eslint-config/tests/tsconfig.json
@@ -1,9 +1,8 @@
{
"extends": "../../ts-config/extra-strict-without-decorators.json",
"compilerOptions": {
- "rootDir": ".",
- "outDir": "../test-dist",
- "tsBuildInfoFile": "../test-dist/.tsbuildinfo",
+ "noEmit": true,
+ "incremental": false,
"types": ["vitest/globals"]
},
"include": ["./"]
diff --git a/packages/event-iterator/tests/tsconfig.json b/packages/event-iterator/tests/tsconfig.json
index 5d00602dc3..d0d5c3eee6 100644
--- a/packages/event-iterator/tests/tsconfig.json
+++ b/packages/event-iterator/tests/tsconfig.json
@@ -1,9 +1,8 @@
{
"extends": "../../ts-config/extra-strict-without-decorators.json",
"compilerOptions": {
- "rootDir": "./",
- "outDir": "./build",
- "tsBuildInfoFile": "./build/.tsbuildinfo",
+ "noEmit": true,
+ "incremental": false,
"types": ["vitest/globals"]
},
"include": ["./"]
diff --git a/packages/fetch/tests/tsconfig.json b/packages/fetch/tests/tsconfig.json
index 5d00602dc3..d0d5c3eee6 100644
--- a/packages/fetch/tests/tsconfig.json
+++ b/packages/fetch/tests/tsconfig.json
@@ -1,9 +1,8 @@
{
"extends": "../../ts-config/extra-strict-without-decorators.json",
"compilerOptions": {
- "rootDir": "./",
- "outDir": "./build",
- "tsBuildInfoFile": "./build/.tsbuildinfo",
+ "noEmit": true,
+ "incremental": false,
"types": ["vitest/globals"]
},
"include": ["./"]
diff --git a/packages/lexure/tests/tsconfig.json b/packages/lexure/tests/tsconfig.json
index 5d00602dc3..d0d5c3eee6 100644
--- a/packages/lexure/tests/tsconfig.json
+++ b/packages/lexure/tests/tsconfig.json
@@ -1,9 +1,8 @@
{
"extends": "../../ts-config/extra-strict-without-decorators.json",
"compilerOptions": {
- "rootDir": "./",
- "outDir": "./build",
- "tsBuildInfoFile": "./build/.tsbuildinfo",
+ "noEmit": true,
+ "incremental": false,
"types": ["vitest/globals"]
},
"include": ["./"]
diff --git a/packages/prettier-config/tests/tsconfig.json b/packages/prettier-config/tests/tsconfig.json
index 28492a5a98..d0d5c3eee6 100644
--- a/packages/prettier-config/tests/tsconfig.json
+++ b/packages/prettier-config/tests/tsconfig.json
@@ -1,9 +1,8 @@
{
"extends": "../../ts-config/extra-strict-without-decorators.json",
"compilerOptions": {
- "rootDir": ".",
- "outDir": "../test-dist",
- "tsBuildInfoFile": "../test-dist/.tsbuildinfo",
+ "noEmit": true,
+ "incremental": false,
"types": ["vitest/globals"]
},
"include": ["./"]
diff --git a/packages/ratelimits/package.json b/packages/ratelimits/package.json
index 855c8e3d2f..e487b4c2f2 100644
--- a/packages/ratelimits/package.json
+++ b/packages/ratelimits/package.json
@@ -56,7 +56,7 @@
"access": "public"
},
"dependencies": {
- "@sapphire/time-utilities": "workspace:^"
+ "@sapphire/timer-manager": "workspace:^"
},
"devDependencies": {
"@favware/cliff-jumper": "^1.8.7",
diff --git a/packages/ratelimits/src/lib/RateLimitManager.ts b/packages/ratelimits/src/lib/RateLimitManager.ts
index cacd6f41e6..900fd25281 100644
--- a/packages/ratelimits/src/lib/RateLimitManager.ts
+++ b/packages/ratelimits/src/lib/RateLimitManager.ts
@@ -1,4 +1,4 @@
-import { TimerManager } from '@sapphire/time-utilities';
+import { TimerManager } from '@sapphire/timer-manager';
import { RateLimit } from './RateLimit';
export class RateLimitManager extends Map> {
diff --git a/packages/ratelimits/tests/lib/RateLimitManager.test.ts b/packages/ratelimits/tests/lib/RateLimitManager.test.ts
index c98aa20db7..5ba116ff24 100644
--- a/packages/ratelimits/tests/lib/RateLimitManager.test.ts
+++ b/packages/ratelimits/tests/lib/RateLimitManager.test.ts
@@ -1,4 +1,4 @@
-import { TimerManager } from '@sapphire/time-utilities';
+import { TimerManager } from '@sapphire/timer-manager';
import { setTimeout as sleep } from 'timers/promises';
import { RateLimitManager } from '../../src';
diff --git a/packages/ratelimits/tests/tsconfig.json b/packages/ratelimits/tests/tsconfig.json
index 371ce4b21a..d6ac0596a8 100644
--- a/packages/ratelimits/tests/tsconfig.json
+++ b/packages/ratelimits/tests/tsconfig.json
@@ -2,9 +2,8 @@
"extends": "../../ts-config/extra-strict-without-decorators.json",
"compilerOptions": {
"target": "ES2020",
- "rootDir": "./",
- "outDir": "./build",
- "tsBuildInfoFile": "./build/.tsbuildinfo",
+ "noEmit": true,
+ "incremental": false,
"types": ["vitest/globals"]
},
"include": ["./"]
diff --git a/packages/result/tests/tsconfig.json b/packages/result/tests/tsconfig.json
index 5d00602dc3..d0d5c3eee6 100644
--- a/packages/result/tests/tsconfig.json
+++ b/packages/result/tests/tsconfig.json
@@ -1,9 +1,8 @@
{
"extends": "../../ts-config/extra-strict-without-decorators.json",
"compilerOptions": {
- "rootDir": "./",
- "outDir": "./build",
- "tsBuildInfoFile": "./build/.tsbuildinfo",
+ "noEmit": true,
+ "incremental": false,
"types": ["vitest/globals"]
},
"include": ["./"]
diff --git a/packages/snowflake/tests/tsconfig.json b/packages/snowflake/tests/tsconfig.json
index 371ce4b21a..d6ac0596a8 100644
--- a/packages/snowflake/tests/tsconfig.json
+++ b/packages/snowflake/tests/tsconfig.json
@@ -2,9 +2,8 @@
"extends": "../../ts-config/extra-strict-without-decorators.json",
"compilerOptions": {
"target": "ES2020",
- "rootDir": "./",
- "outDir": "./build",
- "tsBuildInfoFile": "./build/.tsbuildinfo",
+ "noEmit": true,
+ "incremental": false,
"types": ["vitest/globals"]
},
"include": ["./"]
diff --git a/packages/stopwatch/tests/tsconfig.json b/packages/stopwatch/tests/tsconfig.json
index 5d00602dc3..d0d5c3eee6 100644
--- a/packages/stopwatch/tests/tsconfig.json
+++ b/packages/stopwatch/tests/tsconfig.json
@@ -1,9 +1,8 @@
{
"extends": "../../ts-config/extra-strict-without-decorators.json",
"compilerOptions": {
- "rootDir": "./",
- "outDir": "./build",
- "tsBuildInfoFile": "./build/.tsbuildinfo",
+ "noEmit": true,
+ "incremental": false,
"types": ["vitest/globals"]
},
"include": ["./"]
diff --git a/packages/time-utilities/README.md b/packages/time-utilities/README.md
index fed6032dbf..ac8debe153 100644
--- a/packages/time-utilities/README.md
+++ b/packages/time-utilities/README.md
@@ -27,6 +27,8 @@
Working with Time and Duration can be a huge chore in any programming language. There are various time parsing libraries on the NPM registry but we are of the opinion that none of them meet the code quality that we desire to use. For this reason we have decided to make this package.
+Note that this package only re-exports everything from the four packages `@sapphire/cron`, `@sapphire/duration`, `@sapphire/timer-manager`, and `@sapphire/timestamp`. Those packages can also be installed individually if you only need a subset of the functionality.
+
## Features
- Written in TypeScript
diff --git a/packages/time-utilities/package.json b/packages/time-utilities/package.json
index 656bf70e68..f1301c6dcf 100644
--- a/packages/time-utilities/package.json
+++ b/packages/time-utilities/package.json
@@ -17,8 +17,7 @@
"sideEffects": false,
"homepage": "https://github.com/sapphiredev/utilities/tree/main/packages/time-utilities",
"scripts": {
- "test": "vitest run",
- "lint": "eslint src tests --ext ts --fix -c ../../.eslintrc",
+ "lint": "eslint src --ext ts --fix -c ../../.eslintrc",
"build": "tsup",
"docs": "typedoc-json-parser",
"prepack": "yarn build",
@@ -56,15 +55,16 @@
"access": "public"
},
"dependencies": {
- "@sapphire/utilities": "workspace:^"
+ "@sapphire/cron": "workspace:^",
+ "@sapphire/duration": "workspace:^",
+ "@sapphire/timer-manager": "workspace:^",
+ "@sapphire/timestamp": "workspace:^"
},
"devDependencies": {
"@favware/cliff-jumper": "^1.8.7",
- "@vitest/coverage-c8": "^0.23.4",
"tsup": "^6.2.3",
"typedoc": "^0.23.14",
"typedoc-json-parser": "^4.0.0",
- "typescript": "^4.8.3",
- "vitest": "^0.23.4"
+ "typescript": "^4.8.3"
}
}
diff --git a/packages/time-utilities/src/index.ts b/packages/time-utilities/src/index.ts
index 809256976e..9b2e1d9426 100644
--- a/packages/time-utilities/src/index.ts
+++ b/packages/time-utilities/src/index.ts
@@ -1,6 +1,14 @@
-export { Time, TimeTypes } from './lib/constants';
-export * from './lib/Cron';
-export * from './lib/Duration';
-export * from './lib/DurationFormatter';
-export * from './lib/TimerManager';
-export * from './lib/Timestamp';
+export { allowedNum, Cron, cronTokens, partRegex, predefined, tokensRegex, wildcardRegex } from '@sapphire/cron';
+export {
+ DEFAULT_SEPARATORS,
+ DEFAULT_UNITS,
+ Duration,
+ DurationFormatAssetsTime,
+ DurationFormatAssetsUnit,
+ DurationFormatSeparators,
+ DurationFormatter,
+ Time,
+ TimeTypes
+} from '@sapphire/duration';
+export { TimerManager } from '@sapphire/timer-manager';
+export { days, months, TimeResolvable, Timestamp, TimestampTemplateEntry, tokens } from '@sapphire/timestamp';
diff --git a/packages/time-utilities/src/lib/constants.ts b/packages/time-utilities/src/lib/constants.ts
deleted file mode 100644
index 03c528cce6..0000000000
--- a/packages/time-utilities/src/lib/constants.ts
+++ /dev/null
@@ -1,132 +0,0 @@
-/* eslint-disable @typescript-eslint/naming-convention */
-import type { DurationFormatAssetsTime, DurationFormatSeparators } from './DurationFormatter';
-
-/**
- * The supported time types
- */
-export enum TimeTypes {
- Second = 'second',
- Minute = 'minute',
- Hour = 'hour',
- Day = 'day',
- Week = 'week',
- Month = 'month',
- Year = 'year'
-}
-
-export enum Time {
- Millisecond = 1,
- Second = 1000,
- Minute = 1000 * 60,
- Hour = 1000 * 60 * 60,
- Day = 1000 * 60 * 60 * 24,
- Month = 1000 * 60 * 60 * 24 * (365 / 12),
- Year = 1000 * 60 * 60 * 24 * 365
-}
-
-export const days = ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'];
-
-export const months = ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'];
-
-export const tokens = new Map([
- ['Y', 4],
- ['Q', 1],
- ['M', 4],
- ['D', 4],
- ['d', 4],
- ['X', 1],
- ['x', 1],
- ['H', 2],
- ['h', 2],
- ['a', 1],
- ['A', 1],
- ['m', 2],
- ['s', 2],
- ['S', 3],
- ['Z', 2],
- ['l', 4],
- ['L', 4],
- ['T', 1],
- ['t', 1]
-]);
-
-export const partRegex = /^(?:(\*)|(\d+)(?:-(\d+))?)(?:\/(\d+))?$/;
-
-export const wildcardRegex = /\bh\b|\B\?\B/g;
-
-export const allowedNum = [
- [0, 59],
- [0, 23],
- [1, 31],
- [1, 12],
- [0, 6]
-];
-
-export const predefined = {
- '@annually': '0 0 1 1 *',
- '@yearly': '0 0 1 1 *',
- '@monthly': '0 0 1 * *',
- '@weekly': '0 0 * * 0',
- '@daily': '0 0 * * *',
- '@hourly': '0 * * * *'
-} as const;
-
-export const cronTokens = {
- jan: 1,
- feb: 2,
- mar: 3,
- apr: 4,
- may: 5,
- jun: 6,
- jul: 7,
- aug: 8,
- sep: 9,
- oct: 10,
- nov: 11,
- dec: 12,
- sun: 0,
- mon: 1,
- tue: 2,
- wed: 3,
- thu: 4,
- fri: 5,
- sat: 6
-} as const;
-
-export const tokensRegex = new RegExp(Object.keys(cronTokens).join('|'), 'g');
-
-export const DEFAULT_UNITS: DurationFormatAssetsTime = {
- [TimeTypes.Year]: {
- 1: 'year',
- DEFAULT: 'years'
- },
- [TimeTypes.Month]: {
- 1: 'month',
- DEFAULT: 'months'
- },
- [TimeTypes.Week]: {
- 1: 'week',
- DEFAULT: 'weeks'
- },
- [TimeTypes.Day]: {
- 1: 'day',
- DEFAULT: 'days'
- },
- [TimeTypes.Hour]: {
- 1: 'hour',
- DEFAULT: 'hours'
- },
- [TimeTypes.Minute]: {
- 1: 'minute',
- DEFAULT: 'minutes'
- },
- [TimeTypes.Second]: {
- 1: 'second',
- DEFAULT: 'seconds'
- }
-};
-
-export const DEFAULT_SEPARATORS: DurationFormatSeparators = {
- left: ' ',
- right: ' '
-};
diff --git a/packages/time-utilities/tsconfig.eslint.json b/packages/time-utilities/tsconfig.eslint.json
index 2151f9bd19..247be96005 100644
--- a/packages/time-utilities/tsconfig.eslint.json
+++ b/packages/time-utilities/tsconfig.eslint.json
@@ -4,5 +4,5 @@
"allowJs": true,
"checkJs": true
},
- "include": ["src", "tests"]
+ "include": ["src"]
}
diff --git a/packages/timer-manager/.cliff-jumperrc.yml b/packages/timer-manager/.cliff-jumperrc.yml
new file mode 100644
index 0000000000..bc5b033754
--- /dev/null
+++ b/packages/timer-manager/.cliff-jumperrc.yml
@@ -0,0 +1,3 @@
+name: timer-manager
+org: sapphire
+packagePath: packages/timer-manager
diff --git a/packages/timer-manager/.typedoc-json-parserrc.yml b/packages/timer-manager/.typedoc-json-parserrc.yml
new file mode 100644
index 0000000000..92d0e01d7e
--- /dev/null
+++ b/packages/timer-manager/.typedoc-json-parserrc.yml
@@ -0,0 +1 @@
+json: 'docs/api.json'
diff --git a/packages/timer-manager/CHANGELOG.md b/packages/timer-manager/CHANGELOG.md
new file mode 100644
index 0000000000..e69de29bb2
diff --git a/packages/timer-manager/README.md b/packages/timer-manager/README.md
new file mode 100644
index 0000000000..ced78a0851
--- /dev/null
+++ b/packages/timer-manager/README.md
@@ -0,0 +1,119 @@
+
+
+![Sapphire Logo](https://cdn.skyra.pw/gh-assets/sapphire-banner.png)
+
+# @sapphire/timer-manager
+
+**Timer manager utilities for JavaScript.**
+
+[![GitHub](https://img.shields.io/github/license/sapphiredev/utilities)](https://github.com/sapphiredev/utilities/blob/main/LICENSE.md)
+[![codecov](https://codecov.io/gh/sapphiredev/utilities/branch/main/graph/badge.svg?token=OEGIV6RFDO)](https://codecov.io/gh/sapphiredev/utilities)
+[![npm bundle size](https://img.shields.io/bundlephobia/min/@sapphire/timer-manager?logo=webpack&style=flat-square)](https://bundlephobia.com/result?p=@sapphire/timer-manager)
+[![npm](https://img.shields.io/npm/v/@sapphire/timer-manager?color=crimson&logo=npm&style=flat-square)](https://www.npmjs.com/package/@sapphire/timer-manager)
+
+
+
+**Table of Contents**
+
+- [Features](#features)
+- [Installation](#installation)
+- [Usage](#usage)
+ - [Basic Usage](#basic-usage)
+- [Buy us some doughnuts](#buy-us-some-doughnuts)
+- [Contributors β¨](#contributors-%E2%9C%A8)
+
+## Features
+
+- Written in TypeScript
+- Bundled with esbuild so it can be used in NodeJS and browsers
+- Offers CommonJS, ESM and UMD bundles
+- Fully tested
+
+## Installation
+
+You can use the following command to install this package, or replace `npm install` with your package manager of choice.
+
+```sh
+npm install @sapphire/timer-manager
+```
+
+## Buy us some doughnuts
+
+Sapphire Community is and always will be open source, even if we don't get donations. That being said, we know there are amazing people who may still want to donate just to show their appreciation. Thank you very much in advance!
+
+We accept donations through Open Collective, Ko-fi, PayPal, Patreon and GitHub Sponsorships. You can use the buttons below to donate through your method of choice.
+
+| Donate With | Address |
+| :-------------: | :-------------------------------------------------: |
+| Open Collective | [Click Here](https://sapphirejs.dev/opencollective) |
+| Ko-fi | [Click Here](https://sapphirejs.dev/kofi) |
+| Patreon | [Click Here](https://sapphirejs.dev/patreon) |
+| PayPal | [Click Here](https://sapphirejs.dev/paypal) |
+
+## Contributors β¨
+
+Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/docs/en/emoji-key)):
+
+
+
+
+
+
+
+
+
+
+
+This project follows the [all-contributors](https://github.com/all-contributors/all-contributors) specification. Contributions of any kind welcome!
diff --git a/packages/timer-manager/cliff.toml b/packages/timer-manager/cliff.toml
new file mode 100644
index 0000000000..7663e8bba7
--- /dev/null
+++ b/packages/timer-manager/cliff.toml
@@ -0,0 +1,63 @@
+[changelog]
+header = """
+# Changelog
+
+All notable changes to this project will be documented in this file.\n
+"""
+body = """
+{% if version %}\
+ # [{{ version | trim_start_matches(pat="v") }}]\
+ {% if previous %}\
+ {% if previous.version %}\
+ (https://github.com/sapphiredev/utilities/compare/{{ previous.version }}...{{ version }})\
+ {% else %}\
+ (https://github.com/sapphiredev/utilities/tree/{{ version }})\
+ {% endif %}\
+ {% endif %} \
+ - ({{ timestamp | date(format="%Y-%m-%d") }})
+{% else %}\
+ # [unreleased]
+{% endif %}\
+{% for group, commits in commits | group_by(attribute="group") %}
+ ## {{ group | upper_first }}
+ {% for commit in commits %}
+ - {% if commit.scope %}\
+ **{{commit.scope}}:** \
+ {% endif %}\
+ {{ commit.message | upper_first }} ([{{ commit.id | truncate(length=7, end="") }}](https://github.com/sapphiredev/utilities/commit/{{ commit.id }}))\
+ {% if commit.breaking %}\
+ {% for breakingChange in commit.footers %}\
+ \n{% raw %} {% endraw %}- π₯ **{{ breakingChange.token }}{{ breakingChange.separator }}** {{ breakingChange.value }}\
+ {% endfor %}\
+ {% endif %}\
+ {% endfor %}
+{% endfor %}\n
+"""
+trim = true
+footer = ""
+
+[git]
+conventional_commits = true
+filter_unconventional = true
+commit_parsers = [
+ { message = "^feat", group = "π Features"},
+ { message = "^fix", group = "π Bug Fixes"},
+ { message = "^docs", group = "π Documentation"},
+ { message = "^perf", group = "π Performance"},
+ { message = "^refactor", group = "π Refactor"},
+ { message = "^typings", group = "β¨οΈ Typings"},
+ { message = "^types", group = "β¨οΈ Typings"},
+ { message = ".*deprecated", body = ".*deprecated", group = "π¨ Deprecation"},
+ { message = "^revert", skip = true},
+ { message = "^style", group = "πͺ Styling"},
+ { message = "^test", group = "π§ͺ Testing"},
+ { message = "^chore", skip = true},
+ { message = "^ci", skip = true},
+ { message = "^build", skip = true},
+ { body = ".*security", group = "π‘οΈ Security"},
+]
+filter_commits = true
+tag_pattern = "@sapphire/timer-manager@[0-9]*"
+ignore_tags = ""
+topo_order = false
+sort_commits = "newest"
diff --git a/packages/timer-manager/package.json b/packages/timer-manager/package.json
new file mode 100644
index 0000000000..72e5063769
--- /dev/null
+++ b/packages/timer-manager/package.json
@@ -0,0 +1,68 @@
+{
+ "name": "@sapphire/timer-manager",
+ "version": "1.0.0",
+ "description": "A timer manager utility library for JavaScript.",
+ "author": "@sapphire",
+ "license": "MIT",
+ "main": "dist/index.js",
+ "module": "dist/index.mjs",
+ "browser": "dist/index.global.js",
+ "unpkg": "dist/index.global.js",
+ "types": "dist/index.d.ts",
+ "exports": {
+ "import": "./dist/index.mjs",
+ "require": "./dist/index.js",
+ "types": "./dist/index.d.ts"
+ },
+ "sideEffects": false,
+ "homepage": "https://github.com/sapphiredev/utilities/tree/main/packages/timer-manager",
+ "scripts": {
+ "test": "vitest run",
+ "lint": "eslint src tests --ext ts --fix -c ../../.eslintrc",
+ "build": "tsup",
+ "docs": "typedoc-json-parser",
+ "prepack": "yarn build",
+ "bump": "cliff-jumper",
+ "check-update": "cliff-jumper --dry-run"
+ },
+ "repository": {
+ "type": "git",
+ "url": "git+https://github.com/sapphiredev/utilities.git",
+ "directory": "packages/timer-manager"
+ },
+ "files": [
+ "dist/**/*.js*",
+ "dist/**/*.mjs*",
+ "dist/**/*.d*"
+ ],
+ "engines": {
+ "node": ">=v14.0.0",
+ "npm": ">=7.0.0"
+ },
+ "keywords": [
+ "@sapphire/timer-manager",
+ "timer",
+ "bot",
+ "typescript",
+ "ts",
+ "yarn",
+ "discord",
+ "sapphire",
+ "standalone"
+ ],
+ "bugs": {
+ "url": "https://github.com/sapphiredev/utilities/issues"
+ },
+ "publishConfig": {
+ "access": "public"
+ },
+ "devDependencies": {
+ "@favware/cliff-jumper": "^1.8.7",
+ "@vitest/coverage-c8": "^0.23.4",
+ "tsup": "^6.2.3",
+ "typedoc": "^0.23.14",
+ "typedoc-json-parser": "^4.0.0",
+ "typescript": "^4.8.3",
+ "vitest": "^0.23.4"
+ }
+}
diff --git a/packages/timer-manager/src/index.ts b/packages/timer-manager/src/index.ts
new file mode 100644
index 0000000000..f18971f5f8
--- /dev/null
+++ b/packages/timer-manager/src/index.ts
@@ -0,0 +1 @@
+export * from './lib/TimerManager';
diff --git a/packages/time-utilities/src/lib/TimerManager.ts b/packages/timer-manager/src/lib/TimerManager.ts
similarity index 100%
rename from packages/time-utilities/src/lib/TimerManager.ts
rename to packages/timer-manager/src/lib/TimerManager.ts
diff --git a/packages/timer-manager/src/tsconfig.json b/packages/timer-manager/src/tsconfig.json
new file mode 100644
index 0000000000..89170e53e9
--- /dev/null
+++ b/packages/timer-manager/src/tsconfig.json
@@ -0,0 +1,9 @@
+{
+ "extends": "../../ts-config/extra-strict-without-decorators.json",
+ "compilerOptions": {
+ "rootDir": "./",
+ "outDir": "../dist",
+ "incremental": false
+ },
+ "include": ["."]
+}
diff --git a/packages/time-utilities/tests/lib/timer-manager/TimerManager.test.ts b/packages/timer-manager/tests/lib/TimerManager.test.ts
similarity index 98%
rename from packages/time-utilities/tests/lib/timer-manager/TimerManager.test.ts
rename to packages/timer-manager/tests/lib/TimerManager.test.ts
index 4128eb4cfc..e0cecd2fe9 100644
--- a/packages/time-utilities/tests/lib/timer-manager/TimerManager.test.ts
+++ b/packages/timer-manager/tests/lib/TimerManager.test.ts
@@ -1,4 +1,4 @@
-import { TimerManager } from '../../../src';
+import { TimerManager } from '../../src';
describe('TimerManager', () => {
afterEach(() => {
diff --git a/packages/timer-manager/tests/tsconfig.json b/packages/timer-manager/tests/tsconfig.json
new file mode 100644
index 0000000000..d6ac0596a8
--- /dev/null
+++ b/packages/timer-manager/tests/tsconfig.json
@@ -0,0 +1,10 @@
+{
+ "extends": "../../ts-config/extra-strict-without-decorators.json",
+ "compilerOptions": {
+ "target": "ES2020",
+ "noEmit": true,
+ "incremental": false,
+ "types": ["vitest/globals"]
+ },
+ "include": ["./"]
+}
diff --git a/packages/timer-manager/tsconfig.eslint.json b/packages/timer-manager/tsconfig.eslint.json
new file mode 100644
index 0000000000..2151f9bd19
--- /dev/null
+++ b/packages/timer-manager/tsconfig.eslint.json
@@ -0,0 +1,8 @@
+{
+ "extends": "../ts-config/extra-strict-without-decorators.json",
+ "compilerOptions": {
+ "allowJs": true,
+ "checkJs": true
+ },
+ "include": ["src", "tests"]
+}
diff --git a/packages/timer-manager/tsup.config.ts b/packages/timer-manager/tsup.config.ts
new file mode 100644
index 0000000000..eaf7565c95
--- /dev/null
+++ b/packages/timer-manager/tsup.config.ts
@@ -0,0 +1,3 @@
+import { createTsupConfig } from '../../scripts/tsup.config';
+
+export default createTsupConfig({ globalName: 'SapphireTimerManager', target: 'es2020' });
diff --git a/packages/timer-manager/typedoc.json b/packages/timer-manager/typedoc.json
new file mode 100644
index 0000000000..8c791b5134
--- /dev/null
+++ b/packages/timer-manager/typedoc.json
@@ -0,0 +1,6 @@
+{
+ "$schema": "https://typedoc.org/schema.json",
+ "entryPoints": ["src/index.ts"],
+ "json": "docs/api.json",
+ "tsconfig": "src/tsconfig.json"
+}
diff --git a/packages/timer-manager/vitest.config.ts b/packages/timer-manager/vitest.config.ts
new file mode 100644
index 0000000000..19a1400c7f
--- /dev/null
+++ b/packages/timer-manager/vitest.config.ts
@@ -0,0 +1,7 @@
+import { createVitestConfig } from '../../scripts/vitest.config';
+
+export default createVitestConfig({
+ esbuild: {
+ target: 'es2020'
+ }
+});
diff --git a/packages/timestamp/.cliff-jumperrc.yml b/packages/timestamp/.cliff-jumperrc.yml
new file mode 100644
index 0000000000..cb60dcc35e
--- /dev/null
+++ b/packages/timestamp/.cliff-jumperrc.yml
@@ -0,0 +1,3 @@
+name: timestamp
+org: sapphire
+packagePath: packages/timestamp
diff --git a/packages/timestamp/.typedoc-json-parserrc.yml b/packages/timestamp/.typedoc-json-parserrc.yml
new file mode 100644
index 0000000000..92d0e01d7e
--- /dev/null
+++ b/packages/timestamp/.typedoc-json-parserrc.yml
@@ -0,0 +1 @@
+json: 'docs/api.json'
diff --git a/packages/timestamp/CHANGELOG.md b/packages/timestamp/CHANGELOG.md
new file mode 100644
index 0000000000..e69de29bb2
diff --git a/packages/timestamp/README.md b/packages/timestamp/README.md
new file mode 100644
index 0000000000..b1e17e8373
--- /dev/null
+++ b/packages/timestamp/README.md
@@ -0,0 +1,119 @@
+
+
+![Sapphire Logo](https://cdn.skyra.pw/gh-assets/sapphire-banner.png)
+
+# @sapphire/timestamp
+
+**Timestamp utilities for JavaScript.**
+
+[![GitHub](https://img.shields.io/github/license/sapphiredev/utilities)](https://github.com/sapphiredev/utilities/blob/main/LICENSE.md)
+[![codecov](https://codecov.io/gh/sapphiredev/utilities/branch/main/graph/badge.svg?token=OEGIV6RFDO)](https://codecov.io/gh/sapphiredev/utilities)
+[![npm bundle size](https://img.shields.io/bundlephobia/min/@sapphire/timestamp?logo=webpack&style=flat-square)](https://bundlephobia.com/result?p=@sapphire/timestamp)
+[![npm](https://img.shields.io/npm/v/@sapphire/timestamp?color=crimson&logo=npm&style=flat-square)](https://www.npmjs.com/package/@sapphire/timestamp)
+
+
+
+**Table of Contents**
+
+- [Features](#features)
+- [Installation](#installation)
+- [Usage](#usage)
+ - [Basic Usage](#basic-usage)
+- [Buy us some doughnuts](#buy-us-some-doughnuts)
+- [Contributors β¨](#contributors-%E2%9C%A8)
+
+## Features
+
+- Written in TypeScript
+- Bundled with esbuild so it can be used in NodeJS and browsers
+- Offers CommonJS, ESM and UMD bundles
+- Fully tested
+
+## Installation
+
+You can use the following command to install this package, or replace `npm install` with your package manager of choice.
+
+```sh
+npm install @sapphire/timestamp
+```
+
+## Buy us some doughnuts
+
+Sapphire Community is and always will be open source, even if we don't get donations. That being said, we know there are amazing people who may still want to donate just to show their appreciation. Thank you very much in advance!
+
+We accept donations through Open Collective, Ko-fi, PayPal, Patreon and GitHub Sponsorships. You can use the buttons below to donate through your method of choice.
+
+| Donate With | Address |
+| :-------------: | :-------------------------------------------------: |
+| Open Collective | [Click Here](https://sapphirejs.dev/opencollective) |
+| Ko-fi | [Click Here](https://sapphirejs.dev/kofi) |
+| Patreon | [Click Here](https://sapphirejs.dev/patreon) |
+| PayPal | [Click Here](https://sapphirejs.dev/paypal) |
+
+## Contributors β¨
+
+Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/docs/en/emoji-key)):
+
+
+
+
+
+
+
+
+
+
+
+This project follows the [all-contributors](https://github.com/all-contributors/all-contributors) specification. Contributions of any kind welcome!
diff --git a/packages/timestamp/cliff.toml b/packages/timestamp/cliff.toml
new file mode 100644
index 0000000000..9ae13f96b9
--- /dev/null
+++ b/packages/timestamp/cliff.toml
@@ -0,0 +1,63 @@
+[changelog]
+header = """
+# Changelog
+
+All notable changes to this project will be documented in this file.\n
+"""
+body = """
+{% if version %}\
+ # [{{ version | trim_start_matches(pat="v") }}]\
+ {% if previous %}\
+ {% if previous.version %}\
+ (https://github.com/sapphiredev/utilities/compare/{{ previous.version }}...{{ version }})\
+ {% else %}\
+ (https://github.com/sapphiredev/utilities/tree/{{ version }})\
+ {% endif %}\
+ {% endif %} \
+ - ({{ timestamp | date(format="%Y-%m-%d") }})
+{% else %}\
+ # [unreleased]
+{% endif %}\
+{% for group, commits in commits | group_by(attribute="group") %}
+ ## {{ group | upper_first }}
+ {% for commit in commits %}
+ - {% if commit.scope %}\
+ **{{commit.scope}}:** \
+ {% endif %}\
+ {{ commit.message | upper_first }} ([{{ commit.id | truncate(length=7, end="") }}](https://github.com/sapphiredev/utilities/commit/{{ commit.id }}))\
+ {% if commit.breaking %}\
+ {% for breakingChange in commit.footers %}\
+ \n{% raw %} {% endraw %}- π₯ **{{ breakingChange.token }}{{ breakingChange.separator }}** {{ breakingChange.value }}\
+ {% endfor %}\
+ {% endif %}\
+ {% endfor %}
+{% endfor %}\n
+"""
+trim = true
+footer = ""
+
+[git]
+conventional_commits = true
+filter_unconventional = true
+commit_parsers = [
+ { message = "^feat", group = "π Features"},
+ { message = "^fix", group = "π Bug Fixes"},
+ { message = "^docs", group = "π Documentation"},
+ { message = "^perf", group = "π Performance"},
+ { message = "^refactor", group = "π Refactor"},
+ { message = "^typings", group = "β¨οΈ Typings"},
+ { message = "^types", group = "β¨οΈ Typings"},
+ { message = ".*deprecated", body = ".*deprecated", group = "π¨ Deprecation"},
+ { message = "^revert", skip = true},
+ { message = "^style", group = "πͺ Styling"},
+ { message = "^test", group = "π§ͺ Testing"},
+ { message = "^chore", skip = true},
+ { message = "^ci", skip = true},
+ { message = "^build", skip = true},
+ { body = ".*security", group = "π‘οΈ Security"},
+]
+filter_commits = true
+tag_pattern = "@sapphire/timestamp@[0-9]*"
+ignore_tags = ""
+topo_order = false
+sort_commits = "newest"
diff --git a/packages/timestamp/package.json b/packages/timestamp/package.json
new file mode 100644
index 0000000000..02f4993c7d
--- /dev/null
+++ b/packages/timestamp/package.json
@@ -0,0 +1,68 @@
+{
+ "name": "@sapphire/timestamp",
+ "version": "1.0.0",
+ "description": "A timestamp utility library for JavaScript.",
+ "author": "@sapphire",
+ "license": "MIT",
+ "main": "dist/index.js",
+ "module": "dist/index.mjs",
+ "browser": "dist/index.global.js",
+ "unpkg": "dist/index.global.js",
+ "types": "dist/index.d.ts",
+ "exports": {
+ "import": "./dist/index.mjs",
+ "require": "./dist/index.js",
+ "types": "./dist/index.d.ts"
+ },
+ "sideEffects": false,
+ "homepage": "https://github.com/sapphiredev/utilities/tree/main/packages/timestamp",
+ "scripts": {
+ "test": "vitest run",
+ "lint": "eslint src tests --ext ts --fix -c ../../.eslintrc",
+ "build": "tsup",
+ "docs": "typedoc-json-parser",
+ "prepack": "yarn build",
+ "bump": "cliff-jumper",
+ "check-update": "cliff-jumper --dry-run"
+ },
+ "repository": {
+ "type": "git",
+ "url": "git+https://github.com/sapphiredev/utilities.git",
+ "directory": "packages/timestamp"
+ },
+ "files": [
+ "dist/**/*.js*",
+ "dist/**/*.mjs*",
+ "dist/**/*.d*"
+ ],
+ "engines": {
+ "node": ">=v14.0.0",
+ "npm": ">=7.0.0"
+ },
+ "keywords": [
+ "@sapphire/timestamp",
+ "timestamp",
+ "bot",
+ "typescript",
+ "ts",
+ "yarn",
+ "discord",
+ "sapphire",
+ "standalone"
+ ],
+ "bugs": {
+ "url": "https://github.com/sapphiredev/utilities/issues"
+ },
+ "publishConfig": {
+ "access": "public"
+ },
+ "devDependencies": {
+ "@favware/cliff-jumper": "^1.8.7",
+ "@vitest/coverage-c8": "^0.23.4",
+ "tsup": "^6.2.3",
+ "typedoc": "^0.23.14",
+ "typedoc-json-parser": "^4.0.0",
+ "typescript": "^4.8.3",
+ "vitest": "^0.23.4"
+ }
+}
diff --git a/packages/timestamp/src/index.ts b/packages/timestamp/src/index.ts
new file mode 100644
index 0000000000..77e569fea9
--- /dev/null
+++ b/packages/timestamp/src/index.ts
@@ -0,0 +1,2 @@
+export * from './lib/constants';
+export * from './lib/Timestamp';
diff --git a/packages/time-utilities/src/lib/Timestamp.ts b/packages/timestamp/src/lib/Timestamp.ts
similarity index 100%
rename from packages/time-utilities/src/lib/Timestamp.ts
rename to packages/timestamp/src/lib/Timestamp.ts
diff --git a/packages/timestamp/src/lib/constants.ts b/packages/timestamp/src/lib/constants.ts
new file mode 100644
index 0000000000..a4c3cba06f
--- /dev/null
+++ b/packages/timestamp/src/lib/constants.ts
@@ -0,0 +1,35 @@
+export enum Time {
+ Millisecond = 1,
+ Second = 1000,
+ Minute = 1000 * 60,
+ Hour = 1000 * 60 * 60,
+ Day = 1000 * 60 * 60 * 24,
+ Month = 1000 * 60 * 60 * 24 * (365 / 12),
+ Year = 1000 * 60 * 60 * 24 * 365
+}
+
+export const days = ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'];
+
+export const months = ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'];
+
+export const tokens = new Map([
+ ['Y', 4],
+ ['Q', 1],
+ ['M', 4],
+ ['D', 4],
+ ['d', 4],
+ ['X', 1],
+ ['x', 1],
+ ['H', 2],
+ ['h', 2],
+ ['a', 1],
+ ['A', 1],
+ ['m', 2],
+ ['s', 2],
+ ['S', 3],
+ ['Z', 2],
+ ['l', 4],
+ ['L', 4],
+ ['T', 1],
+ ['t', 1]
+]);
diff --git a/packages/timestamp/src/tsconfig.json b/packages/timestamp/src/tsconfig.json
new file mode 100644
index 0000000000..89170e53e9
--- /dev/null
+++ b/packages/timestamp/src/tsconfig.json
@@ -0,0 +1,9 @@
+{
+ "extends": "../../ts-config/extra-strict-without-decorators.json",
+ "compilerOptions": {
+ "rootDir": "./",
+ "outDir": "../dist",
+ "incremental": false
+ },
+ "include": ["."]
+}
diff --git a/packages/time-utilities/tests/lib/timestamp/displayAfternoon.test.ts b/packages/timestamp/tests/lib/displayAfternoon.test.ts
similarity index 98%
rename from packages/time-utilities/tests/lib/timestamp/displayAfternoon.test.ts
rename to packages/timestamp/tests/lib/displayAfternoon.test.ts
index 0e8e6e246a..f45ba492f2 100644
--- a/packages/time-utilities/tests/lib/timestamp/displayAfternoon.test.ts
+++ b/packages/timestamp/tests/lib/displayAfternoon.test.ts
@@ -1,4 +1,4 @@
-import { Timestamp } from '../../../src';
+import { Timestamp } from '../../src';
// Saturday 9th March 2019, at 16:20:35:500
const date = new Date(2019, 2, 9, 16, 20, 35, 1);
diff --git a/packages/time-utilities/tests/lib/timestamp/displayArbitrary.test.ts b/packages/timestamp/tests/lib/displayArbitrary.test.ts
similarity index 96%
rename from packages/time-utilities/tests/lib/timestamp/displayArbitrary.test.ts
rename to packages/timestamp/tests/lib/displayArbitrary.test.ts
index 164452f06d..5fedf4c0d7 100644
--- a/packages/time-utilities/tests/lib/timestamp/displayArbitrary.test.ts
+++ b/packages/timestamp/tests/lib/displayArbitrary.test.ts
@@ -1,4 +1,4 @@
-import { Timestamp } from '../../../src';
+import { Timestamp } from '../../src';
// Saturday 9th March 2019, at 16:20:35:500
const date = new Date(2019, 2, 9, 16, 20, 35, 1);
diff --git a/packages/time-utilities/tests/lib/timestamp/displayMorning.test.ts b/packages/timestamp/tests/lib/displayMorning.test.ts
similarity index 98%
rename from packages/time-utilities/tests/lib/timestamp/displayMorning.test.ts
rename to packages/timestamp/tests/lib/displayMorning.test.ts
index 2adb762abd..d95ab23536 100644
--- a/packages/time-utilities/tests/lib/timestamp/displayMorning.test.ts
+++ b/packages/timestamp/tests/lib/displayMorning.test.ts
@@ -1,4 +1,4 @@
-import { Timestamp } from '../../../src';
+import { Timestamp } from '../../src';
// Saturday 9th March 2019, at 4:20:35:500
const date = new Date(2019, 2, 9, 4, 20, 35, 1);
diff --git a/packages/time-utilities/tests/lib/timestamp/displayUTC.test.ts b/packages/timestamp/tests/lib/displayUTC.test.ts
similarity index 99%
rename from packages/time-utilities/tests/lib/timestamp/displayUTC.test.ts
rename to packages/timestamp/tests/lib/displayUTC.test.ts
index dae8e1f6d5..865c7e875d 100644
--- a/packages/time-utilities/tests/lib/timestamp/displayUTC.test.ts
+++ b/packages/timestamp/tests/lib/displayUTC.test.ts
@@ -1,4 +1,4 @@
-import { Timestamp } from '../../../src';
+import { Timestamp } from '../../src';
// Saturday 9th March 2019, at 16:20:35:500
const date = new Date(2019, 2, 9, 16, 20, 35, 1);
diff --git a/packages/time-utilities/tests/lib/timestamp/displayZeroes.test.ts b/packages/timestamp/tests/lib/displayZeroes.test.ts
similarity index 98%
rename from packages/time-utilities/tests/lib/timestamp/displayZeroes.test.ts
rename to packages/timestamp/tests/lib/displayZeroes.test.ts
index 35189e54ed..4493f24634 100644
--- a/packages/time-utilities/tests/lib/timestamp/displayZeroes.test.ts
+++ b/packages/timestamp/tests/lib/displayZeroes.test.ts
@@ -1,4 +1,4 @@
-import { Timestamp } from '../../../src';
+import { Timestamp } from '../../src';
// Saturday 9th March 2019, at 0:00:00:000
const date = new Date(2019, 2, 9, 0, 0, 0, 0);
diff --git a/packages/time-utilities/tests/lib/timestamp/template.test.ts b/packages/timestamp/tests/lib/template.test.ts
similarity index 97%
rename from packages/time-utilities/tests/lib/timestamp/template.test.ts
rename to packages/timestamp/tests/lib/template.test.ts
index 8e3f66c0f6..a8749c2eab 100644
--- a/packages/time-utilities/tests/lib/timestamp/template.test.ts
+++ b/packages/timestamp/tests/lib/template.test.ts
@@ -1,4 +1,4 @@
-import { Timestamp, TimestampTemplateEntry } from '../../../src';
+import { Timestamp, TimestampTemplateEntry } from '../../src';
function extractParsedTemplate(timestamp: Timestamp): TimestampTemplateEntry[] {
return timestamp['template'];
diff --git a/packages/timestamp/tests/tsconfig.json b/packages/timestamp/tests/tsconfig.json
new file mode 100644
index 0000000000..d6ac0596a8
--- /dev/null
+++ b/packages/timestamp/tests/tsconfig.json
@@ -0,0 +1,10 @@
+{
+ "extends": "../../ts-config/extra-strict-without-decorators.json",
+ "compilerOptions": {
+ "target": "ES2020",
+ "noEmit": true,
+ "incremental": false,
+ "types": ["vitest/globals"]
+ },
+ "include": ["./"]
+}
diff --git a/packages/timestamp/tsconfig.eslint.json b/packages/timestamp/tsconfig.eslint.json
new file mode 100644
index 0000000000..2151f9bd19
--- /dev/null
+++ b/packages/timestamp/tsconfig.eslint.json
@@ -0,0 +1,8 @@
+{
+ "extends": "../ts-config/extra-strict-without-decorators.json",
+ "compilerOptions": {
+ "allowJs": true,
+ "checkJs": true
+ },
+ "include": ["src", "tests"]
+}
diff --git a/packages/timestamp/tsup.config.ts b/packages/timestamp/tsup.config.ts
new file mode 100644
index 0000000000..0bc60ea51a
--- /dev/null
+++ b/packages/timestamp/tsup.config.ts
@@ -0,0 +1,3 @@
+import { createTsupConfig } from '../../scripts/tsup.config';
+
+export default createTsupConfig({ globalName: 'SapphireTimestamp', target: 'es2020' });
diff --git a/packages/timestamp/typedoc.json b/packages/timestamp/typedoc.json
new file mode 100644
index 0000000000..8c791b5134
--- /dev/null
+++ b/packages/timestamp/typedoc.json
@@ -0,0 +1,6 @@
+{
+ "$schema": "https://typedoc.org/schema.json",
+ "entryPoints": ["src/index.ts"],
+ "json": "docs/api.json",
+ "tsconfig": "src/tsconfig.json"
+}
diff --git a/packages/timestamp/vitest.config.ts b/packages/timestamp/vitest.config.ts
new file mode 100644
index 0000000000..19a1400c7f
--- /dev/null
+++ b/packages/timestamp/vitest.config.ts
@@ -0,0 +1,7 @@
+import { createVitestConfig } from '../../scripts/vitest.config';
+
+export default createVitestConfig({
+ esbuild: {
+ target: 'es2020'
+ }
+});
diff --git a/packages/ts-config/tests/tsconfig.json b/packages/ts-config/tests/tsconfig.json
index b9211b7144..5ad0d67096 100644
--- a/packages/ts-config/tests/tsconfig.json
+++ b/packages/ts-config/tests/tsconfig.json
@@ -2,9 +2,8 @@
"extends": "../extra-strict-without-decorators.json",
"compilerOptions": {
"lib": ["ESNext", "DOM"],
- "outDir": "../build",
- "rootDir": "./",
- "tsBuildInfoFile": "../build/test.tsbuildinfo",
+ "noEmit": true,
+ "incremental": false,
"types": ["vitest/globals"]
},
"include": ["./"]
diff --git a/packages/utilities/tests/tsconfig.json b/packages/utilities/tests/tsconfig.json
index 5d00602dc3..d0d5c3eee6 100644
--- a/packages/utilities/tests/tsconfig.json
+++ b/packages/utilities/tests/tsconfig.json
@@ -1,9 +1,8 @@
{
"extends": "../../ts-config/extra-strict-without-decorators.json",
"compilerOptions": {
- "rootDir": "./",
- "outDir": "./build",
- "tsBuildInfoFile": "./build/.tsbuildinfo",
+ "noEmit": true,
+ "incremental": false,
"types": ["vitest/globals"]
},
"include": ["./"]
diff --git a/scripts/clean-full.mjs b/scripts/clean-full.mjs
index 67b94936a9..c40ab86dd2 100644
--- a/scripts/clean-full.mjs
+++ b/scripts/clean-full.mjs
@@ -10,9 +10,11 @@ const paths = [
// Nested node_modules folders
new URL('async-queue/node_modules/', packagesDir),
+ new URL('cron/node_modules/', packagesDir),
new URL('decorators/node_modules/', packagesDir),
new URL('discord-utilities/node_modules/', packagesDir),
new URL('discord.js-utilities/node_modules/', packagesDir),
+ new URL('duration/node_modules/', packagesDir),
new URL('eslint-config/node_modules/', packagesDir),
new URL('event-iterator/node_modules/', packagesDir),
new URL('fetch/node_modules/', packagesDir),
@@ -24,14 +26,18 @@ const paths = [
new URL('snowflake/node_modules/', packagesDir),
new URL('stopwatch/node_modules/', packagesDir),
new URL('time-utilities/node_modules/', packagesDir),
+ new URL('timer-manager/node_modules/', packagesDir),
+ new URL('timestamp/node_modules/', packagesDir),
new URL('ts-config/node_modules/', packagesDir),
new URL('utilities/node_modules/', packagesDir),
// Dist folders
new URL('async-queue/dist/', packagesDir),
+ new URL('cron/dist/', packagesDir),
new URL('decorators/dist/', packagesDir),
new URL('discord-utilities/dist/', packagesDir),
new URL('discord.js-utilities/dist/', packagesDir),
+ new URL('duration/dist/', packagesDir),
new URL('eslint-config/dist/', packagesDir),
new URL('event-iterator/dist/', packagesDir),
new URL('fetch/dist/', packagesDir),
@@ -43,7 +49,8 @@ const paths = [
new URL('snowflake/dist/', packagesDir),
new URL('stopwatch/dist/', packagesDir),
new URL('time-utilities/dist/', packagesDir),
- new URL('ts-config/build/', packagesDir),
+ new URL('timer-manager/dist/', packagesDir),
+ new URL('timestamp/dist/', packagesDir),
new URL('utilities/dist/', packagesDir)
];
diff --git a/scripts/clean.mjs b/scripts/clean.mjs
index 69da9e8ac1..bccd5abb86 100644
--- a/scripts/clean.mjs
+++ b/scripts/clean.mjs
@@ -7,9 +7,11 @@ const options = { recursive: true, force: true };
const paths = [
// Dist folders
new URL('async-queue/dist/', packagesDir),
+ new URL('cron/dist/', packagesDir),
new URL('decorators/dist/', packagesDir),
new URL('discord-utilities/dist/', packagesDir),
new URL('discord.js-utilities/dist/', packagesDir),
+ new URL('duration/dist/', packagesDir),
new URL('eslint-config/dist/', packagesDir),
new URL('event-iterator/dist/', packagesDir),
new URL('fetch/dist/', packagesDir),
@@ -21,14 +23,17 @@ const paths = [
new URL('snowflake/dist/', packagesDir),
new URL('stopwatch/dist/', packagesDir),
new URL('time-utilities/dist/', packagesDir),
- new URL('ts-config/build/', packagesDir),
+ new URL('timer-manager/dist/', packagesDir),
+ new URL('timestamp/dist/', packagesDir),
new URL('utilities/dist/', packagesDir),
// Turbo folders
new URL('async-queue/.turbo/', packagesDir),
+ new URL('cron/.turbo/', packagesDir),
new URL('decorators/.turbo/', packagesDir),
new URL('discord-utilities/.turbo/', packagesDir),
new URL('discord.js-utilities/.turbo/', packagesDir),
+ new URL('duration/.turbo/', packagesDir),
new URL('eslint-config/.turbo/', packagesDir),
new URL('event-iterator/.turbo/', packagesDir),
new URL('fetch/.turbo/', packagesDir),
@@ -40,6 +45,8 @@ const paths = [
new URL('snowflake/.turbo/', packagesDir),
new URL('stopwatch/.turbo/', packagesDir),
new URL('time-utilities/.turbo/', packagesDir),
+ new URL('timer-manager/.turbo/', packagesDir),
+ new URL('timestamp/.turbo/', packagesDir),
new URL('ts-config/.turbo/', packagesDir),
new URL('utilities/.turbo/', packagesDir)
];
diff --git a/scripts/twemoji-regex-updater.mjs b/scripts/twemoji-regex-updater.mjs
index 6b4fc8f03f..3edf40d025 100644
--- a/scripts/twemoji-regex-updater.mjs
+++ b/scripts/twemoji-regex-updater.mjs
@@ -1,6 +1,6 @@
import { fetch, FetchResultTypes } from '@sapphire/fetch';
-import { Time, Timestamp } from '@sapphire/time-utilities';
-import { green, red, yellow } from 'colorette';
+import { Time, Timestamp } from '@sapphire/timestamp';
+import { green, yellow } from 'colorette';
import { rm, writeFile } from 'node:fs/promises';
import { URL } from 'node:url';
diff --git a/turbo.json b/turbo.json
index 524e9152c3..c5e75fc960 100644
--- a/turbo.json
+++ b/turbo.json
@@ -2,14 +2,30 @@
"pipeline": {
"build": {
"dependsOn": ["^build"],
- "outputs": ["dist/**", "build/**"]
+ "outputs": ["dist/**"]
},
"lint": {
- "dependsOn": ["@sapphire/prettier-config#build", "@sapphire/eslint-config#build"],
+ "dependsOn": [
+ "@sapphire/prettier-config#build",
+ "@sapphire/eslint-config#build",
+ "@sapphire/utilities#build",
+ "@sapphire/duration#build"
+ ],
"outputs": []
},
"test": {
- "dependsOn": ["@sapphire/time-utilities#build", "@sapphire/fetch#build"],
+ "dependsOn": [
+ "@sapphire/async-queue#build",
+ "@sapphire/discord-utilities#build",
+ "@sapphire/discord.js-utilities#build",
+ "@sapphire/duration#build",
+ "@sapphire/fetch#build",
+ "@sapphire/lexure#build",
+ "@sapphire/ratelimits#build",
+ "@sapphire/result#build",
+ "@sapphire/timer-manager#build",
+ "@sapphire/utilities#build"
+ ],
"outputs": ["coverage/**"]
},
"bump": {
@@ -22,12 +38,14 @@
},
"docs": {
"dependsOn": [
+ "@sapphire/cron#build",
"@sapphire/discord.js-utilities#build",
"@sapphire/fetch#build",
- "@sapphire/result#build",
- "@sapphire/utilities#build",
+ "@sapphire/lexure#build",
"@sapphire/ratelimits#build",
- "@sapphire/lexure#build"
+ "@sapphire/result#build",
+ "@sapphire/timestamp#build",
+ "@sapphire/utilities#build"
],
"outputs": ["docs/**"]
}
diff --git a/typedoc.json b/typedoc.json
index 6e0b53f2c8..fafe9581ce 100644
--- a/typedoc.json
+++ b/typedoc.json
@@ -3,9 +3,11 @@
"entryPointStrategy": "resolve",
"entryPoints": [
"packages/async-queue/src/index.ts",
+ "packages/cron/src/index.ts",
"packages/decorators/src/index.ts",
"packages/discord-utilities/src/index.ts",
"packages/discord.js-utilities/src/index.ts",
+ "packages/duration/src/index.ts",
"packages/eslint-config/src/index.ts",
"packages/event-iterator/src/index.ts",
"packages/fetch/src/index.ts",
@@ -17,6 +19,8 @@
"packages/snowflake/src/index.ts",
"packages/stopwatch/src/index.ts",
"packages/time-utilities/src/index.ts",
+ "packages/timer-manager/src/index.ts",
+ "packages/timestamp/src/index.ts",
"packages/utilities/src/index.ts"
],
"intentionallyNotExported": [
diff --git a/yarn.lock b/yarn.lock
index 0802c15540..f983b612e4 100644
--- a/yarn.lock
+++ b/yarn.lock
@@ -523,6 +523,21 @@ __metadata:
languageName: unknown
linkType: soft
+"@sapphire/cron@workspace:^, @sapphire/cron@workspace:packages/cron":
+ version: 0.0.0-use.local
+ resolution: "@sapphire/cron@workspace:packages/cron"
+ dependencies:
+ "@favware/cliff-jumper": ^1.8.7
+ "@sapphire/utilities": "workspace:^"
+ "@vitest/coverage-c8": ^0.23.4
+ tsup: ^6.2.3
+ typedoc: ^0.23.14
+ typedoc-json-parser: ^4.0.0
+ typescript: ^4.8.3
+ vitest: ^0.23.4
+ languageName: unknown
+ linkType: soft
+
"@sapphire/decorators@workspace:packages/decorators":
version: 0.0.0-use.local
resolution: "@sapphire/decorators@workspace:packages/decorators"
@@ -562,7 +577,7 @@ __metadata:
"@favware/cliff-jumper": ^1.8.7
"@favware/rollup-type-bundler": ^1.0.11
"@sapphire/discord-utilities": "workspace:^"
- "@sapphire/time-utilities": "workspace:^"
+ "@sapphire/duration": "workspace:^"
"@sapphire/utilities": "workspace:^"
tslib: ^2.4.0
tsup: ^6.2.3
@@ -572,6 +587,20 @@ __metadata:
languageName: unknown
linkType: soft
+"@sapphire/duration@workspace:^, @sapphire/duration@workspace:packages/duration":
+ version: 0.0.0-use.local
+ resolution: "@sapphire/duration@workspace:packages/duration"
+ dependencies:
+ "@favware/cliff-jumper": ^1.8.7
+ "@vitest/coverage-c8": ^0.23.4
+ tsup: ^6.2.3
+ typedoc: ^0.23.14
+ typedoc-json-parser: ^4.0.0
+ typescript: ^4.8.3
+ vitest: ^0.23.4
+ languageName: unknown
+ linkType: soft
+
"@sapphire/eslint-config@workspace:^, @sapphire/eslint-config@workspace:packages/eslint-config":
version: 0.0.0-use.local
resolution: "@sapphire/eslint-config@workspace:packages/eslint-config"
@@ -696,7 +725,7 @@ __metadata:
resolution: "@sapphire/ratelimits@workspace:packages/ratelimits"
dependencies:
"@favware/cliff-jumper": ^1.8.7
- "@sapphire/time-utilities": "workspace:^"
+ "@sapphire/timer-manager": "workspace:^"
"@vitest/coverage-c8": ^0.23.4
tsup: ^6.2.3
typedoc: ^0.23.14
@@ -759,12 +788,41 @@ __metadata:
languageName: unknown
linkType: soft
-"@sapphire/time-utilities@workspace:^, @sapphire/time-utilities@workspace:packages/time-utilities":
+"@sapphire/time-utilities@workspace:packages/time-utilities":
version: 0.0.0-use.local
resolution: "@sapphire/time-utilities@workspace:packages/time-utilities"
dependencies:
"@favware/cliff-jumper": ^1.8.7
- "@sapphire/utilities": "workspace:^"
+ "@sapphire/cron": "workspace:^"
+ "@sapphire/duration": "workspace:^"
+ "@sapphire/timer-manager": "workspace:^"
+ "@sapphire/timestamp": "workspace:^"
+ tsup: ^6.2.3
+ typedoc: ^0.23.14
+ typedoc-json-parser: ^4.0.0
+ typescript: ^4.8.3
+ languageName: unknown
+ linkType: soft
+
+"@sapphire/timer-manager@workspace:^, @sapphire/timer-manager@workspace:packages/timer-manager":
+ version: 0.0.0-use.local
+ resolution: "@sapphire/timer-manager@workspace:packages/timer-manager"
+ dependencies:
+ "@favware/cliff-jumper": ^1.8.7
+ "@vitest/coverage-c8": ^0.23.4
+ tsup: ^6.2.3
+ typedoc: ^0.23.14
+ typedoc-json-parser: ^4.0.0
+ typescript: ^4.8.3
+ vitest: ^0.23.4
+ languageName: unknown
+ linkType: soft
+
+"@sapphire/timestamp@workspace:^, @sapphire/timestamp@workspace:packages/timestamp":
+ version: 0.0.0-use.local
+ resolution: "@sapphire/timestamp@workspace:packages/timestamp"
+ dependencies:
+ "@favware/cliff-jumper": ^1.8.7
"@vitest/coverage-c8": ^0.23.4
tsup: ^6.2.3
typedoc: ^0.23.14