Skip to content

Commit

Permalink
setup for rewrite
Browse files Browse the repository at this point in the history
  • Loading branch information
frangio committed Dec 19, 2021
0 parents commit 6cc31b0
Show file tree
Hide file tree
Showing 8 changed files with 1,739 additions and 0 deletions.
32 changes: 32 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: Test

on:
push:
branches: [master]
pull_request: {}

jobs:
build:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
node-version: 12.x

- name: Cache pnpm modules
uses: actions/cache@v2
with:
path: ~/.pnpm-store
key: ${{ runner.os }}-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-
- uses: pnpm/[email protected]
with:
version: 6
run_install: true

- run: pnpm test
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
node_modules
*.tsbuildinfo
/dist
129 changes: 129 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,129 @@
# Changelog

## 0.5.16

- Change handling of circular dependencies to an incomplete but correct approach, fixing a potential issue with bad caching.

## 0.5.15

- Fix use of `@inheritdoc` in circularly dependent files.

## 0.5.14

- Add support for documenting structs and enums: `{{structs}}`, `{{ownStructs}}`, and likewise for enums.

## 0.5.13

- Fix a bug when parsing @custom NatSpec tags.

## 0.5.12

- Add support for @custom: NatSpec tags.

## 0.5.11

- Provide a `privateFunctions` array variable in the contract template.

## 0.5.10

- Add support for @inheritdoc NatSpec tag.

## 0.5.9

- Fix bug introduced in 0.5.8 for projects with dependencies.

## 0.5.8

- Fixed trimming of whitespace at the beginning of NatSpec lines.
- Fixed issues with ignored newlines in solc >= 0.6.9.

This may change the output slightly for all users of solc >= 0.6. This
shouldn't be an issue if the output format is Markdown.

## 0.5.7

- Fixed a bug that caused `solidity-docgen` to fail with solc >=0.7.1.

## 0.5.6

- Fixed a bug that prevented using solc 0.7 with the `--solc-module` option.

The built in compiler remains solc 0.6, but users who want to use the newer
compiler version can do so by installing the desired solc version and using the
flag `--solc-module`. Here's an example using npm aliases:

```
npm install -D solc-0.7@npm:solc@^0.7.0
npx solidity-docgen --solc-module solc-0.7
```

## 0.5.5

- Fixed a bug in the `contracts` output structure that would result in
contracts missing from the output if there was more than one defined in the
same Solidity source file.

This is technically a breaking change in how output paths are generated, but it
should not affect most people. In particular, users who follow the convention
of naming Solidity files by the contract that they contain will not be affected
at all. Users who follow a different convention and who use the `contracts`
output structure (the default) will see output files generated in a
different path.

## 0.5.4

- Added a `--helpers` (`-H`) option: a path to a file whose exports will be
registed as handlebars helpers.

## 0.5.2, 0.5.3

- Changed `--solc-module` option to use Node module resolution algorithm.

For example, if you've installed `[email protected]` alongside `solidity-docgen`, you
can now run `solidity-docgen --solc-module solc`.

This is a small breaking change. If you were using this option before, you need
to make sure its value is now something that Node recognizes as a module, such
as the name of an installed Node module or a path beginning with `./`, `../`,
or `/`.

## 0.5.1

- Fixed a bug in the npm package.

## 0.5.0

**This release contains breaking changes.**

- Replaced `--contract-pages` with `--output-structure [contracts|readmes|single]`.
- Changed default output structure. The new default is equivalent to the old `--contract-pages`.

If you were using `--contract-pages`, you should remove it, since it is the new
default. If you were using the previous defaults, you should now use
`--output-structure single` if you want a single page with all contracts, or
`--output-structure readmes` if you use READMEs to structure your output pages.

- Removed the default prelude template.

The prelude is an advanced feature that most users will not care about. It can
be used to create cross-references in your documentation. If you were using the
default templates before and you would like to keep the prelude, you will have
to copy them into your project. Take `contract.hbs` and `prelude.sample.hbs`
from the [`templates`](templates) directory, rename the latter to
`prelude.hbs`, and put them in a directory in your project. Then invoke
`solidity-docgen` with the `-t <templates-directory>` option.

There is one additional breaking change in 0.5.2. Please refer to the relevant
entry above.

## 0.4.1

- Implemented support for dependency imports in input contracts.

## 0.4.0

- Upgraded solc to 0.6.

If you would like to upgrade `solidity-docgen` but continue using the 0.5
compiler, you can install `[email protected]` in your project and run `solidity-docgen
--solc-module ./node_modules/solc`.
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2018 OpenZeppelin.

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
35 changes: 35 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# `solidity-docgen`

**Documentation generator for smart contract libraries.** Use the inline
documentation in your Solidity code for generating websites or any sort of
document.

The output is completely customizable through Handlebars templates that provide
easy access to all the metadata of your smart contract.

## Usage

> **Note:** Detailed usage information is not available yet. Please be patient!
```sh
npm install solidity-docgen
```

`solidity-docgen` takes as input a directory of contracts and `README`
documents. This directory is specified using the `--input`/`-i` flag,
defaulting to `./contracts`. It produces a set of files that it will place in
the output directory specified by `--output`/`-o`, defaulting to `./docs`.

```
solidity-docgen [ -i <input-dir> ] [ -o <output-dir> ] [ -t <templates-dir> ]
```

[NatSpec]: https://solidity.readthedocs.io/en/develop/natspec-format.html

### Solidity 0.7

The built in compiler remains solc 0.6, but users who want to use the newer compiler version can do so by installing the desired solc version and using the flag `--solc-module`. Here's an example using npm aliases:
```
npm install -D solc-0.7@npm:solc@^0.7.0
npx solidity-docgen --solc-module solc-0.7
```
34 changes: 34 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
{
"name": "solidity-docgen",
"version": "0.6.0",
"description": "Documentation generator for Solidity smart contracts.",
"repository": "github:OpenZeppelin/solidity-docgen",
"files": [
"dist",
"src",
"templates"
],
"scripts": {
"build": "tsc",
"docs": "oz-docs -c docs",
"docs:watch": "pnpm docs watch",
"test": "uvu",
"clean": "rimraf dist tsconfig.tsbuildinfo",
"prepare": "pnpm clean && pnpm build"
},
"dependencies": {
"handlebars": "^4.7.6"
},
"devDependencies": {
"code-style": "github:OpenZeppelin/code-style",
"openzeppelin-docs-utils": "github:OpenZeppelin/docs-utils",
"typescript": "^4.0.0"
},
"keywords": [
"solidity",
"api",
"documentation",
"generator"
],
"license": "MIT"
}
Loading

0 comments on commit 6cc31b0

Please sign in to comment.