Skip to content

Upgrade nuxt dependencies #49

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

Merged
merged 9 commits into from
May 23, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions .eslintignore

This file was deleted.

14 changes: 14 additions & 0 deletions .eslintprettier.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import prettierPlugin from 'eslint-plugin-prettier'
import eslintConfig from './eslint.config.mjs'

export default [
...eslintConfig,
{
plugins: {
prettier: prettierPlugin,
},
rules: {
'prettier/prettier': 'error',
},
},
]
24 changes: 24 additions & 0 deletions .eslintrc.prettier.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
module.exports = {
root: true,
extends: ['@nuxt/eslint-config', 'plugin:prettier/recommended'],
rules: {
'prettier/prettier': 'error',
'@stylistic/quotes': ['error', 'single'],
'@stylistic/semi': ['error', 'never'],
'@stylistic/comma-dangle': ['error', 'always-multiline'],
'@stylistic/operator-linebreak': ['error', 'before'],
'@stylistic/member-delimiter-style': [
'error',
{
multiline: {
delimiter: 'none',
requireLast: false,
},
singleline: {
delimiter: 'comma',
requireLast: false,
},
},
],
},
}
6 changes: 3 additions & 3 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@ jobs:
timeout-minutes: 10
runs-on: ubuntu-latest
container:
image: mcr.microsoft.com/playwright:v1.39.0-jammy
image: mcr.microsoft.com/playwright:v1.52.0-jammy

strategy:
matrix:
node-version: [18, 20]
node-version: [20, 22]

steps:
- name: Checkout code
Expand All @@ -26,7 +26,7 @@ jobs:
id: cache-npm
uses: actions/cache@v3
with:
path: "**/node_modules"
path: '**/node_modules'
key: ${{ runner.os }}-node-${{ matrix.node-version }}-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-node-${{ matrix.node-version }}-
Expand Down
22 changes: 22 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# dependencies
node_modules
.nuxt
.output
dist

# logs
*.log

# coverage files
coverage
.nyc_output

# OSX
.DS_Store

# Editors
.idea
.vscode

# git
.git
12 changes: 12 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"singleQuote": true,
"quoteProps": "as-needed",
"semi": false,
"trailingComma": "all",
"bracketSpacing": true,
"arrowParens": "always",
"endOfLine": "lf",
"printWidth": 100,
"tabWidth": 2,
"useTabs": false
}
2 changes: 2 additions & 0 deletions .tool-versions
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
nodejs 22.15.1
yarn 1.22.19
59 changes: 29 additions & 30 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,8 @@ npm install --save-dev nuxt-utm

```js
export default defineNuxtConfig({
modules: ["nuxt-utm"],
});
modules: ['nuxt-utm'],
})
```

That's it! You can now use Nuxt UTM in your Nuxt app ✨
Expand All @@ -57,7 +57,7 @@ You can use `useNuxtUTM` composable to access the UTM object:

```vue
<script setup>
const utm = useNuxtUTM();
const utm = useNuxtUTM()
</script>
```

Expand All @@ -67,42 +67,41 @@ Alternatively, you can get the UTM information through the Nuxt App with the fol

```vue
<script setup>
import { useNuxtApp } from "nuxt/app";
const { $utm } = useNuxtApp();
import { useNuxtApp } from 'nuxt/app'
const { $utm } = useNuxtApp()
</script>
```

Regardless of the option you choose to use the module, the `utm' object will contain an array of UTM parameters collected for use. Each element in the array represents a set of UTM parameters collected from a URL visit, and is structured as follows

```js
```json
[
{
timestamp: "2023-11-02T10:11:17.219Z", // Timestamp of the URL visit
utmParams: {
utm_source: "test_source",
utm_medium: "test_medium",
utm_campaign: "test_campaign",
utm_term: "test_term",
utm_content: "test_content",
},
additionalInfo: {
referrer: "http://referrer.url", // Referrer URL
userAgent: "User-Agent String", // User-Agent string of the browser
language: "en-GB", // Language setting of the browser
landingPageUrl: "http://landingpage.url", // The URL of the page the user landed on
screen: {
width: 1728,
height: 1117,
},
"timestamp": "2023-11-02T10:11:17.219Z",
"utmParams": {
"utm_source": "test_source",
"utm_medium": "test_medium",
"utm_campaign": "test_campaign",
"utm_term": "test_term",
"utm_content": "test_content"
},
sessionId: "beai1gx7dg",
gclidParams: {
gclid: "CjklsefawEFRfeafads",
gad_source: "1",
"additionalInfo": {
"referrer": "http://referrer.url",
"userAgent": "User-Agent String",
"language": "en-GB",
"landingPageUrl": "http://landingpage.url",
"screen": {
"width": 1728,
"height": 1117
}
},
}, // the first item in this array is the most recent
// ... old items
];
"sessionId": "beai1gx7dg",
"gclidParams": {
"gclid": "CjklsefawEFRfeafads",
"gad_source": "1"
}
}
]
```

In the `$utm` array, each entry provides a `timestamp` indicating when the UTM parameters were collected, the `utmParams` object containing the UTM parameters, `additionalInfo` object with more context about the visit, and a `sessionId` to differentiate visits in different sessions.
Expand Down
5 changes: 5 additions & 0 deletions docs/CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
# Code of conduct

## Purpose

The primary goal of this Code of Conduct is to enable an open and welcoming environment. We pledge to making participation in our project a harassment-free experience for everyone, regardless of gender, sexual
orientation, ability, ethnicity, socioeconomic status, and religion (or lack thereof).

## General recommendations

Examples of behavior that contributes to creating a positive environment include:

- Using welcoming and inclusive language
Expand All @@ -22,14 +24,17 @@ Examples of unacceptable behavior by participants include:
- Other conduct which could reasonably be considered inappropriate in a professional setting

## Maintainer responsibilities

Project maintainers are responsible for clarifying the standards of acceptable behavior and are expected to take appropriate and fair corrective action in response to any instances of unacceptable behavior.

Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, or to ban temporarily or permanently any contributor for other behaviors that they deem inappropriate, threatening, offensive, or harmful.

## Scope

This Code of Conduct applies both within project spaces and in public spaces when an individual is representing the project or its community. Examples of representing a project or community include using an official project e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event. Representation of a project may be further defined and clarified by project maintainers.

## Enforcement

Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the project team at [[email protected]](mailto:[email protected]). All complaints will be reviewed and investigated and will result in a response that is deemed necessary and appropriate to the circumstances. The project team is obligated to maintain confidentiality with regard to the reporter of an incident. Further details of specific enforcement policies may be posted separately.

Project maintainers who do not follow or enforce the Code of Conduct in good faith may face temporary or permanent repercussions as determined by other members of the project's leadership.
2 changes: 1 addition & 1 deletion docs/CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

Thank you for your interest in contributing to this Stack Builders' library. To contribute, please take our [Code of Conduct](CODE_OF_CONDUCT.md) into account, along with the following recommendations:

- When submitting contributions to this repository, please make sure to discuss with the maintainer(s) the change you want to make. You can do this through an issue, or by sending an email to [[email protected]](mailto:[email protected])
Expand All @@ -10,4 +9,5 @@ Thank you for your interest in contributing to this Stack Builders' library. To
- Once you get an approval from any of the maintainers, please merge your Pull Request. Keep in mind that some of our Stack Builders repositories use CI/CD pipelines, so you will need to pass all of the required checks before merging.

## Getting help

Contact any of our current maintainers, or send us an email at [[email protected]](mailto:[email protected]) for more information. Thank you for contributing!
37 changes: 37 additions & 0 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
// @ts-check
import { createConfigForNuxt } from '@nuxt/eslint-config/flat'

// Run `npx @eslint/config-inspector` to inspect the resolved config interactively
export default createConfigForNuxt({
features: {
// Rules for module authors
tooling: true,
// Rules for formatting
stylistic: true,
},
dirs: {
src: ['./playground'],
},
}).append({
rules: {
'@stylistic/quotes': ['error', 'single', { avoidEscape: true }],
'@stylistic/semi': ['error', 'never'],
'@stylistic/comma-dangle': ['error', 'always-multiline'],
'@stylistic/operator-linebreak': 'off',
'@stylistic/brace-style': 'off',
'@stylistic/indent-binary-ops': 'off',
'@stylistic/member-delimiter-style': [
'error',
{
multiline: {
delimiter: 'none',
requireLast: false,
},
singleline: {
delimiter: 'comma',
requireLast: false,
},
},
],
},
})
56 changes: 36 additions & 20 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,41 +24,57 @@
"type": "module",
"exports": {
".": {
"types": "./dist/types.d.ts",
"types": "./dist/types.d.mts",
"import": "./dist/module.mjs",
"require": "./dist/module.cjs"
}
},
"main": "./dist/module.cjs",
"types": "./dist/types.d.ts",
"main": "./dist/module.mjs",
"typesVersions": {
"*": {
".": [
"./dist/types.d.mts"
]
}
},
"files": [
"dist"
],
"scripts": {
"prepack": "nuxt-module-build",
"prepack": "nuxt-module-build build",
"dev": "nuxi dev playground",
"dev:build": "nuxi build playground",
"dev:prepare": "nuxt-module-build --stub && nuxt-module-build prepare && nuxi prepare playground",
"dev:prepare": "nuxt-module-build build --stub && nuxt-module-build prepare && nuxi prepare playground",
"release": "npm run prepack && changelogen --release && git push --follow-tags",
"lint": "eslint .",
"lint:prettier": "eslint --config .eslintprettier.config.js .",
"format": "prettier --write .",
"lint:fix": "eslint . --fix && prettier --write .",
"test": "vitest run",
"test:watch": "vitest watch"
"test:watch": "vitest watch",
"test:types": "vue-tsc --noEmit && cd playground && vue-tsc --noEmit"
},
"dependencies": {
"@nuxt/kit": "^3.7.3"
"@nuxt/kit": "^3.17.2"
},
"devDependencies": {
"@nuxt/devtools": "latest",
"@nuxt/eslint-config": "^0.2.0",
"@nuxt/module-builder": "^0.5.1",
"@nuxt/schema": "^3.7.3",
"@nuxt/test-utils": "^3.7.3",
"@types/node": "^18.17.17",
"changelogen": "^0.5.5",
"eslint": "^8.49.0",
"nuxt": "^3.7.3",
"playwright": "^1.48.1",
"playwright-core": "^1.39.0",
"vitest": "^0.33.0"
"@nuxt/devtools": "^2.4.0",
"@nuxt/eslint": "1.3.1",
"@nuxt/eslint-config": "^1.3.1",
"@nuxt/module-builder": "^1.0.1",
"@nuxt/schema": "^3.17.2",
"@nuxt/test-utils": "^3.18.0",
"@types/node": "latest",
"changelogen": "^0.6.1",
"eslint": "^9.26.0",
"eslint-config-prettier": "^10.1.5",
"eslint-plugin-prettier": "^5.4.0",
"nuxt": "^3.17.2",
"playwright": "^1.52.0",
"playwright-core": "^1.52.0",
"prettier": "^3.5.3",
"typescript": "~5.8.3",
"vitest": "^3.1.2",
"vue-tsc": "^2.2.10"
}
}
}
4 changes: 2 additions & 2 deletions playground/app.vue
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
</template>

<script setup>
import { useNuxtUTM } from '#imports';
import { useNuxtUTM } from '#imports'

const utm = useNuxtUTM();
const utm = useNuxtUTM()
</script>
6 changes: 3 additions & 3 deletions playground/nuxt.config.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
export default defineNuxtConfig({
modules: ["../src/module"],
utm: {},
modules: ['../src/module'],
devtools: { enabled: true },
});
utm: {},
})
2 changes: 1 addition & 1 deletion playground/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@
"generate": "nuxi generate"
},
"devDependencies": {
"nuxt": "latest"
"nuxt": "^3.17.2"
}
}
Loading