Skip to content

Commit 25ce450

Browse files
committedAug 28, 2023
chore: use zcli to preview the theme for the lighthouse run
1 parent 0719dd5 commit 25ce450

File tree

5 files changed

+19
-26
lines changed

5 files changed

+19
-26
lines changed
 

‎.zat.example ‎.a11yrc.json.example

File renamed without changes.

‎.gitignore

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
.sass-cache/
22
style.css.map
33
node_modules/
4-
.zat
4+
.a11yrc.json
55
script.js
66
style.css
77
*.DS_Store
8-
coverage/
8+
coverage/

‎bin/lighthouse/account.js

+15-8
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,31 @@
11
/**
2-
* Reads account information from env variables or .zat file
2+
* Reads account information from env variables or .a11yrc.json file
33
*/
4-
const zatAccount = require("./zat");
4+
const fs = require("fs");
5+
6+
let a11yAccount = {};
7+
const a11yrcFilePath = ".a11yrc.json";
8+
9+
if (fs.existsSync(a11yrcFilePath)) {
10+
a11yAccount = JSON.parse(fs.readFileSync(a11yrcFilePath));
11+
}
512

613
function isValid(account) {
714
return account.subdomain && account.email && account.password;
815
}
916

1017
function getAccount() {
11-
// Reads account from the env or .zat file if present
18+
// Reads account from the env or .a11yrc.json file if present
1219
let account = {
13-
subdomain: process.env.subdomain || zatAccount.subdomain,
14-
email: process.env.end_user_email || zatAccount.username,
15-
password: process.env.end_user_password || zatAccount.password,
16-
urls: process.env?.urls?.trim()?.split(/\s+/) || zatAccount.urls
20+
subdomain: process.env.subdomain || a11yAccount.subdomain,
21+
email: process.env.end_user_email || a11yAccount.username,
22+
password: process.env.end_user_password || a11yAccount.password,
23+
urls: process.env?.urls?.trim()?.split(/\s+/) || a11yAccount.urls
1724
};
1825

1926
if (!isValid(account)) {
2027
console.error(
21-
"No account specified. Please create a .zat file or set subdomain, end_user_email and end_user_password as environment variables"
28+
"No account specified. Please create a .a11yrc.json file or set subdomain, end_user_email and end_user_password as environment variables"
2229
);
2330
process.exit(1);
2431
}

‎bin/lighthouse/index.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ const outputAudit = (
2020
}
2121

2222
(async () => {
23-
// TODO: If dev, check if ZAT is running
23+
// TODO: If dev, check if zcli is running
2424
const isDev = process.argv[2] === "-d";
2525
const results = {
2626
stats: {},
@@ -34,7 +34,7 @@ const outputAudit = (
3434
// Build list of urls to audit
3535
if (!account.urls || account.urls.length === 0) {
3636
console.log(
37-
"No urls were found in .zat or as env variable. Building urls from the API...",
37+
"No urls were found in .a11yrc.json or as env variable. Building urls from the API...",
3838
"\n"
3939
);
4040
account.urls = await buildUrlsFromAPI(account);

‎bin/lighthouse/zat.js

-14
This file was deleted.

0 commit comments

Comments
 (0)
Please sign in to comment.