Skip to content

Commit 595db70

Browse files
authored
Switch to Class-based as main implementation (#13)
Switch to `Class-based` as main implementation
2 parents ef14b81 + ef2a551 commit 595db70

19 files changed

+5500
-630
lines changed

.babelrc

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"env": {
3+
"test": {
4+
"plugins": ["@babel/plugin-transform-modules-commonjs"]
5+
}
6+
}
7+
}

.github/workflows/test.yml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
name: Jest Test
2+
3+
on:
4+
pull_request:
5+
types: [synchronize, opened, reopened]
6+
push:
7+
branches: [main]
8+
workflow_dispatch:
9+
10+
jobs:
11+
install:
12+
name: Install and Test
13+
14+
runs-on: ubuntu-latest
15+
16+
strategy:
17+
matrix:
18+
node-version: [12.x, 14.x, 16.x]
19+
20+
steps:
21+
- uses: actions/checkout@v2
22+
23+
- name: Install
24+
run: npm ci
25+
26+
- name: Test with Jest
27+
run: npm test

.gitignore

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
node_modules/
22

33
/out/
4-
/src/urlList.js
4+
/legacy/src/urlList.js
55
/src/urlList.class.js
66

77
.gitlog
88

9-
test.js
9+
test.js
10+
performance.js

index.class.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
1-
import { existsSync, copyFileSync } from 'fs'
21
import ThesisLighthouse from './src/lib/application.class.js'
3-
if (!existsSync('./src/urlList.class.js')) copyFileSync('./src/urlList.class.example', './src/urlList.class.js')
42
import Config from "./src/urlList.class.js"
53

6-
const app = new ThesisLighthouse(Config)
4+
const app = new ThesisLighthouse(Config).start()

index.js renamed to legacy/index.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { series } from 'async'
22
import { exec } from 'child_process'
33
import { readFileSync, writeFileSync, existsSync, mkdirSync, copyFileSync } from 'fs'
4-
if (!existsSync('./src/urlList.js')) copyFileSync('./src/urlList.example', './src/urlList.js')
4+
if (!existsSync('./legacy/src/urlList.js')) copyFileSync('./legacy/src/urlList.example', './legacy/src/urlList.js')
55
import { urlList, options, execOptions } from './src/urlList.js'
66
import { makeCommandFromURL } from './src/lib/commandHandlers.js'
77
import { getCategoriesFromCategoriesFlags, getCurrentCategories } from './src/lib/categoriesHandlers.js'
@@ -70,7 +70,7 @@ const main = (urlList, options) => {
7070
const isOptionsCategories = getCategoriesFlags(options?.categories)
7171
const currentFlags = `${isOptionsCategories}--output json --disable-full-page-screenshot --chrome-flags="--no-sandbox --headless --disable-gpu"`
7272

73-
console.log(`TLighthouse ${process.env.npm_package_version} - Thesis Example Code`)
73+
console.log(`[Legacy] TLighthouse ${process.env.npm_package_version} - Thesis Example Code`)
7474
console.log(`Running with these Flags: ${currentFlags}\n`)
7575

7676
urlList.forEach((url, index) => { testURL(url, options) })
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)