Initial commit
This commit is contained in:
17
hardhat/install-deps.js
Normal file
17
hardhat/install-deps.js
Normal file
@@ -0,0 +1,17 @@
|
||||
import fs from 'fs';
|
||||
import { execSync } from 'child_process';
|
||||
import path from 'path';
|
||||
|
||||
const parentDirectory = process.cwd();
|
||||
if (parentDirectory.includes('hardhat') && !fs.existsSync(path.join(parentDirectory, 'hardhat'))) {
|
||||
parentDirectory = path.join(parentDirectory, '..');
|
||||
}
|
||||
|
||||
const hardhatDirectory = path.join(parentDirectory, 'hardhat');
|
||||
|
||||
if (!fs.existsSync(path.join(hardhatDirectory, 'node_modules'))) {
|
||||
console.log('Hardhat directory node_modules not found. Installing...');
|
||||
execSync('npm install', { stdio: 'inherit', cwd: hardhatDirectory });
|
||||
} else {
|
||||
console.log('Hardhat directory node_modules already exists. Skipping.');
|
||||
}
|
||||
Reference in New Issue
Block a user