Skip to content

Commit

Permalink
feat: Add in plugin for Nuxt (#121)
Browse files Browse the repository at this point in the history
Add in new plugin bringing direct support for Nuxt.

GH #97
  • Loading branch information
nicholas-codecov committed Apr 29, 2024
1 parent 5f68b60 commit cb90ab7
Show file tree
Hide file tree
Showing 67 changed files with 7,601 additions and 820 deletions.
9 changes: 9 additions & 0 deletions .changeset/little-knives-hunt.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---
"@codecov/bundler-plugin-core": patch
"@codecov/webpack-plugin": patch
"@codecov/rollup-plugin": patch
"@codecov/nuxt-plugin": patch
"@codecov/vite-plugin": patch
---

Add in a new plugin specifically for Nuxt
1 change: 1 addition & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ const config = {
"./tsconfig.json",
"./integration-tests/tsconfig.json",
"./packages/bundler-plugin-core/tsconfig.json",
"./packages/nuxt-plugin/tsconfig.json",
"./packages/rollup-plugin/tsconfig.json",
"./packages/vite-plugin/tsconfig.json",
"./packages/webpack-plugin/tsconfig.json",
Expand Down
12 changes: 7 additions & 5 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -195,21 +195,21 @@ jobs:
with:
token: ${{ secrets.CODECOV_ORG_TOKEN }}
url: ${{ secrets.CODECOV_URL }}

- name: Upload coverage reports to codecov (Staging)
if: ${{ !github.event.pull_request.head.repo.fork && github.repository_owner == 'codecov' }}
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_ORG_TOKEN_STAGING }}
url: ${{ secrets.CODECOV_STAGING_URL }}

- name: Upload test result reports to codecov
if: ${{ !cancelled() && !github.event.pull_request.head.repo.fork && github.repository_owner == 'codecov' }}
uses: codecov/test-results-action@v1
with:
token: ${{ secrets.CODECOV_ORG_TOKEN }}
url: ${{ secrets.CODECOV_URL }}

- name: Upload test result reports to codecov (Staging)
if: ${{ !cancelled() && !github.event.pull_request.head.repo.fork && github.repository_owner == 'codecov' }}
uses: codecov/test-results-action@v1
Expand Down Expand Up @@ -279,7 +279,7 @@ jobs:
strategy:
fail-fast: false
matrix:
example: ["next-js", "rollup", "vite", "webpack"]
example: ["next-js", "nuxt", "rollup", "vite", "webpack"]
steps:
- name: Checkout
uses: actions/checkout@v4
Expand Down Expand Up @@ -342,7 +342,7 @@ jobs:
strategy:
fail-fast: false
matrix:
example: ["next-js", "rollup", "vite", "webpack"]
example: ["next-js", "nuxt", "rollup", "vite", "webpack"]
steps:
- name: Checkout
uses: actions/checkout@v4
Expand Down Expand Up @@ -408,6 +408,7 @@ jobs:
package:
[
"bundler-plugin-core",
"nuxt-plugin",
"rollup-plugin",
"vite-plugin",
"webpack-plugin",
Expand Down Expand Up @@ -471,6 +472,7 @@ jobs:
package:
[
"bundler-plugin-core",
"nuxt-plugin",
"rollup-plugin",
"vite-plugin",
"webpack-plugin",
Expand Down
3 changes: 3 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"vitest.disableWorkspaceWarning": true
}
2 changes: 1 addition & 1 deletion examples/next-js/package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "@codecov/nextjs-plugin-example",
"name": "@codecov/example-nextjs-app",
"version": "0.0.0",
"private": true,
"scripts": {
Expand Down
24 changes: 24 additions & 0 deletions examples/nuxt/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Nuxt dev/build outputs
.output
.data
.nuxt
.nitro
.cache
dist

# Node dependencies
node_modules

# Logs
logs
*.log

# Misc
.DS_Store
.fleet
.idea

# Local env files
.env
.env.*
!.env.example
75 changes: 75 additions & 0 deletions examples/nuxt/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
# Nuxt 3 Minimal Starter

Look at the [Nuxt 3 documentation](https://nuxt.com/docs/getting-started/introduction) to learn more.

## Setup

Make sure to install the dependencies:

```bash
# npm
npm install

# pnpm
pnpm install

# yarn
yarn install

# bun
bun install
```

## Development Server

Start the development server on `http://localhost:3000`:

```bash
# npm
npm run dev

# pnpm
pnpm run dev

# yarn
yarn dev

# bun
bun run dev
```

## Production

Build the application for production:

```bash
# npm
npm run build

# pnpm
pnpm run build

# yarn
yarn build

# bun
bun run build
```

Locally preview production build:

```bash
# npm
npm run preview

# pnpm
pnpm run preview

# yarn
yarn preview

# bun
bun run preview
```

Check out the [deployment documentation](https://nuxt.com/docs/getting-started/deployment) for more information.
5 changes: 5 additions & 0 deletions examples/nuxt/app.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<template>
<div>
<NuxtWelcome />
</div>
</template>
16 changes: 16 additions & 0 deletions examples/nuxt/nuxt.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
// https://nuxt.com/docs/api/configuration/nuxt-config
export default defineNuxtConfig({
devtools: { enabled: true },
modules: [
[
"@codecov/nuxt-plugin",
{
dryRun: true,
enableBundleAnalysis: true,
bundleName: "@codecov/example-nuxt-app",
uploadToken: process.env.VITE_UPLOAD_TOKEN,
apiUrl: process.env.VITE_API_URL,
},
],
],
});
19 changes: 19 additions & 0 deletions examples/nuxt/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"name": "@codecov/example-nuxt-app",
"private": true,
"type": "module",
"scripts": {
"build": "nuxt prepare && nuxt build",
"dev": "nuxt dev",
"generate": "nuxt generate",
"preview": "nuxt preview"
},
"dependencies": {
"nuxt": "^3.11.2",
"vue": "^3.4.21",
"vue-router": "^4.3.0"
},
"devDependencies": {
"@codecov/nuxt-plugin": "workspace:^"
}
}
Binary file added examples/nuxt/public/favicon.ico
Binary file not shown.
3 changes: 3 additions & 0 deletions examples/nuxt/server/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"extends": "../.nuxt/tsconfig.server.json",
}
4 changes: 4 additions & 0 deletions examples/nuxt/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
// https://nuxt.com/docs/guide/concepts/typescript
"extends": "./.nuxt/tsconfig.json",
}
2 changes: 1 addition & 1 deletion examples/rollup/package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "@codecov/rollup-plugin-example",
"name": "@codecov/example-rollup-app",
"version": "1.0.0",
"main": "index.js",
"type": "module",
Expand Down
4 changes: 2 additions & 2 deletions examples/vite/package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "@codecov/vite-plugin-example",
"name": "@codecov/example-vite-app",
"private": true,
"version": "0.0.0",
"type": "module",
Expand All @@ -25,7 +25,7 @@
"eslint-plugin-react-refresh": "^0.4.5",
"rollup": "^4.9.6",
"typescript": "^5.3.3",
"vite": "^5.0.12"
"vite": "^5.2.10"
},
"volta": {
"extends": "../../package.json"
Expand Down
2 changes: 1 addition & 1 deletion examples/webpack/package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "@codecov/webpack-plugin-example",
"name": "@codecov/example-webpack-app",
"version": "0.0.0",
"private": "true",
"scripts": {
Expand Down

0 comments on commit cb90ab7

Please sign in to comment.