@d-zero/a11y-check 0.4.9 → 0.4.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/spreadsheet.js +75 -67
  2. package/package.json +10 -10
@@ -3,74 +3,14 @@ import { SheetTable } from '@d-zero/google-sheets';
3
3
  import { parseUrl } from '@d-zero/shared/parse-url';
4
4
  import dotenv from 'dotenv';
5
5
  export class SpreadsheetReporter {
6
- #table;
6
+ #table = null;
7
7
  // eslint-disable-next-line no-restricted-syntax
8
- constructor(sheetUrl, sheetName, auth) {
9
- this.#table = new SheetTable(sheetUrl, sheetName, auth, {
10
- id: 'No.',
11
- url: '対象画面URL',
12
- tool: 'テスト方法',
13
- timestamp: '日時',
14
- component: 'パーツ',
15
- environment: '環境',
16
- targetNode: '対象箇所',
17
- asIs: 'AS IS',
18
- toBe: {
19
- label: 'TO BE',
20
- conditionalFormatRules: [
21
- {
22
- booleanRule: {
23
- condition: { type: 'BLANK' },
24
- format: {
25
- backgroundColor: { red: 0.9 },
26
- textFormat: { foregroundColor: { red: 1, green: 1, blue: 1 } },
27
- },
28
- },
29
- },
30
- ],
31
- },
32
- explanation: {
33
- label: 'TO BE(補足)',
34
- conditionalFormatRules: [
35
- {
36
- booleanRule: {
37
- condition: {
38
- type: 'TEXT_STARTS_WITH',
39
- values: [{ userEnteredValue: 'N/A' }],
40
- },
41
- format: {
42
- backgroundColor: { red: 0.9 },
43
- textFormat: { foregroundColor: { red: 1, green: 1, blue: 1 } },
44
- },
45
- },
46
- },
47
- {
48
- booleanRule: {
49
- condition: {
50
- type: 'TEXT_STARTS_WITH',
51
- values: [{ userEnteredValue: 'WARNING' }],
52
- },
53
- format: {
54
- backgroundColor: { red: 1, green: 0.5, blue: 0 },
55
- textFormat: { foregroundColor: { red: 1, green: 1, blue: 1 } },
56
- },
57
- },
58
- },
59
- ],
60
- },
61
- wcagVersion: 'WCAGバージョン',
62
- scNumber: '達成基準番号',
63
- level: '適合レベル',
64
- screenshot: 'スクリーンショット',
65
- }, {
66
- frozen: {
67
- rows: 1,
68
- cols: 2,
69
- },
70
- });
71
- }
8
+ constructor() { }
72
9
  async report(results) {
73
- await this.#table.update(results.map((result) => {
10
+ if (!this.#table) {
11
+ throw new Error('Table is not created');
12
+ }
13
+ await this.#table.addRecords(results.map((result) => {
74
14
  const url = parseUrl(result.url);
75
15
  return {
76
16
  id: { value: result.id },
@@ -99,6 +39,72 @@ export class SpreadsheetReporter {
99
39
  };
100
40
  }));
101
41
  }
42
+ async #create(sheetUrl, sheetName, auth) {
43
+ this.#table = await SheetTable.create(sheetUrl, sheetName, auth, {
44
+ define: {
45
+ id: 'No.',
46
+ url: '対象画面URL',
47
+ tool: 'テスト方法',
48
+ timestamp: '日時',
49
+ component: 'パーツ',
50
+ environment: '環境',
51
+ targetNode: '対象箇所',
52
+ asIs: 'AS IS',
53
+ toBe: {
54
+ label: 'TO BE',
55
+ conditionalFormatRules: [
56
+ {
57
+ booleanRule: {
58
+ condition: { type: 'BLANK' },
59
+ format: {
60
+ backgroundColor: { red: 0.9 },
61
+ textFormat: { foregroundColor: { red: 1, green: 1, blue: 1 } },
62
+ },
63
+ },
64
+ },
65
+ ],
66
+ },
67
+ explanation: {
68
+ label: 'TO BE(補足)',
69
+ conditionalFormatRules: [
70
+ {
71
+ booleanRule: {
72
+ condition: {
73
+ type: 'TEXT_STARTS_WITH',
74
+ values: [{ userEnteredValue: 'N/A' }],
75
+ },
76
+ format: {
77
+ backgroundColor: { red: 0.9 },
78
+ textFormat: { foregroundColor: { red: 1, green: 1, blue: 1 } },
79
+ },
80
+ },
81
+ },
82
+ {
83
+ booleanRule: {
84
+ condition: {
85
+ type: 'TEXT_STARTS_WITH',
86
+ values: [{ userEnteredValue: 'WARNING' }],
87
+ },
88
+ format: {
89
+ backgroundColor: { red: 1, green: 0.5, blue: 0 },
90
+ textFormat: { foregroundColor: { red: 1, green: 1, blue: 1 } },
91
+ },
92
+ },
93
+ },
94
+ ],
95
+ },
96
+ wcagVersion: 'WCAGバージョン',
97
+ scNumber: '達成基準番号',
98
+ level: '適合レベル',
99
+ screenshot: 'スクリーンショット',
100
+ },
101
+ }, {
102
+ frozen: {
103
+ rows: 1,
104
+ cols: 2,
105
+ },
106
+ });
107
+ }
102
108
  static async setup(sheetUrl, sheetName) {
103
109
  dotenv.config();
104
110
  if (!process.env.GOOGLE_AUTH_CREDENTIALS) {
@@ -107,6 +113,8 @@ export class SpreadsheetReporter {
107
113
  const auth = await authentication(process.env.GOOGLE_AUTH_CREDENTIALS, [
108
114
  'https://www.googleapis.com/auth/spreadsheets',
109
115
  ]);
110
- return new SpreadsheetReporter(sheetUrl, sheetName, auth);
116
+ const reporter = new SpreadsheetReporter();
117
+ await reporter.#create(sheetUrl, sheetName, auth);
118
+ return reporter;
111
119
  }
112
120
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@d-zero/a11y-check",
3
- "version": "0.4.9",
3
+ "version": "0.4.11",
4
4
  "description": "Accessibility Checker CLI",
5
5
  "author": "D-ZERO",
6
6
  "license": "MIT",
@@ -24,20 +24,20 @@
24
24
  "clean": "tsc --build --clean"
25
25
  },
26
26
  "dependencies": {
27
- "@d-zero/a11y-check-axe-scenario": "0.4.8",
28
- "@d-zero/a11y-check-core": "0.5.8",
29
- "@d-zero/a11y-check-scenarios": "0.4.8",
27
+ "@d-zero/a11y-check-axe-scenario": "0.4.10",
28
+ "@d-zero/a11y-check-core": "0.5.10",
29
+ "@d-zero/a11y-check-scenarios": "0.4.10",
30
30
  "@d-zero/cli-core": "1.1.3",
31
- "@d-zero/google-auth": "0.4.4",
32
- "@d-zero/google-sheets": "0.4.2",
33
- "@d-zero/puppeteer-page-scan": "4.2.3",
34
- "@d-zero/readtext": "1.1.10",
35
- "@d-zero/shared": "0.11.0",
31
+ "@d-zero/google-auth": "0.5.0",
32
+ "@d-zero/google-sheets": "0.5.1",
33
+ "@d-zero/puppeteer-page-scan": "4.2.5",
34
+ "@d-zero/readtext": "1.1.12",
35
+ "@d-zero/shared": "0.12.0",
36
36
  "ansi-colors": "4.1.3",
37
37
  "dayjs": "1.11.18",
38
38
  "dotenv": "17.2.3",
39
39
  "front-matter": "4.0.2",
40
40
  "minimist": "1.2.8"
41
41
  },
42
- "gitHead": "bbf6a629d7677d26b2bdbbaf474ca32d49412cb4"
42
+ "gitHead": "fe6d98ee0108b0e53848f28a74e4e08875e31a78"
43
43
  }