diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..86a43d2 --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,20 @@ +name: Build TypeScript definitions + +on: [push] + +jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: Use Node.js + uses: actions/setup-node@v4 + with: + node-version: '20.x' + - run: npm ci + - run: npm run build + - name: commit + uses: stefanzweifel/git-auto-commit-action@v4 + with: + commit_message: 'chore: update type definitions [skip ci]' + commit_author: GitHub Actions diff --git a/Uploader.d.ts b/Uploader.d.ts new file mode 100644 index 0000000..9a3bfc0 --- /dev/null +++ b/Uploader.d.ts @@ -0,0 +1,11 @@ +export = Uploader; +declare class Uploader { + constructor(client: any, forceReady?: boolean); + client: any; + ready: boolean; + url: any; + uploadFile(filePath: any, name?: any, tag?: string): Promise; + uploadUrl(url: any, fileName: any, tag?: string): Promise; + upload(file: any, fileName: any, tag?: string): Promise; + #private; +} diff --git a/package-lock.json b/package-lock.json index 6899d7c..457cc73 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,18 +1,30 @@ { "name": "revolt-uploader", - "version": "1.0.0", + "version": "1.1.5", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "revolt-uploader", - "version": "1.0.0", - "license": "ISC", + "version": "1.1.5", + "license": "MIT", "dependencies": { "form-data": "^4.0.0", "node-fetch": "^2.6.7" }, - "devDependencies": {} + "devDependencies": { + "@types/node": "^20.12.12", + "typescript": "^5.4.5" + } + }, + "node_modules/@types/node": { + "version": "20.12.12", + "resolved": "https://registry.npmjs.org/@types/node/-/node-20.12.12.tgz", + "integrity": "sha512-eWLDGF/FOSPtAvEqeRAQ4C8LSA7M1I7i0ky1I8U7kD1J5ITyW3AsRhQrKVoWf5pFKZ2kILsEGJhsI9r93PYnOw==", + "dev": true, + "dependencies": { + "undici-types": "~5.26.4" + } }, "node_modules/asynckit": { "version": "0.4.0", @@ -94,6 +106,25 @@ "resolved": "https://registry.npmjs.org/tr46/-/tr46-0.0.3.tgz", "integrity": "sha512-N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw==" }, + "node_modules/typescript": { + "version": "5.4.5", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.4.5.tgz", + "integrity": "sha512-vcI4UpRgg81oIRUFwR0WSIHKt11nJ7SAVlYNIu+QpqeyXP+gpQJy/Z4+F0aGxSE4MqwjyXvW/TzgkLAx2AGHwQ==", + "dev": true, + "bin": { + "tsc": "bin/tsc", + "tsserver": "bin/tsserver" + }, + "engines": { + "node": ">=14.17" + } + }, + "node_modules/undici-types": { + "version": "5.26.5", + "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-5.26.5.tgz", + "integrity": "sha512-JlCMO+ehdEIKqlFxk6IfVoAUVmgz7cU7zD/h9XZ0qzeosSHmUJVOzSQvvYSYWXkFXC+IfLKSIffhv0sVZup6pA==", + "dev": true + }, "node_modules/webidl-conversions": { "version": "3.0.1", "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-3.0.1.tgz", @@ -110,6 +141,15 @@ } }, "dependencies": { + "@types/node": { + "version": "20.12.12", + "resolved": "https://registry.npmjs.org/@types/node/-/node-20.12.12.tgz", + "integrity": "sha512-eWLDGF/FOSPtAvEqeRAQ4C8LSA7M1I7i0ky1I8U7kD1J5ITyW3AsRhQrKVoWf5pFKZ2kILsEGJhsI9r93PYnOw==", + "dev": true, + "requires": { + "undici-types": "~5.26.4" + } + }, "asynckit": { "version": "0.4.0", "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz", @@ -164,6 +204,18 @@ "resolved": "https://registry.npmjs.org/tr46/-/tr46-0.0.3.tgz", "integrity": "sha512-N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw==" }, + "typescript": { + "version": "5.4.5", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.4.5.tgz", + "integrity": "sha512-vcI4UpRgg81oIRUFwR0WSIHKt11nJ7SAVlYNIu+QpqeyXP+gpQJy/Z4+F0aGxSE4MqwjyXvW/TzgkLAx2AGHwQ==", + "dev": true + }, + "undici-types": { + "version": "5.26.5", + "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-5.26.5.tgz", + "integrity": "sha512-JlCMO+ehdEIKqlFxk6IfVoAUVmgz7cU7zD/h9XZ0qzeosSHmUJVOzSQvvYSYWXkFXC+IfLKSIffhv0sVZup6pA==", + "dev": true + }, "webidl-conversions": { "version": "3.0.1", "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-3.0.1.tgz", diff --git a/package.json b/package.json index d5ab648..fbf43c2 100644 --- a/package.json +++ b/package.json @@ -1,9 +1,11 @@ { "name": "revolt-uploader", - "version": "1.1.4", + "version": "1.1.5", "description": "A utility script to allow easy uploads of files to revolt.", "main": "Uploader.js", + "types": "Uploader.d.ts", "scripts": { + "build": "tsc --emitDeclarationOnly --allowJs --declaration Uploader.js", "test": "echo \"Error: no test specified\" && exit 1" }, "keywords": [ @@ -16,12 +18,15 @@ "revolt.chat" ], "author": "ShadowLp174", - "license": "ISC", + "license": "MIT", "dependencies": { "form-data": "^4.0.0", "node-fetch": "^2.6.7" }, - "devDependencies": {}, + "devDependencies": { + "@types/node": "^20.12.12", + "typescript": "^5.4.5" + }, "repository": { "type": "git", "url": "git+https://github.com/ShadowLp174/revolt-uploader.git"