This repository was archived by the owner on Jul 25, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathappend-output.js
51 lines (45 loc) · 1.66 KB
/
append-output.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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
const fs = require('fs');
const path = require('path');
// Path to the generated bundle.js file
const bundlePath = path.resolve(__dirname, 'dist/ViewXtend.user.js');
// Your banner comment
const bannerComment = `// ==UserScript==
// @name ViewXtend
// @description Youtube with extra features
// @icon None
// @version 1.0.2
// @author Fate (https://github.com/FateNotAvailable)
// @namespace https://github.com/FateNotAvailable/ViewXtend
// @supportURL https://github.com/FateNotAvailable/ViewXtend/issues
// @updateURL https://raw.githubusercontent.com/FateNotAvailable/ViewXtend/main/dist/ViewXtend.user.js
// @license GPL-3
// @icon https://i.ibb.co/cwvhZQN/View-Xtend.png
// @match https://www.youtube.com/*
// @match https://www.youtube-nocookie.com/*
// @match https://m.youtube.com/*
// @grant none
// @run-at document-start
// @compatible chrome
// @compatible firefox
// @compatible opera
// @compatible edge
// @compatible safari
// ==/UserScript==
`;
// Read the existing bundle content
fs.readFile(bundlePath, 'utf8', (err, data) => {
if (err) {
console.error(`Error reading bundle file: ${err}`);
return;
}
// Combine the banner comment and the existing bundle content
const updatedBundle = bannerComment + '\n' + data;
// Write the updated bundle content back to the file
fs.writeFile(bundlePath, updatedBundle, 'utf8', (err) => {
if (err) {
console.error(`Error writing updated bundle file: ${err}`);
} else {
console.log('Banner comment appended to the bundle.');
}
});
});