Input undefined -- library use case for Truffle
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Idoneità per principianti
- 25/100
- Tipo di issue
- Funzionalità
- Chiarezza
- Abbastanza chiara
- Stato di attività
- Ferma
- Stack tecnologico
- node.js, solidity, typescript
- Ambito
- documentation, tooling
Direzione di ricerca
Start with the README's raw docgen example and the buildSite path in site.js, then inspect clone.js where originalBuild.input is parsed. Reproduce the Truffle build/contracts/CurrencyManager.json input with the supplied docify.js script; done means the documented raw-input form no longer fails, or the README clearly states the required input shape and supported limitation.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Trying to get solidity-docgen (installed from npm, specified as '^0.6.0-beta.17' in package.json) to compile files for me, without transitioning from Truffle to Hardhat, by using the following script:
const { docgen } = require('solidity-docgen');
const fs = require("fs");
const json = JSON.parse(fs.readFileSync('build/contracts/CurrencyManager.json'));
// console.log(json);
docgen([{ output: json }]).then(res => {
console.log(res);
});
Note that the CurrencyManager.json file is the json output after truffle compiled -- it does have an 'ast' field present, as indicated by the readme. To my understanding, this this script is equivalent the current readme example usage, although I am of course confused by what exactly the 'output' parameter needs to be. The error I get if I run this:
undefined:1
undefined
^
SyntaxError: Unexpected token u in JSON at position 0
at JSON.parse (<anonymous>)
at clone (/home/miko/solidity/karmaToken/node_modules/solidity-docgen/dist/utils/clone.js:9:29)
at buildSite (/home/miko/solidity/karmaToken/node_modules/solidity-docgen/dist/site.js:27:41)
at main (/home/miko/solidity/karmaToken/node_modules/solidity-docgen/dist/main.js:20:39)
at Object.<anonymous> (/home/miko/solidity/karmaToken/docify.js:6:1)
at Module._compile (node:internal/modules/cjs/loader:1101:14)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1153:10)
at Module.load (node:internal/modules/cjs/loader:981:32)
at Function.Module._load (node:internal/modules/cjs/loader:822:12)
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:81:12)
Taking a look at the offending function in site.js, I get the following -- the error occurs when we try to pass originalBuild.input to some function clone, where originalBuild is actually the element inside the array I passed in the config. The error seems to be happening because the code required the 'input' field to be json-parseable, while it is recommended to be undefined in the readme.
function buildSite(builds, siteConfig) {
var _a;
const assign = typeof siteConfig.pages === 'string' ? exports.pageAssigner[siteConfig.pages] : siteConfig.pages;
const seen = new Set();
const items = [];
const pages = {};
for (const originalBuild of builds) {
// Clone because we will mutate in order to add item context.
const output = (0, clone_1.clone)(originalBuild.output);
const input = (0, clone_1.clone)(originalBuild.input);
const deref = (0, utils_1.astDereferencer)(output);
const build = { input, output, deref };
for (const { ast: file } of Object.values(build.output.sources)) {
I understand that this project is mostly concerned with supporting the hardhat use-case. Was hoping for clarification if this raw use-case is even possible and, if so, how we should go about doing it.
👍👍 Thanks for supporting!
- Lingua principale
- TypeScript
- Stelle
- 460
- Fork
- 111
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Preparare l'ambiente
Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di OpenZeppelin/solidity-docgen
-
Support for Hardhat 3Aperta
Difficoltà 5/5 Più di una settimana Idoneità per principianti 35/100
OpenZeppelin/solidity-docgen#471 · 2 reazioni ·
-
using $ as a return parameter name doesn't workForse già presa @pucedoteth l’ha presa 56 giorni fa. Aperta
Difficoltà 3/5 1-2 giorni Idoneità per principianti 45/100
OpenZeppelin/solidity-docgen#464 ·
-
Difficoltà 3/5 1-2 giorni Idoneità per principianti 45/100
OpenZeppelin/solidity-docgen#454 ·
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 48/100
OpenZeppelin/solidity-docgen#439 · 2 commenti ·
-
Use docgen in the browserAperta
Difficoltà 5/5 Più di una settimana Idoneità per principianti 25/100
OpenZeppelin/solidity-docgen#437 · 4 commenti ·
Tutte le issue di OpenZeppelin/solidity-docgen
Issue simili
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 70/100
jeanibarz/knowledge-base-mcp-server#1268 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 78/100
Koenkk/zigbee-herdsman-converters#13820 ·
I maintainer di solito rispondono entro 2 giorni
-
[prefer-expect-resolves] autofix leaves a stray ")" when the awaited expression is parenthesizedAperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
jest-community/eslint-plugin-jest#2052 ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 70/100
-
Wallet functions throws TypeError when the wallet has no account IDForse già presa @Medhansh-741 l’ha presa oggi. Apertabug
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
hiero-ledger/hiero-sdk-js#4781 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno