-
Notifications
You must be signed in to change notification settings - Fork 146
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #5817 from leather-io/release/overconfident-bison
release: overconfident-bison
- Loading branch information
Showing
101 changed files
with
2,052 additions
and
1,349 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
import fs from 'fs/promises'; | ||
|
||
const filePath = './package.json'; | ||
const backupFilePath = './package-original.json'; | ||
|
||
async function modifyUiPackageJson() { | ||
try { | ||
// Check if a backup already exists | ||
try { | ||
await fs.access(backupFilePath); | ||
console.log(`Backup file already exists: ${backupFilePath}`); | ||
} catch { | ||
await fs.copyFile(filePath, backupFilePath); | ||
console.log(`Backup created: ${backupFilePath}`); | ||
} | ||
|
||
// Read and parse the package.json file | ||
const data = await fs.readFile(filePath, 'utf-8'); | ||
let packageJson = JSON.parse(data); | ||
|
||
// Modify the @leather.io/ui dependency | ||
packageJson.dependencies['@leather.io/ui'] = 'file:../mono/packages/ui'; | ||
|
||
// Ensure pnpm and pnpm.overrides are initialized | ||
if (!packageJson.pnpm) { | ||
packageJson.pnpm = {}; | ||
} | ||
if (!packageJson.pnpm.overrides) { | ||
packageJson.pnpm.overrides = {}; | ||
} | ||
|
||
// Add the specified overrides | ||
const overrides = { | ||
'@leather.io/rpc': 'file:../mono/packages/rpc', | ||
'@leather.io/constants': 'file:../mono/packages/constants', | ||
'@leather.io/models': 'file:../mono/packages/models', | ||
'@leather.io/tokens': 'file:../mono/packages/tokens', | ||
'@leather.io/utils': 'file:../mono/packages/utils' | ||
}; | ||
|
||
packageJson.pnpm.overrides = { ...packageJson.pnpm.overrides, ...overrides }; | ||
|
||
// Write the modified package.json back to the file | ||
await fs.writeFile(filePath, JSON.stringify(packageJson, null, 2) + '\n', 'utf-8'); | ||
console.log(`Successfully updated ${filePath}`); | ||
|
||
} catch (err) { | ||
console.error(`Error: ${err}`); | ||
} | ||
} | ||
|
||
// Execute the function | ||
modifyUiPackageJson(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
import fs from 'fs/promises'; | ||
|
||
const filePath = './package.json'; | ||
const backupFilePath = './package-original.json'; | ||
|
||
async function modifyPackageJson() { | ||
try { | ||
try { | ||
await fs.access(backupFilePath); | ||
console.log(`Backup file already exists: ${backupFilePath}`); | ||
} catch { | ||
await fs.copyFile(filePath, backupFilePath); | ||
console.log(`Backup created: ${backupFilePath}`); | ||
} | ||
|
||
const data = await fs.readFile(filePath, 'utf-8'); | ||
let packageJson = JSON.parse(data); | ||
|
||
const relativePaths = [ | ||
'@leather.io/bitcoin', | ||
'@leather.io/constants', | ||
'@leather.io/crypto', | ||
'@leather.io/models', | ||
'@leather.io/query', | ||
'@leather.io/tokens', | ||
'@leather.io/utils', | ||
'@leather.io/stacks', | ||
]; | ||
|
||
const devRelativePaths = ['@leather.io/panda-preset', '@leather.io/rpc']; | ||
|
||
relativePaths.forEach(dep => { | ||
if (packageJson.dependencies[dep]) { | ||
packageJson.dependencies[dep] = `file:../mono/packages/${dep.split('/').pop()}`; | ||
} | ||
}); | ||
|
||
devRelativePaths.forEach(devDep => { | ||
if (packageJson.devDependencies[devDep]) { | ||
packageJson.devDependencies[devDep] = `file:../mono/packages/${devDep.split('/').pop()}`; | ||
} | ||
}); | ||
|
||
if (!packageJson.pnpm) { | ||
packageJson.pnpm = {}; | ||
} | ||
if (!packageJson.pnpm.overrides) { | ||
packageJson.pnpm.overrides = {}; | ||
} | ||
|
||
[...relativePaths, ...devRelativePaths].forEach(dep => { | ||
if (packageJson.dependencies[dep] || packageJson.devDependencies[dep]) { | ||
packageJson.pnpm.overrides[dep] = `file:../mono/packages/${dep.split('/').pop()}`; | ||
} | ||
}); | ||
|
||
await fs.writeFile(filePath, JSON.stringify(packageJson, null, 2) + '\n', 'utf-8'); | ||
console.log(`Successfully updated ${filePath}`); | ||
} catch (err) { | ||
console.error(`Error: ${err}`); | ||
} | ||
} | ||
|
||
modifyPackageJson(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import fs from 'fs/promises'; | ||
|
||
const filePath = './package.json'; | ||
const backupFilePath = './package-original.json'; | ||
|
||
async function revertPackageJson() { | ||
try { | ||
try { | ||
await fs.access(backupFilePath); | ||
} catch { | ||
throw new Error(`Backup file not found: ${backupFilePath}`); | ||
} | ||
|
||
await fs.copyFile(backupFilePath, filePath); | ||
console.log(`Successfully reverted ${filePath}`); | ||
|
||
await fs.unlink(backupFilePath); | ||
console.log(`Backup file removed: ${backupFilePath}`); | ||
|
||
} catch (err) { | ||
console.error(`Error: ${err}`); | ||
} | ||
} | ||
|
||
revertPackageJson(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.