Skip to content

Commit

Permalink
Upgrade dependencies, use biome for formatting and linting
Browse files Browse the repository at this point in the history
  • Loading branch information
hamlim committed Oct 22, 2024
1 parent 6d54541 commit 3c5456a
Show file tree
Hide file tree
Showing 67 changed files with 806 additions and 600 deletions.
12 changes: 12 additions & 0 deletions .knip.jsonc
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"$schema": "https://unpkg.com/knip@5/schema.json",
"workspaces": {
".": {
"ignoreDependencies": ["@turbo/gen"]
},
"packages/*": {
"ignore": ["**/*.test.(ts|tsx|mjs|js)"],
"ignoreDependencies": ["@swc/cli", "@swc/core"]
}
}
}
3 changes: 0 additions & 3 deletions apps/docs/.eslintrc.json

This file was deleted.

1 change: 1 addition & 0 deletions apps/docs/app/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ export default function RootLayout({
<head>
<script
suppressHydrationWarning
// biome-ignore lint/security/noDangerouslySetInnerHtml: <explanation>
dangerouslySetInnerHTML={{
__html: `(${themeCheck.toString()})()`,
}}
Expand Down
73 changes: 47 additions & 26 deletions apps/docs/app/page.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,15 @@
import { Code } from "bright";
import { StarIcon } from "lucide-react";
import type { Metadata } from "next";
import { Blockquote, H1, H2, InlineCode, Link, P, UnorderedList } from "~/components/typography";
import {
Blockquote,
H1,
H2,
InlineCode,
Link,
P,
UnorderedList,
} from "~/components/typography";
import { Button } from "~/components/ui/button";
import { Tabs, TabsContent, TabsList, TabsTrigger } from "~/components/ui/tabs";

Expand Down Expand Up @@ -33,12 +41,14 @@ export default function Home() {
<header className={sectionClasses}>
<H1>One Version</H1>
<P>
One Version is a strict dependency conformance tool for monorepos, managing dependencies across repos has
never been easier!
One Version is a strict dependency conformance tool for monorepos,
managing dependencies across repos has never been easier!
</P>
<P>
This tool ensures that all workspaces in your monorepo are using the same version of a dependency, and also an
(opt-in) strict versioning strategy to ensure that all dependencies are pinned to an exact version.
This tool ensures that all workspaces in your monorepo are using the
same version of a dependency, and also an (opt-in) strict versioning
strategy to ensure that all dependencies are pinned to an exact
version.
</P>

<div className="pt-10 flex row justify-evenly items-center">
Expand All @@ -55,7 +65,8 @@ export default function Home() {
<section id="installation" className={sectionClasses}>
<H2>Installation</H2>
<P>
Install <InlineCode>one-version</InlineCode> via your favorite package manager:
Install <InlineCode>one-version</InlineCode> via your favorite package
manager:
</P>
<div className="mt-6">
<Tabs defaultValue="bun">
Expand Down Expand Up @@ -83,15 +94,17 @@ export default function Home() {
</div>
<Blockquote>
<P>
Notably! <InlineCode>one-version</InlineCode> should be installed at the root of your monorepo.
Notably! <InlineCode>one-version</InlineCode> should be installed at
the root of your monorepo.
</P>
</Blockquote>
</section>
<section className={sectionClasses}>
<H2 className="mt-4">Usage:</H2>
<P>
Once you&apos;ve installed <InlineCode>one-version</InlineCode>, you can add a{" "}
<InlineCode>one-version:check</InlineCode> script in your root <InlineCode>package.json</InlineCode>:
Once you&apos;ve installed <InlineCode>one-version</InlineCode>, you
can add a <InlineCode>one-version:check</InlineCode> script in your
root <InlineCode>package.json</InlineCode>:
</P>
<Code lang="json">
{`{
Expand All @@ -101,19 +114,22 @@ export default function Home() {
}`}
</Code>
<P>
You can now run <InlineCode>bun run one-version:check</InlineCode>{" "}
(or use whatever package manager you have setup) to check for version conformance!
You can now run <InlineCode>bun run one-version:check</InlineCode> (or
use whatever package manager you have setup) to check for version
conformance!
</P>
</section>
<section className={sectionClasses}>
<H2>Configuration:</H2>
<P>
<InlineCode>one-version</InlineCode>{" "}
can work out of the box without any configuration at all, however if you&apos;d like to allow specific
workspaces to use different versions of a dependency, you&apos;ll need to add a configuration file.
<InlineCode>one-version</InlineCode> can work out of the box without
any configuration at all, however if you&apos;d like to allow specific
workspaces to use different versions of a dependency, you&apos;ll need
to add a configuration file.
</P>
<P>
<InlineCode>one-version</InlineCode> currently supports the following package managers:
<InlineCode>one-version</InlineCode> currently supports the following
package managers:
</P>
<UnorderedList>
<li>
Expand All @@ -132,13 +148,15 @@ export default function Home() {
<InlineCode>yarn-berry</InlineCode> - Yarn version 2.x, 3.x, 4.x
</li>
<li>
<InlineCode>deno</InlineCode> - When using <InlineCode>package.json</InlineCode>
<InlineCode>deno</InlineCode> - When using{" "}
<InlineCode>package.json</InlineCode>
</li>
</UnorderedList>
<P>
You can configure <InlineCode>one-version</InlineCode> via either a{" "}
<InlineCode>one-version.config.jsonc</InlineCode> or <InlineCode>one-version.config.json</InlineCode>{" "}
file. An example configuration is provided below:
<InlineCode>one-version.config.jsonc</InlineCode> or{" "}
<InlineCode>one-version.config.json</InlineCode> file. An example
configuration is provided below:
</P>

<Code lang="json">
Expand Down Expand Up @@ -172,16 +190,18 @@ export default function Home() {
package which I had contributed to while at Wayfair.
</P>
<P>
That package still works fine, but hasn&apos;t been maintained in some time - and also doesn&apos;t support
either <InlineCode>bun</InlineCode> or <InlineCode>npm</InlineCode>.
That package still works fine, but hasn&apos;t been maintained in some
time - and also doesn&apos;t support either{" "}
<InlineCode>bun</InlineCode> or <InlineCode>npm</InlineCode>.
</P>
<P>
Both this package and the original implement a version of Google&apos;s{" "}
<InlineCode>One-Version Rule</InlineCode>:
Both this package and the original implement a version of
Google&apos;s <InlineCode>One-Version Rule</InlineCode>:
</P>
<Blockquote>
<P>
For every dependency in [a] repository, there must be only one version of that dependency to choose
For every dependency in [a] repository, there must be only one
version of that dependency to choose
<sup>
<Link href="#fn-1">1</Link>
</sup>
Expand All @@ -198,15 +218,16 @@ export default function Home() {
<footer className={sectionClasses}>
<P>
The source code for the library is available on{" "}
<Link href="https://github.com/hamlim/one-version">GitHub</Link>. If you run into any bugs, please report them
via{" "}
<Link href="https://github.com/hamlim/one-version">GitHub</Link>. If
you run into any bugs, please report them via{" "}
<Link href="https://github.com/hamlim/one-version/issues/new">
issues
</Link>
.
</P>
<P>
If you&apos;d like to discuss changes to the project, feel free to start a{" "}
If you&apos;d like to discuss changes to the project, feel free to
start a{" "}
<Link href="https://github.com/hamlim/one-version/discussions/new/choose">
discussion
</Link>
Expand Down
2 changes: 1 addition & 1 deletion apps/docs/components.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@
"components": "~/components",
"utils": "~/lib/utils"
}
}
}
117 changes: 100 additions & 17 deletions apps/docs/components/typography.tsx
Original file line number Diff line number Diff line change
@@ -1,41 +1,111 @@
import { cn } from "~/lib/utils";

export function H1(props: React.HTMLAttributes<HTMLHeadingElement> & { children?: React.ReactNode }) {
export function H1(
props: React.HTMLAttributes<HTMLHeadingElement> & {
children?: React.ReactNode;
},
) {
return (
<h1 {...props} className={cn(props.className, "scroll-m-20 text-4xl font-extrabold tracking-tight lg:text-5xl")} />
<h1
{...props}
className={cn(
props.className,
"scroll-m-20 text-4xl font-extrabold tracking-tight lg:text-5xl",
)}
/>
);
}

export function H2(props: React.HTMLAttributes<HTMLHeadingElement> & { children?: React.ReactNode }) {
export function H2(
props: React.HTMLAttributes<HTMLHeadingElement> & {
children?: React.ReactNode;
},
) {
return (
<h2
{...props}
className={cn(props.className, "scroll-m-20 border-b pb-2 text-3xl font-semibold tracking-tight first:mt-0")}
className={cn(
props.className,
"scroll-m-20 border-b pb-2 text-3xl font-semibold tracking-tight first:mt-0",
)}
/>
);
}

export function H3(props: React.HTMLAttributes<HTMLHeadingElement> & { children?: React.ReactNode }) {
return <h3 {...props} className={cn(props.className, "scroll-m-20 text-2xl font-semibold tracking-tight")} />;
export function H3(
props: React.HTMLAttributes<HTMLHeadingElement> & {
children?: React.ReactNode;
},
) {
return (
<h3
{...props}
className={cn(
props.className,
"scroll-m-20 text-2xl font-semibold tracking-tight",
)}
/>
);
}

export function H4(props: React.HTMLAttributes<HTMLHeadingElement> & { children?: React.ReactNode }) {
return <h4 {...props} className={cn(props.className, "scroll-m-20 text-xl font-semibold tracking-tight")} />;
export function H4(
props: React.HTMLAttributes<HTMLHeadingElement> & {
children?: React.ReactNode;
},
) {
return (
<h4
{...props}
className={cn(
props.className,
"scroll-m-20 text-xl font-semibold tracking-tight",
)}
/>
);
}

export function P(props: React.HTMLAttributes<HTMLParagraphElement> & { children?: React.ReactNode }) {
return <p {...props} className={cn(props.className, "leading-7 [&:not(:first-child)]:mt-6")} />;
export function P(
props: React.HTMLAttributes<HTMLParagraphElement> & {
children?: React.ReactNode;
},
) {
return (
<p
{...props}
className={cn(props.className, "leading-7 [&:not(:first-child)]:mt-6")}
/>
);
}

export function Blockquote(props: React.HTMLAttributes<HTMLQuoteElement> & { children?: React.ReactNode }) {
return <blockquote {...props} className={cn(props.className, "mt-6 border-l-2 pl-6 italic")} />;
export function Blockquote(
props: React.HTMLAttributes<HTMLQuoteElement> & {
children?: React.ReactNode;
},
) {
return (
<blockquote
{...props}
className={cn(props.className, "mt-6 border-l-2 pl-6 italic")}
/>
);
}

export function UnorderedList(props: React.HTMLAttributes<HTMLUListElement> & { children?: React.ReactNode }) {
return <ul {...props} className={cn(props.className, "my-6 ml-6 list-disc [&>li]:mt-2")} />;
export function UnorderedList(
props: React.HTMLAttributes<HTMLUListElement> & {
children?: React.ReactNode;
},
) {
return (
<ul
{...props}
className={cn(props.className, "my-6 ml-6 list-disc [&>li]:mt-2")}
/>
);
}

export function InlineCode(props: React.HTMLAttributes<HTMLElement> & { children?: React.ReactNode }) {
export function InlineCode(
props: React.HTMLAttributes<HTMLElement> & { children?: React.ReactNode },
) {
return (
<code
{...props}
Expand All @@ -47,6 +117,19 @@ export function InlineCode(props: React.HTMLAttributes<HTMLElement> & { children
);
}

export function Link(props: React.HTMLAttributes<HTMLAnchorElement> & { children?: React.ReactNode; href: string }) {
return <a {...props} className={cn(props.className, "font-medium text-primary underline underline-offset-4")} />;
export function Link(
props: React.HTMLAttributes<HTMLAnchorElement> & {
children?: React.ReactNode;
href: string;
},
) {
return (
<a
{...props}
className={cn(
props.className,
"font-medium text-primary underline underline-offset-4",
)}
/>
);
}
13 changes: 8 additions & 5 deletions apps/docs/components/ui/button.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,12 @@ const buttonVariants = cva(
variants: {
variant: {
default: "bg-primary text-primary-foreground hover:bg-primary/90",
destructive: "bg-destructive text-destructive-foreground hover:bg-destructive/90",
outline: "border border-input bg-background hover:bg-accent hover:text-accent-foreground",
secondary: "bg-secondary text-secondary-foreground hover:bg-secondary/80",
destructive:
"bg-destructive text-destructive-foreground hover:bg-destructive/90",
outline:
"border border-input bg-background hover:bg-accent hover:text-accent-foreground",
secondary:
"bg-secondary text-secondary-foreground hover:bg-secondary/80",
ghost: "hover:bg-accent hover:text-accent-foreground",
link: "text-primary underline-offset-4 hover:underline",
},
Expand All @@ -31,8 +34,8 @@ const buttonVariants = cva(
);

export interface ButtonProps
extends React.ButtonHTMLAttributes<HTMLButtonElement>, VariantProps<typeof buttonVariants>
{
extends React.ButtonHTMLAttributes<HTMLButtonElement>,
VariantProps<typeof buttonVariants> {
asChild?: boolean;
}

Expand Down
4 changes: 2 additions & 2 deletions apps/docs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"dev": "next dev --turbo",
"build": "next build",
"start": "next start",
"lint": "next lint"
"lint": "biome lint"
},
"dependencies": {
"@radix-ui/react-slot": "^1.0.2",
Expand All @@ -15,7 +15,7 @@
"class-variance-authority": "^0.7.0",
"clsx": "^2.1.1",
"lucide-react": "^0.378.0",
"next": "14.3.0-canary.61",
"next": "15.0.1-canary.0",
"tailwind-merge": "^2.3.0",
"tailwindcss-animate": "^1.0.7"
},
Expand Down
5 changes: 1 addition & 4 deletions apps/docs/tailwind.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,7 @@ import type { Config } from "tailwindcss";

const config = {
darkMode: ["class"],
content: [
"./components/**/*.{ts,tsx}",
"./app/**/*.{ts,tsx}",
],
content: ["./components/**/*.{ts,tsx}", "./app/**/*.{ts,tsx}"],
prefix: "",
theme: {
container: {
Expand Down
Loading

0 comments on commit 3c5456a

Please sign in to comment.