Skip to content

Commit

Permalink
Fix package type exports (#15)
Browse files Browse the repository at this point in the history
* Fix package type exports

* Update examples to the latest deps

* Fix lints

* Update pr-check.yml

* Create quiet-dodos-listen.md
  • Loading branch information
manzoorwanijk authored Oct 28, 2023
1 parent 266ecd0 commit 57581b5
Show file tree
Hide file tree
Showing 19 changed files with 4,998 additions and 5,729 deletions.
6 changes: 6 additions & 0 deletions .changeset/quiet-dodos-listen.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
'@telegram-auth/server': patch
'@telegram-auth/react': patch
---

Fixed type exports
2 changes: 2 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,6 @@ mjs/
umd/
*.d.ts
.next
+.turbo
.cache
**/pnpm-lock.yaml
2 changes: 1 addition & 1 deletion .github/workflows/pr-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
- name: Install Node.js
uses: actions/setup-node@v3
with:
node-version: 16
node-version: 18

- uses: pnpm/action-setup@v2
name: Install pnpm
Expand Down
14 changes: 7 additions & 7 deletions examples/next-auth/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,21 +9,21 @@
"typecheck": "tsc --noEmit"
},
"dependencies": {
"@chakra-ui/react": "^2.4.7",
"@chakra-ui/react": "^2.8.1",
"@emotion/react": "^11",
"@emotion/styled": "^11",
"@telegram-auth/react": "*",
"@telegram-auth/server": "*",
"framer-motion": "^6",
"next": "latest",
"next-auth": "latest",
"framer-motion": "^10",
"next": "^13.5.6",
"next-auth": "^4.24.4",
"nodemailer": "^6",
"react": "^18.2.0",
"react-dom": "^18.2.0"
},
"devDependencies": {
"@types/node": "^17",
"@types/react": "^18.0.15",
"typescript": "^4"
"@types/node": "^20",
"@types/react": "^18.2.33",
"typescript": "^5"
}
}
32 changes: 14 additions & 18 deletions examples/remix-basic/app/entry.client.tsx
Original file line number Diff line number Diff line change
@@ -1,22 +1,18 @@
/**
* By default, Remix will handle hydrating your app on the client for you.
* You are free to delete this file if you'd like to, but if you ever want it revealed again, you can run `npx remix reveal` ✨
* For more information, see https://remix.run/file-conventions/entry.client
*/

import { RemixBrowser } from '@remix-run/react';
import { startTransition, StrictMode } from 'react';
import { hydrateRoot } from 'react-dom/client';

function hydrate() {
startTransition(() => {
hydrateRoot(
document,
<StrictMode>
<RemixBrowser />
</StrictMode>
);
});
}

if (window.requestIdleCallback) {
window.requestIdleCallback(hydrate);
} else {
// Safari doesn't support requestIdleCallback
// https://caniuse.com/requestidlecallback
window.setTimeout(hydrate, 1);
}
startTransition(() => {
hydrateRoot(
document,
<StrictMode>
<RemixBrowser />
</StrictMode>
);
});
6 changes: 0 additions & 6 deletions examples/remix-basic/app/root.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,6 @@ import { Links, LiveReload, Meta, Outlet, Scripts, ScrollRestoration } from '@re

import styles from './style.css';

export const meta: MetaFunction = () => ({
charset: 'utf-8',
title: 'New Remix App',
viewport: 'width=device-width,initial-scale=1',
});

export default function App() {
return (
<html lang="en">
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import { json } from '@remix-run/node';
import { Link, Form } from '@remix-run/react';
import { useLoaderData } from '@remix-run/react';
import type { LoaderArgs } from '@remix-run/node';
import type { LoaderFunction } from '@remix-run/node';
import { getSession, commitSession } from '../sessions';
import type { TelegramAuthData } from '@telegram-auth/react';

export async function loader({ request }: LoaderArgs) {
export const loader: LoaderFunction = async ({ request }) => {
const session = await getSession(request.headers.get('Cookie'));

const user: TelegramAuthData = session.get('user');
Expand All @@ -17,7 +17,7 @@ export async function loader({ request }: LoaderArgs) {
'Set-Cookie': await commitSession(session),
},
});
}
};

export default function Index() {
const { user } = useLoaderData<typeof loader>();
Expand Down
9 changes: 4 additions & 5 deletions examples/remix-basic/app/routes/auth.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
import { redirect } from '@remix-run/node';
import type { LoaderArgs } from '@remix-run/node';
import type { LoaderFunction } from '@remix-run/node';
import { urlStrToAuthDataMap, AuthDataValidator } from '@telegram-auth/server';

import { getSession, commitSession } from '../sessions';

export async function loader({ request }: LoaderArgs) {
const validator = new AuthDataValidator({ botToken: `${process.env.BOT_TOKEN}ok` });
export const loader: LoaderFunction = async ({ request }) => {
const validator = new AuthDataValidator({ botToken: `${process.env.BOT_TOKEN}` });

const session = await getSession(request.headers.get('Cookie'));

Expand All @@ -32,4 +31,4 @@ export async function loader({ request }: LoaderArgs) {
'Set-Cookie': await commitSession(session),
},
});
}
};
8 changes: 4 additions & 4 deletions examples/remix-basic/app/routes/login.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import { json, redirect } from '@remix-run/node';
import { useLoaderData, Link } from '@remix-run/react';
import type { LoaderArgs, ActionFunction } from '@remix-run/node';
import type { LoaderFunction, ActionFunction } from '@remix-run/node';
import { LoginButton } from '@telegram-auth/react';

import { getSession, commitSession, destroySession } from '../sessions';

export async function loader({ request }: LoaderArgs) {
export const loader: LoaderFunction = async ({ request }) => {
const session = await getSession(request.headers.get('Cookie'));

if (session.has('user')) {
Expand All @@ -21,7 +21,7 @@ export async function loader({ request }: LoaderArgs) {
'Set-Cookie': await commitSession(session),
},
});
}
};

export const action: ActionFunction = async ({ request }) => {
const session = await getSession(request.headers.get('Cookie'));
Expand All @@ -34,7 +34,7 @@ export const action: ActionFunction = async ({ request }) => {
};

export default function Login() {
const { botUsername, error } = useLoaderData();
const { botUsername, error } = useLoaderData<typeof loader>();

return (
<div className="center">
Expand Down
17 changes: 9 additions & 8 deletions examples/remix-basic/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"name": "@telegram-auth/example-remix-basic",
"private": true,
"sideEffects": false,
"type": "module",
"scripts": {
"build": "remix build",
"dev": "remix dev",
Expand All @@ -10,20 +11,20 @@
"typecheck": "tsc --noEmit"
},
"dependencies": {
"@remix-run/node": "^1.9.0",
"@remix-run/react": "^1.9.0",
"@remix-run/serve": "^1.9.0",
"@remix-run/node": "^2.1.0",
"@remix-run/react": "^2.1.0",
"@remix-run/serve": "^2.1.0",
"@telegram-auth/react": "*",
"@telegram-auth/server": "*",
"isbot": "^3.6.5",
"isbot": "^3.7.0",
"react": "^18.2.0",
"react-dom": "^18.2.0"
},
"devDependencies": {
"@remix-run/dev": "^1.9.0",
"@types/react": "^18.0.26",
"@types/react-dom": "^18.0.10",
"typescript": "^4.9.4"
"@remix-run/dev": "^2.1.0",
"@types/react": "^18.2.33",
"@types/react-dom": "^18.2.14",
"typescript": "^5.2.2"
},
"engines": {
"node": ">=14"
Expand Down
4 changes: 2 additions & 2 deletions examples/remix-basic/remix.config.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
/** @type {import('@remix-run/dev').AppConfig} */
module.exports = {
export default {
ignoredRouteFiles: ['**/.*'],
// appDirectory: "app",
// assetsBuildDirectory: "public/build",
// serverBuildPath: "build/index.js",
// publicPath: "/build/",
// serverBuildPath: "build/index.js",
};
2 changes: 0 additions & 2 deletions examples/remix-basic/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@
"paths": {
"~/*": ["./app/*"]
},
"skipLibCheck": true,
// Remix takes care of building everything in `remix build`.
"noEmit": true
},
"exclude": ["**/node_modules"]
Expand Down
18 changes: 9 additions & 9 deletions internal/eslint-config/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,17 +11,17 @@
"tests.js"
],
"devDependencies": {
"@typescript-eslint/eslint-plugin": "^5.47.0",
"@typescript-eslint/parser": "^5.47.0",
"@remix-run/eslint-config": "^1.9.0",
"eslint": "^8.30.0",
"eslint-config-prettier": "^8.5.0",
"eslint-plugin-jest": "^27.2.1",
"@typescript-eslint/eslint-plugin": "^6.9.0",
"@typescript-eslint/parser": "^6.9.0",
"@remix-run/eslint-config": "^2.1.0",
"eslint": "^8.52.0",
"eslint-config-prettier": "^9.0.0",
"eslint-plugin-jest": "^27.6.0",
"eslint-plugin-json-es": "^1.5.7",
"eslint-plugin-prettier": "^4.2.1",
"prettier": "^2.8.1",
"eslint-plugin-prettier": "^5.0.1",
"prettier": "^3.0.3",
"react": "^18.2.0",
"typescript": "^4.9.4"
"typescript": "^5.2.2"
},
"publishConfig": {
"access": "public"
Expand Down
12 changes: 6 additions & 6 deletions internal/jest/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@
"jest": "node_modules/jest/bin/jest.js"
},
"devDependencies": {
"@types/jest": "^29.2.5",
"jest": "^29.3.1",
"jest-environment-jsdom": "^29.3.1",
"jest-environment-miniflare": "^2.11.0",
"ts-jest": "^29.0.3",
"typescript": "^4.9.4"
"@types/jest": "^29.5.6",
"jest": "^29.7.0",
"jest-environment-jsdom": "^29.7.0",
"jest-environment-miniflare": "^2.14.1",
"ts-jest": "^29.1.1",
"typescript": "^5.2.2"
}
}
14 changes: 7 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,14 @@
"version:dev": "changeset version --snapshot dev"
},
"devDependencies": {
"@changesets/changelog-github": "0.4.6",
"@changesets/cli": "2.24.1",
"@changesets/changelog-github": "0.4.8",
"@changesets/cli": "2.26.2",
"@telegram-auth/eslint-config": "workspace:*",
"eslint": "^8.30.0",
"prettier": "^2.8.1",
"rimraf": "^3.0.2",
"turbo": "^1.6.3",
"typescript": "^4.9.4"
"eslint": "^8.52.0",
"prettier": "^3.0.3",
"rimraf": "^5.0.5",
"turbo": "^1.10.16",
"typescript": "^5.2.2"
},
"workspaces": [
"examples/*",
Expand Down
23 changes: 12 additions & 11 deletions packages/react/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
".": {
"import": {
"node": "./dist/cjs/index.js",
"types": "./dist/types/index.d.ts",
"default": "./dist/esm/index.js"
},
"require": "./dist/cjs/index.js"
Expand Down Expand Up @@ -48,7 +49,7 @@
},
"scripts": {
"build": "pnpm build:ts",
"build:cjs": "tsc --project ./tsconfig.build.json --module commonjs --outDir dist/cjs",
"build:cjs": "tsc --project ./tsconfig.build.json --module commonjs --moduleResolution node --outDir dist/cjs",
"build:docs": "typedoc",
"build:esm": "tsc --project ./tsconfig.build.json",
"build:ts": "pnpm build:esm && pnpm build:cjs",
Expand All @@ -62,18 +63,18 @@
},
"devDependencies": {
"@telegram-auth/jest": "workspace:*",
"@testing-library/dom": "^8.19.1",
"@testing-library/jest-dom": "5.16.5",
"@testing-library/react": "^13.4.0",
"@types/jest": "^29.2.5",
"@types/react": "^18.0.26",
"@types/react-dom": "^18.0.10",
"@testing-library/dom": "^9.3.3",
"@testing-library/jest-dom": "6.1.4",
"@testing-library/react": "^14.0.0",
"@types/jest": "^29.5.6",
"@types/react": "^18.2.33",
"@types/react-dom": "^18.2.14",
"clean-package": "^2.2.0",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"typedoc": "^0.23.23",
"typedoc-plugin-markdown": "^3.14.0",
"typedoc-plugin-mdn-links": "^2.0.2",
"typescript": "^4.9.4"
"typedoc": "^0.25.2",
"typedoc-plugin-markdown": "^3.16.0",
"typedoc-plugin-mdn-links": "^3.1.0",
"typescript": "^5.2.2"
}
}
15 changes: 8 additions & 7 deletions packages/server/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
".": {
"import": {
"node": "./dist/cjs/index.js",
"types": "./dist/types/index.d.ts",
"default": "./dist/esm/index.js"
},
"require": "./dist/cjs/index.js"
Expand All @@ -48,7 +49,7 @@
"clean-package": "../../config/clean-package.json",
"scripts": {
"build": "pnpm build:ts",
"build:cjs": "tsc --project ./tsconfig.build.json --module commonjs --outDir dist/cjs",
"build:cjs": "tsc --project ./tsconfig.build.json --module commonjs --moduleResolution node --outDir dist/cjs",
"build:docs": "typedoc",
"build:esm": "tsc --project ./tsconfig.build.json",
"build:ts": "pnpm build:esm && pnpm build:cjs",
Expand All @@ -64,12 +65,12 @@
},
"devDependencies": {
"@telegram-auth/jest": "workspace:*",
"@types/jest": "^29.2.5",
"@types/node": "^18.11.17",
"@types/jest": "^29.5.6",
"@types/node": "^20.8.9",
"clean-package": "^2.2.0",
"typedoc": "^0.23.23",
"typedoc-plugin-markdown": "^3.14.0",
"typedoc-plugin-mdn-links": "^2.0.2",
"typescript": "^4.9.4"
"typedoc": "^0.25.2",
"typedoc-plugin-markdown": "^3.16.0",
"typedoc-plugin-mdn-links": "^3.1.0",
"typescript": "^5.2.2"
}
}
Loading

0 comments on commit 57581b5

Please sign in to comment.