Skip to content

Commit f369571

Browse files
authored
Merge pull request #274 from rmrk-team/docs-flow
Docs flow
2 parents d10218a + 71668f9 commit f369571

304 files changed

Lines changed: 83010 additions & 6463 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/npm-publish.yml

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
name: Publish npm package
2+
3+
on:
4+
release:
5+
types:
6+
- published
7+
8+
jobs:
9+
publish:
10+
runs-on: ubuntu-latest
11+
permissions:
12+
contents: read
13+
steps:
14+
- name: Checkout
15+
uses: actions/checkout@v4
16+
17+
- name: Setup Bun
18+
uses: oven-sh/setup-bun@v1
19+
with:
20+
bun-version: "1.3.4"
21+
22+
- name: Install dependencies
23+
run: bun install --frozen-lockfile
24+
25+
- name: Run tests
26+
run: bun run test
27+
28+
- name: Build artifacts
29+
run: bun run build:artifacts
30+
31+
- name: Check npm version
32+
id: npm
33+
run: |
34+
publish=$(bun -e "const pkg=require('./package.json'); const res=await fetch('https://registry.npmjs.org/' + encodeURIComponent(pkg.name)); if (!res.ok) { console.log('true'); } else { const data=await res.json(); console.log(data.versions && data.versions[pkg.version] ? 'false' : 'true'); }")
35+
echo "publish=$publish" >> $GITHUB_OUTPUT
36+
37+
- name: Configure npm auth
38+
if: steps.npm.outputs.publish == 'true'
39+
env:
40+
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
41+
run: echo "//registry.npmjs.org/:_authToken=${NPM_TOKEN}" > ~/.npmrc
42+
43+
- name: Publish
44+
if: steps.npm.outputs.publish == 'true'
45+
run: bun publish --access public

.github/workflows/prettier.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,10 @@ jobs:
88
prettier:
99
runs-on: ubuntu-latest
1010
steps:
11-
- uses: actions/checkout@v2
12-
- name: Run prettier
13-
uses: actions/setup-node@v1
11+
- uses: actions/checkout@v4
12+
- name: Setup Bun
13+
uses: oven-sh/setup-bun@v1
1414
with:
15-
node-version: "18"
16-
- run: yarn install
17-
- run: yarn prettier
15+
bun-version: "1.3.4"
16+
- run: bun install --frozen-lockfile
17+
- run: bun run prettier

.github/workflows/release-package.yml

Lines changed: 0 additions & 33 deletions
This file was deleted.

.github/workflows/run-tests.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,10 @@ jobs:
88
test:
99
runs-on: ubuntu-latest
1010
steps:
11-
- uses: actions/checkout@v2
12-
- name: Run unit tests
13-
uses: actions/setup-node@v1
11+
- uses: actions/checkout@v4
12+
- name: Setup Bun
13+
uses: oven-sh/setup-bun@v1
1414
with:
15-
node-version: "18"
16-
- run: yarn install
17-
- run: npx hardhat test
15+
bun-version: "1.3.4"
16+
- run: bun install --frozen-lockfile
17+
- run: bun run test

.gitignore

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,24 @@
11
node_modules
22
.env
3+
.env.local
4+
.env.*.local
35
coverage
46
coverage.json
57
typechain
68
typechain-types
79
temp
810
.idea
11+
.DS_Store
12+
*.log
13+
*.tsbuildinfo
914

1015
#Hardhat files
1116
cache
1217
artifacts
1318

19+
#Next.js
20+
.next
21+
out
22+
1423
#sec notes
1524
sec-review.md

README.md

Lines changed: 44 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,17 +10,54 @@ A set of Solidity smart contracts implementing [RMRK](https://rmrk.app) modular
1010
To use the RMRK legos and smart contracts contained in this repository, simply add them to your project:
1111

1212
```shell
13-
yarn add @rmrk-team/evm-contracts
13+
bun add @rmrk-team/evm-contracts
1414
```
1515

16-
or
16+
Once the dependency is added to your project, simply import the smart contracts you wish to utilize into your own smart
17+
contract.
18+
19+
## Development
1720

1821
```shell
19-
npm -i @rmrk-team/evm-contracts
22+
bun install
23+
bun run docs:import
24+
bun run test
25+
bun run coverage
26+
bun run build:artifacts
27+
bun run docs:prepare
28+
bun run docs:build
2029
```
2130

22-
Once the dependency is added to your project, simply import the smart contracts you wish to utilize into your own smart
23-
contract.
31+
## Docs workflow
32+
33+
Docs are built with Nextra/Next.js using the content in `pages/` plus the contract docs generated
34+
from `docs/`:
35+
36+
- `bun run docs:import` pulls the original `evm-docs` pages/components/public assets into this repo
37+
(run once, then edit locally).
38+
- `bun run docs:prepare` runs `hardhat dodoc`, syncs the generated contract docs into
39+
`pages/evm-package/`, and generates `_meta.json` navigation.
40+
- `bun run docs:build` runs `docs:prepare`, then `next build && next export` to emit the static site
41+
in `out/`.
42+
- `bun run docs:dev` runs the local docs dev server.
43+
44+
## Automation
45+
46+
On each push to `master`, Cloudflare Pages builds and deploys the docs using the repo settings from
47+
the CF UI.
48+
49+
On each published GitHub Release, GitHub Actions publishes the npm package: it installs
50+
dependencies with Bun, runs `bun run test`, runs `bun run build:artifacts`, and publishes the
51+
package with `bun publish --access public` when the package version is not already on npm.
52+
53+
Cloudflare Pages settings:
54+
55+
- **Build command**: `bun run docs:build`
56+
- **Output directory**: `out`
57+
58+
Required secrets for automation:
59+
60+
- `NPM_TOKEN` for npm publishing
2461

2562
## RMRK Legos
2663

@@ -32,7 +69,7 @@ So far we have created 6 modules as ERC proposals, all of which are ERC721 compa
3269
- Composable & Equippable: [ERC-6220: Composable NFTs utilizing Equippable Parts](https://eips.ethereum.org/EIPS/eip-6220)
3370
- Soulbound: [ERC-6454: Minimal Transferable NFT detection interface](https://eips.ethereum.org/EIPS/eip-6454)
3471
- Emotable: [ERC-7409: Public Non-Fungible Tokens Emote Repository](https://eips.ethereum.org/EIPS/eip-7409)
35-
- Dynamic Attributes: [ERC-7508: Dynamic On-Chain Token Attributes Repository ](https://eips.ethereum.org/EIPS/eip-7508)
36-
- ERC20-Holder: [ERC-7590: ERC-20 Holder Extension for NFTs ](https://eips.ethereum.org/EIPS/eip-7590)
72+
- Dynamic Attributes: [ERC-7508: Dynamic On-Chain Token Attributes Repository](https://eips.ethereum.org/EIPS/eip-7508)
73+
- ERC20-Holder: [ERC-7590: ERC-20 Holder Extension for NFTs](https://eips.ethereum.org/EIPS/eip-7590)
3774

3875
![RMRK Modules](/img/General_Overview_Modules.png)

0 commit comments

Comments
 (0)