Skip to content

Commit

Permalink
Merge pull request #4692 from NomicFoundation/solidity-survey
Browse files Browse the repository at this point in the history
Add solidity survey banner and message
  • Loading branch information
fvictorio authored Dec 19, 2023
2 parents 377796b + 3adbba2 commit 79fe92c
Show file tree
Hide file tree
Showing 5 changed files with 38 additions and 6 deletions.
5 changes: 5 additions & 0 deletions .changeset/three-boxes-divide.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"hardhat": patch
---

Added a temporary message about the 2023 Solidtiy Developer Survey
4 changes: 2 additions & 2 deletions docs/redirects.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -100,9 +100,9 @@ const customRedirects = [
permanent: false,
},
{
source: "/solidity-survey-2022",
source: "/solidity-survey-2023",
destination:
"https://cryptpad.fr/form/#/2/form/view/HuPIRv4gvziSV0dPV1SJncKzYJXTVc8LGCaMfLUoj2c/",
"https://cryptpad.fr/form/#/2/form/view/pV-DdryeJoYUWvW+gXsFaMNynEY7t5mUsgeD1urgwSE",
permanent: false,
},
{
Expand Down
7 changes: 4 additions & 3 deletions docs/src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,14 @@ export const SOCIALS_LINKS = {
[SocialsEnum.DISCORD]: "/discord",
};

export const BANNER_LINK = "https://nomic.foundation/hiring";
export const BANNER_LINK =
"https://cryptpad.fr/form/#/2/form/view/pV-DdryeJoYUWvW+gXsFaMNynEY7t5mUsgeD1urgwSE";

export const PRIVACY_POLICY_PATH = "/privacy-policy.html";

export const bannerContent = {
text: "Join the Hardhat team! Nomic Foundation is hiring",
shortText: "Join the Hardhat team! We are hiring",
text: "Please take a few minutes to complete the 2023 Solidity Survey",
shortText: "Complete the 2023 Solidity Survey here",
href: BANNER_LINK,
};

Expand Down
12 changes: 11 additions & 1 deletion packages/hardhat-core/src/internal/cli/cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ import { saveFlamegraph } from "../core/flamegraph";
import { Analytics } from "./analytics";
import { ArgumentsParser } from "./ArgumentsParser";
import { enableEmoji } from "./emoji";
import { createProject } from "./project-creation";
import { createProject, showSoliditySurveyMessage } from "./project-creation";
import { confirmHHVSCodeInstallation, confirmTelemetryConsent } from "./prompt";
import {
InstallationState,
Expand Down Expand Up @@ -358,6 +358,16 @@ async function main() {
) {
await suggestInstallingHardhatVscode();

// we show the solidity survey message if the tests failed and only
// 1/3 of the time
if (
process.exitCode !== 0 &&
Math.random() < 0.3333 &&
process.env.HARDHAT_HIDE_SOLIDITY_SURVEY_MESSAGE !== "true"
) {
showSoliditySurveyMessage();
}

// we show the viaIR warning only if the tests failed
if (process.exitCode !== 0) {
showViaIRWarning(resolvedConfig);
Expand Down
16 changes: 16 additions & 0 deletions packages/hardhat-core/src/internal/cli/project-creation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -362,6 +362,20 @@ function showStarOnGitHubMessage() {
console.log(chalk.cyan(" https://github.com/NomicFoundation/hardhat"));
}

export function showSoliditySurveyMessage() {
if (new Date() > new Date("2024-01-07 23:39")) {
// the survey has finished
return;
}

console.log();
console.log(
chalk.cyan(
"Please take a moment to complete the 2023 Solidity Survey: https://hardhat.org/solidity-survey-2023"
)
);
}

export async function createProject() {
printAsciiLogo();

Expand Down Expand Up @@ -407,6 +421,7 @@ export async function createProject() {

console.log();
showStarOnGitHubMessage();
showSoliditySurveyMessage();

return;
}
Expand Down Expand Up @@ -512,6 +527,7 @@ export async function createProject() {
console.log("See the README.md file for some example tasks you can run");
console.log();
showStarOnGitHubMessage();
showSoliditySurveyMessage();
}

async function canInstallRecommendedDeps() {
Expand Down

0 comments on commit 79fe92c

Please sign in to comment.