Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
16 commits
Select commit Hold shift + click to select a range
526bd33
Cleaning up whitespaces and remove unused library
WilsonkwSheng Mar 6, 2026
e9cfb90
getHost imports to utils index and remove legacy exports from utils.ts
WilsonkwSheng Mar 6, 2026
77e78b4
Extract getCurrentDate into utils module and export via utils/index
WilsonkwSheng Mar 6, 2026
12783b4
Extract isWhitelistedContentType and update crawlSitemap import
WilsonkwSheng Mar 6, 2026
580c048
Extract getStoragePath/getPdfStoragePath and migrate imports to utils…
WilsonkwSheng Mar 6, 2026
de0a2d2
Extract user data helpers and migrate imports to utils index
WilsonkwSheng Mar 6, 2026
4f8aa77
Move results folder helpers into utils/resultsFolders and update imports
WilsonkwSheng Mar 6, 2026
1676076
Extract link strategy and random helpers into utils folder
WilsonkwSheng Mar 6, 2026
b4d7e6b
Extract retryFunction into utils module and update imports
WilsonkwSheng Mar 6, 2026
113f54d
Move runtime flag helpers into utils/runtimeFlags
WilsonkwSheng Mar 6, 2026
5af14c5
Remove datetime re-export from utils.ts and update test imports
WilsonkwSheng Mar 6, 2026
1a04257
Move zipResults to utils/zipResults and update imports
WilsonkwSheng Mar 6, 2026
221ec3e
Extract WCAG pass/progress helpers and related types into wcagProgres…
WilsonkwSheng Mar 6, 2026
2ca1175
Move issues percentage and total rules helpers into utils/issuesPerce…
WilsonkwSheng Mar 6, 2026
19f7bc2
Move WCAG classification helpers into utils/wcagClassification
WilsonkwSheng Mar 6, 2026
703cd3e
Index and retire monolithic utils.ts
WilsonkwSheng Mar 6, 2026
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: 1 addition & 1 deletion __tests__/mergeAxeResults.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ const {
createFilenames,
createFinalResultsInJson,
} = require('../__mocks__/mockFunctions');
const { getCurrentDate, getFormattedTime } = require('../utils');
const { getCurrentDate, getFormattedTime } = require('../src/utils/index.js');
const { consoleLogger, silentLogger } = require('../logs');

let randomToken;
Expand Down
2 changes: 1 addition & 1 deletion __tests__/utils.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import {
validateUrl,
getStoragePath,
setHeadlessMode,
} from '../utils.js';
} from '../src/utils/index.js';

describe('test setting of threshold warn level', () => {
const OLD_ENV = process.env;
Expand Down
8 changes: 7 additions & 1 deletion src/cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,13 @@ import printMessage from 'print-message';
import { devices } from 'playwright';
import { fileURLToPath } from 'url';
import path from 'path';
import { setHeadlessMode, getVersion, getStoragePath, listenForCleanUp, cleanUpAndExit } from './utils.js';
import {
listenForCleanUp,
cleanUpAndExit,
getStoragePath,
getVersion,
setHeadlessMode,
} from './utils/index.js';
import {
checkUrl,
prepareData,
Expand Down
9 changes: 7 additions & 2 deletions src/combine.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,12 @@ import crawlDomain from './crawlers/crawlDomain.js';
import crawlLocalFile from './crawlers/crawlLocalFile.js';
import crawlIntelligentSitemap from './crawlers/crawlIntelligentSitemap.js';
import generateArtifacts from './mergeAxeResults.js';
import { getHost, createAndUpdateResultsFolders, cleanUpAndExit, getStoragePath } from './utils.js';
import {
cleanUpAndExit,
createAndUpdateResultsFolders,
getHost,
getStoragePath,
} from './utils/index.js';
import { ScannerTypes, UrlsCrawled } from './constants/constants.js';
import { getBlackListedPatterns, submitForm } from './constants/common.js';
import { consoleLogger, silentLogger } from './logs.js';
Expand Down Expand Up @@ -328,4 +333,4 @@ const combineRun = async (details: Data, deviceToScan: string) => {
}
};

export default combineRun;
export default combineRun;
3 changes: 1 addition & 2 deletions src/constants/cliFunctions.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Options } from 'yargs';
import printMessage from 'print-message';
import { BrowserTypes, RuleFlags, ScannerTypes } from './constants.js';
import { cleanUpAndExit } from '../utils.js';
import { cleanUpAndExit } from '../utils/index.js';

export const messageOptions = {
border: false,
Expand Down Expand Up @@ -342,4 +342,3 @@ To obtain the JSON files, you need to base64-decode the file followed by gunzip.
coerce: val => Number(val),
},
};

3 changes: 2 additions & 1 deletion src/constants/common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@ import constants, {
} from './constants.js';
import { consoleLogger } from '../logs.js';
import { isUrlPdf } from '../crawlers/commonCrawlerFunc.js';
import { cleanUpAndExit, randomThreeDigitNumberString, register } from '../utils.js';
import { randomThreeDigitNumberString } from '../utils/index.js';
import { cleanUpAndExit, register } from '../utils/index.js';
import { Answers, Data } from '../index.js';
import { DeviceDescriptor } from '../types/types.js';
import { getProxyInfo, proxyInfoToResolution, ProxySettings } from '../proxyService.js';
Expand Down
2 changes: 1 addition & 1 deletion src/constants/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -361,7 +361,7 @@ export const sitemapPaths = [
'/sitemap_index.xml.xz',
];

// Remember to update getWcagPassPercentage() in src/utils/utils.ts if you change this
// Remember to update getWcagPassPercentage() in src/utils/wcagProgress.ts if you change this
const wcagLinks = {
'WCAG 1.1.1': 'https://www.w3.org/TR/WCAG22/#non-text-content',
'WCAG 1.2.2': 'https://www.w3.org/TR/WCAG22/#captions-prerecorded',
Expand Down
2 changes: 1 addition & 1 deletion src/constants/questions.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Question } from 'inquirer';
import { Answers } from '../index.js';
import { getUserDataTxt, randomThreeDigitNumberString, setHeadlessMode } from '../utils.js';
import { getUserDataTxt, randomThreeDigitNumberString, setHeadlessMode } from '../utils/index.js';
import {
checkUrl,
getBrowserToRun,
Expand Down
2 changes: 1 addition & 1 deletion src/crawlers/commonCrawlerFunc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import { flagUnlabelledClickableElements } from './custom/flagUnlabelledClickabl
import xPathToCss from './custom/xPathToCss.js';
import type { Response as PlaywrightResponse } from 'playwright';
import fs from 'fs';
import { getStoragePath } from '../utils.js';
import { getStoragePath } from '../utils/index.js';
import path from 'path';

// types
Expand Down
2 changes: 1 addition & 1 deletion src/crawlers/crawlDomain.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ import {
getUrlsFromRobotsTxt,
waitForPageLoaded,
} from '../constants/common.js';
import { areLinksEqual, isFollowStrategy, register } from '../utils.js';
import { areLinksEqual, isFollowStrategy, register } from '../utils/index.js';
import {
handlePdfDownload,
runPdfScan,
Expand Down
2 changes: 1 addition & 1 deletion src/crawlers/crawlIntelligentSitemap.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import crawlDomain from './crawlDomain.js';
import crawlSitemap from './crawlSitemap.js';
import { ViewportSettingsClass } from '../combine.js';
import { getPlaywrightLaunchOptions } from '../constants/common.js';
import { register } from '../utils.js';
import { register } from '../utils/index.js';

const crawlIntelligentSitemap = async (
url: string,
Expand Down
2 changes: 1 addition & 1 deletion src/crawlers/crawlLocalFile.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import {
import { runPdfScan, mapPdfScanResults, doPdfScreenshots } from './pdfScanFunc.js';
import { guiInfoLog } from '../logs.js';
import crawlSitemap from './crawlSitemap.js';
import { getPdfStoragePath, getStoragePath, register } from '../utils.js';
import { getPdfStoragePath, register } from '../utils/index.js';

export const crawlLocalFile = async ({
url,
Expand Down
4 changes: 2 additions & 2 deletions src/crawlers/crawlSitemap.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import {
waitForPageLoaded,
isFilePath,
} from '../constants/common.js';
import { areLinksEqual, isWhitelistedContentType, register } from '../utils.js';
import { areLinksEqual, isWhitelistedContentType, register } from '../utils/index.js';
import {
handlePdfDownload,
runPdfScan,
Expand Down Expand Up @@ -447,4 +447,4 @@ const crawlSitemap = async ({
return { urlsCrawled, durationExceeded };
};

export default crawlSitemap;
export default crawlSitemap;
2 changes: 1 addition & 1 deletion src/crawlers/pdfScanFunc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import constants, {
STATUS_CODE_METADATA,
UrlsCrawled,
} from '../constants/constants.js';
import { cleanUpAndExit, getPdfStoragePath, getStoragePath } from '../utils.js';
import { cleanUpAndExit, getPdfStoragePath, getStoragePath } from '../utils/index.js';
import { error } from 'console';

const require = createRequire(import.meta.url);
Expand Down
2 changes: 1 addition & 1 deletion src/crawlers/runCustom.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/* eslint-env browser */
import { chromium } from 'playwright';
import { createCrawleeSubFolders } from './commonCrawlerFunc.js';
import { cleanUpAndExit, register, registerSoftClose } from '../utils.js';
import { cleanUpAndExit, register, registerSoftClose } from '../utils/index.js';
import constants, {
getIntermediateScreenshotsPath,
guiInfoStatusTypes,
Expand Down
8 changes: 4 additions & 4 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@ import printMessage from 'print-message';
import inquirer from 'inquirer';
import { EnqueueStrategy } from 'crawlee';
import {
getVersion,
getUserDataTxt,
writeToUserDataTxt,
listenForCleanUp,
cleanUpAndExit,
} from './utils.js';
getUserDataTxt,
getVersion,
writeToUserDataTxt,
} from './utils/index.js';
import {
prepareData,
messageOptions,
Expand Down
Loading