Skip to content
This repository has been archived by the owner on Feb 26, 2024. It is now read-only.

Build codec and preserve docs as part of bootstrap #5823

Merged
merged 1 commit into from
Jan 10, 2023
Merged

Conversation

cds-amal
Copy link
Member

@cds-amal cds-amal commented Jan 9, 2023

PR description

This PR extends the build process to generate documentation for both codec and preserve. If either fails, we will be alerted and can correct at the time of failure.

First call yarn prepare and allow each package to build, then call yarn build docs to generate typedocs for built packagers, avoiding dependency build issues.

Motivation: #5821

Testing instructions

Build and verify codec and preserve docs are created.

Documentation

  • No label doc-change-required

Breaking changes and new features

  • No breaking changes

Now if codec or preserve fails building docs, CI will fail.

First call `yarn prepare` and allow each package to build, then call
`yarn bulid docs` to generate typedocs for built packagers, avoiding
dependency build issues.
Copy link
Contributor

@dongmingh dongmingh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I test commands yarn docs and yarn prepare and observe many warning messages of references not included in the documentation for codec as listed below. Both codec and preserve docs are created.

yarn docs
yarn run v1.22.11
$ lerna run docs --stream --concurrency=1
lerna notice cli v5.6.2
lerna info versioning independent
lerna info Executing command in 2 packages: "yarn run docs"
@truffle/codec: $ ./scripts/generate-docs
@truffle/codec: Warning: EventEntry, defined at ../abi-utils/dist/lib/types.d.ts:24, is referenced by @truffle/codec.AnonymousDecoding.abi but not included in the documentation.
@truffle/codec: Warning: ConstructorEntry, defined at ../abi-utils/dist/lib/types.d.ts:11, is referenced by @truffle/codec.ConstructorDecoding.abi but not included in the documentation.
@truffle/codec: Warning: FunctionEntry, defined at ../abi-utils/dist/lib/types.d.ts:4, is referenced by @truffle/codec.FunctionDecoding.abi but not included in the documentation.
@truffle/codec: Warning: FallbackEntry, defined at ../abi-utils/dist/lib/types.d.ts:16, is referenced by @truffle/codec.MessageDecoding.abi but not included in the documentation.
@truffle/codec: Warning: ReceiveEntry, defined at ../abi-utils/dist/lib/types.d.ts:20, is referenced by @truffle/codec.MessageDecoding.abi but not included in the documentation.
@truffle/codec: Warning: ErrorEntry, defined at ../abi-utils/dist/lib/types.d.ts:30, is referenced by @truffle/codec.RevertMessageDecoding.abi but not included in the documentation.
@truffle/codec: Warning: ContractObject, defined at ../contract-schema/spec/index.d.ts:75, is referenced by @truffle/decoder.ContractDecoder.artifact but not included in the documentation.
@truffle/codec: Warning: ProviderAdapter, defined at ../encoder/dist/adapter.d.ts:54, is referenced by @truffle/decoder.ContractDecoder.providerAdapter but not included in the documentation.
@truffle/codec: Warning: ProjectEncoder, defined at ../encoder/dist/encoders.d.ts:11, is referenced by @truffle/decoder.ContractInstanceDecoder.encoder but not included in the documentation.
@truffle/codec: Warning: StorageCache, defined at ../decoder/lib/types.ts:118, is referenced by @truffle/decoder.ContractInstanceDecoder.storageCache but not included in the documentation.
@truffle/codec: Warning: CodeCache, defined at ../decoder/lib/types.ts:126, is referenced by @truffle/decoder.ProjectDecoder.codeCache but not included in the documentation.
@truffle/codec: Warning: Provider, defined at ../encoder/dist/adapter.d.ts:50, is referenced by @truffle/decoder.DecoderSettings.provider but not included in the documentation.
@truffle/codec: Warning: Abi, defined at ../abi-utils/dist/lib/types.d.ts:1, is referenced by @truffle/encoder.ContractEncoder.abi but not included in the documentation.
@truffle/codec: Warning: ENSCache, defined at ../encoder/lib/encoders.ts:31, is referenced by @truffle/encoder.ProjectEncoder.ensCache but not included in the documentation.
@truffle/codec: Warning: Provider, defined at ../encoder/lib/adapter.ts:122, is referenced by @truffle/encoder.ProjectEncoder.provider but not included in the documentation.
@truffle/codec: Warning: ConstructorCalldataAndReturndataAllocation, defined at lib/abi-data/allocate/types.ts:82, is referenced by @truffle/codec.AbiData.Allocate.CalldataAndReturndataAllocation but not included in the documentation.
@truffle/codec: Warning: Abi, defined at ../contract-schema/spec/index.d.ts:13, is referenced by @truffle/codec.Compilations.Contract.abi but not included in the documentation.
@truffle/codec: Warning: Bytecode, defined at ../compile-common/dist/src/types.d.ts:22, is referenced by @truffle/codec.Compilations.Contract.bytecode but not included in the documentation.
@truffle/codec: Warning: ImmutableReferences, defined at ../contract-schema/spec/index.d.ts:197, is referenced by @truffle/codec.Compilations.Contract.immutableReferences but not included in the documentation.
@truffle/codec: Warning: Compilation, defined at ../compile-common/dist/src/types.d.ts:2, is referenced by @truffle/codec.Compilations.ProjectInfoCommon.commonCompilations but not included in the documentation.
@truffle/codec: Warning: CalldataAllocations, defined at lib/abi-data/allocate/types.ts:67, is referenced by @truffle/codec.Evm.AllocationInfo.calldata but not included in the documentation.
@truffle/codec: Warning: EventAllocations, defined at lib/abi-data/allocate/types.ts:118, is referenced by @truffle/codec.Evm.AllocationInfo.event but not included in the documentation.
@truffle/codec: Warning: NumberFormatter, defined at lib/export.ts:30, is referenced by @truffle/codec.Export.NativizeOptions.numberFormatter but not included in the documentation.
@truffle/codec: Warning: ContractInfo, defined at ../decoder/lib/types.ts:132, is referenced by @truffle/decoder.ContractDecoder.getContractInfo.getContractInfo but not included in the documentation.
@truffle/codec: Warning: RegularizedBlockSpecifier, defined at lib/types.ts:907, is referenced by @truffle/decoder.ContractDecoder.regularizeBlock.regularizeBlock but not included in the documentation.
@truffle/codec: Warning: ContractConstructorObject, defined at ../decoder/lib/types.ts:336, is referenced by @truffle/decoder.forContract.forContract.contract but not included in the documentation.
@truffle/codec: Warning: ContractInstanceObject, defined at ../decoder/lib/types.ts:342, is referenced by @truffle/decoder.forContractInstance.forContractInstance.contract but not included in the documentation.
@truffle/codec: Warning: ContractConstructorObject, defined at ../encoder/lib/types.ts:140, is referenced by @truffle/encoder.forContract.forContract.contract but not included in the documentation.
@truffle/codec: Warning: ContractInstanceObject, defined at ../encoder/lib/types.ts:146, is referenced by @truffle/encoder.forContractInstance.forContractInstance.contract but not included in the documentation.
@truffle/codec: Warning: EncoderInfoInternal, defined at ../encoder/lib/types.ts:57, is referenced by @truffle/encoder.forProjectInternal.forProjectInternal.info but not included in the documentation.
@truffle/codec: Warning: AbiAllocation, defined at lib/abi-data/allocate/types.ts:46, is referenced by @truffle/codec.AbiData.Allocate.AbiAllocations.__index but not included in the documentation.
@truffle/codec: Warning: CalldataArgumentAllocation, defined at lib/abi-data/allocate/types.ts:103, is referenced by @truffle/codec.AbiData.Allocate.CalldataAllocation.arguments but not included in the documentation.
@truffle/codec: Warning: ReturnImmutableAllocation, defined at lib/abi-data/allocate/types.ts:211, is referenced by @truffle/codec.AbiData.Allocate.ConstructorReturndataAllocation.immutables but not included in the documentation.
@truffle/codec: Warning: EventArgumentAllocation, defined at lib/abi-data/allocate/types.ts:145, is referenced by @truffle/codec.AbiData.Allocate.EventAllocation.arguments but not included in the documentation.
@truffle/codec: Warning: ReturndataArgumentAllocation, defined at lib/abi-data/allocate/types.ts:205, is referenced by @truffle/codec.AbiData.Allocate.ReturnValueReturndataAllocation.arguments but not included in the documentation.
@truffle/codec: Warning: Abi.Entry, defined at ../abi-utils/dist/lib/types.d.ts:2, is referenced by @truffle/codec.Ast.Utils.definitionToAbi.definitionToAbi but not included in the documentation.
@truffle/codec: Warning: CompilationAndContract, defined at lib/compilations/utils.ts:74, is referenced by @truffle/codec.Compilations.Utils.findCompilationAndContract.findCompilationAndContract but not included in the documentation.
@truffle/codec: Warning: DecoderOptions, defined at lib/types.ts:688, is referenced by @truffle/codec.AbiData.Decode.decodeAbi.decodeAbi.options but not included in the documentation.
@truffle/codec: Warning: Parameter, defined at ../abi-utils/dist/lib/types.d.ts:35, is referenced by @truffle/codec.AbiData.Import.abiParameterToType.abiParameterToType.abi but not included in the documentation.
@truffle/codec: Warning: CompiledContract, defined at ../compile-common/dist/src/types.d.ts:38, is referenced by @truffle/codec.Compilations.Utils.shimArtifacts.shimArtifacts.artifacts but not included in the documentation.
@truffle/codec: Warning: CompilationOptions, defined at lib/compilations/utils.ts:66, is referenced by @truffle/codec.Compilations.Utils.shimContracts.shimContracts.options but not included in the documentation.
@truffle/codec: Info: Documentation generated at ./dist/docs
@truffle/codec: Info: JSON written to ./dist/api.json
@truffle/preserve: $ typedoc --options ./docs/typedoc.json
@truffle/preserve: Info: Documentation generated at ./dist/docs
@truffle/preserve: Info: JSON written to ./docs/api.json
lerna success run Ran npm script 'docs' in 2 packages in 4.9s:
lerna success - @truffle/codec
lerna success - @truffle/preserve
✨  Done in 5.42s.

@cds-amal cds-amal changed the title Add codec and preserve typedoc creation to build process Build codec and preserve docs as part of bootstrap Jan 9, 2023
@cds-amal cds-amal requested review from eggplantzzz and gnidan January 9, 2023 23:19
@cds-amal
Copy link
Member Author

@dongmingh This PR introduces a build step to alert us if doc generation fails. Previously, docs failed to build and we had no way of knowing when. See #5821

@lsqproduction
Copy link
Contributor

In the PR descriptions, it said yarn build docs, do you mean yarn run docs?

Copy link
Contributor

@eggplantzzz eggplantzzz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i like it

Copy link
Contributor

@dongmingh dongmingh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@cds-amal Thanks for explanations. The changes look good.

@cds-amal cds-amal merged commit 147698d into develop Jan 10, 2023
@cds-amal cds-amal deleted the build-all-docs branch January 10, 2023 22:43
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants