@caweb/a11y-webpack-plugin 2.1.1 → 2.1.3

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/index.js +13 -8
  2. package/package.json +3 -3
package/index.js CHANGED
@@ -124,22 +124,22 @@ class CAWebA11yPlugin {
124
124
  // }
125
125
 
126
126
  compiler.hooks.thisCompilation.tap(pluginName, (compilation) => {
127
- // We can audit the html files now that the compilation is done.
128
- // we hook into the done hook to run the accessibility checker.
129
- compiler.hooks.done.tapAsync(
127
+ // // We can audit the html files now that the compilation is done.
128
+ // // we hook into the done hook to run the accessibility checker.
129
+ compiler.hooks.done.tap(
130
130
  pluginName,
131
- (stats, callback) => {
131
+ (stats) => {
132
132
 
133
133
  console.log('<i> \x1b[32m[webpack-dev-middleware] Running IBM Accessibility scan...\x1b[0m');
134
134
  /**
135
135
  * We run the accessibility checker
136
136
  */
137
- this.a11yCheck(
137
+ if( this.a11yCheck(
138
138
  compiler.options.output.path,
139
139
  this.config
140
- );
141
-
142
- console.log(`<i> \x1b[32m[webpack-dev-middleware] IBM Accessibilty Report can be viewed at \x1b[34m ${new URL(`${auditUrl}${staticDir.publicPath}/${this.config.outputFilename}.html`).toString()}\x1b[0m`);
140
+ )){
141
+ console.log(`<i> \x1b[32m[webpack-dev-middleware] IBM Accessibilty Report can be viewed at \x1b[34m ${new URL(`${auditUrl}${staticDir.publicPath}/${this.config.outputFilename}.html`).toString()}\x1b[0m`);
142
+ }
143
143
 
144
144
  });
145
145
  })
@@ -237,6 +237,11 @@ class CAWebA11yPlugin {
237
237
  if( file.endsWith('.json') || file.endsWith('.html') ){
238
238
  let newName = file.replace( target.replace(':', '_') + '\\', '').replace('.html.html', '.html');
239
239
 
240
+ // make sure the directory exists before renaming the file, if not we create it.
241
+ if( ! fs.existsSync( path.join(outputFolder, path.dirname(newName)) ) ){
242
+ fs.mkdirSync( path.join(outputFolder, path.dirname(newName)), { recursive: true } );
243
+ }
244
+
240
245
  // we rename the json/html file to remove the target from the filename
241
246
  fs.renameSync(
242
247
  path.join(outputFolder, file),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@caweb/a11y-webpack-plugin",
3
- "version": "2.1.1",
3
+ "version": "2.1.3",
4
4
  "description": "CAWebPublishing Webpack Plugin to run Accessibility Scans",
5
5
  "type": "module",
6
6
  "main": "index.js",
@@ -35,13 +35,13 @@
35
35
  "webpack"
36
36
  ],
37
37
  "dependencies": {
38
- "@caweb/webpack": "^1.6.6",
38
+ "@caweb/webpack": "^1.6.7",
39
39
  "accessibility-checker": "^4.0.12",
40
40
  "check-valid-url": "^0.1.0"
41
41
  },
42
42
  "devDependencies": {
43
43
  "@caweb/html-webpack-plugin": "^2.1.5",
44
- "webpack": "^5.105.1",
44
+ "webpack": "^5.105.2",
45
45
  "webpack-cli": "^6.0.1"
46
46
  }
47
47
  }