forked from microsoft/accessibility-insights-web
-
Notifications
You must be signed in to change notification settings - Fork 0
/
replace-plugin.js
31 lines (27 loc) · 946 Bytes
/
replace-plugin.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
const fs = require('fs');
const CreateReplaceJsonValidatorPlugin = () => {
return {
name: 'replace-json-validator-plugin',
setup(build) {
build.onLoad(
{
filter: /.*load-assessment-data-validator.ts/,
},
async args => {
const origContent = fs.readFileSync(args.path, 'utf-8');
const newContent = origContent.replace(
'empty-validate-assessment-json',
'generated-validate-assessment-json',
);
return {
contents: newContent,
loader: 'ts',
};
},
);
},
};
};
module.exports = { CreateReplaceJsonValidatorPlugin };