Skip to content

Commit 9e80476

Browse files
hakenprogsadjow
andauthored
fix: address security vulnerabilities and upgrade Nuxt to v3.17.2 (#49)
- Upgrade Nuxt from older version to ^3.17.2 to address security alerts - Update all dependencies to latest versions for security patches - Add ESLint and Prettier configuration for code quality - Refactor module to use ES modules syntax - Update Node.js and Yarn versions in .tool-versions - Add unit tests for getGCLID function - Update CI workflow with new Playwright and Node versions - Improve code formatting and consistency across all files - Update documentation (CODE_OF_CONDUCT.md, CONTRIBUTING.md) Addresses Dependabot security alerts by upgrading vulnerable dependencies Co-authored-by: Sadjow Leão <[email protected]>
1 parent 153a816 commit 9e80476

26 files changed

+12534
-4440
lines changed

.eslintignore

Lines changed: 0 additions & 2 deletions
This file was deleted.

.eslintprettier.config.js

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
import prettierPlugin from 'eslint-plugin-prettier'
2+
import eslintConfig from './eslint.config.mjs'
3+
4+
export default [
5+
...eslintConfig,
6+
{
7+
plugins: {
8+
prettier: prettierPlugin,
9+
},
10+
rules: {
11+
'prettier/prettier': 'error',
12+
},
13+
},
14+
]

.eslintrc.prettier.js

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
module.exports = {
2+
root: true,
3+
extends: ['@nuxt/eslint-config', 'plugin:prettier/recommended'],
4+
rules: {
5+
'prettier/prettier': 'error',
6+
'@stylistic/quotes': ['error', 'single'],
7+
'@stylistic/semi': ['error', 'never'],
8+
'@stylistic/comma-dangle': ['error', 'always-multiline'],
9+
'@stylistic/operator-linebreak': ['error', 'before'],
10+
'@stylistic/member-delimiter-style': [
11+
'error',
12+
{
13+
multiline: {
14+
delimiter: 'none',
15+
requireLast: false,
16+
},
17+
singleline: {
18+
delimiter: 'comma',
19+
requireLast: false,
20+
},
21+
},
22+
],
23+
},
24+
}

.github/workflows/main.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,11 @@ jobs:
77
timeout-minutes: 10
88
runs-on: ubuntu-latest
99
container:
10-
image: mcr.microsoft.com/playwright:v1.39.0-jammy
10+
image: mcr.microsoft.com/playwright:v1.52.0-jammy
1111

1212
strategy:
1313
matrix:
14-
node-version: [18, 20]
14+
node-version: [20, 22]
1515

1616
steps:
1717
- name: Checkout code
@@ -26,7 +26,7 @@ jobs:
2626
id: cache-npm
2727
uses: actions/cache@v3
2828
with:
29-
path: "**/node_modules"
29+
path: '**/node_modules'
3030
key: ${{ runner.os }}-node-${{ matrix.node-version }}-${{ hashFiles('**/yarn.lock') }}
3131
restore-keys: |
3232
${{ runner.os }}-node-${{ matrix.node-version }}-

.prettierignore

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# dependencies
2+
node_modules
3+
.nuxt
4+
.output
5+
dist
6+
7+
# logs
8+
*.log
9+
10+
# coverage files
11+
coverage
12+
.nyc_output
13+
14+
# OSX
15+
.DS_Store
16+
17+
# Editors
18+
.idea
19+
.vscode
20+
21+
# git
22+
.git

.prettierrc

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
{
2+
"singleQuote": true,
3+
"quoteProps": "as-needed",
4+
"semi": false,
5+
"trailingComma": "all",
6+
"bracketSpacing": true,
7+
"arrowParens": "always",
8+
"endOfLine": "lf",
9+
"printWidth": 100,
10+
"tabWidth": 2,
11+
"useTabs": false
12+
}

.tool-versions

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
nodejs 22.15.1
2+
yarn 1.22.19

README.md

Lines changed: 29 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,8 @@ npm install --save-dev nuxt-utm
4545

4646
```js
4747
export default defineNuxtConfig({
48-
modules: ["nuxt-utm"],
49-
});
48+
modules: ['nuxt-utm'],
49+
})
5050
```
5151

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

5858
```vue
5959
<script setup>
60-
const utm = useNuxtUTM();
60+
const utm = useNuxtUTM()
6161
</script>
6262
```
6363

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

6868
```vue
6969
<script setup>
70-
import { useNuxtApp } from "nuxt/app";
71-
const { $utm } = useNuxtApp();
70+
import { useNuxtApp } from 'nuxt/app'
71+
const { $utm } = useNuxtApp()
7272
</script>
7373
```
7474

7575
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
7676

77-
```js
77+
```json
7878
[
7979
{
80-
timestamp: "2023-11-02T10:11:17.219Z", // Timestamp of the URL visit
81-
utmParams: {
82-
utm_source: "test_source",
83-
utm_medium: "test_medium",
84-
utm_campaign: "test_campaign",
85-
utm_term: "test_term",
86-
utm_content: "test_content",
87-
},
88-
additionalInfo: {
89-
referrer: "http://referrer.url", // Referrer URL
90-
userAgent: "User-Agent String", // User-Agent string of the browser
91-
language: "en-GB", // Language setting of the browser
92-
landingPageUrl: "http://landingpage.url", // The URL of the page the user landed on
93-
screen: {
94-
width: 1728,
95-
height: 1117,
96-
},
80+
"timestamp": "2023-11-02T10:11:17.219Z",
81+
"utmParams": {
82+
"utm_source": "test_source",
83+
"utm_medium": "test_medium",
84+
"utm_campaign": "test_campaign",
85+
"utm_term": "test_term",
86+
"utm_content": "test_content"
9787
},
98-
sessionId: "beai1gx7dg",
99-
gclidParams: {
100-
gclid: "CjklsefawEFRfeafads",
101-
gad_source: "1",
88+
"additionalInfo": {
89+
"referrer": "http://referrer.url",
90+
"userAgent": "User-Agent String",
91+
"language": "en-GB",
92+
"landingPageUrl": "http://landingpage.url",
93+
"screen": {
94+
"width": 1728,
95+
"height": 1117
96+
}
10297
},
103-
}, // the first item in this array is the most recent
104-
// ... old items
105-
];
98+
"sessionId": "beai1gx7dg",
99+
"gclidParams": {
100+
"gclid": "CjklsefawEFRfeafads",
101+
"gad_source": "1"
102+
}
103+
}
104+
]
106105
```
107106

108107
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.

docs/CODE_OF_CONDUCT.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
# Code of conduct
22

33
## Purpose
4+
45
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
56
orientation, ability, ethnicity, socioeconomic status, and religion (or lack thereof).
67

78
## General recommendations
9+
810
Examples of behavior that contributes to creating a positive environment include:
911

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

2426
## Maintainer responsibilities
27+
2528
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.
2629

2730
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.
2831

2932
## Scope
33+
3034
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.
3135

3236
## Enforcement
37+
3338
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.
3439

3540
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.

docs/CONTRIBUTING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
21
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:
32

43
- 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])
@@ -10,4 +9,5 @@ Thank you for your interest in contributing to this Stack Builders' library. To
109
- 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.
1110

1211
## Getting help
12+
1313
Contact any of our current maintainers, or send us an email at [[email protected]](mailto:[email protected]) for more information. Thank you for contributing!

0 commit comments

Comments
 (0)