hardhat-deploy
Advanced tools
Comparing version
@@ -58,6 +58,7 @@ import { Deployment, DeploymentsExtension, DeploymentSubmission } from '../types'; | ||
maxPriorityFeePerGas?: string; | ||
tagsRequireAll?: boolean; | ||
}): Promise<{ | ||
[name: string]: Deployment; | ||
}>; | ||
executeDeployScripts(deployScriptsPaths: string[], tags?: string[]): Promise<void>; | ||
executeDeployScripts(deployScriptsPaths: string[], tags?: string[], tagsRequireAll?: boolean): Promise<void>; | ||
export(options: { | ||
@@ -64,0 +65,0 @@ exportAll?: string; |
@@ -693,3 +693,3 @@ "use strict"; | ||
try { | ||
await this.executeDeployScripts([externalContracts.deploy], tags); | ||
await this.executeDeployScripts([externalContracts.deploy], tags, options.tagsRequireAll); | ||
} | ||
@@ -703,7 +703,7 @@ finally { | ||
const deployPaths = utils_1.getDeployPaths(this.network); | ||
await this.executeDeployScripts(deployPaths, tags); | ||
await this.executeDeployScripts(deployPaths, tags, options.tagsRequireAll); | ||
await this.export(options); | ||
return this.db.deployments; | ||
} | ||
async executeDeployScripts(deployScriptsPaths, tags) { | ||
async executeDeployScripts(deployScriptsPaths, tags = [], tagsRequireAll = false) { | ||
const wasWrittingToFiles = this.db.writeDeploymentsToFiles; | ||
@@ -752,35 +752,17 @@ // TODO loop over companion networks ? | ||
// console.log("get tags if any for " + scriptFilePath); | ||
let scriptTags = deployFunc.tags; | ||
if (scriptTags !== undefined) { | ||
if (typeof scriptTags === 'string') { | ||
scriptTags = [scriptTags]; | ||
let scriptTags = deployFunc.tags || []; | ||
if (typeof scriptTags === 'string') { | ||
scriptTags = [scriptTags]; | ||
} | ||
for (const tag of scriptTags) { | ||
if (tag.indexOf(',') >= 0) { | ||
throw new Error('Tag cannot contain commas'); | ||
} | ||
for (const tag of scriptTags) { | ||
if (tag.indexOf(',') >= 0) { | ||
throw new Error('Tag cannot contains commas'); | ||
} | ||
const bag = scriptPathBags[tag] || []; | ||
scriptPathBags[tag] = bag; | ||
bag.push(scriptFilePath); | ||
} | ||
const bag = scriptPathBags[tag] || []; | ||
scriptPathBags[tag] = bag; | ||
bag.push(scriptFilePath); | ||
} | ||
// console.log("tags found " + scriptFilePath, scriptTags); | ||
if (tags !== undefined) { | ||
let found = false; | ||
if (scriptTags !== undefined) { | ||
for (const tagToFind of tags) { | ||
for (const tag of scriptTags) { | ||
if (tag === tagToFind) { | ||
scriptFilePaths.push(scriptFilePath); | ||
found = true; | ||
break; | ||
} | ||
} | ||
if (found) { | ||
break; | ||
} | ||
} | ||
} | ||
} | ||
else { | ||
if (tagsRequireAll && tags.every(tag => scriptTags.includes(tag)) | ||
|| !tagsRequireAll && (tags.length == 0 || tags.some(tag => scriptTags.includes(tag)))) { | ||
scriptFilePaths.push(scriptFilePath); | ||
@@ -787,0 +769,0 @@ } |
@@ -331,2 +331,3 @@ "use strict"; | ||
.addOptionalParam('tags', 'specify which deploy script to execute via tags, separated by commas', undefined, types.string) | ||
.addFlag('tagsRequireAll', 'execute only deploy scripts containing all the tags specified') | ||
.addOptionalParam('write', 'whether to write deployments to file', true, types.boolean) | ||
@@ -356,2 +357,3 @@ .addOptionalParam('pendingtx', 'whether to save pending tx', false, types.boolean) | ||
maxPriorityFeePerGas: args.priorityfee, | ||
tagsRequireAll: args.tagsRequireAll, | ||
}); | ||
@@ -366,2 +368,3 @@ if (args.reportGas) { | ||
.addOptionalParam('tags', 'specify which deploy script to execute via tags, separated by commas', undefined, types.string) | ||
.addFlag('tagsRequireAll', 'execute only deploy scripts containing all the tags specified') | ||
.addOptionalParam('write', 'whether to write deployments to file', true, types.boolean) | ||
@@ -484,2 +487,3 @@ .addOptionalParam('pendingtx', 'whether to save pending tx', false, types.boolean) | ||
.addOptionalParam('tags', 'specify which deploy script to execute via tags, separated by commas', undefined, types.string) | ||
.addFlag('tagsRequireAll', 'execute only deploy scripts containing all the tags specified') | ||
.addOptionalParam('write', 'whether to write deployments to file', undefined, types.boolean) | ||
@@ -486,0 +490,0 @@ // TODO pendingtx |
{ | ||
"name": "hardhat-deploy", | ||
"version": "0.11.36", | ||
"version": "0.11.37", | ||
"description": "Hardhat Plugin For Replicable Deployments And Tests", | ||
@@ -5,0 +5,0 @@ "repository": "github:wighawag/hardhat-deploy", |
@@ -984,2 +984,3 @@ /* eslint-disable @typescript-eslint/no-explicit-any */ | ||
maxPriorityFeePerGas?: string; | ||
tagsRequireAll?: boolean; | ||
} = { | ||
@@ -1050,3 +1051,3 @@ log: false, | ||
try { | ||
await this.executeDeployScripts([externalContracts.deploy], tags); | ||
await this.executeDeployScripts([externalContracts.deploy], tags, options.tagsRequireAll); | ||
} finally { | ||
@@ -1061,3 +1062,3 @@ this.db.onlyArtifacts = undefined; | ||
await this.executeDeployScripts(deployPaths, tags); | ||
await this.executeDeployScripts(deployPaths, tags, options.tagsRequireAll); | ||
@@ -1071,3 +1072,4 @@ await this.export(options); | ||
deployScriptsPaths: string[], | ||
tags?: string[] | ||
tags: string[] = [], | ||
tagsRequireAll = false, | ||
): Promise<void> { | ||
@@ -1119,34 +1121,17 @@ const wasWrittingToFiles = this.db.writeDeploymentsToFiles; | ||
// console.log("get tags if any for " + scriptFilePath); | ||
let scriptTags = deployFunc.tags; | ||
if (scriptTags !== undefined) { | ||
if (typeof scriptTags === 'string') { | ||
scriptTags = [scriptTags]; | ||
let scriptTags = deployFunc.tags || []; | ||
if (typeof scriptTags === 'string') { | ||
scriptTags = [scriptTags]; | ||
} | ||
for (const tag of scriptTags) { | ||
if (tag.indexOf(',') >= 0) { | ||
throw new Error('Tag cannot contain commas'); | ||
} | ||
for (const tag of scriptTags) { | ||
if (tag.indexOf(',') >= 0) { | ||
throw new Error('Tag cannot contains commas'); | ||
} | ||
const bag = scriptPathBags[tag] || []; | ||
scriptPathBags[tag] = bag; | ||
bag.push(scriptFilePath); | ||
} | ||
const bag = scriptPathBags[tag] || []; | ||
scriptPathBags[tag] = bag; | ||
bag.push(scriptFilePath); | ||
} | ||
// console.log("tags found " + scriptFilePath, scriptTags); | ||
if (tags !== undefined) { | ||
let found = false; | ||
if (scriptTags !== undefined) { | ||
for (const tagToFind of tags) { | ||
for (const tag of scriptTags) { | ||
if (tag === tagToFind) { | ||
scriptFilePaths.push(scriptFilePath); | ||
found = true; | ||
break; | ||
} | ||
} | ||
if (found) { | ||
break; | ||
} | ||
} | ||
} | ||
} else { | ||
if (tagsRequireAll && tags.every(tag => scriptTags.includes(tag)) | ||
|| !tagsRequireAll && (tags.length == 0 || tags.some(tag => scriptTags.includes(tag)))) { | ||
scriptFilePaths.push(scriptFilePath); | ||
@@ -1153,0 +1138,0 @@ } |
@@ -405,2 +405,6 @@ import './type-extensions'; | ||
) | ||
.addFlag( | ||
'tagsRequireAll', | ||
'execute only deploy scripts containing all the tags specified' | ||
) | ||
.addOptionalParam( | ||
@@ -450,2 +454,3 @@ 'write', | ||
maxPriorityFeePerGas: args.priorityfee, | ||
tagsRequireAll: args.tagsRequireAll, | ||
}); | ||
@@ -466,2 +471,6 @@ if (args.reportGas) { | ||
) | ||
.addFlag( | ||
'tagsRequireAll', | ||
'execute only deploy scripts containing all the tags specified' | ||
) | ||
.addOptionalParam( | ||
@@ -621,2 +630,6 @@ 'write', | ||
) | ||
.addFlag( | ||
'tagsRequireAll', | ||
'execute only deploy scripts containing all the tags specified' | ||
) | ||
.addOptionalParam( | ||
@@ -623,0 +636,0 @@ 'write', |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
Found 1 instance in 1 package
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
Found 1 instance in 1 package
11880869
01508
0.27%164293
-0.01%