Skip to content

Commit

Permalink
feta: Update to Astro 5 and Vite 6 (#173)
Browse files Browse the repository at this point in the history
  • Loading branch information
Fryuni authored Dec 4, 2024
1 parent 7e20109 commit 21e0744
Show file tree
Hide file tree
Showing 87 changed files with 2,288 additions and 1,372 deletions.
5 changes: 5 additions & 0 deletions .changeset/grumpy-coins-collect.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@inox-tools/astro-tests': patch
---

Fix opt-out of Vite's dependency optimization during tests
5 changes: 5 additions & 0 deletions .changeset/hot-pandas-dream.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@inox-tools/custom-routing': major
---

Bump support to Astro 5
50 changes: 50 additions & 0 deletions .changeset/pre.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
{
"mode": "exit",
"tag": "beta",
"initialVersions": {
"docs": "0.0.5",
"@examples/astro-when": "0.0.8",
"@example/content-injection": "0.0.12",
"@example/custom-routing": "0.0.2",
"@example/inline-mod": "0.0.1",
"@example/inline-mod-aik": "0.1.0",
"@example/inline-mod-astro": "0.0.2",
"@example/request-nanostores": "0.0.2",
"@example/request-state": "0.0.11",
"@example/sitemap-ext": "0.1.20",
"@inox-tools/aik-mod": "0.8.4",
"@inox-tools/aik-route-config": "0.7.4",
"@inox-tools/astro-tests": "0.1.5",
"@inox-tools/astro-when": "0.2.4",
"@astro-when/server-output": "0.0.0",
"@astro-when/static-output": "0.0.0",
"@inox-tools/content-utils": "0.7.3",
"@inox-tools/custom-routing": "0.4.1",
"@inox-tools/cut-short": "0.1.2",
"@cut-short/basic": "0.0.0",
"@inox-tools/inline-mod": "1.5.2",
"@inox-tools/modular-station": "0.3.3",
"@inox-tools/portal-gun": "0.1.0",
"@portal-gun/basic": "0.0.0",
"@inox-tools/request-nanostores": "0.1.4",
"@request-nanostores/basic": "0.0.0",
"@request-nanostores/race": "0.0.0",
"@inox-tools/request-state": "0.1.4",
"@request-state/basic": "0.0.0",
"@request-state/dev": "0.0.0",
"@request-state/view-transitions": "0.0.0",
"@inox-tools/runtime-logger": "0.3.4",
"@inox-tools/sitemap-ext": "0.3.5",
"@inox-tools/star-warp": "0.1.5",
"@inox-tools/utils": "0.2.0",
"@inox-tools/velox-luna": "0.3.2",
"templates": "1.0.0"
},
"changesets": [
"grumpy-coins-collect",
"hot-pandas-dream",
"sixty-chefs-itch",
"smooth-pets-grab",
"ten-fireants-peel"
]
}
6 changes: 6 additions & 0 deletions .changeset/sixty-chefs-itch.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
'@inox-tools/inline-mod': major
'@inox-tools/utils': minor
---

Bump support to Vite 6
8 changes: 8 additions & 0 deletions .changeset/smooth-pets-grab.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
'@inox-tools/astro-when': major
'@inox-tools/portal-gun': major
'@inox-tools/cut-short': major
'@inox-tools/astro-tests': minor
---

Bump support to Astro 5
5 changes: 5 additions & 0 deletions .changeset/ten-fireants-peel.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@inox-tools/utils': minor
---

Add utility for setting deeply nested values through optional fields
17 changes: 13 additions & 4 deletions docs/astro.config.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,21 @@
import { defineConfig } from 'astro/config';
import starlight from '@astrojs/starlight';
import type { StarlightConfig } from '@astrojs/starlight/types';
import vercel from '@astrojs/vercel/serverless';
import starWarp from '@inox-tools/star-warp';
import starlightLinksValidator from 'starlight-links-validator';

const badge = {
new: {
text: 'NEW',
variant: 'success',
},
updated: {
text: 'UPDATED',
variant: 'default',
},
} satisfies Record<string, NonNullable<NonNullable<StarlightConfig['sidebar']>[number]['badge']>>;

process.env.ASTRO_PROJECT_ROOT = new URL('../', import.meta.url).toString();

const SITE =
Expand Down Expand Up @@ -32,12 +44,9 @@ export default defineConfig({
Head: './src/components/Head.astro',
PageTitle: './src/components/PageTitle.astro',
Sidebar: './src/components/Sidebar.astro',
MarkdownContent: './src/components/MarkdownContent.astro',
},
sidebar: [
{
label: 'BETA Docs (Astro 5)',
link: 'https://inox-tools-git-feat-astro-5-fryuni-pro.vercel.app/',
},
{
label: 'Tiny and Cute Integrations',
collapsed: false,
Expand Down
10 changes: 5 additions & 5 deletions docs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,14 @@
"@croct/plug": "^0.16.4",
"@inox-tools/star-warp": "workspace:^",
"@inox-tools/utils": "workspace:^",
"@vercel/analytics": "^1.3.2",
"astro": "catalog:",
"@vercel/analytics": "^1.4.1",
"astro": "^4.16.16",
"sharp": "^0.33.5",
"starlight-links-validator": "^0.12.3",
"starlight-package-managers": "^0.7.0"
"starlight-links-validator": "^0.13.4",
"starlight-package-managers": "^0.8.0"
},
"devDependencies": {
"@astrojs/check": "^0.9.4",
"typescript": "~5.6.3"
"typescript": "~5.7.2"
}
}
2 changes: 2 additions & 0 deletions docs/src/components/Head.astro
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
---
import StarlightHead from '@astrojs/starlight/components/Head.astro';
export type { Props } from '@astrojs/starlight/props';
Astro.locals.starlight = Astro.props;
---

<StarlightHead {...Astro.props} />
Expand Down
81 changes: 81 additions & 0 deletions docs/src/components/InstallCmd.astro
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
---
import { Aside, Code } from '@astrojs/starlight/components';
import { AstroError } from 'astro/errors';
import { PackageManagers } from 'starlight-package-managers';
export type Props = {
type?: 'lib' | 'devLib' | 'integration';
packageName?: string;
inSteps?: boolean;
version?: string;
};
const { type: packageType = 'integration', inSteps, version = 'beta' } = Astro.props;
const packageName: string | undefined =
Astro.locals.starlight.entry.data.packageName ?? Astro.props.packageName;
if (!packageName) {
throw new AstroError('Missing package name.');
}
const packageSpec = version && version !== 'latest' ? `${packageName}@${version}` : packageName;
// Taked from Astro source to show the exact code the user will see.
const codemodBrokenIdent = packageSpec
.trim()
.replace(/[-_./]?astro(?:js)?[-_.]?/g, '')
.replace(/\.js/, '')
.replace(/[.\-_/]+([a-zA-Z])/g, (_, w) => w.toUpperCase())
.replace(/^[^a-zA-Z$_]+/, '');
const codemodFixedIdent = codemodBrokenIdent.replace(/@.*$/, '');
---

{
inSteps && (
<>
Install <code dir="auto">{packageName}</code>:{' '}
</>
)
}

{
packageType === 'integration' && (
<>
<PackageManagers type="exec" pkg="astro" args={`add ${packageSpec}`} />
{codemodBrokenIdent !== codemodFixedIdent && (
<Aside type="caution" title="Invalid Codemod">
<p>
Installing the <code>{version}</code> version of the this package using
<code>astro add</code>
generates an invalid code for your Astro Config. After installing, remove the
<code>@{version}</code> added in the import and integrations section.
</p>
<Code
lang="ts"
title="astro.config.mjs"
del={{ range: '1,5' }}
ins={{ range: '2,6' }}
code={`
import ${codemodBrokenIdent} from '${packageName}';
import ${codemodFixedIdent} from '${packageName}';
export default defineConfig({
integrations: [${codemodBrokenIdent}()],
integrations: [${codemodFixedIdent}()],
});`.trim()}
/>
<p>
Follow <a href="https://github.com/withastro/astro/issues/12359">this issue</a> for more
information and updates.
</p>
</Aside>
)}
</>
)
}

{
packageType !== 'integration' && (
<PackageManagers dev={packageType === 'devLib'} pkg={packageSpec} />
)
}
8 changes: 8 additions & 0 deletions docs/src/components/MarkdownContent.astro
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
import Default from '@astrojs/starlight/components/MarkdownContent.astro';
export type { Props } from '@astrojs/starlight/props';
Astro.locals.starlight = Astro.props;
---

<Default {...Astro.props}><slot /></Default>
4 changes: 2 additions & 2 deletions docs/src/content/docs/astro-tests.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@ If the conversations ends in the decision of not having a test package provided

## How to install

import { PackageManagers } from 'starlight-package-managers';
import InstallCmd from '@/components/InstallCmd.astro';

<PackageManagers dev pkg="@inox-tools/astro-tests" />
<InstallCmd type="devLib" />

## Fixtures

Expand Down
4 changes: 2 additions & 2 deletions docs/src/content/docs/astro-when.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ When/Where your code is running is made available as an exported constant, so yo

This integration is needed during build time only, so you can install it as a dev dependency.

import { PackageManagers } from 'starlight-package-managers';
import InstallCmd from '@/components/InstallCmd.astro';

<PackageManagers type="exec" pkg="astro" args="add @inox-tools/astro-when" />
<InstallCmd />

## How to use

Expand Down
7 changes: 2 additions & 5 deletions docs/src/content/docs/content-utils/git.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,11 @@ Git is only necessary during build, so you can deploy your site anywhere. Even o

## How to use

import { PackageManagers } from 'starlight-package-managers';
import InstallCmd from '@/components/InstallCmd.astro';

<Steps>

1. Install `@inox-tools/content-utils`:

<PackageManagers type="exec" pkg="astro" args="add @inox-tools/content-utils" />

1. <InstallCmd inSteps />
2. Import the time getter you want from `@it-astro:content/git`:

```astro title="src/pages/blog/[...slug].astro"
Expand Down
4 changes: 2 additions & 2 deletions docs/src/content/docs/custom-routing.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ sidebar:

This integration allows you to define custom routes for your Astro project independent of the file-system. Use whatever logic you want to define your routes.

import { PackageManagers } from 'starlight-package-managers';
import InstallCmd from '@/components/InstallCmd.astro';

<PackageManagers pkg="@inox-tools/custom-routing" />
<InstallCmd />

```ts
// astro.config.mjs
Expand Down
4 changes: 2 additions & 2 deletions docs/src/content/docs/cut-short.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ Keep the the custom response for specific conditions close to the conditions and

## Installing the integration

import { PackageManagers } from 'starlight-package-managers';
import InstallCmd from '@/components/InstallCmd.astro';

<PackageManagers type="exec" pkg="astro" args="add @inox-tools/cut-short" />
<InstallCmd />

## How to use

Expand Down
4 changes: 0 additions & 4 deletions docs/src/content/docs/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,6 @@
title: Inox Tools
description: A collection of oxygen-free tools for Astronauts
tableOfContents: false
banner:
content: |
A beta version of all of Inox Tools is available to be used with Astro 5 and Vite 6.
<a href="https://inox-tools-git-feat-astro-5-fryuni-pro.vercel.app/">Check it out.</a>
hero:
tagline: A collection of oxygen-free tools for Astronauts
image:
Expand Down
4 changes: 2 additions & 2 deletions docs/src/content/docs/inline-mod/aik-plugin.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ sidebar:

## Installing the dependency

import { PackageManagers } from 'starlight-package-managers';
import InstallCmd from '@/components/InstallCmd.astro';

<PackageManagers pkg="@inox-tools/aik-mod" />
<InstallCmd type="lib" />

## Getting Started

Expand Down
4 changes: 2 additions & 2 deletions docs/src/content/docs/modular-station/api.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ This utility allows you, as an integration author, to expose APIs for other inte

## Installing the dependency

import { PackageManagers } from 'starlight-package-managers';
import InstallCmd from '@/components/InstallCmd.astro';

<PackageManagers pkg="@inox-tools/modular-station" />
<InstallCmd />

## How to use as an author

Expand Down
4 changes: 2 additions & 2 deletions docs/src/content/docs/modular-station/hooks.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ To avoid confusion, throughout this page you'll see these terms to refer to the

## Installing the dependency

import { PackageManagers } from 'starlight-package-managers';
import InstallCmd from '@/components/InstallCmd.astro';

<PackageManagers pkg="@inox-tools/modular-station" />
<InstallCmd />

## As a source integration

Expand Down
4 changes: 2 additions & 2 deletions docs/src/content/docs/portal-gun.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ When an element requires rendering outside of the usual component hierarchy, cha

## Installing the integration

import { PackageManagers } from 'starlight-package-managers';
import InstallCmd from '@/components/InstallCmd.astro';

<PackageManagers type="exec" pkg="astro" args="add @inox-tools/portal-gun" />
<InstallCmd />

## How to use

Expand Down
4 changes: 2 additions & 2 deletions docs/src/content/docs/request-nanostores.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ This integration bridges this gap and enables the use of Nanostores in Astro acr

## Installing the dependency

import { PackageManagers } from 'starlight-package-managers';
import InstallCmd from '@/components/InstallCmd.astro';

<PackageManagers type="exec" pkg="astro" args="add @inox-tools/request-nanostores" />
<InstallCmd />

### Prerequisites

Expand Down
4 changes: 2 additions & 2 deletions docs/src/content/docs/request-state.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@ This library provides a solution for those problems:

## Installing the dependency

import { PackageManagers } from 'starlight-package-managers';
import InstallCmd from '@/components/InstallCmd.astro';

<PackageManagers type="exec" pkg="astro" args="add @inox-tools/request-state" />
<InstallCmd />

### Prerequisites

Expand Down
Loading

0 comments on commit 21e0744

Please sign in to comment.