Skip to content

Commit

Permalink
chore: format all files (incl .nr) (#5)
Browse files Browse the repository at this point in the history
* chore: format with dprint

* chore: format `nr` files with `rustfmt`

* chore: include style check in ci workflow

* chore: rename tests workflow to main

For consistency with other zk-kit repos

* fix: fix yml indentation

* fix: fix output name typo in test workflow

* fix: add id value to step job

* refactor: rename main workflow
  • Loading branch information
sripwoud authored Jul 2, 2024
1 parent 66bcda8 commit e9df1bf
Show file tree
Hide file tree
Showing 27 changed files with 532 additions and 363 deletions.
32 changes: 16 additions & 16 deletions .commitlintrc.js
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
const fs = require("node:fs")
const path = require("node:path")
const fs = require('node:fs')
const path = require('node:path')

const packages = fs.readdirSync(path.resolve(__dirname, "packages"))
const packages = fs.readdirSync(path.resolve(__dirname, 'packages'))

module.exports = {
extends: ["@commitlint/config-conventional"],
prompt: {
scopes: [...packages],
markBreakingChangeMode: true,
allowCustomIssuePrefix: false,
allowEmptyIssuePrefix: false,
issuePrefixes: [
{
value: "re",
name: "re: ISSUES related"
}
]
}
extends: ['@commitlint/config-conventional'],
prompt: {
scopes: [...packages],
markBreakingChangeMode: true,
allowCustomIssuePrefix: false,
allowEmptyIssuePrefix: false,
issuePrefixes: [
{
value: 're',
name: 're: ISSUES related',
},
],
},
}
32 changes: 32 additions & 0 deletions .dprint.jsonc
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
{
"exec": {
"commands": [{
"command": "rustfmt",
"exts": ["nr"],
}],
},
"prettier": {
"singleQuote": true,
},
"typescript": {
"quoteProps": "asNeeded",
"quoteStyle": "preferSingle",
"semiColons": "asi",
"useBraces": "preferNone",
},
"excludes": [
"**/node_modules",
"yarn.lock",
".yarn",
"packages/merkle-trees/src/globals.nr",
],
"plugins": [
"https://plugins.dprint.dev/json-0.19.3.wasm",
"https://plugins.dprint.dev/markdown-0.17.1.wasm",
"https://plugins.dprint.dev/typescript-0.91.1.wasm",
"https://plugins.dprint.dev/exec-0.4.4.json@c207bf9b9a4ee1f0ecb75c594f774924baf62e8e53a2ce9d873816a408cecbf7",
"https://plugins.dprint.dev/toml-0.6.2.wasm",
// keep it last so that it is used only for exts that other plugins don't handle (yaml)
"https://plugins.dprint.dev/prettier-0.40.0.json@68c668863ec834d4be0f6f5ccaab415df75336a992aceb7eeeb14fdf096a9e9c",
],
}
6 changes: 3 additions & 3 deletions .github/ISSUE_TEMPLATE/---bug.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@ If applicable, add screenshots to help explain your problem.

**Technologies (please complete the following information):**

- Node.js version
- NPM version
- Solidity version
- Node.js version
- NPM version
- Solidity version

**Additional context**
Add any other context about the problem here.
14 changes: 7 additions & 7 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,10 @@

<!-- Please check if the PR fulfills these requirements. -->

- [ ] My code follows the style guidelines of this project
- [ ] I have performed a self-review of my code
- [ ] I have commented my code, particularly in hard-to-understand areas
- [ ] My changes generate no new warnings
- [ ] I have run `yarn test` without getting any errors
- [ ] I have added tests that prove my fix is effective or that my feature works
- [ ] New and existing unit tests pass locally with my changes
- [ ] My code follows the style guidelines of this project
- [ ] I have performed a self-review of my code
- [ ] I have commented my code, particularly in hard-to-understand areas
- [ ] My changes generate no new warnings
- [ ] I have run `yarn test` without getting any errors
- [ ] I have added tests that prove my fix is effective or that my feature works
- [ ] New and existing unit tests pass locally with my changes
46 changes: 46 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
name: main

on:
push:
branches: [main]
pull_request:

concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true

jobs:
changed-files:
runs-on: ubuntu-latest
outputs:
any_nr_changed: ${{ steps.changed-files.outputs.any_changed }}
steps:
- uses: actions/checkout@v4
- uses: tj-actions/changed-files@v44
id: changed-files
with:
files: |
packages/**/*.{nr,toml}
Nargo.toml
style:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 20
cache: yarn
- run: yarn
- run: yarn check

test:
needs: changed-files
if: needs.changed-files.outputs.any_nr_changed == 'true'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: noir-lang/noirup@v0.1.3
with:
toolchain: 0.26.0
- run: nargo test
72 changes: 36 additions & 36 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,43 +1,43 @@
name: release

permissions:
contents: write
contents: write

on:
push:
tags:
- "*"
push:
tags:
- '*'

jobs:
release:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Install Node.js
uses: actions/setup-node@v4
with:
node-version: 20
cache: yarn
registry-url: "https://registry.npmjs.org"

- name: Authentication
run: |
echo npmAuthToken: "$NODE_AUTH_TOKEN" >> ./.yarnrc.yml
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

- name: Install dependencies
run: yarn

- name: Publish packages
run: yarn version:publish
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

- run: yarn version:release
env:
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
release:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Install Node.js
uses: actions/setup-node@v4
with:
node-version: 20
cache: yarn
registry-url: 'https://registry.npmjs.org'

- name: Authentication
run: |
echo npmAuthToken: "$NODE_AUTH_TOKEN" >> ./.yarnrc.yml
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

- name: Install dependencies
run: yarn

- name: Publish packages
run: yarn version:publish
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

- run: yarn version:release
env:
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
45 changes: 0 additions & 45 deletions .github/workflows/tests.yml

This file was deleted.

2 changes: 1 addition & 1 deletion .lintstagedrc.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
"**/*.{js,json,md,yml,yaml}": "prettier --write"
"**/*.{js,json,md,nr,toml,yml,yaml}": "yarn fmt"
}
6 changes: 3 additions & 3 deletions .prettierrc.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"semi": false,
"arrowParens": "always",
"trailingComma": "none"
"semi": false,
"arrowParens": "always",
"trailingComma": "none"
}
30 changes: 15 additions & 15 deletions CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,24 +17,24 @@ diverse, inclusive, and healthy community.
Examples of behavior that contributes to a positive environment for our
community include:

- Demonstrating empathy and kindness toward other people
- Being respectful of differing opinions, viewpoints, and experiences
- Giving and gracefully accepting constructive feedback
- Accepting responsibility and apologizing to those affected by our mistakes,
and learning from the experience
- Focusing on what is best not just for us as individuals, but for the
overall community
- Demonstrating empathy and kindness toward other people
- Being respectful of differing opinions, viewpoints, and experiences
- Giving and gracefully accepting constructive feedback
- Accepting responsibility and apologizing to those affected by our mistakes,
and learning from the experience
- Focusing on what is best not just for us as individuals, but for the
overall community

Examples of unacceptable behavior include:

- The use of sexualized language or imagery, and sexual attention or
advances of any kind
- Trolling, insulting or derogatory comments, and personal or political attacks
- Public or private harassment
- Publishing others' private information, such as a physical or email
address, without their explicit permission
- Other conduct which could reasonably be considered inappropriate in a
professional setting
- The use of sexualized language or imagery, and sexual attention or
advances of any kind
- Trolling, insulting or derogatory comments, and personal or political attacks
- Public or private harassment
- Publishing others' private information, such as a physical or email
address, without their explicit permission
- Other conduct which could reasonably be considered inappropriate in a
professional setting

## Enforcement Responsibilities

Expand Down
44 changes: 22 additions & 22 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ Pull requests are great if you want to add a feature or fix a bug. Here's a quic

7. Push to your fork and submit a pull request on our `main` branch. Please provide us with some explanation of why you made the changes you made. For new features make sure to explain a standard use case to us.

> [!NOTE]
> [!NOTE]\
> When a new package is created or a new feature is added to the repository, the contributor will be added to the `.github/CODEOWNERS` file to review and approve any future changes to their code.
## CI (Github Actions) Tests
Expand Down Expand Up @@ -65,17 +65,17 @@ The **header** is mandatory and the **scope** of the header is optional.

The type must be one of the following:

- feat: A new feature
- fix: A bug fix
- docs: Documentation only changes
- style: Changes that do not affect the meaning of the code (white-space, formatting, missing semi-colons, etc)
- refactor: A code change that neither fixes a bug nor adds a feature (improvements of the code structure)
- perf: A code change that improves the performance
- test: Adding missing or correcting existing tests
- build: Changes that affect the build system or external dependencies (example scopes: gulp, npm)
- ci: Changes to CI configuration files and scripts (example scopes: travis, circle)
- chore: Other changes that don't modify src or test files
- revert: Reverts a previous commit
- feat: A new feature
- fix: A bug fix
- docs: Documentation only changes
- style: Changes that do not affect the meaning of the code (white-space, formatting, missing semi-colons, etc)
- refactor: A code change that neither fixes a bug nor adds a feature (improvements of the code structure)
- perf: A code change that improves the performance
- test: Adding missing or correcting existing tests
- build: Changes that affect the build system or external dependencies (example scopes: gulp, npm)
- ci: Changes to CI configuration files and scripts (example scopes: travis, circle)
- chore: Other changes that don't modify src or test files
- revert: Reverts a previous commit

#### Scope

Expand All @@ -85,23 +85,23 @@ The scope should be the name of the npm package affected (as perceived by the pe

The subject contains a succinct description of the change:

- Use the imperative, present tense: "change" not "changed" nor "changes"
- Don't capitalize the first letter
- No dot (.) at the end
- Use the imperative, present tense: "change" not "changed" nor "changes"
- Don't capitalize the first letter
- No dot (.) at the end

#### Body

Just as in the subject, use the imperative, present tense: "change" not "changed" nor "changes". The body should include the motivation for the change and contrast this with previous behavior.

### Branch rules

- There must be a `main` branch, used only for the releases.
- Avoid long descriptive names for long-lived branches.
- Use kebab-case (no CamelCase).
- Use grouping tokens (words) at the beginning of your branch names (in a similar way to the `type` of commit).
- Define and use short lead tokens to differentiate branches in a way that is meaningful to your workflow.
- Use slashes to separate parts of your branch names.
- Remove branch after merge if it is not important.
- There must be a `main` branch, used only for the releases.
- Avoid long descriptive names for long-lived branches.
- Use kebab-case (no CamelCase).
- Use grouping tokens (words) at the beginning of your branch names (in a similar way to the `type` of commit).
- Define and use short lead tokens to differentiate branches in a way that is meaningful to your workflow.
- Use slashes to separate parts of your branch names.
- Remove branch after merge if it is not important.

Examples:

Expand Down
Loading

0 comments on commit e9df1bf

Please sign in to comment.