Skip to content

Commit 90901a5

Browse files
authored
feat: Create Astro integration (#216)
feat: Create Astro integration.
1 parent 6f2bebc commit 90901a5

File tree

106 files changed

+5022
-610
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

106 files changed

+5022
-610
lines changed

.changeset/nine-boxes-help.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
---
2+
"@codecov/bundler-plugin-core": minor
3+
"@codecov/astro-plugin": minor
4+
"@codecov/bundle-analyzer": minor
5+
"@codecov/nextjs-webpack-plugin": minor
6+
"@codecov/nuxt-plugin": minor
7+
"@codecov/remix-vite-plugin": minor
8+
"@codecov/rollup-plugin": minor
9+
"@codecov/solidstart-plugin": minor
10+
"@codecov/sveltekit-plugin": minor
11+
"@codecov/vite-plugin": minor
12+
"@codecov/webpack-plugin": minor
13+
---
14+
15+
Export bundle analysis plugin return type from bundler plugin core

.changeset/old-singers-visit.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
---
2+
"@codecov/bundler-plugin-core": minor
3+
"@codecov/astro-plugin": minor
4+
"@codecov/bundle-analyzer": minor
5+
"@codecov/nextjs-webpack-plugin": minor
6+
"@codecov/nuxt-plugin": minor
7+
"@codecov/remix-vite-plugin": minor
8+
"@codecov/rollup-plugin": minor
9+
"@codecov/solidstart-plugin": minor
10+
"@codecov/sveltekit-plugin": minor
11+
"@codecov/vite-plugin": minor
12+
"@codecov/webpack-plugin": minor
13+
---
14+
15+
Add new Astro Plugin to support BA uploads for Astro applications

.changeset/tame-glasses-compete.md

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,15 @@
11
---
2-
"@codecov/nextjs-webpack-plugin": minor
32
"@codecov/bundler-plugin-core": minor
3+
"@codecov/astro-plugin": minor
4+
"@codecov/bundle-analyzer": minor
5+
"@codecov/nextjs-webpack-plugin": minor
6+
"@codecov/nuxt-plugin": minor
47
"@codecov/remix-vite-plugin": minor
8+
"@codecov/rollup-plugin": minor
59
"@codecov/solidstart-plugin": minor
610
"@codecov/sveltekit-plugin": minor
7-
"@codecov/webpack-plugin": minor
8-
"@codecov/rollup-plugin": minor
9-
"@codecov/nuxt-plugin": minor
1011
"@codecov/vite-plugin": minor
12+
"@codecov/webpack-plugin": minor
1113
---
1214

1315
Collect dynamic imports for base bundler plugins, which apply to the extended meta-framework plugins.

.eslintrc.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ const config = {
2828
"./tsconfig.json",
2929
"./integration-tests/tsconfig.json",
3030
"./packages/bundler-plugin-core/tsconfig.json",
31+
"./packages/astro-plugin/tsconfig.json",
3132
"./packages/nextjs-webpack-plugin/tsconfig.json",
3233
"./packages/nuxt-plugin/tsconfig.json",
3334
"./packages/remix-vite-plugin/tsconfig.json",

.github/workflows/ci.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -284,6 +284,7 @@ jobs:
284284
matrix:
285285
example:
286286
[
287+
"astro",
287288
"bundle-analyzer-cli",
288289
"bundle-analyzer-lib-cjs",
289290
"bundle-analyzer-lib-esm",
@@ -346,6 +347,8 @@ jobs:
346347
env:
347348
HEAD_SHA: ${{ github.event.pull_request.head.sha }}
348349
BASE_SHA: ${{ github.event.pull_request.base.sha }}
350+
ASTRO_UPLOAD_TOKEN: ${{ secrets.CODECOV_ORG_TOKEN }}
351+
ASTRO_API_URL: ${{ secrets.CODECOV_API_URL }}
349352
BUNDLE_ANALYZER_UPLOAD_TOKEN: ${{ secrets.CODECOV_ORG_TOKEN }}
350353
BUNDLE_ANALYZER_API_URL: ${{ secrets.CODECOV_API_URL }}
351354
NEXT_UPLOAD_TOKEN: ${{ secrets.CODECOV_ORG_TOKEN }}
@@ -378,6 +381,7 @@ jobs:
378381
matrix:
379382
example:
380383
[
384+
"astro",
381385
"bundle-analyzer-cli",
382386
"bundle-analyzer-lib-cjs",
383387
"bundle-analyzer-lib-esm",
@@ -440,6 +444,8 @@ jobs:
440444
env:
441445
HEAD_SHA: ${{ github.event.pull_request.head.sha }}
442446
BASE_SHA: ${{ github.event.pull_request.base.sha }}
447+
ASTRO_UPLOAD_TOKEN: ${{ secrets.CODECOV_ORG_TOKEN }}
448+
ASTRO_API_URL: ${{ secrets.CODECOV_API_URL }}
443449
BUNDLE_ANALYZER_UPLOAD_TOKEN: ${{ secrets.CODECOV_ORG_TOKEN }}
444450
BUNDLE_ANALYZER_API_URL: ${{ secrets.CODECOV_API_URL }}
445451
NEXT_UPLOAD_TOKEN: ${{ secrets.CODECOV_ORG_TOKEN_STAGING }}
@@ -472,6 +478,7 @@ jobs:
472478
matrix:
473479
package:
474480
[
481+
"astro-plugin",
475482
"bundle-analyzer",
476483
"bundler-plugin-core",
477484
"nextjs-webpack-plugin",
@@ -541,6 +548,7 @@ jobs:
541548
matrix:
542549
package:
543550
[
551+
"astro-plugin",
544552
"bundle-analyzer",
545553
"bundler-plugin-core",
546554
"nextjs-webpack-plugin",

examples/astro/.gitignore

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# build output
2+
dist/
3+
4+
# generated types
5+
.astro/
6+
7+
# dependencies
8+
node_modules/
9+
10+
# logs
11+
npm-debug.log*
12+
yarn-debug.log*
13+
yarn-error.log*
14+
pnpm-debug.log*
15+
16+
# environment variables
17+
.env
18+
.env.production
19+
20+
# macOS-specific files
21+
.DS_Store
22+
23+
# jetbrains setting folder
24+
.idea/
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"recommendations": ["astro-build.astro-vscode"],
3+
"unwantedRecommendations": []
4+
}

examples/astro/.vscode/launch.json

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"version": "0.2.0",
3+
"configurations": [
4+
{
5+
"command": "./node_modules/.bin/astro dev",
6+
"name": "Development server",
7+
"request": "launch",
8+
"type": "node-terminal"
9+
}
10+
]
11+
}

examples/astro/README.md

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
# Astro Starter Kit: Basics
2+
3+
```sh
4+
npm create astro@latest -- --template basics
5+
```
6+
7+
[![Open in StackBlitz](https://developer.stackblitz.com/img/open_in_stackblitz.svg)](https://stackblitz.com/github/withastro/astro/tree/latest/examples/basics)
8+
[![Open with CodeSandbox](https://assets.codesandbox.io/github/button-edit-lime.svg)](https://codesandbox.io/p/sandbox/github/withastro/astro/tree/latest/examples/basics)
9+
[![Open in GitHub Codespaces](https://github.com/codespaces/badge.svg)](https://codespaces.new/withastro/astro?devcontainer_path=.devcontainer/basics/devcontainer.json)
10+
11+
> 🧑‍🚀 **Seasoned astronaut?** Delete this file. Have fun!
12+
13+
![just-the-basics](https://github.com/withastro/astro/assets/2244813/a0a5533c-a856-4198-8470-2d67b1d7c554)
14+
15+
## 🚀 Project Structure
16+
17+
Inside of your Astro project, you'll see the following folders and files:
18+
19+
```text
20+
/
21+
├── public/
22+
│ └── favicon.svg
23+
├── src/
24+
│ ├── components/
25+
│ │ └── Card.astro
26+
│ ├── layouts/
27+
│ │ └── Layout.astro
28+
│ └── pages/
29+
│ └── index.astro
30+
└── package.json
31+
```
32+
33+
Astro looks for `.astro` or `.md` files in the `src/pages/` directory. Each page is exposed as a route based on its file name.
34+
35+
There's nothing special about `src/components/`, but that's where we like to put any Astro/React/Vue/Svelte/Preact components.
36+
37+
Any static assets, like images, can be placed in the `public/` directory.
38+
39+
## 🧞 Commands
40+
41+
All commands are run from the root of the project, from a terminal:
42+
43+
| Command | Action |
44+
| :------------------------ | :----------------------------------------------- |
45+
| `npm install` | Installs dependencies |
46+
| `npm run dev` | Starts local dev server at `localhost:4321` |
47+
| `npm run build` | Build your production site to `./dist/` |
48+
| `npm run preview` | Preview your build locally, before deploying |
49+
| `npm run astro ...` | Run CLI commands like `astro add`, `astro check` |
50+
| `npm run astro -- --help` | Get help using the Astro CLI |
51+
52+
## 👀 Want to learn more?
53+
54+
Feel free to check [our documentation](https://docs.astro.build) or jump into our [Discord server](https://astro.build/chat).

examples/astro/astro.config.mjs

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
// @ts-check
2+
import { defineConfig } from "astro/config";
3+
4+
import codecovAstroPlugin from "@codecov/astro-plugin";
5+
6+
import node from "@astrojs/node";
7+
8+
import react from "@astrojs/react";
9+
10+
// https://astro.build/config
11+
export default defineConfig({
12+
output: "hybrid",
13+
adapter: node({
14+
mode: "standalone",
15+
}),
16+
integrations: [
17+
react(),
18+
codecovAstroPlugin({
19+
enableBundleAnalysis: true,
20+
bundleName: "@codecov/example-astro-app",
21+
uploadToken: process.env.ASTRO_UPLOAD_TOKEN,
22+
apiUrl: process.env.ASTRO_API_URL,
23+
gitService: "github",
24+
debug: true,
25+
}),
26+
],
27+
});

0 commit comments

Comments
 (0)