Repository navigation
Conversation
…e output directory
Do not automatically run plugin tests when contract are being tested.
Each plugin under `hardhat/` now has its own package.json (dependencies, peer dependencies, files, exports), a tsconfig.json, and its code under `src/`. They are built to `dist/` with tsc through their `prepare` script, linked from the root package.json as `file:` dev dependencies, and imported by name from hardhat.config.ts. - Fix the type errors surfaced by compiling the plugins with tsc (strict mode, verbatimModuleSyntax, explicit `.ts` import extensions). - docgen: copy the handlebars themes to `dist/` and load compiled `.js` theme helpers. - oz-contracts-helpers: declare the network-helpers plugin dependency. - Add `plugins:prepare` and `plugins:test` root scripts, and rebuild the plugins in CI when node_modules is restored from cache.
|
|
Review the following changes in direct dependencies. Learn more about Socket for GitHub.
|
…kages # Conflicts: # hardhat/hardhat-exposed/src/internal/manifest.ts # hardhat/hardhat-exposed/test/incremental-generation.test.js
This branch has not been deployed
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The four Hardhat plugins under
hardhat/(hardhat-exposed,hardhat-oz-contracts-helpers,hardhat-solidity-docgen,hardhat-transpiler) become standalone npm packages, so they can be published and reused outside this repository.Changes
src/(plugin.ts→src/index.ts), apackage.json(dependencies, peer dependencies,exports,files) and atsconfig.json.preparecompilessrc/todist/withtsc.hardhat-exposed'spackage.jsonfollows the previoushardhat-exposed(v0.3.x) package.file:dev dependencies of the root package and are imported by name inhardhat.config.ts.npm install/npm cibuilds them through theirpreparescript.sourcecondition pointing tosrc/index.ts, enabled by the root.npmrc(node-options=--conditions=source). Within the repository,npm run …/npx hardhatload the plugins' TypeScript sources, so edits don't require a rebuild. Published consumers still getdist/.checks.ymlsetsnpm_config_node_options, since npm'snode-optionsreplacesNODE_OPTIONS(which carries--max_old_space_size).npm run plugins:preparerebuilds all plugins,npm run plugins:testruns their tests (currently onlyhardhat-exposed, whose tests move tohardhat/hardhat-exposed/test/, plus unit tests for its manifest inmanifest.test.js).node_modulesis restored from cache, since the cache doesn't containdist/.pluginsworkflow builds (type-checks) the plugins and runsnpm run plugins:test, on changes underhardhat/, the rootpackage.json/package-lock.json, or the setup action.tsc(strict,noUncheckedIndexedAccess,verbatimModuleSyntax):.tsextensions on relative imports (rewritten to.json emit),import typefor type-only imports.hardhat-exposed: thebuildoverride takesTaskArgumentsand casts it.hardhat-solidity-docgen: copies the.hbsthemes todist/, and loads theme helpers from eitherhelpers.js(compiled built-in theme) orhelpers.ts(user templates).hardhat-oz-contracts-helpers: declares@nomicfoundation/hardhat-network-helpersas a plugin dependency (it already relied onnetworkHelpers).Testing
npm run plugins:test: 30 passing.hardhat docgenoutput is identical to the one produced by the previous (in-tree) plugin code.hardhat transpile(after applyingupgradeable.patch) output is identical to the one produced by the previous plugin code.hardhat teston a suite using the helpers and exposed contracts passes.Open questions
hardhat-exposed@0.4.0, others0.1.0) andrepositoryfields.