Skip to content

React/Vue Typescript Hooks #422

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

Merged
merged 85 commits into from
May 2, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
85 commits
Select commit Hold shift + click to select a range
d987a4e
Adding React Hook
tnylea Apr 4, 2025
af723e0
Adding updates to react hook
tnylea Apr 4, 2025
aa6cb36
Adding vue functionality for composable
tnylea Apr 4, 2025
87d8aeb
Adding react,vue, and ts defs to package json
tnylea Apr 4, 2025
8219a32
fixing the formatting
tnylea Apr 4, 2025
74f3956
fixing issues highlighted by styleci
tnylea Apr 4, 2025
61715ac
fixing issues highlighted by styleci
tnylea Apr 4, 2025
9f8612f
fixing issues highlighted by styleci
tnylea Apr 4, 2025
ab94f99
improved types
joetannenbaum Apr 7, 2025
3e4a327
Clean up and re-organize
tnylea Apr 8, 2025
d5f157b
Getting StyleCI to pass
tnylea Apr 8, 2025
3cd2080
Getting StyleCI to pass
tnylea Apr 8, 2025
be8eeab
Adding the correct way to build the react and vue hooks, fixing lint …
tnylea Apr 8, 2025
edb05fc
updating workflow test to run on ubuntu-latest
tnylea Apr 8, 2025
f4ac15b
Update use-echo.ts
joetannenbaum Apr 9, 2025
961a8d4
Update use-echo.ts
joetannenbaum Apr 9, 2025
b7ef05a
Fixing styleCI issues
tnylea Apr 11, 2025
24adf8c
Adding a few more tests
tnylea Apr 11, 2025
0b084bb
Adding simple test
tnylea Apr 11, 2025
d6d9c96
Adding simple test
tnylea Apr 11, 2025
c3cde09
Adding simple test
tnylea Apr 11, 2025
879489d
re-organizing file
tnylea Apr 14, 2025
fac7534
remove deprecated `isolatedModules`
joetannenbaum Apr 28, 2025
cc0599d
remove deprecated jest calls
joetannenbaum Apr 28, 2025
d4c8f51
refactor
joetannenbaum Apr 28, 2025
c661a03
style fix
joetannenbaum Apr 28, 2025
3c61c84
remove style ci
joetannenbaum Apr 28, 2025
c3b20a4
Update useEcho.ts
joetannenbaum Apr 28, 2025
22502df
Update use-echo.ts
joetannenbaum Apr 28, 2025
9613196
format code action
joetannenbaum Apr 28, 2025
cfe9a81
format
joetannenbaum Apr 28, 2025
14bbd2c
improve option types
joetannenbaum Apr 28, 2025
6ecc4d3
Update use-echo.ts
joetannenbaum Apr 28, 2025
6a696f6
pnpm workspaces
joetannenbaum Apr 29, 2025
9f73f97
rollup -> vite
joetannenbaum Apr 29, 2025
83e7f8e
react vite
joetannenbaum Apr 29, 2025
df74a0d
all things vite
joetannenbaum Apr 29, 2025
0923f20
react/vue entry points
joetannenbaum Apr 29, 2025
a318c98
wip
joetannenbaum Apr 29, 2025
1d5d6ef
Update hooks.test.ts
joetannenbaum Apr 30, 2025
6a73670
Update hooks.test.ts
joetannenbaum Apr 30, 2025
5c63884
vue tests
joetannenbaum Apr 30, 2025
1d5557e
leave all channel variations
joetannenbaum Apr 30, 2025
f1f8750
docblocks for clarity
joetannenbaum Apr 30, 2025
e496860
Create README.md
joetannenbaum Apr 30, 2025
2668d1b
react defaults
joetannenbaum Apr 30, 2025
c740e1e
Update use-echo.ts
joetannenbaum Apr 30, 2025
cb1a259
vue config defaults
joetannenbaum Apr 30, 2025
615b3f3
ably with sensible defaults
joetannenbaum Apr 30, 2025
c343d2c
Update use-echo.ts
joetannenbaum May 1, 2025
1bf8ece
Update use-echo.ts
joetannenbaum May 1, 2025
9005db8
Update use-echo.ts
joetannenbaum May 1, 2025
62b3a6d
Update use-echo.ts
joetannenbaum May 1, 2025
1ef657c
Update use-echo.ts
joetannenbaum May 1, 2025
3d50422
wip
joetannenbaum May 1, 2025
6033452
Update use-echo.ts
joetannenbaum May 1, 2025
5820cdd
visibility helper hooks
joetannenbaum May 1, 2025
0be1376
Update use-echo.ts
joetannenbaum May 1, 2025
8c775f5
Update README.md
joetannenbaum May 1, 2025
20650a9
wip
joetannenbaum May 1, 2025
f0b99d2
Update useEcho.ts
joetannenbaum May 1, 2025
b8a7dd0
update package names
joetannenbaum May 1, 2025
d557294
Update hooks.test.ts
joetannenbaum May 2, 2025
9f8400f
Update hooks.test.ts
joetannenbaum May 2, 2025
7b5ff11
wip
joetannenbaum May 2, 2025
9eecfb2
wip
joetannenbaum May 2, 2025
ef738e7
jest -> vitest
joetannenbaum May 2, 2025
5e167ee
Update CONTRIBUTING.md
joetannenbaum May 2, 2025
b6dfb1c
npm -> pnpm
joetannenbaum May 2, 2025
81eff91
remove deprecated standard-version
joetannenbaum May 2, 2025
793cb5e
release script
joetannenbaum May 2, 2025
a9ba929
fix homepages
joetannenbaum May 2, 2025
13aa3f7
Update package.json
joetannenbaum May 2, 2025
5544f86
align versions
joetannenbaum May 2, 2025
03858fc
Update release.sh
joetannenbaum May 2, 2025
7bd0c55
Update release.sh
joetannenbaum May 2, 2025
28b2c07
Merge branch '2.x' into starterKitIntegration
joetannenbaum May 2, 2025
81a4e42
fix workflows
joetannenbaum May 2, 2025
15e1a3d
Merge branch 'starterKitIntegration' of github.com:laravel/echo into …
joetannenbaum May 2, 2025
ee01357
Update package.json
joetannenbaum May 2, 2025
c2581e2
Update useEcho.ts
joetannenbaum May 2, 2025
63259a4
temp remove lint
joetannenbaum May 2, 2025
73714a0
Update pnpm-lock.yaml
joetannenbaum May 2, 2025
6587f48
fix running tests
joetannenbaum May 2, 2025
83e1085
fixed linting
joetannenbaum May 2, 2025
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
1 change: 0 additions & 1 deletion .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,5 @@
.gitattributes export-ignore
.gitignore export-ignore
.npmignore export-ignore
.styleci.yml export-ignore
CHANGELOG.md export-ignore
RELEASE.md export-ignore
41 changes: 41 additions & 0 deletions .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,44 @@
# Contribution Guide

The Laravel contributing guide can be found in the [Laravel documentation](https://laravel.com/docs/contributions).

# Installation

This monorepo contains three packages:

- [laravel-echo](https://www.npmjs.com/package/laravel-echo)
- [@laravel/echo-react](https://www.npmjs.com/package/@laravel/echo-react)
- [@laravel/echo-vue](https://www.npmjs.com/package/@laravel/echo-vue)

[pnpm](https://pnpm.io/) is used to manage dependencies, the repo is set up as a workspace. Each package lives under `packages/*`

From the root directory, install dependencies for all packages:

```bash
pnpm i
```

## Running Tests

Tests are written with [Vitest](https://vitest.dev/).

To run all tests, from the root directory:

```bash
pnpm -r run test
```

To run tests for an individual package:

```bash
cd packages/react
pnpm run test
```

## Publishing

This section is really for the benefit of the core maintainers. From the root directory:

```bash
./release
```
2 changes: 0 additions & 2 deletions .github/ISSUE_TEMPLATE/1_Bug_report.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,5 +51,3 @@ body:
description: Provide detailed steps to reproduce your issue. If necessary, please provide a GitHub repository to demonstrate your issue using `laravel new bug-report --github="--public"`.
validations:
required: true


4 changes: 2 additions & 2 deletions .github/ISSUE_TEMPLATE/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@ blank_issues_enabled: false
contact_links:
- name: Feature request
url: https://github.com/laravel/echo/pulls
about: 'For ideas or feature requests, send in a pull request'
about: "For ideas or feature requests, send in a pull request"
- name: Support Questions & Other
url: https://laravel.com/docs/contributions#support-questions
about: 'This repository is only for reporting bugs. If you have a question or need help using the library, click:'
about: "This repository is only for reporting bugs. If you have a question or need help using the library, click:"
- name: Documentation issue
url: https://github.com/laravel/docs
about: For documentation issues, open a pull request at the laravel/docs repository
58 changes: 29 additions & 29 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,12 @@ name: codeql

on:
push:
branches: [ master ]
branches: [master]
pull_request:
# The branches below must be a subset of the branches above
branches: [ master ]
branches: [master]
schedule:
- cron: '44 23 * * 1'
- cron: "44 23 * * 1"

jobs:
analyze:
Expand All @@ -28,40 +28,40 @@ jobs:
strategy:
fail-fast: false
matrix:
language: [ 'javascript' ]
language: ["javascript"]
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python' ]
# Learn more:
# https://docs.github.com/en/free-pro-team@latest/github/finding-security-vulnerabilities-and-errors-in-your-code/configuring-code-scanning#changing-the-languages-that-are-analyzed

steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Checkout repository
uses: actions/checkout@v4

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v2
with:
languages: ${{ matrix.language }}
# If you wish to specify custom queries, you can do so here or in a config file.
# By default, queries listed here will override any specified in a config file.
# Prefix the list here with "+" to use these queries and those in the config file.
# queries: ./path/to/local/query, your-org/your-repo/queries@main
# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v2
with:
languages: ${{ matrix.language }}
# If you wish to specify custom queries, you can do so here or in a config file.
# By default, queries listed here will override any specified in a config file.
# Prefix the list here with "+" to use these queries and those in the config file.
# queries: ./path/to/local/query, your-org/your-repo/queries@main

# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
# If this step fails, then you should remove it and run the build manually (see below)
- name: Autobuild
uses: github/codeql-action/autobuild@v2
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
# If this step fails, then you should remove it and run the build manually (see below)
- name: Autobuild
uses: github/codeql-action/autobuild@v2

# ℹ️ Command-line programs to run using the OS shell.
# 📚 https://git.io/JvXDl
# ℹ️ Command-line programs to run using the OS shell.
# 📚 https://git.io/JvXDl

# ✏️ If the Autobuild fails above, remove it and uncomment the following three lines
# and modify them (or add more) to build your code if your project
# uses a compiled language
# ✏️ If the Autobuild fails above, remove it and uncomment the following three lines
# and modify them (or add more) to build your code if your project
# uses a compiled language

#- run: |
# make bootstrap
# make release
#- run: |
# make bootstrap
# make release

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2
32 changes: 32 additions & 0 deletions .github/workflows/coding-standards.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: fix code styling

on:
push:
branches:
- master
- "*.x"
pull_request:

jobs:
format:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Install pnpm
uses: pnpm/action-setup@v4
with:
version: 10

- name: Install dependencies
run: pnpm install

- name: Format code
run: pnpm run format

- name: Commit linted files
uses: stefanzweifel/git-auto-commit-action@v5
with:
commit_message: "Fix code styling"
23 changes: 14 additions & 9 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,27 +4,32 @@ on:
push:
branches:
- master
- '*.x'
- "*.x"
pull_request:
schedule:
- cron: '0 0 * * *'
- cron: "0 0 * * *"

jobs:
tests:
runs-on: ubuntu-22.04
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Install pnpm
uses: pnpm/action-setup@v4
with:
version: 10

- name: Install dependencies
run: npm install
run: pnpm install

- name: Build
run: pnpm build

- name: ESLint
run: npm run lint
run: pnpm run lint

- name: Execute tests
run: npm test

- name: Run build
run: npm run build
run: pnpm test
5 changes: 0 additions & 5 deletions .styleci.yml

This file was deleted.

8 changes: 4 additions & 4 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@

## [v2.0.2](https://github.com/laravel/echo/compare/v2.0.0...v2.0.2) - 2025-02-18

* [2.x] Fix TS errors with `skipLibCheck: false` by [@SanderMuller](https://github.com/SanderMuller) in https://github.com/laravel/echo/pull/416
- [2.x] Fix TS errors with `skipLibCheck: false` by [@SanderMuller](https://github.com/SanderMuller) in https://github.com/laravel/echo/pull/416

## v2.0.0 - 2025-02-11

* Fix TypeScript Error in `isConstructor` by [@SanderMuller](https://github.com/SanderMuller) in https://github.com/laravel/echo/pull/412
* [2.0] Major package upgrades, better TypeScript support, smaller build by [@SanderMuller](https://github.com/SanderMuller) in https://github.com/laravel/echo/pull/413
* [2.x] move tslib to dev deps by [@SanderMuller](https://github.com/SanderMuller) in https://github.com/laravel/echo/pull/414
- Fix TypeScript Error in `isConstructor` by [@SanderMuller](https://github.com/SanderMuller) in https://github.com/laravel/echo/pull/412
- [2.0] Major package upgrades, better TypeScript support, smaller build by [@SanderMuller](https://github.com/SanderMuller) in https://github.com/laravel/echo/pull/413
- [2.x] move tslib to dev deps by [@SanderMuller](https://github.com/SanderMuller) in https://github.com/laravel/echo/pull/414
12 changes: 0 additions & 12 deletions jest.config.cjs

This file was deleted.

74 changes: 6 additions & 68 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,12 +1,5 @@
{
"name": "laravel-echo",
"version": "2.0.2",
"description": "Laravel Echo library for beautiful Pusher and Socket.IO integration",
"keywords": [
"laravel",
"pusher",
"ably"
],
"homepage": "https://github.com/laravel/echo",
"repository": {
"type": "git",
Expand All @@ -16,67 +9,12 @@
"author": {
"name": "Taylor Otwell"
},
"type": "module",
"main": "dist/echo.common.js",
"module": "dist/echo.js",
"types": "dist/echo.d.ts",
"scripts": {
"build": "npm run compile && npm run declarations",
"compile": "rollup -c",
"declarations": "tsc --emitDeclarationOnly",
"lint": "eslint --config eslint.config.mjs",
"prepublish": "npm run build",
"release": "npm run test && standard-version && git push --follow-tags && npm publish",
"test": "jest"
},
"devDependencies": {
"@babel/core": "^7.26.7",
"@babel/plugin-proposal-decorators": "^7.25.9",
"@babel/plugin-proposal-function-sent": "^7.25.9",
"@babel/plugin-proposal-throw-expressions": "^7.25.9",
"@babel/plugin-transform-export-namespace-from": "^7.25.9",
"@babel/plugin-transform-numeric-separator": "^7.25.9",
"@babel/plugin-transform-object-assign": "^7.25.9",
"@babel/preset-env": "^7.26.7",
"@rollup/plugin-babel": "^6.0.0",
"@rollup/plugin-node-resolve": "^16.0.0",
"@rollup/plugin-typescript": "^12.1.2",
"@types/jest": "^29.5",
"@types/node": "^20.0.0",
"@typescript-eslint/eslint-plugin": "^8.21.0",
"@typescript-eslint/parser": "^8.21.0",
"eslint": "^9.0.0",
"jest": "^29.7.0",
"pusher-js": "^8.0",
"rollup": "^3.0.0",
"socket.io-client": "^4.0",
"standard-version": "^9.3.2",
"ts-jest": "^29.2.5",
"tslib": "^2.8.1",
"typescript": "^5.7.0"
},
"peerDependencies": {
"socket.io-client": "*",
"pusher-js": "*"
},
"typesVersions": {
"*": {
"socket.io-client": [],
"pusher-js": []
}
},
"engines": {
"node": ">=20"
},
"exports": {
".": {
"import": "./dist/echo.js",
"require": "./dist/echo.common.js",
"types": "./dist/echo.d.ts"
},
"./iife": "./dist/echo.iife.js"
},
"overrides": {
"glob": "^9.0.0"
"test": "pnpm -r --if-present run test",
"build": "pnpm -r --if-present run build",
"lint": "pnpm -r --if-present run lint",
"format": "pnpm -r --if-present run format",
"compile": "pnpm -r --if-present run compile",
"declarations": "pnpm -r --if-present run declarations"
}
}
13 changes: 7 additions & 6 deletions eslint.config.mjs → packages/laravel-echo/eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
import tsParser from "@typescript-eslint/parser";
import tsPlugin from "@typescript-eslint/eslint-plugin";
import tsParser from "@typescript-eslint/parser";

const config = [
{
files: [
"typings/**/*.ts",
"src/**/*.ts"
],
ignores: ["dist/**/*"],
files: ["src/**/*.ts"],
languageOptions: {
parser: tsParser, // Use the imported parser object
parserOptions: {
Expand All @@ -31,7 +29,10 @@ const config = [
"@typescript-eslint/no-unsafe-function-type": "off",
"@typescript-eslint/no-unsafe-member-access": "warn",
"@typescript-eslint/no-unsafe-return": "warn",
"@typescript-eslint/no-unused-vars": ["warn", { argsIgnorePattern: "^_" }],
"@typescript-eslint/no-unused-vars": [
"warn",
{ argsIgnorePattern: "^_" },
],
"no-console": "warn",
"prefer-const": "off",
},
Expand Down
Loading