Skip to content
This repository has been archived by the owner on Jan 1, 2025. It is now read-only.

Commit

Permalink
fix: update versioning [skip ci]"
Browse files Browse the repository at this point in the history
Signed-off-by: Francisco Javier Ribó Labrador <elribonazo@gmail.com>
  • Loading branch information
elribonazo committed Oct 27, 2023
1 parent b3b9446 commit db61623
Show file tree
Hide file tree
Showing 3 changed files with 51 additions and 2 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,4 +43,4 @@ jobs:
GH_TOKEN: ${{ secrets.PLUTO_GITHUB }}
GITHUB_TOKEN: ${{ secrets.PLUTO_GITHUB }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
run: npm test && npx jest-coverage-badges && npm run docs -- --hideInPageTOC true --hideBreadcrumbs true && cp -r docs/* . && npx semantic-release
run: npm test && npx jest-coverage-badges && npm run docs -- --hideInPageTOC true --hideBreadcrumbs true && cp -r docs/* . && node versioning.cjs && npx semantic-release
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Pluto-encrypted
Pluto Encrypted is a secure storage wrapper for IndexDB and [AtalaPrism ](https://input-output-hk.github.io/atala-prism-wallet-sdk-ts/)([Pluto](https://input-output-hk.github.io/atala-prism-wallet-sdk-ts/interfaces/Domain.Pluto.html))

This package is compatible with Atala Prism Wallet SDK Version 2.4.1
This package is compatible with Atala Prism Wallet SDK v2.4.1

### Coverage
| Statements | Branches | Functions | Lines |
Expand Down
49 changes: 49 additions & 0 deletions versioning.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
const fs = require('fs');

function findPackageVersion(packageName) {
try {
// Read the package.json file
const packageJson = JSON.parse(fs.readFileSync('./package.json', 'utf-8'));

// Check if the package is in the dependencies
if (packageJson.peerDependencies && packageJson.peerDependencies[packageName]) {
return packageJson.peerDependencies[packageName];
} else {
return undefined; // Package not found
}
} catch (error) {
console.error('Error reading or parsing package.json:', error);
return undefined;
}
}

function updateReadme(version) {
const readmeFilePath = 'README.md';

try {
// Read the content of the README.md file
let readmeContent = fs.readFileSync(readmeFilePath, 'utf-8').split('\n');

// Check if there are at least 4 lines in the file
if (readmeContent.length >= 4) {
// Replace the 4th line with "123"
readmeContent[3] = `This package is compatible with Atala Prism Wallet SDK v${version.slice(1)}`;

// Join the lines back together
readmeContent = readmeContent.join('\n');

// Write the modified content back to the README.md file
fs.writeFileSync(readmeFilePath, readmeContent, 'utf-8');
console.log('README.md updated successfully.');
} else {
console.log('README.md does not have at least 4 lines.');
}
} catch (error) {
console.error('Error reading or updating README.md:', error);
}
}


const packageNameToFind = '@input-output-hk/atala-prism-wallet-sdk'; // Replace with the package name you want to find
const packageVersion = findPackageVersion(packageNameToFind);
updateReadme(packageVersion)

0 comments on commit db61623

Please sign in to comment.