Skip to content

Commit ca66c07

Browse files
committed
initial commit
1 parent 36f92b1 commit ca66c07

17 files changed

+844
-0
lines changed

.editorconfig

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# top-most EditorConfig file
2+
root = true
3+
4+
# Unix-style newlines with a newline ending every file
5+
[*]
6+
end_of_line = lf
7+
charset = utf-8
8+
trim_trailing_whitespace = true
9+
insert_final_newline = true
10+
indent_style = space
11+
indent_size = 2

.github/dependabot.yml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# To get started with Dependabot version updates, you'll need to specify which
2+
# package ecosystems to update and where the package manifests are located.
3+
# Please see the documentation for all configuration options:
4+
# https://docs.github.com/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file
5+
6+
version: 2
7+
updates:
8+
# Maintain dependencies for GitHub Actions
9+
- package-ecosystem: "github-actions"
10+
# Workflow files stored in the default location of `.github/workflows`. (You don't need to specify `/.github/workflows` for `directory`. You can use `directory: "/"`.)
11+
directory: "/"
12+
schedule:
13+
interval: "weekly"
14+
# Maintain dependencies for node
15+
- package-ecosystem: "npm" # See documentation for possible values
16+
directory: "/" # Location of package manifests
17+
schedule:
18+
interval: "weekly"

.github/release.yml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
# .github/release.yml
2+
# https://docs.github.com/en/repositories/releasing-projects-on-github/automatically-generated-release-notes
3+
4+
changelog:
5+
exclude:
6+
labels:
7+
- ignore-for-release
8+
- documentation
9+
authors:
10+
- octocat
11+
- github-actions
12+
categories:
13+
- title: Breaking Changes 🛠
14+
labels:
15+
- Semver-Major
16+
- breaking-change
17+
- title: Exciting New Features 🎉
18+
labels:
19+
- Semver-Minor
20+
- enhancement
21+
- title: Bug Fixes
22+
labels:
23+
- bug
24+
- title: Other Changes
25+
labels:
26+
- "*"

.github/workflows/create-release.yml

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
# https://github.com/softprops/action-gh-release
2+
name: Create Release
3+
on:
4+
workflow_dispatch:
5+
push:
6+
branches:
7+
- main
8+
paths:
9+
- "package.json"
10+
jobs:
11+
build:
12+
runs-on: ubuntu-latest
13+
steps:
14+
- name: Checkout
15+
uses: actions/checkout@v4
16+
with:
17+
fetch-depth: 0 # [!] we need to checkout with tags and commit history
18+
- name: Setup python
19+
uses: actions/setup-python@v5
20+
with:
21+
python-version: "3.x" # Version range or exact version of a Python version to use, using SemVer's version range syntax
22+
architecture: "x64" # optional x64 or x86. Defaults to x64 if not specified
23+
- name: Setup dependencies using pip
24+
run: pip install -r requirements.txt
25+
- name: 📋 Get Commits since last Release
26+
id: changes
27+
uses: simbo/[email protected]
28+
with:
29+
line-prefix: "* "
30+
include-hashes: false
31+
- name: Generate new release version
32+
id: newversion
33+
run: python tools/release.py -l "${{ steps.changes.outputs.last-tag }}"
34+
- name: GitHub Release
35+
uses: softprops/action-gh-release@v2
36+
with:
37+
tag_name: "${{ env.NEW_VERSION }}"
38+
make_latest: "true"
39+
generate_release_notes: true
40+
- name: NPM Release (version specific)
41+
uses: JS-DevTools/npm-publish@v3
42+
with:
43+
token: ${{ secrets.NPM_TOKEN }}

.github/workflows/linux.yml

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
name: Run Lighthouse plugin on Linux
2+
on:
3+
push:
4+
branches:
5+
- main
6+
pull_request:
7+
branches:
8+
- main
9+
jobs:
10+
build:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- uses: actions/checkout@v4
14+
- name: Use Node.js
15+
uses: actions/setup-node@v4
16+
with:
17+
node-version: '20.x'
18+
- name: Install sitespeed.io
19+
run: |
20+
npm install sitespeed.io -g
21+
npm install @sitespeed.io/plugin-lighthouse -g
22+
cd ../webperf-sitespeedio-plugin
23+
npm install
24+
- name: Lint
25+
run: npm run lint
26+
- name: Show sitespeed.io version
27+
run: sitespeed.io --version
28+
- name: Run tests using Lighthouse plugin
29+
run: sitespeed.io --plugins.add ./lib/index.js --plugins.remove browsertime https://www.sitespeed.io/
30+
- name: Run tests using Lighthouse plugin as mobile
31+
run: sitespeed.io --plugins.add ./lib/index.js --plugins.remove browsertime https://www.sitespeed.io/ --mobile
32+
- name: Run tests to illustrate maxLoadTime
33+
run: sitespeed.io --maxLoadTime 30000 -b firefox --firefox.includeResponseBodies all --firefox.preference privacy.trackingprotection.enabled:false --firefox.preference privacy.donottrackheader.enabled:false --firefox.preference browser.safebrowsing.malware.enabled:false --firefox.preference browser.safebrowsing.phishing.enabled:false --firefox.preference security.tls.version.min:1 --firefox.preference security.tls.version.max:1 --pageCompleteCheckNetworkIdle true --browsertime.screenshot false --screenshot false --screenshotLCP false --browsertime.screenshotLCP false --videoParams.createFilmstrip false --visualMetrics false --visualMetricsPerceptual false --visualMetricsContentful false --browsertime.headless true --silent true --utc true -n 1 https://webperf.se
34+
35+
36+
# - name: Run tests using Lighthouse plugin as mobile
37+
# run: sitespeed.io --plugins.remove assets --plugins.remove budget --plugins.remove coach --plugins.remove pagexray --plugins.remove thirdparty --plugins.remove domains --maxLoadTime 30000 --shm-size=1g -b firefox --firefox.includeResponseBodies all --firefox.preference privacy.trackingprotection.enabled:false --firefox.preference privacy.donottrackheader.enabled:false --firefox.preference browser.safebrowsing.malware.enabled:false --firefox.preference browser.safebrowsing.phishing.enabled:false --firefox.preference security.tls.version.min:1 --firefox.preference security.tls.version.max:1 --pageCompleteCheckNetworkIdle true --plugins.remove screenshot --plugins.remove html --plugins.remove metrics --browsertime.screenshot false --screenshot false --screenshotLCP false --browsertime.screenshotLCP false --videoParams.createFilmstrip false --visualMetrics false --visualMetricsPerceptual false --visualMetricsContentful false --browsertime.headless true --silent true --utc true -n 1
38+
39+
40+
41+
42+
# - name: Run tests with configuration file
43+
# run: sitespeed.io --plugins.add ./index.js --plugins.remove browsertime https://www.sitespeed.io/ --lighthouse.config ./test/config.js
44+
# - name: Run tests with flag file
45+
# run: sitespeed.io --plugins.add ./index.js --plugins.remove browsertime https://www.sitespeed.io/ --lighthouse.flags ./test/flags.json
46+
# - name: Test global install
47+
# run: |
48+
# npm install -g
49+
# sitespeed.io --plugins.add @sitespeed.io/plugin-lighthouse --plugins.remove browsertime https://www.sitespeed.io/

.github/workflows/prep-release.yml

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
# https://github.com/simbo/changes-since-last-release-action
2+
name: Prepare Release
3+
on:
4+
workflow_dispatch:
5+
push:
6+
branches:
7+
- main
8+
paths:
9+
- "index.js"
10+
schedule:
11+
# https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#onschedule
12+
# * is a special character in YAML so you have to quote this string
13+
- cron: "30 6 1 * *"
14+
jobs:
15+
build:
16+
runs-on: ubuntu-latest
17+
steps:
18+
- name: Checkout
19+
uses: actions/checkout@v4
20+
with:
21+
fetch-depth: 0 # [!] we need to checkout with tags and commit history
22+
- name: Setup python
23+
uses: actions/setup-python@v5
24+
with:
25+
python-version: "3.x" # Version range or exact version of a Python version to use, using SemVer's version range syntax
26+
architecture: "x64" # optional x64 or x86. Defaults to x64 if not specified
27+
- name: Setup dependencies using pip
28+
run: pip install -r requirements.txt
29+
- name: 📋 Get Commits since last Release
30+
id: changes
31+
uses: simbo/[email protected]
32+
with:
33+
line-prefix: "* "
34+
include-hashes: false
35+
- name: Generate new release version
36+
id: newversion
37+
run: python tools/release.py -u "${{ steps.changes.outputs.last-tag }}"
38+
- name: Create pull request
39+
uses: peter-evans/create-pull-request@v7
40+
with:
41+
commit-message: Updated version in package.json to latest
42+
branch: update-version-in-package-json
43+
title: "Prepare release - ${{ env.NEW_VERSION }}"
44+
body: |
45+
Approving this PR triggers creation of a new release.
46+
47+
Changes since ${{ steps.changes.outputs.last-tag }}:
48+
${{ steps.changes.outputs.log }}
49+
assignees: 7h3Rabbit
50+
reviewers: 7h3Rabbit
51+
add-paths: |
52+
package.json

.gitignore

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
.DS_Store
2+
node_modules
3+
*.log
4+
*.iml
5+
.vscode
6+
sitespeed-result
7+
configs
8+
docs/_site
9+
yarn.lock
10+
.tern-project

.npmignore

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
.mypy_cache/
2+
.DS_Store
3+
.editorconfig
4+
.gitattributes
5+
.github
6+
node_modules
7+
tools
8+
sitespeed-result
9+
package-lock.json
10+
requirements.txt
11+
tmp
12+
cache

README.md

Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,92 @@
11
# plugin-js
22
Javascript plugin for sitespeed.io
3+
4+
## Overview
5+
6+
The `plugin-js` is a plugin for [sitespeed.io](https://www.sitespeed.io/) that helps identify and log "Javascript" (JS) errors during web testing. It integrates with sitespeed.io to provide detailed information about JS errors.
7+
8+
## Features
9+
10+
11+
## Installation
12+
13+
To install the plugin, run the following command:
14+
15+
```sh
16+
npm install plugin-js
17+
```
18+
19+
## Usage
20+
21+
To use the plugin with sitespeed.io, add it to your sitespeed.io configuration file or command line options.
22+
23+
### Configuration
24+
25+
Add the plugin to your sitespeed.io configuration file:
26+
27+
```json
28+
{
29+
"plugins": {
30+
"plugin-js": {
31+
"enabled": true
32+
}
33+
}
34+
}
35+
```
36+
37+
### Command Line
38+
39+
You can also enable the plugin via the command line:
40+
41+
```sh
42+
sitespeed.io --plugins.add plugin-js
43+
```
44+
45+
## Example
46+
47+
Here is an example of how to use the plugin with sitespeed.io:
48+
49+
```sh
50+
sitespeed.io https://www.example.com --plugins.add plugin-js
51+
```
52+
53+
## Development
54+
55+
### Running Tests
56+
57+
To run the tests, use the following command:
58+
59+
```sh
60+
npm test
61+
```
62+
63+
### Linting
64+
65+
To lint the code, use the following command:
66+
67+
```sh
68+
npm run lint
69+
```
70+
71+
To automatically fix linting issues, use the following command:
72+
73+
```sh
74+
npm run lint:fix
75+
```
76+
77+
### License
78+
79+
This project is licensed under the MIT License. See the [LICENSE](./LICENSE) file for details.
80+
81+
## Contributing
82+
83+
Contributions are welcome! Please open an issue or submit a pull request on GitHub.
84+
85+
## Author
86+
87+
- **7h3Rabbit** - [GitHub](https://github.com/7h3Rabbit)
88+
89+
## Acknowledgements
90+
91+
- [sitespeed.io](https://www.sitespeed.io/)
92+
- [plugin-webperf-core](https://www.npmjs.com/package/plugin-webperf-core)

configurations/security.mjs

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
import globals from "globals";
2+
3+
export default [{
4+
languageOptions: {
5+
globals: {
6+
...globals.browser,
7+
...globals.node,
8+
},
9+
10+
ecmaVersion: "latest",
11+
sourceType: "module",
12+
},
13+
14+
rules: {
15+
"no-eval": "error",
16+
"no-implied-eval": "error",
17+
"no-new-func": "error",
18+
"no-script-url": "error",
19+
"no-unsafe-finally": "error",
20+
"no-unsafe-negation": "error",
21+
"no-prototype-builtins": "error",
22+
"no-self-assign": "error",
23+
"no-self-compare": "error",
24+
"no-unmodified-loop-condition": "error",
25+
"no-unused-expressions": "error",
26+
"no-useless-call": "error",
27+
"no-useless-concat": "error",
28+
"no-useless-escape": "error",
29+
"no-with": "error",
30+
"require-await": "error",
31+
"no-return-await": "error",
32+
"eqeqeq": ["error", "always"],
33+
},
34+
}];

0 commit comments

Comments
 (0)