Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Add BA support for SvelteKit #126

Merged
merged 20 commits into from
May 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
682c49d
add in example sveltekit app
nicholas-codecov Apr 30, 2024
92020d3
add in example sveltekit app for integration tests
nicholas-codecov May 1, 2024
fcb8955
add in new sveltekit plugin
nicholas-codecov May 1, 2024
6e8de77
add in changeset
nicholas-codecov May 1, 2024
67a85bb
slight tweak to gen config util
nicholas-codecov May 1, 2024
161162b
add in integration tests for sveltekit
nicholas-codecov May 1, 2024
6426fce
update eslint config
nicholas-codecov May 1, 2024
faeab27
updates to the lock file
nicholas-codecov May 1, 2024
5cee458
bump license version
nicholas-codecov May 1, 2024
7278541
mark internal unpligin plugins as internal and remove from typedocs
nicholas-codecov May 1, 2024
0382ce5
update CI pipeline
nicholas-codecov May 1, 2024
9c538d3
small tweak to sveltekit integration tests
nicholas-codecov May 1, 2024
d9648da
run e2e tests individually for each plugin
nicholas-codecov May 1, 2024
74f9c25
remove running integration tests by plugin, not noticable enough diff…
nicholas-codecov May 1, 2024
348a53e
correct license year
nicholas-codecov May 23, 2024
ea60f47
fix up type in getBundleName functions
nicholas-codecov May 23, 2024
2db45c9
Revert "fix up type in getBundleName functions"
nicholas-codecov May 23, 2024
08e515d
Merge branch 'main' into gh-cjbp-94-add-support-for-svelte-kit
nicholas-codecov May 23, 2024
0e5855f
resolve updates that happened before merging the sveltekit plugin
nicholas-codecov May 23, 2024
72b56fd
bump pnpm version in CI to 9
nicholas-codecov May 23, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
10 changes: 10 additions & 0 deletions .changeset/light-ants-thank.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
---
"@codecov/bundler-plugin-core": patch
"@codecov/nuxt-plugin": patch
"@codecov/rollup-plugin": patch
"@codecov/sveltekit-plugin": patch
"@codecov/vite-plugin": patch
"@codecov/webpack-plugin": patch
---

Add in support for bundle analysis for SvelteKit through new SvelteKit plugin
10 changes: 10 additions & 0 deletions .changeset/orange-lemons-run.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
---
"@codecov/bundler-plugin-core": patch
"@codecov/sveltekit-plugin": patch
"@codecov/webpack-plugin": patch
"@codecov/rollup-plugin": patch
"@codecov/nuxt-plugin": patch
"@codecov/vite-plugin": patch
---

Update license to 2024
1 change: 1 addition & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ const config = {
"./packages/bundler-plugin-core/tsconfig.json",
"./packages/nuxt-plugin/tsconfig.json",
"./packages/rollup-plugin/tsconfig.json",
"./packages/sveltekit-plugin/tsconfig.json",
"./packages/vite-plugin/tsconfig.json",
"./packages/webpack-plugin/tsconfig.json",
],
Expand Down
26 changes: 14 additions & 12 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ jobs:
- name: Install pnpm
uses: pnpm/action-setup@v2
with:
version: 8
version: 9
run_install: false

- name: Get pnpm store directory
Expand Down Expand Up @@ -69,7 +69,7 @@ jobs:
- name: Install pnpm
uses: pnpm/action-setup@v2
with:
version: 8
version: 9
run_install: false

- name: Get pnpm store directory
Expand Down Expand Up @@ -115,7 +115,7 @@ jobs:
- name: Install pnpm
uses: pnpm/action-setup@v2
with:
version: 8
version: 9
run_install: false

- name: Get pnpm store directory
Expand Down Expand Up @@ -161,7 +161,7 @@ jobs:
- name: Install pnpm
uses: pnpm/action-setup@v2
with:
version: 8
version: 9
run_install: false

- name: Get pnpm store directory
Expand Down Expand Up @@ -218,7 +218,7 @@ jobs:
url: ${{ secrets.CODECOV_STAGING_URL }}

integration-test:
name: Run Integration Tests (Node ${{ matrix.node-version }})
name: Run integration tests (Node ${{ matrix.node-version }})
needs: install
runs-on: ubuntu-latest
services:
Expand All @@ -244,7 +244,7 @@ jobs:
- name: Install pnpm
uses: pnpm/action-setup@v2
with:
version: 8
version: 9
run_install: false

- name: Get pnpm store directory
Expand Down Expand Up @@ -279,7 +279,7 @@ jobs:
strategy:
fail-fast: false
matrix:
example: ["next-js", "nuxt", "rollup", "vite", "webpack"]
example: ["next-js", "nuxt", "rollup", "sveltekit", "vite", "webpack"]
steps:
- name: Checkout
uses: actions/checkout@v4
Expand All @@ -294,7 +294,7 @@ jobs:
- name: Install pnpm
uses: pnpm/action-setup@v2
with:
version: 8
version: 9
run_install: false

- name: Get pnpm store directory
Expand Down Expand Up @@ -342,7 +342,7 @@ jobs:
strategy:
fail-fast: false
matrix:
example: ["next-js", "nuxt", "rollup", "vite", "webpack"]
example: ["next-js", "nuxt", "rollup", "sveltekit", "vite", "webpack"]
steps:
- name: Checkout
uses: actions/checkout@v4
Expand All @@ -357,7 +357,7 @@ jobs:
- name: Install pnpm
uses: pnpm/action-setup@v2
with:
version: 8
version: 9
run_install: false

- name: Get pnpm store directory
Expand Down Expand Up @@ -410,6 +410,7 @@ jobs:
"bundler-plugin-core",
"nuxt-plugin",
"rollup-plugin",
"sveltekit-plugin",
"vite-plugin",
"webpack-plugin",
]
Expand All @@ -427,7 +428,7 @@ jobs:
- name: Install pnpm
uses: pnpm/action-setup@v2
with:
version: 8
version: 9
run_install: false

- name: Get pnpm store directory
Expand Down Expand Up @@ -474,6 +475,7 @@ jobs:
"bundler-plugin-core",
"nuxt-plugin",
"rollup-plugin",
"sveltekit-plugin",
"vite-plugin",
"webpack-plugin",
]
Expand All @@ -491,7 +493,7 @@ jobs:
- name: Install pnpm
uses: pnpm/action-setup@v2
with:
version: 8
version: 9
run_install: false

- name: Get pnpm store directory
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/prepare-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
- name: Setup pnpm & install dependencies
uses: pnpm/action-setup@v2
with:
version: 8
version: 9
run_install: true

- name: Create Release Pull Request
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ jobs:
- name: Setup pnpm
uses: pnpm/action-setup@v2
with:
version: 8
version: 9
run_install: false

- name: Get pnpm store directory
Expand Down Expand Up @@ -97,7 +97,7 @@ jobs:
- name: Setup pnpm
uses: pnpm/action-setup@v2
with:
version: 8
version: 9
run_install: false

- name: Get pnpm store directory
Expand Down
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2023 Codecov
Copyright (c) 2023-2024 Codecov

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
12 changes: 12 additions & 0 deletions examples/sveltekit/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
.DS_Store
node_modules
/build
/.svelte-kit
/package
.env
.env.*
!.env.example
.vercel
.output
vite.config.js.timestamp-*
vite.config.ts.timestamp-*
1 change: 1 addition & 0 deletions examples/sveltekit/.npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
engine-strict=true
38 changes: 38 additions & 0 deletions examples/sveltekit/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# create-svelte

Everything you need to build a Svelte project, powered by [`create-svelte`](https://github.com/sveltejs/kit/tree/main/packages/create-svelte).

## Creating a project

If you're seeing this, you've probably already done this step. Congrats!

```bash
# create a new project in the current directory
npm create svelte@latest

# create a new project in my-app
npm create svelte@latest my-app
```

## Developing

Once you've created a project and installed dependencies with `npm install` (or `pnpm install` or `yarn`), start a development server:

```bash
npm run dev

# or start the server and open the app in a new browser tab
npm run dev -- --open
```

## Building

To create a production version of your app:

```bash
npm run build
```

You can preview the production build with `npm run preview`.

> To deploy your app, you may need to install an [adapter](https://kit.svelte.dev/docs/adapters) for your target environment.
25 changes: 25 additions & 0 deletions examples/sveltekit/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{
"name": "sveltekit",
"version": "0.0.1",
"scripts": {
"dev": "vite dev",
"build": "vite build",
"preview": "vite preview",
"check": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json",
"check:watch": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json --watch"
},
"devDependencies": {
"@codecov/sveltekit-plugin": "workspace:^",
"@fontsource/fira-mono": "^4.5.10",
"@neoconfetti/svelte": "^1.0.0",
"@sveltejs/adapter-auto": "^3.0.0",
"@sveltejs/kit": "^2.0.0",
"@sveltejs/vite-plugin-svelte": "^3.0.0",
"svelte": "^4.2.7",
"svelte-check": "^3.6.0",
"tslib": "^2.4.1",
"typescript": "^5.0.0",
"vite": "^5.0.3"
},
"type": "module"
}
13 changes: 13 additions & 0 deletions examples/sveltekit/src/app.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
// See https://kit.svelte.dev/docs/types#app
// for information about these interfaces
declare global {
namespace App {
// interface Error {}
// interface Locals {}
// interface PageData {}
// interface PageState {}
// interface Platform {}
}
}

export {};
12 changes: 12 additions & 0 deletions examples/sveltekit/src/app.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8" />
<link rel="icon" href="%sveltekit.assets%/favicon.png" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
%sveltekit.head%
</head>
<body data-sveltekit-preload-data="hover">
<div style="display: contents">%sveltekit.body%</div>
</body>
</html>
16 changes: 16 additions & 0 deletions examples/sveltekit/src/lib/images/github.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions examples/sveltekit/src/lib/images/svelte-logo.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
53 changes: 53 additions & 0 deletions examples/sveltekit/src/routes/+layout.svelte
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
<script>
import Header from './Header.svelte';
import './styles.css';
</script>

<div class="app">
<Header />

<main>
<slot />
</main>

<footer>
<p>visit <a href="https://kit.svelte.dev">kit.svelte.dev</a> to learn SvelteKit</p>
</footer>
</div>

<style>
.app {
display: flex;
flex-direction: column;
min-height: 100vh;
}
main {
flex: 1;
display: flex;
flex-direction: column;
padding: 1rem;
width: 100%;
max-width: 64rem;
margin: 0 auto;
box-sizing: border-box;
}
footer {
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
padding: 12px;
}
footer a {
font-weight: bold;
}
@media (min-width: 480px) {
footer {
padding: 12px 0;
}
}
</style>