Skip to content

Commit 2e9f2c0

Browse files
committed
remove local scope support
1 parent 527bf71 commit 2e9f2c0

File tree

3 files changed

+7
-32
lines changed

3 files changed

+7
-32
lines changed

README.md

Lines changed: 4 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,15 @@ This plugin is a simple wrapper around the [html-validate.org](https://html-vali
1414
## Install
1515

1616
```bash
17-
npm install html-validate-webpack-plugin --save-dev
17+
npm i -D html-validate-webpack-plugin
1818
```
1919

20-
**Note**: Install `html-validate` and create a `.htmlvalidate.json` at the project root with your [configurations](https://html-validate.org/usage/index.html).
21-
2220
```bash
23-
npm install html-validate --save-dev
21+
npm i -g html-validate
2422
```
2523

24+
**Note**: You must have `html-validate` installed globally and create a `.htmlvalidate.json` at the project root with your [configurations](https://html-validate.org/usage/index.html).
25+
2626
## Usage
2727

2828
In your webpack configuration (development builds):
@@ -31,13 +31,9 @@ In your webpack configuration (development builds):
3131
const HtmlValidatePlugin = require('html-validate-webpack-plugin');
3232

3333
module.exports = {
34-
// ...
3534
plugins: [
36-
// ...
3735
new HtmlValidatePlugin(),
38-
// ...
3936
],
40-
// ...
4137
};
4238
```
4339

@@ -68,24 +64,11 @@ Specify a different configuration file.
6864

6965
**Note:** For your custom configuration omit the `.json` extension and supply the name only.
7066

71-
### `global`
72-
73-
- Type: `boolean`
74-
- Default: `false`
75-
76-
Specify the run context of html-validate.
77-
78-
**Note:** If you installed `html-validate` globally, set the value to `true`.
79-
8067
## Features
8168

8269
- `html-validate` [performs all validation locally](https://html-validate.org/#offline) which means you can use `html-validate` and `html-validate-webpack-plugin` offline.
8370
- `html-validate-webpack-plugin` contains minimal dependencies.
8471

85-
## Contributing
86-
87-
Pull requests are welcome! For major changes, please open an issue first to discuss what you would like to change.
88-
8972
## License
9073

9174
MIT

index.js

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,12 @@ class HTMLValidatePlugin {
1414
path: 'src/**/*',
1515
extensions: 'html',
1616
config: '.htmlvalidate',
17-
global: false,
1817
},
1918
({
2019
// destructure params
2120
path: this.path,
2221
extensions: this.extensions,
2322
config: this.config,
24-
global: this.global,
2523
// user provided params override defaults
2624
} = options)
2725
);
@@ -44,17 +42,15 @@ class HTMLValidatePlugin {
4442
: processedExtension.replace(/\{/g, '').replace(/\}/g, '');
4543
}
4644

47-
runCliBasedOnScope(userParams, spawnParams) {
45+
runCli(userParams, spawnParams) {
4846
/*
4947
Attempts at better security:
5048
- schema utils used to validate user input
5149
- spawn command (by default) is not exec under a shell env
5250
https://gist.github.com/evilpacket/5a9655c752982faf7c4ec6450c1cbf1b
5351
https://nodejs.org/api/child_process.html#child_process_child_process_spawn_command_args_options
5452
*/
55-
return this.global
56-
? spawn('html-validate', [`${userParams}`], spawnParams)
57-
: spawn('node', ['node_modules/.bin/html-validate', `${userParams}`], spawnParams);
53+
return spawn('html-validate', [`${userParams}`], spawnParams);
5854
}
5955

6056
apply(compiler) {
@@ -64,7 +60,7 @@ class HTMLValidatePlugin {
6460
const userParams = `${this.path}.${this.getExtensions()} ${this.getConfig()}`;
6561
const spawnParams = { shell: true, stdio: 'inherit' };
6662

67-
this.runCliBasedOnScope(userParams, spawnParams);
63+
this.runCli(userParams, spawnParams);
6864
});
6965
}
7066
}

schema.json

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,6 @@
1212
"config": {
1313
"description": "Specify a different configuration file.",
1414
"type": "string"
15-
},
16-
"global": {
17-
"description": "Specify the run context of html-validate.",
18-
"type": "boolean"
1915
}
2016
},
2117
"additionalProperties": false

0 commit comments

Comments
 (0)