Skip to content

Commit

Permalink
refactor(docs): reformatting docs (#454)
Browse files Browse the repository at this point in the history
  • Loading branch information
FuzzB0t authored Sep 16, 2023
1 parent 177cdbf commit e28b0cc
Show file tree
Hide file tree
Showing 12 changed files with 323,742 additions and 101 deletions.
10 changes: 7 additions & 3 deletions .github/workflows/build-docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ on:
pull_request:
branches: [main]

permissions:
contents: write
pull-requests: write

jobs:
build-docs:
runs-on: ubuntu-latest
Expand All @@ -27,16 +31,16 @@ jobs:
- 'packages/cli/src/schemas.zod.ts'
- name: Set up Node
if: ${{ steps.file-changes.outputs.schemas_any_changed == 'true' }}
if: ${{ steps.file-changes.outputs.schemas_any_changed }}
uses: actions/setup-node@v2
with:
node-version: '20.5.1'
- name: Build Dependencies
if: ${{ steps.file-changes.outputs.schemas_any_changed == 'true' }}
if: ${{ steps.file-changes.outputs.schemas_any_changed }}
run: |
npm ci
npm run build
- name: Build docs
if: ${{ steps.file-changes.outputs.schemas_any_changed == 'true' }}
if: ${{ steps.file-changes.outputs.schemas_any_changed }}
run: npm run docgen
8 changes: 6 additions & 2 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
[submodule "packages/contracts/lib/forge-std"]
path = packages/contracts/lib/forge-std
[submodule "examples/sample-foundry-project/lib/forge-std"]
path = examples/sample-foundry-project/lib/forge-std
url = https://github.com/foundry-rs/forge-std

[submodule "examples/sample-foundry-project/lib/cannon-std"]
path = examples/sample-foundry-project/lib/cannon-std
url = https://github.com/usecannon/cannon-std

[submodule "packages/contracts/lib/openzeppelin-contracts"]
path = packages/contracts/lib/openzeppelin-contracts
url = https://github.com/openzeppelin/openzeppelin-contracts
1 change: 1 addition & 0 deletions examples/sample-foundry-project/lib/cannon-std
Submodule cannon-std added at 321478
1 change: 1 addition & 0 deletions examples/sample-foundry-project/lib/forge-std
Submodule forge-std added at 1d9650
44 changes: 36 additions & 8 deletions packages/builder/src/schemas.zod.ts
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ export const contractSchema = z
)
),
/**
* Constructor or initializer args
* Constructor or initializer args
*/
args: z.array(argsUnion),
/**
Expand Down Expand Up @@ -163,10 +163,9 @@ export const importSchema = z
preset: z.string(),
/**
* Previous steps this step is dependent on
* @example
* ```toml
* depends = ['contract.Storage', 'import.Contract']
* ```
* depends = ['contract.Storage', 'import.Contract']
* ```
*/
depends: z.array(
z.string().refine(
Expand Down Expand Up @@ -224,6 +223,9 @@ export const invokeSchema = z
(val) => ({ message: `"${val}" must be a valid ethereum address` })
),

/**
* Specify a function to use as the 'from' value in a function call. Example `owner()`.
*/
fromCall: z.object({
/**
* The name of a view function to call on this contract. The result will be used as the from input.
Expand All @@ -244,6 +246,9 @@ export const invokeSchema = z
* Override transaction settings
*/
overrides: z.object({
/**
* Gas limit to send along with the transaction
*/
gasLimit: z.string().refine((val) => !!parseInt(val), { message: 'Gas limit is invalid' }),
}),
/**
Expand Down Expand Up @@ -361,17 +366,17 @@ export const provisionSchema = z
.object({
/**
* ID of the chain to import the package from
* @default - 13370
* Default - 13370
*/
chainId: z.number().int(),
/**
* Override the preset to use when provisioning this package.
* @default - "main"
* Default - "main"
*/
sourcePreset: z.string(),
/**
* Set the new preset to use for this package.
* @default - "main"
* Default - "main"
*/
targetPreset: z.string(),
/**
Expand Down Expand Up @@ -399,9 +404,21 @@ export const provisionSchema = z
);

export const routerSchema = z.object({
/**
* Set of contracts that will be passed to the router
*/
contracts: z.array(z.string()),
/**
* Address to pass to the from call
*/
from: z.string().optional(),
/**
* Used to force new copy of a contract (not actually used)
*/
salt: z.string().optional(),
/**
* List of steps that this action depends on
*/
depends: z.array(z.string()).optional(),
});

Expand Down Expand Up @@ -442,7 +459,6 @@ export const chainDefinitionSchema = z
keywords: z.array(z.string()),
/**
* Object that allows the definition of values for use in next steps
* @example
* ```toml
* [settings.owner]
* defaultValue: "some-eth-address"
Expand Down Expand Up @@ -470,9 +486,21 @@ export const chainDefinitionSchema = z
* @internal
*/
import: z.record(importSchema),
/**
* @internal
*/
provision: z.record(provisionSchema),
/**
* @internal
*/
contract: z.record(contractSchema),
/**
* @internal
*/
invoke: z.record(invokeSchema),
/**
* @internal
*/
router: z.record(routerSchema),
// ... there may be others that come from plugins
})
Expand Down
Loading

0 comments on commit e28b0cc

Please sign in to comment.