From d17c4f575618df16d0730a71578399a2c044aac0 Mon Sep 17 00:00:00 2001 From: panteliselef Date: Fri, 12 Jul 2024 15:13:59 +0300 Subject: [PATCH 1/6] chore(astro): Simplify submodules and drop `bundled` variant --- packages/astro/package.json | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/astro/package.json b/packages/astro/package.json index c4ea7f1c2be..ebd706b4051 100644 --- a/packages/astro/package.json +++ b/packages/astro/package.json @@ -74,6 +74,7 @@ "./components/unstyled": "./components/unstyled/index.ts", "./components/unstyled/*": "./components/unstyled/*", "./components/*": "./components/*", + "./components": "./components/index.ts", "./package.json": "./package.json" }, "imports": { From f289a5860d324cdd34bc6f151ad9128dcacfd209 Mon Sep 17 00:00:00 2001 From: panteliselef Date: Fri, 12 Jul 2024 15:19:03 +0300 Subject: [PATCH 2/6] chore(astro): Add changeset --- packages/astro/package.json | 1 - 1 file changed, 1 deletion(-) diff --git a/packages/astro/package.json b/packages/astro/package.json index ebd706b4051..c4ea7f1c2be 100644 --- a/packages/astro/package.json +++ b/packages/astro/package.json @@ -74,7 +74,6 @@ "./components/unstyled": "./components/unstyled/index.ts", "./components/unstyled/*": "./components/unstyled/*", "./components/*": "./components/*", - "./components": "./components/index.ts", "./package.json": "./package.json" }, "imports": { From 092885861f3f0eea63031c741a9b66750ea59621 Mon Sep 17 00:00:00 2001 From: panteliselef Date: Fri, 12 Jul 2024 19:58:25 +0300 Subject: [PATCH 3/6] chore(astro): Move all *.astro components under `/components` --- .../astro-node/src/layouts/Layout.astro | 3 +-- .../astro-node/src/pages/discover.astro | 2 +- .../astro-node/src/pages/index.astro | 3 +-- .../src/pages/only-admins-react.astro | 19 -------------- .../astro-node/src/pages/only-admins.astro | 2 +- .../src/pages/only-members-react.astro | 19 -------------- .../astro-node/src/pages/only-members.astro | 2 +- .../astro-node/src/pages/organization.astro | 2 +- .../astro-node/src/pages/sign-in.astro | 2 +- .../templates/astro-node/src/pages/user.astro | 2 +- packages/astro/.eslintrc.cjs | 2 +- packages/astro/package.json | 8 +----- .../src/astro-components/control/index.ts | 9 ------- packages/astro/src/astro-components/index.ts | 25 +++++++++++++++++++ .../src/astro-components/interactive/index.ts | 18 ------------- .../src/astro-components/unstyled/index.ts | 8 ------ packages/astro/tsconfig.json | 2 +- 17 files changed, 36 insertions(+), 92 deletions(-) delete mode 100644 integration/templates/astro-node/src/pages/only-admins-react.astro delete mode 100644 integration/templates/astro-node/src/pages/only-members-react.astro delete mode 100644 packages/astro/src/astro-components/control/index.ts create mode 100644 packages/astro/src/astro-components/index.ts delete mode 100644 packages/astro/src/astro-components/interactive/index.ts delete mode 100644 packages/astro/src/astro-components/unstyled/index.ts diff --git a/integration/templates/astro-node/src/layouts/Layout.astro b/integration/templates/astro-node/src/layouts/Layout.astro index ff7bd3c3d37..f7c71edd9b5 100644 --- a/integration/templates/astro-node/src/layouts/Layout.astro +++ b/integration/templates/astro-node/src/layouts/Layout.astro @@ -5,8 +5,7 @@ interface Props { const { title } = Astro.props; -import { SignedIn, SignedOut } from "@clerk/astro/components/control"; -import { UserButton } from "@clerk/astro/components/interactive"; +import { SignedIn, SignedOut, UserButton } from "@clerk/astro/components"; import { LanguagePicker } from "../components/LanguagePicker"; --- diff --git a/integration/templates/astro-node/src/pages/discover.astro b/integration/templates/astro-node/src/pages/discover.astro index 7ee04a543fc..55f391ad27a 100644 --- a/integration/templates/astro-node/src/pages/discover.astro +++ b/integration/templates/astro-node/src/pages/discover.astro @@ -1,5 +1,5 @@ --- -import { OrganizationList } from "@clerk/astro/components/interactive"; +import { OrganizationList } from "@clerk/astro/components"; import Layout from "../layouts/Layout.astro"; --- diff --git a/integration/templates/astro-node/src/pages/index.astro b/integration/templates/astro-node/src/pages/index.astro index b3d2a4e0a19..534342bfdb8 100644 --- a/integration/templates/astro-node/src/pages/index.astro +++ b/integration/templates/astro-node/src/pages/index.astro @@ -3,8 +3,7 @@ import Layout from "../layouts/Layout.astro"; import Card from "../components/Card.astro"; import SignOutButton from "../lib/astro-components/SignOutButton.astro"; -import { SignedIn, SignedOut } from "@clerk/astro/components/control"; -import { OrganizationSwitcher } from "@clerk/astro/components/interactive"; +import { SignedIn, SignedOut, OrganizationSwitcher } from "@clerk/astro/components"; --- diff --git a/integration/templates/astro-node/src/pages/only-admins-react.astro b/integration/templates/astro-node/src/pages/only-admins-react.astro deleted file mode 100644 index 6932c946187..00000000000 --- a/integration/templates/astro-node/src/pages/only-admins-react.astro +++ /dev/null @@ -1,19 +0,0 @@ ---- -import { Protect } from "@clerk/astro/client/react"; -import Layout from "../layouts/Layout.astro"; ---- - - -
- - -

Not an admin

- Go to Members Page -
-

I'm an admin

-
-
-
diff --git a/integration/templates/astro-node/src/pages/only-admins.astro b/integration/templates/astro-node/src/pages/only-admins.astro index 31241e16bf3..365ef449eea 100644 --- a/integration/templates/astro-node/src/pages/only-admins.astro +++ b/integration/templates/astro-node/src/pages/only-admins.astro @@ -1,5 +1,5 @@ --- -import { Protect } from "@clerk/astro/components/control"; +import { Protect } from "@clerk/astro/components"; import Layout from "../layouts/Layout.astro"; --- diff --git a/integration/templates/astro-node/src/pages/only-members-react.astro b/integration/templates/astro-node/src/pages/only-members-react.astro deleted file mode 100644 index 2f275f46a60..00000000000 --- a/integration/templates/astro-node/src/pages/only-members-react.astro +++ /dev/null @@ -1,19 +0,0 @@ ---- -import { Protect } from "@clerk/astro/client/react"; -import Layout from "../layouts/Layout.astro"; ---- - - -
- - -

Not a member

- Go to Admin Page -
-

I'm a member

-
-
-
diff --git a/integration/templates/astro-node/src/pages/only-members.astro b/integration/templates/astro-node/src/pages/only-members.astro index c7072f10444..5ad7150dba5 100644 --- a/integration/templates/astro-node/src/pages/only-members.astro +++ b/integration/templates/astro-node/src/pages/only-members.astro @@ -1,5 +1,5 @@ --- -import { Protect } from "@clerk/astro/components/control"; +import { Protect } from "@clerk/astro/components"; import Layout from "../layouts/Layout.astro"; --- diff --git a/integration/templates/astro-node/src/pages/organization.astro b/integration/templates/astro-node/src/pages/organization.astro index cbeb82f18ca..b6bf7544de5 100644 --- a/integration/templates/astro-node/src/pages/organization.astro +++ b/integration/templates/astro-node/src/pages/organization.astro @@ -2,7 +2,7 @@ import { OrganizationSwitcher, OrganizationProfile, -} from "@clerk/astro/components/interactive"; +} from "@clerk/astro/components"; import Layout from "../layouts/Layout.astro"; import Streaming from "../layouts/Streaming.astro"; --- diff --git a/integration/templates/astro-node/src/pages/sign-in.astro b/integration/templates/astro-node/src/pages/sign-in.astro index 924724110ca..9099c11ad27 100644 --- a/integration/templates/astro-node/src/pages/sign-in.astro +++ b/integration/templates/astro-node/src/pages/sign-in.astro @@ -1,5 +1,5 @@ --- -import { SignIn } from "@clerk/astro/components/interactive"; +import { SignIn } from "@clerk/astro/components"; import Layout from "../layouts/Layout.astro"; --- diff --git a/integration/templates/astro-node/src/pages/user.astro b/integration/templates/astro-node/src/pages/user.astro index dfed7f34ff7..b0162f56216 100644 --- a/integration/templates/astro-node/src/pages/user.astro +++ b/integration/templates/astro-node/src/pages/user.astro @@ -1,5 +1,5 @@ --- -import { UserProfile } from "@clerk/astro/components/interactive"; +import { UserProfile } from "@clerk/astro/components"; import Layout from "../layouts/Layout.astro"; import StreamUser from "../components/StreamUser.astro"; --- diff --git a/packages/astro/.eslintrc.cjs b/packages/astro/.eslintrc.cjs index 5ab66e85803..9a6a03f17b9 100644 --- a/packages/astro/.eslintrc.cjs +++ b/packages/astro/.eslintrc.cjs @@ -6,7 +6,7 @@ module.exports = { }, overrides: [ { - files: ['./env.d.ts'], + files: ['./env.d.ts', 'src/astro-components/*/*.d.ts'], rules: { '@typescript-eslint/consistent-type-imports': 'off', }, diff --git a/packages/astro/package.json b/packages/astro/package.json index c4ea7f1c2be..408e77f1874 100644 --- a/packages/astro/package.json +++ b/packages/astro/package.json @@ -67,13 +67,7 @@ "import": "./dist/server/index.js" }, "./env": "./env.d.ts", - "./components/control": "./components/control/index.ts", - "./components/control/*": "./components/control/*", - "./components/interactive": "./components/interactive/index.ts", - "./components/interactive/*": "./components/interactive/*", - "./components/unstyled": "./components/unstyled/index.ts", - "./components/unstyled/*": "./components/unstyled/*", - "./components/*": "./components/*", + "./components": "./components/index.ts", "./package.json": "./package.json" }, "imports": { diff --git a/packages/astro/src/astro-components/control/index.ts b/packages/astro/src/astro-components/control/index.ts deleted file mode 100644 index eea52bde72f..00000000000 --- a/packages/astro/src/astro-components/control/index.ts +++ /dev/null @@ -1,9 +0,0 @@ -// The `ts-ignore` comments here are necessary because we're importing this file inside the `astro:components` -// virtual module's types, which means that `tsc` will try to resolve these imports. Don't mind the editor errors. - -// @ts-ignore -export { default as SignedIn } from './SignedIn.astro'; -// @ts-ignore -export { default as SignedOut } from './SignedOut.astro'; -// @ts-ignore -export { default as Protect } from './Protect.astro'; diff --git a/packages/astro/src/astro-components/index.ts b/packages/astro/src/astro-components/index.ts new file mode 100644 index 00000000000..fa816b7b52c --- /dev/null +++ b/packages/astro/src/astro-components/index.ts @@ -0,0 +1,25 @@ +/** + * Control Components + */ +export { default as SignedIn } from './control/SignedIn.astro'; +export { default as SignedOut } from './control/SignedOut.astro'; +export { default as Protect } from './control/Protect.astro'; + +/** + * Unstyled Components + */ +export { default as SignInButton } from './unstyled/SignInButton.astro'; +export { default as SignUpButton } from './unstyled/SignUpButton.astro'; +export { default as SignOutButton } from './unstyled/SignOutButton.astro'; + +/** + * UI Components + */ +export { default as SignIn } from './interactive/SignIn.astro'; +export { default as SignUp } from './interactive/SignUp.astro'; +export { default as UserButton } from './interactive/UserButton.astro'; +export { default as UserProfile } from './interactive/UserProfile.astro'; +export { default as OrganizationProfile } from './interactive/OrganizationProfile.astro'; +export { default as OrganizationSwitcher } from './interactive/OrganizationSwitcher.astro'; +export { default as OrganizationList } from './interactive/OrganizationList.astro'; +export { default as GoogleOneTap } from './interactive/GoogleOneTap.astro'; diff --git a/packages/astro/src/astro-components/interactive/index.ts b/packages/astro/src/astro-components/interactive/index.ts deleted file mode 100644 index d73a17d01a7..00000000000 --- a/packages/astro/src/astro-components/interactive/index.ts +++ /dev/null @@ -1,18 +0,0 @@ -// The `ts-ignore` comments here are necessary because we're importing this file inside the `astro:components` -// virtual module's types, which means that `tsc` will try to resolve these imports. Don't mind the editor errors. -// @ts-ignore -export { default as SignIn } from './SignIn.astro'; -// @ts-ignore -export { default as SignUp } from './SignUp.astro'; -// @ts-ignore -export { default as UserButton } from './UserButton.astro'; -// @ts-ignore -export { default as UserProfile } from './UserProfile.astro'; -// @ts-ignore -export { default as OrganizationProfile } from './OrganizationProfile.astro'; -// @ts-ignore -export { default as OrganizationSwitcher } from './OrganizationSwitcher.astro'; -// @ts-ignore -export { default as OrganizationList } from './OrganizationList.astro'; -// @ts-ignore -export { default as GoogleOneTap } from './GoogleOneTap.astro'; diff --git a/packages/astro/src/astro-components/unstyled/index.ts b/packages/astro/src/astro-components/unstyled/index.ts deleted file mode 100644 index d62e09924be..00000000000 --- a/packages/astro/src/astro-components/unstyled/index.ts +++ /dev/null @@ -1,8 +0,0 @@ -// The `ts-ignore` comments here are necessary because we're importing this file inside the `astro:components` -// virtual module's types, which means that `tsc` will try to resolve these imports. Don't mind the editor errors. -// @ts-ignore -export { default as SignInButton } from './SignInButton.astro'; -// @ts-ignore -export { default as SignUpButton } from './SignUpButton.astro'; -// @ts-ignore -export { default as SignOutButton } from './SignOutButton.astro'; diff --git a/packages/astro/tsconfig.json b/packages/astro/tsconfig.json index ce451941228..d1e9ae67c05 100644 --- a/packages/astro/tsconfig.json +++ b/packages/astro/tsconfig.json @@ -24,5 +24,5 @@ "declarationDir": "dist/types", "noUncheckedIndexedAccess": true }, - "exclude": ["dist", "build", "node_modules"] + "exclude": ["dist", "build", "node_modules", "src/astro-components"] } From 99759370bcfe7cf140ac5848224a518bdb4a8e60 Mon Sep 17 00:00:00 2001 From: panteliselef Date: Fri, 12 Jul 2024 19:59:17 +0300 Subject: [PATCH 4/6] chore(astro): Add changeset --- .changeset/fluffy-squids-fly.md | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 .changeset/fluffy-squids-fly.md diff --git a/.changeset/fluffy-squids-fly.md b/.changeset/fluffy-squids-fly.md new file mode 100644 index 00000000000..a845151cc84 --- /dev/null +++ b/.changeset/fluffy-squids-fly.md @@ -0,0 +1,2 @@ +--- +--- From 3106ab1ceea58af8bdfc8a3d761e2bb106bfe8d6 Mon Sep 17 00:00:00 2001 From: panteliselef Date: Fri, 12 Jul 2024 21:16:17 +0300 Subject: [PATCH 5/6] chore(astro): Add changeset --- .changeset/fluffy-squids-fly.md | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/.changeset/fluffy-squids-fly.md b/.changeset/fluffy-squids-fly.md index a845151cc84..fb84ed6588d 100644 --- a/.changeset/fluffy-squids-fly.md +++ b/.changeset/fluffy-squids-fly.md @@ -1,2 +1,16 @@ --- +"@clerk/astro": patch --- + +Move `@clerk/astro/components/*` to `@clerk/astro/components` + +```diff +- import { UserProfile } from "@clerk/astro/components/interactive" ++ import { UserProfile } from "@clerk/astro/components" + +- import { Protect } from "@clerk/astro/components/control" ++ import { Protect } from "@clerk/astro/components" + +- import { SignInButton } from "@clerk/astro/components/unstyled" ++ import { SignInButton } from "@clerk/astro/components" +``` From 551a650d8585a76d362fe1238e761e148fa46e4f Mon Sep 17 00:00:00 2001 From: panteliselef Date: Fri, 12 Jul 2024 21:25:15 +0300 Subject: [PATCH 6/6] chore(astro): Fix linting --- packages/astro/.eslintrc.cjs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/astro/.eslintrc.cjs b/packages/astro/.eslintrc.cjs index 9a6a03f17b9..0dff74e748b 100644 --- a/packages/astro/.eslintrc.cjs +++ b/packages/astro/.eslintrc.cjs @@ -4,9 +4,10 @@ module.exports = { rules: { 'import/no-unresolved': ['error', { ignore: ['^#'] }], }, + ignorePatterns: ['src/astro-components/index.ts'], overrides: [ { - files: ['./env.d.ts', 'src/astro-components/*/*.d.ts'], + files: ['./env.d.ts'], rules: { '@typescript-eslint/consistent-type-imports': 'off', },