Skip to content

Commit

Permalink
feat: auto-commit (#263)
Browse files Browse the repository at this point in the history
* feat: auto-commit

* add latest

* remove go for now

* add pnpm

* switch places and prettier write

* add before build step

* use git-auto-commit

* Apply automatic changes

* setup prettier and run all of it each time

* hardcode rust-peer

* Apply automatic changes

* check

* remove lock file mentions

* restore rust-peer version

* Apply automatic changes

---------

Co-authored-by: shamsartem <[email protected]>
  • Loading branch information
shamsartem and shamsartem authored Jun 1, 2023
1 parent 84c33a2 commit 1221d0f
Show file tree
Hide file tree
Showing 16 changed files with 4,815 additions and 2,604 deletions.
1 change: 0 additions & 1 deletion .github/actions/replace-version/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ inputs:
versions:
type: string


runs:
using: "node16"
main: "dist/index.js"
2 changes: 1 addition & 1 deletion .github/e2e/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ networks:
driver: bridge
ipam:
config:
- subnet: 10.50.10.0/24
- subnet: 10.50.10.0/24

services:
aurora:
Expand Down
8 changes: 2 additions & 6 deletions .github/renovate.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
{
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
"extends": [
"config:base"
],
"extends": ["config:base"],
"semanticCommitType": "chore",
"semanticCommitScope": "deps",
"enabledManagers": ["npm", "github-actions"],
Expand All @@ -18,9 +16,7 @@
},
{
"matchManagers": ["npm"],
"matchPackagePatterns": [
"@fluencelabs/.*"
],
"matchPackagePatterns": ["@fluencelabs/.*"],
"semanticCommitType": "fix",
"semanticCommitScope": "deps",
"schedule": "at any time"
Expand Down
12 changes: 11 additions & 1 deletion .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ jobs:
version: "${{ steps.snapshot.outputs.version }}"

permissions:
contents: read
contents: write
id-token: write

steps:
Expand Down Expand Up @@ -161,6 +161,12 @@ jobs:
}
}
- name: Run on each commit
env:
FLUENCE_USER_DIR: "${{ github.workspace }}/tmp/.fluence"
if: ${{ github.event_name == 'pull_request' && github.repository == github.event.repository.full_name }}
run: pnpm on-each-commit

- name: Run tests
env:
FLUENCE_ENV: "${{ inputs.fluence-env }}"
Expand All @@ -178,3 +184,7 @@ jobs:
- name: Dump rust-peer logs
if: always()
uses: jwalton/gh-docker-logs@v2

- name: Auto-commit
if: ${{ github.event_name == 'pull_request' && github.repository == github.event.repository.full_name }}
uses: stefanzweifel/git-auto-commit-action@v4
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ oclif.manifest.json

# for ease of development
/fluence.yaml
/fluence-lock.yaml
/hosts.yaml
/workers.yaml
/deals.yaml
Expand Down
1 change: 0 additions & 1 deletion .husky/.gitignore

This file was deleted.

5 changes: 0 additions & 5 deletions .husky/pre-commit

This file was deleted.

2 changes: 0 additions & 2 deletions .huskyrc

This file was deleted.

2 changes: 2 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,5 @@ tmp
.fluence
package-lock.json
src/lib/compiled-aqua
pnpm-lock.yaml
CHANGELOG.md
2 changes: 0 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@ When you contribute, you have to be aware that your contribution is covered by *
- To use Fluence CLI in the development mode, run: `./bin/dev.js` (types are not checked in development mode because it's faster and more convenient to work with. Use typechecking provided by your IDE during development)
- To use Fluence CLI in the production mode, run `pnpm run build` first, then run: `./bin/run.js`. If you want to make sure you are running the actual package the users will use, do `pnpm build`, `pnpm pack` and install this tar package (the approach is used for tests)
- Don't name arguments or flags with names that contain underscore symbols because autogenerated links in markdown will not work
- pre-commit runs each time before you commit. It attempts to build and lint your project, runs prettier and generates docs/commands/README.md file.
- If you are using nvm and want to commit using VSCode, place `.huskyrc` file to your home directory
- Don't export anything from command files except for the command itself. If you need to share code between commands - create a separate file
- Avoid using `this` in commands except for inside `initCli` function. This style is easier to understand and there will be less stuff to refactor if instead of using methods on command object you simply use separate functions which can later be moved outside into a separate module for reuse in other commands
- Use `commandObj.error` (or `throw new CLIError`) for human readable errors. They will be reported to analytics as events. Use `throw new Error` (or `assert`) for unexpected errors. They will be reported to analytics as crashes.
Expand Down
4 changes: 2 additions & 2 deletions docs/commands/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ FLAGS
absolute. Will be created if it doesn't exists
-w, --watch Watch aqua file or folder for changes and recompile
--air Generate .air file instead of .ts
--common-js Use no extension in generated .ts file
--common-js Use no extension in generated .ts file imports
--const=<NAME=value>... Constants to be passed to the compiler
--dry Checks if compilation is succeeded, without output
--import=<path>... Path to a directory to import aqua files from. May be used several times
Expand All @@ -59,7 +59,7 @@ FLAGS
--no-input Don't interactively ask for any input from the user
--no-relay Do not generate a pass through the relay node
--no-xor Do not generate a wrapper that catches and displays errors
--old-fluence-js Generate TypeScript or JavaScript files for new JS Client
--old-fluence-js Generate TypeScript or JavaScript files for old fluence-js
--scheduled Generate air code for script storage. Without error handling wrappers and hops on relay.
Will ignore other options
Expand Down
2 changes: 1 addition & 1 deletion docs/configs/app-properties-services.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

Additional properties are allowed, as long as they follow this schema:

Service names as keys and Deployment results as values
Service names as keys and deployment results as values

* is optional

Expand Down
19 changes: 6 additions & 13 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,16 +25,16 @@
"build": "shx rm -rf dist && tsc -b",
"lint": "eslint . --ext .ts --ext .js",
"lint-fix": "eslint . --ext .ts --ext .js --cache --fix",
"prettier": "prettier --write .",
"find-dead-code": "ts-prune",
"postpack": "shx rm -f oclif.manifest.json",
"prepack": "pnpm before-build && pnpm build && oclif manifest && cd docs/commands && oclif readme --no-aliases",
"prepack": "pnpm before-build && pnpm build",
"jest": "node --experimental-vm-modules node_modules/jest/bin/jest.js",
"test": "shx rm -rf tmp && shx mkdir tmp && pnpm pack --pack-destination ./tmp && prettier --check '*.{ts,js}' && pnpm lint && pnpm circular && cd tmp && pnpm init && pnpm i ./fluencelabs-cli-${npm_package_version}.tgz && cd .. && ts-node ./test/setupTests.ts && pnpm jest",
"prepare": "node -e \"process.env.CI === undefined && require('husky').install()\"",
"check": "pnpm build && pnpm lint-fix && pnpm circular",
"test": "shx rm -rf tmp && shx mkdir tmp && pnpm pack --pack-destination ./tmp && cd tmp && pnpm init && pnpm i ./fluencelabs-cli-${npm_package_version}.tgz && cd .. && ts-node ./test/setupTests.ts && pnpm jest",
"check": "pnpm before-build && pnpm build && pnpm lint-fix && pnpm prettier && pnpm circular",
"circular": "madge --circular --extensions ts ./",
"pre-commit": "exitzero pnpm build && exitzero pnpm lint-fix && cd docs/commands && oclif readme --no-aliases && git add README.md",
"clean": "shx rm -rf .fluence && shx rm -rf fluence-lock.yaml && shx rm -rf fluence.yaml && shx rm -rf target && shx rm -rf Cargo.toml && shx rm -rf Cargo.lock && shx rm -rf hosts.yaml && shx rm -rf workers.yaml && shx rm -rf deals.yaml && shx rm -rf src/aqua && shx rm -rf src/ts && shx rm -rf src/js",
"on-each-commit": "pnpm check && pnpm gen-config-docs && cd docs/commands && oclif readme --no-aliases",
"clean": "shx rm -rf .fluence && shx rm -rf fluence.yaml && shx rm -rf target && shx rm -rf Cargo.toml && shx rm -rf Cargo.lock && shx rm -rf hosts.yaml && shx rm -rf workers.yaml && shx rm -rf deals.yaml && shx rm -rf src/aqua && shx rm -rf src/ts && shx rm -rf src/js",
"gen-config-docs": "shx rm -rf schemas && shx rm -rf docs/configs && ts-node ./src/schemas.ts && jsonschema2md -d schemas -o docs/configs -h false -f yaml -x schemas -n && ts-node ./src/schemas.ts -f"
},
"dependencies": {
Expand Down Expand Up @@ -97,11 +97,8 @@
"eslint-plugin-license-header": "^0.6.0",
"eslint-plugin-node": "^11.1.0",
"eslint-plugin-unused-imports": "^2",
"exitzero": "^1.0.1",
"globby": "^13",
"husky": "^8.0.3",
"jest": "^29.5.0",
"lint-staged": "^13.2.1",
"madge": "^6.0.0",
"oclif": "^3.7.3",
"prettier": "^2.8.4",
Expand Down Expand Up @@ -300,10 +297,6 @@
"tmp",
"resources"
],
"lint-staged": {
"*.ts": "prettier --write",
"*.js": "prettier --write"
},
"directories": {
"test": "test"
}
Expand Down
Loading

0 comments on commit 1221d0f

Please sign in to comment.