Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: change to monorepo #35

Merged
merged 8 commits into from
Sep 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .github/workflows/pull_request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ jobs:
with:
deno-version: v1.x
- run: deno publish --dry-run
working-directory: ./packages/linejs

deno:
name: 'Deno'
Expand All @@ -38,4 +39,4 @@ jobs:
- uses: denoland/setup-deno@v1
with:
deno-version: v1.x
- run: deno task format:check
- run: deno task format:check
2 changes: 1 addition & 1 deletion .github/workflows/release-types.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,4 @@ jobs:

- name: Publish to JSR
run: deno run -A jsr:@david/[email protected]
working-directory: ./packages/client/libs/thrift
working-directory: ./packages/linejs-types
3 changes: 2 additions & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,5 @@ jobs:
deno-version: v1.x

- name: Publish to JSR
run: deno run -A jsr:@david/[email protected]
run: deno run -A jsr:@david/[email protected]
working-directory: ./packages/linejs
69 changes: 0 additions & 69 deletions README.md

This file was deleted.

1 change: 1 addition & 0 deletions README.md
16 changes: 8 additions & 8 deletions deno.json
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
{
"name": "@evex/linejs",
"version": "0.0.0",
"exports": {
".": "./packages/client/index.ts",
"./client": "./packages/client/index.ts",
"./utils": "./packages/utils/index.ts",
"./storage": "./packages/storage/index.ts",
"./rate-limit": "./packages/rate-limit/index.ts"
"workspace": ["./packages/linejs", "./packages/types"],
"fmt": {
"indentWidth": 2,
"singleQuote": false,
"useTabs": true,
"exclude": [
"./docs/"
]
},
"imports": {
"@std/assert": "jsr:@std/assert@^1.0.2",
Expand Down
69 changes: 69 additions & 0 deletions packages/linejs/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
# LINEJS

[![JSR](https://jsr.io/badges/@evex/linejs)](https://jsr.io/@evex/linejs)
[![JSR Score](https://jsr.io/badges/@evex/linejs/score)](https://jsr.io/@evex/linejs)
[![JSR Scope](https://jsr.io/badges/@evex)](https://jsr.io/@evex)
![release workflow](https://github.com/evex-dev/linejs/actions/workflows/release.yml/badge.svg)\
[![](https://dcbadge.limes.pink/api/server/evex)](https://discord.gg/evex)

<center>
<img src="./.github/assets/icon.png" width="150" height="150" alt="LINEJS" />
</center>

<center> <b>LINEJS</b> is a JavaScript library for creating a LINE SelfBot. </center>

---

##### <center>❓ Question: Join our [Discord community](https://discord.gg/evex)</center>

##### <center>📚 Documentation: [Check out the full documentation](https://linejs.evex.land)</center>

---

## Installation

Supports all runtimes (Node.js, Deno, and Bun) and Typescript.

```llvm
npx jsr add @evex/linejs
bunx --bun jsr add @evex/linejs
deno add @evex/linejs
```

##### Documentation is [https://linejs.evex.land](https://linejs.evex.land/)

## Browser Support

For now, please use "https://esm.sh/jsr/@evex/linejs".

## LINEJS Types

Please see [@evex/linejs-types](https://jsr.io/@evex/linejs-types)\
In short, TypeScript Types and Enum (ReactionType (0, 1, 2, 3), MessageType,
etc...) are provided.

## Provided Packages

- client - (@evex/linejs) or (@evex/linejs/client)
- Client - LINE SelfBot Client
- utils - (@evex/linejs/utils)
- LINE_SCHEME - LINE Scheme utility
- LINE_OBS - LINE OBS utility
- LINE_REGEX - LINE URI Regex utility
- LINE_FUNCTIONS - LINE Function utility (search openchat, ticket to emid,
etc...)
- storage - (@evex/linejs/storage)
- BaseStorage - LINE Client Base Storage
- MemoryStorage - LINE Client Memory Storage
- FileStorage - LINE Client File Storage
- rate-limit - (@evex/linejs/rate-limit)
- RateLimitter - RateLimit for Safety
- types - (@evex/linejs-types)
- All Types for LINE

## Authors

- Owner & Developer: [Piloking](https://github.com/piloking)
- Developer: [EdamAme-x](https://github.com/EdamAme-x)
- Developer: [MocA-Love](https://github.com/MocA-Love)
- Developer: [Hafusun](https://github.com/hafusun)
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ import {
type ProtocolKey,
Protocols,
} from "../libs/thrift/declares.ts";
import type * as LINETypes from "../libs/thrift/line_types.ts";
import type * as LINETypes from "@evex/linejs-types";
import ThriftRenameParser from "../libs/thrift/parser.ts";
import { readThrift } from "../libs/thrift/read.ts";
import { Thrift } from "../libs/thrift/thrift.ts";
import { Thrift } from "@evex/linejs-types/thrift";
import { writeThrift } from "../libs/thrift/write.ts";
import { TypedEventEmitter } from "../libs/typed-event-emitter/index.ts";
import type { LogType } from "../entities/log.ts";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import {
type Location,
type Message,
MIDType,
} from "../../libs/thrift/line_types.ts";
} from "@evex/linejs-types";
import nacl from "tweetnacl";

class E2EE extends TalkClient {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// For Channel (channel, etc)

import type { ProtocolKey } from "../../libs/thrift/declares.ts";
import type * as LINETypes from "../../libs/thrift/line_types.ts";
import type * as LINETypes from "@evex/linejs-types";
import { SquareClient } from "./square-client.ts";

export class ChannelClient extends SquareClient {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { JSDOM } from "npm:[email protected]";
import type { NestedArray, ProtocolKey } from "../../libs/thrift/declares.ts";
import type { LooseType } from "../../entities/common.ts";
import { BaseClient } from "../base-client.ts";
import type * as LINETypes from "../../libs/thrift/line_types.ts";
import type * as LINETypes from "@evex/linejs-types";

export class LiffClient extends BaseClient {
protected static readonly LINE_LIFF_ENDPOINT =
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
// For Friend

import type { NestedArray, ProtocolKey } from "../../libs/thrift/declares.ts";
import type { ProtocolKey } from "../../libs/thrift/declares.ts";
import type { LooseType } from "../../entities/common.ts";
import { E2EE } from "../e2ee/index.ts";
import type * as LINETypes from "../../libs/thrift/line_types.ts";

export class RelationClient extends E2EE {
protected RelationService_API_PATH = "/RE4";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// For Square (square, etc)

import type { NestedArray, ProtocolKey } from "../../libs/thrift/declares.ts";
import type * as LINETypes from "../../libs/thrift/line_types.ts";
import type * as LINETypes from "@evex/linejs-types";
import type { LooseType } from "../../entities/common.ts";
import { LiffClient } from "./liff-client.ts";

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// For Talk (talk, group(chat), etc)

import type { NestedArray, ProtocolKey } from "../../libs/thrift/declares.ts";
import type * as LINETypes from "../../libs/thrift/line_types.ts";
import type * as LINETypes from "@evex/linejs-types";
import type { LooseType } from "../../entities/common.ts";
import { ChannelClient } from "./channel-client.ts";
import type { Buffer } from "node:buffer";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,16 @@
/**
* Common types
* @module
*/

/**
* Loose Type
*/
// deno-lint-ignore no-explicit-any
export type LooseType = any;

/**
* Always Type
*/
// deno-lint-ignore ban-types
export type AlwaysType = {};
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type { Log } from "./log.ts";
import type * as LINETypes from "../libs/thrift/line_types.ts";
import type * as LINETypes from "@evex/linejs-types";
import type { Message, SquareMessage } from "./message.ts";

export type ClientEvents = {
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type * as LINETypes from "../libs/thrift/line_types.ts";
import type * as LINETypes from "@evex/linejs-types";
import type { LooseType } from "./common.ts";

export type Message = Omit<LINETypes.Operation, "type"> & {
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Key } from "node-bignumber";
import type { RSAKey } from "../thrift/line_types.ts";
import type { RSAKey } from "@evex/linejs-types";

export function getRSACrypto(message: string, json: RSAKey) {
const rsa = new Key();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,7 @@ export class TypedEventEmitter<
* This creates a promise that you can use for a single event.
* @param event A event name
*/
public waitFor<E2 extends E, P = Parameters<T[E2]>>(
event: E2,
): Promise<P> {
public waitFor<E2 extends E, P = Parameters<T[E2]>>(event: E2): Promise<P> {
return new Promise<P>((resolve) => {
const listener = ((...args) => {
this.off(event, listener);
Expand Down
12 changes: 12 additions & 0 deletions packages/linejs/deno.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"name": "@evex/linejs",
"version": "0.0.0",
"license": "MIT",
"exports": {
".": "./client/index.ts",
"./client": "./client/index.ts",
"./utils": "./utils/index.ts",
"./storage": "./storage/index.ts",
"./rate-limit": "./rate-limit/index.ts"
}
}
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"version": "0.0.0",
"license": "MIT",
"exports": {
".": "./line_types.ts"
".": "./line_types.ts",
"./thrift": "./thrift.ts"
}
}
File renamed without changes.
File renamed without changes.