Skip to content

Commit

Permalink
generic node - better config handling
Browse files Browse the repository at this point in the history
  • Loading branch information
froger-me committed Jan 10, 2024
1 parent 171e360 commit cfb1204
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions integration/dummy-generic/wppus-api.js
Original file line number Diff line number Diff line change
Expand Up @@ -86,11 +86,16 @@ async function main() {

const uninstall = async function () {
// remove the license key from wppus.json
config.licenseKey = "";
delete config.licenseKey;
// remove the license signature from wppus.json
config.licenseSignature = "";
delete config.licenseSignature;
// remove the file '.installed' from current directory
fs.unlinkSync(path.join(__dirname, '.installed'));
if (parseInt(process.version.slice(1).split('.')[0]) >= 14) {
fs.rmSync(path.join(__dirname, '.installed'));
} else {
fs.unlinkSync(path.join(__dirname, '.installed'));
}

// write the new wppus.json file
fs.writeFileSync(path.join(__dirname, 'wppus.json'), JSON.stringify(config, null, 4));

Expand Down Expand Up @@ -185,7 +190,7 @@ async function main() {
// make the request
send_api_request(endpoint, args);
// remove the license signature from wppus.json
config.licenseSignature = "";
delete config.licenseSignature;
// write the new wppus.json file
fs.writeFileSync(path.join(__dirname, 'wppus.json'), JSON.stringify(config, null, 4));

Expand Down

0 comments on commit cfb1204

Please sign in to comment.