update megalodon to the new templates

This commit is contained in:
Hazelnoot 2025-10-07 00:37:01 -04:00
parent 802e881173
commit f13972b814
132 changed files with 64 additions and 42 deletions

View file

@ -7,7 +7,7 @@
import { createDefaultEsmPreset, type JestConfigWithTsJest } from 'ts-jest';
const presetConfig = createDefaultEsmPreset({
tsconfig: '<rootDir>/tsconfig.json'
tsconfig: '<rootDir>/src/test/tsconfig.json'
});
export default {
@ -29,7 +29,7 @@ export default {
// collectCoverage: false,
// An array of glob patterns indicating a set of files for which coverage information should be collected
collectCoverageFrom: ['src/**/*.ts'],
collectCoverageFrom: ['src/lib/**/*.ts'],
// The directory where Jest should output its coverage files
coverageDirectory: "coverage",
@ -143,7 +143,7 @@ export default {
// A list of paths to directories that Jest should use to search for files in
roots: [
"<rootDir>/test"
"<rootDir>/src/test"
],
// Allows you to use a custom runner instead of Jest's default test runner
@ -172,7 +172,7 @@ export default {
// The glob patterns Jest uses to detect test files
testMatch: [
"<rootDir>/test/**/*.spec.ts"
"<rootDir>/src/test/**/*.spec.ts"
],
// An array of regexp pattern strings that are matched against all test paths, matched tests are skipped

View file

@ -4,11 +4,14 @@
"version": "7.0.1",
"private": true,
"description": "Mastodon API client for node.js and browser",
"main": "./lib/src/index.js",
"typings": "./lib/src/index.d.ts",
"main": "./built/lib/index.js",
"typings": "./built/lib/index.d.ts",
"scripts": {
"build": "tsc -p tsconfig.json",
"typecheck": "tsc -p tsconfig.json --noEmit",
"build": "tsc -p src/lib/tsconfig.json",
"typecheck-all": "pnpm run --no-bail typecheck:lib && pnpm run --no-bail typecheck:test",
"typecheck": "pnpm run typecheck:lib && pnpm run typecheck:test",
"typecheck:lib": "tsc -p src/lib/tsconfig.json --noEmit",
"typecheck:test": "tsc -p src/test/tsconfig.json --noEmit",
"lint": "pnpm run typecheck",
"jest": "cross-env NODE_ENV=test node --no-experimental-require-module --experimental-vm-modules --experimental-import-meta-resolve node_modules/jest/bin/jest.js --coverage --detectOpenHandles",
"test": "pnpm run jest"

View file

@ -1,5 +1,4 @@
import FormData from 'form-data'
import fs from 'fs';
import * as MisskeyAPI from './misskey/api_client.js'
import { DEFAULT_UA } from './default.js'
import * as OAuth from './oauth.js'
@ -1531,9 +1530,9 @@ export default class Misskey implements MegalodonInterface {
/**
* POST /api/drive/files/create
*/
public async uploadMedia(file: { filepath: fs.PathLike, mimetype: string, filename: string }, _options?: { description?: string; focus?: string }): Promise<Response<Entity.Attachment>> {
public async uploadMedia(file: { stream: ReadableStream, mimetype: string, filename: string }, _options?: { description?: string; focus?: string }): Promise<Response<Entity.Attachment>> {
const formData = new FormData()
formData.append('file', fs.createReadStream(file.filepath), {
formData.append('file', file.stream, {
contentType: file.mimetype,
});

Some files were not shown because too many files have changed in this diff Show more