[iceshrimp-js] Build with tsc so we get type declarations

This commit is contained in:
Laura Hausmann 2023-12-04 19:24:11 +01:00
parent d4aef0b930
commit 7f58107311
No known key found for this signature in database
GPG Key ID: D044E84C5BE01605
7 changed files with 30 additions and 17 deletions

View File

@ -5,7 +5,7 @@
"main": "./built/index.js", "main": "./built/index.js",
"types": "./built/index.d.ts", "types": "./built/index.d.ts",
"scripts": { "scripts": {
"build": "swc src -d built -D", "build": "tsc",
"build:debug": "swc src -d built -s -D", "build:debug": "swc src -d built -s -D",
"render": "yarn build && yarn api && yarn api-prod && cp temp/iceshrimp-js.api.json etc/ && yarn api-doc", "render": "yarn build && yarn api && yarn api-prod && cp temp/iceshrimp-js.api.json etc/ && yarn api-doc",
"tsd": "tsc && tsd", "tsd": "tsc && tsd",

View File

@ -1,4 +1,4 @@
import { Endpoints } from "./api.types"; import { Endpoints } from "./api.types.js";
const MK_API_ERROR = Symbol(); const MK_API_ERROR = Symbol();

View File

@ -34,7 +34,7 @@ import {
NoteReaction, NoteReaction,
Signin, Signin,
MessagingMessage, MessagingMessage,
} from "./entities"; } from "./entities.js";
type TODO = Record<string, any> | null; type TODO = Record<string, any> | null;

View File

@ -1,8 +1,8 @@
import { Endpoints } from "./api.types"; import { Endpoints } from "./api.types.js";
import Stream, { Connection } from "./streaming"; import Stream, { Connection } from "./streaming.js";
import { Channels } from "./streaming.types"; import { Channels } from "./streaming.types.js";
import { Acct } from "./acct"; import { Acct } from "./acct.js";
import * as consts from "./consts"; import * as consts from "./consts.js";
export { Endpoints, Stream, Connection as ChannelConnection, Channels, Acct }; export { Endpoints, Stream, Connection as ChannelConnection, Channels, Acct };
@ -14,6 +14,6 @@ export const ffVisibility = consts.ffVisibility;
// api extractor not supported yet // api extractor not supported yet
//export * as api from './api'; //export * as api from './api';
//export * as entities from './entities'; //export * as entities from './entities';
import * as api from "./api"; import * as api from "./api.js";
import * as entities from "./entities"; import * as entities from "./entities.js";
export { api, entities }; export { api, entities };

View File

@ -1,6 +1,6 @@
import { EventEmitter } from "eventemitter3"; import { EventEmitter } from "eventemitter3";
import ReconnectingWebsocket from "reconnecting-websocket"; import ReconnectingWebsocket from "reconnecting-websocket";
import { BroadcastEvents, Channels } from "./streaming.types"; import { BroadcastEvents, Channels } from "./streaming.types.js";
function autobind(instance: any): void { function autobind(instance: any): void {
const prototype = Object.getPrototypeOf(instance); const prototype = Object.getPrototypeOf(instance);

View File

@ -9,7 +9,7 @@ import type {
PageEvent, PageEvent,
User, User,
UserGroup, UserGroup,
} from "./entities"; } from "./entities.js";
type FIXME = any; type FIXME = any;

View File

@ -1,8 +1,9 @@
{ {
"$schema": "http://json.schemastore.org/tsconfig", "$schema": "http://json.schemastore.org/tsconfig",
"compilerOptions": { "compilerOptions": {
"target": "es2020", "target": "ES2022",
"module": "commonjs", "module": "nodenext",
"moduleResolution": "nodenext",
"declaration": true, "declaration": true,
"declarationMap": true, "declarationMap": true,
"sourceMap": true, "sourceMap": true,
@ -13,8 +14,20 @@
"strictNullChecks": true, "strictNullChecks": true,
"experimentalDecorators": true, "experimentalDecorators": true,
"noImplicitReturns": true, "noImplicitReturns": true,
"esModuleInterop": true "esModuleInterop": true,
"typeRoots": [
"./node_modules/@types"
],
"lib": [
"esnext",
"dom"
]
}, },
"include": ["src/**/*"], "include": [
"exclude": ["node_modules", "test/**/*"] "src/**/*"
],
"exclude": [
"node_modules",
"test/**/*"
]
} }