Comparing version 1.0.0 to 1.0.1
34
index.js
@@ -6,3 +6,2 @@ #!/usr/bin/env node | ||
* | ||
* Thomas Konings - 2022 | ||
* If VIA breaks that's your problem. If you ran this program, don't go complain to the VIA team. | ||
@@ -18,11 +17,13 @@ * I take no responsibility for any issues caused by this tool. Use it at your own risk. | ||
const default_url = "http://127.0.0.1:1337"; | ||
let default_url = "https://viamia.github.io"; | ||
const myArgs = process.argv.slice(2); | ||
if(myArgs[0] !== undefined){ | ||
// TODO: check url validity | ||
default_url = myArgs[0]; | ||
} | ||
// TODO: ADD SOME ASCII ART | ||
async function Main(){ | ||
console.log("ViaMia - v0.01"); | ||
console.log("ViaMia allows you to define a custom keyboard JSON collection for VIA to use during startup."); | ||
console.log("It does so by adjusting a single url in your VIA install. Updates to VIA may break this tool."); | ||
console.log("If you encounter any issues with VIA after running this tool, do not contact the VIA team. Reinstall VIA."); | ||
console.log("ViaMia - v1.0.2"); | ||
console.log("If you encounter any issues with VIA after running this tool, do not contact the VIA team. Contact ViaMia."); | ||
console.log(" "); | ||
console.log("Important: close VIA before continuing."); | ||
@@ -97,10 +98,9 @@ console.log(" "); | ||
let {replaceWith} = await inquirer.prompt([ | ||
{"type": "input", "name": "replaceWith", "message": "Replace VIA url with", "default": default_url} | ||
]); | ||
// let {replaceWith} = await inquirer.prompt([ | ||
// {"type": "input", "name": "replaceWith", "message": "Replace VIA url with", "default": default_url} | ||
// ]); | ||
let replaceWith = default_url; | ||
// TODO: CHECK URL VALIDITY | ||
for(const target of targets){ | ||
await fileContentReplace(target, "https://www.caniusevia.com", replaceWith); | ||
await fileContentReplace(target, replaceWith); | ||
}; | ||
@@ -122,6 +122,8 @@ console.log("All target files modified."); | ||
async function fileContentReplace(file, replace, replaceWith){ | ||
async function fileContentReplace(file, replaceWith){ | ||
let replaceRegex = /("keyboards\.v2\.json",")(.+?)(")/g; | ||
console.log("Reading file: "+file); | ||
let contents = (await fs.promises.readFile(file)).toString(); | ||
contents = contents.replace(replace, replaceWith); | ||
contents = contents.replace(replaceRegex, "$1"+replaceWith+"$3"); | ||
await fs.promises.writeFile(file, contents); | ||
@@ -128,0 +130,0 @@ console.log("Modded file: "+file); |
{ | ||
"name": "viamia", | ||
"version": "1.0.0", | ||
"version": "1.0.1", | ||
"description": "Patcher for VIA. Use your own keyboards api and never import a JSON file again.", | ||
@@ -10,3 +10,8 @@ "main": "index.js", | ||
}, | ||
"pkg": { | ||
"targets": [ "node14-linux-x64", "node14-macos-x64", "node14-win-x64" ], | ||
"outputPath": "dist" | ||
}, | ||
"author": "tkon99", | ||
"homepage": "https://github.com/ViaMia/ViaMia-Patcher", | ||
"license": "MIT", | ||
@@ -13,0 +18,0 @@ "dependencies": { |
# ViaMia | ||
Patcher for VIA. Use your own keyboards api and never import a JSON file again. | ||
To run the patcher use: | ||
``` | ||
npx viamia | ||
``` |
Sorry, the diff of this file is not supported yet
No website
QualityPackage does not have a website.
Found 1 instance in 1 package
8293
5
103
1
8