diff --git a/.changeset/fluffy-squids-fly.md b/.changeset/fluffy-squids-fly.md new file mode 100644 index 00000000000..fb84ed6588d --- /dev/null +++ b/.changeset/fluffy-squids-fly.md @@ -0,0 +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" +``` 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..0dff74e748b 100644 --- a/packages/astro/.eslintrc.cjs +++ b/packages/astro/.eslintrc.cjs @@ -4,6 +4,7 @@ module.exports = { rules: { 'import/no-unresolved': ['error', { ignore: ['^#'] }], }, + ignorePatterns: ['src/astro-components/index.ts'], overrides: [ { files: ['./env.d.ts'], 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"] }