forked from OasisDEX/oasis-earn-sc
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsymlink-contracts.ts
27 lines (22 loc) · 1.08 KB
/
symlink-contracts.ts
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
import fs from 'fs'
import path from 'path'
const ajnaContractsPath = path.join(__dirname, 'packages/ajna-contracts/contracts')
const dmaContractsPath = path.join(__dirname, 'packages/dma-contracts/contracts')
const directoriesToSymlink = ['ajna', 'chainlink', 'tokens']
/*
* Symlink the contracts from ajna-contracts to dma-contracts.
* This is necessary because the DMA contracts need to be able to access the contracts and build artifacts
* from the ajna-contracts package.
* This allows the ajna system to be deployed to a node during testing in dma-contracts and enables dma-library development
* and testing against ajna prior to ajna being deployed to mainnet and testnets.
*/
directoriesToSymlink.forEach(dir => {
const sourcePath = path.join(ajnaContractsPath, dir)
const destinationPath = path.join(dmaContractsPath, dir)
if (fs.existsSync(destinationPath)) {
fs.unlinkSync(destinationPath)
console.log(`Removed existing symlink ${destinationPath}`)
}
fs.symlinkSync(sourcePath, destinationPath, 'dir')
console.log(`Symlinked ${sourcePath} to ${destinationPath}`)
})