-
Notifications
You must be signed in to change notification settings - Fork 13
/
Copy pathupdate-js-content.ts
46 lines (39 loc) · 1.57 KB
/
update-js-content.ts
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#!/usr/bin/env ts-node
/*!
* Script to globally update content of assets.
* Copyright 2020-2024 Chocolatey Software
* Licensed under Apache License (https://github.com/chocolatey/choco-theme/blob/main/LICENSE)
*/
import { updateContent } from './functions/update-content';
const init = async () => {
const fileValidationJs = ['validation.js', 'validation.min.js'];
for await (const file of fileValidationJs) {
console.log(`🚀 Updating content for ${file}...`);
await updateContent({
destination: './dist/js',
targetFile: file,
targetFileDestination: './dist/js',
targetFileContentToReplace: 'input-validation-error',
replaceWithContent: 'input-validation-error is-invalid',
replacementContentIsFile: false
});
await updateContent({
destination: './dist/js',
targetFile: file,
targetFileDestination: './dist/js',
targetFileContentToReplace: 'field-validation-error',
replaceWithContent: 'field-validation-error invalid-feedback',
replacementContentIsFile: false
});
await updateContent({
destination: './dist/js',
targetFile: file,
targetFileDestination: './dist/js',
targetFileContentToReplace: '.field-validation-error invalid-feedback',
replaceWithContent: '.field-validation-error.invalid-feedback',
replacementContentIsFile: false
});
console.log(`✅ Content for ${file} updated`);
}
};
init();