Skip to content

Commit

Permalink
chore: simplify contribution process
Browse files Browse the repository at this point in the history
Ref: #259
Signed-off-by: Tomas Dvorak <[email protected]>
  • Loading branch information
Tomas2D committed Dec 20, 2024
1 parent e10b053 commit 3dcc1e3
Show file tree
Hide file tree
Showing 5 changed files with 44 additions and 10 deletions.
5 changes: 5 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,11 @@ jobs:
cache: "yarn"
- name: Install dependencies
run: yarn install --immutable
- name: Copyright Headers
uses: actions/setup-go@v3
with:
go-version: 1.23
run: yarn copyright
- name: Code Lint
run: yarn lint
- name: Code Format
Expand Down
11 changes: 7 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,8 @@
},
"lint-staged": {
"*.{ts,js}": "eslint --fix",
"*": "prettier --ignore-unknown --write"
"*": ["prettier --ignore-unknown --write", "yarn copyright"],
"docs/**/*.md": "yarn docs:links"
},
"prettier": {
"printWidth": 100,
Expand Down Expand Up @@ -76,7 +77,8 @@
},
"hooks": {
"before:init": [
"[ \"$RELEASE_SKIP_DOCS\" = \"true\" ] && echo 'Skipping docs check.' || yarn docs:check",
"yarn docs:check",
"[ \"$RELEASE_SKIP_DOCS_LINKS\" = \"true\" ] && echo 'Skipping docs links check.' || yarn docs:links:all",
"yarn lint",
"yarn ts:check",
"yarn test:all"
Expand Down Expand Up @@ -140,8 +142,9 @@
"start:bee": "yarn start -- examples/agents/bee.ts",
"start:telemetry": "BEE_FRAMEWORK_INSTRUMENTATION_ENABLED=true yarn start --import ./examples/helpers/telemetry.ts",
"docs:build": "embedme --source-root=. docs/**/*.md && cp *.md docs/ && yarn lint:fix docs/ && yarn prettier --write docs/",
"docs:check": "embedme --source-root=. docs/**/*.md --verify && yarn docs:links",
"docs:links": "linkinator \"**/*.md\" --timeout=10000 --retry --markdown --directory-listing --skip node_modules --skip \"https://ai.meta.com/blog/meta-llama-3-1/\" ",
"docs:check": "embedme --source-root=. docs/**/*.md --verify",
"docs:links": "linkinator . --timeout=10000 --retry --markdown --directory-listing --skip node_modules --skip CHANGELOG.md --skip docs/CHANGELOG.md --skip \"https://ai.meta.com/blog/meta-llama-3-1/\" --include",
"docs:links:all": "yarn docs:links docs/**/*.md",
"docs:watch": "docsify serve ./docs --open",
"lint": "yarn eslint",
"lint:fix": "yarn eslint --fix",
Expand Down
20 changes: 15 additions & 5 deletions scripts/copyright.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,11 @@

set -e

TARGETS=(${TARGETS:-src dist tests scripts})
if [ "$#" -eq 0 ]; then
TARGETS=("src" "dist" "tests" "scripts")
else
TARGETS=("$@")
fi

# Path to the package.json file
PACKAGE_JSON_PATH="./package.json"
Expand Down Expand Up @@ -43,11 +47,17 @@ if ! command -v nwa &> /dev/null && command -v go &> /dev/null; then
export PATH=$PATH:$(go env GOPATH)/bin
fi

TYPE=${TYPE:-add}

if command -v nwa &> /dev/null; then
nwa add -l apache -c "$AUTHOR" "${TARGETS[@]}"
nwa "${TYPE}" -l apache -c "$AUTHOR" "${TARGETS[@]}"
elif command -v docker &> /dev/null; then
docker run --rm -v "${PWD}:/src" ghcr.io/b1nary-gr0up/nwa:main add -l apache -c "$AUTHOR" "${TARGETS[@]}"
docker run --rm -v "${PWD}:/src" ghcr.io/b1nary-gr0up/nwa:main "${TYPE}" -l apache -c "$AUTHOR" "${TARGETS[@]}"
else
echo "Error: 'nwa' is not available. Either install it manually or install go/docker."
exit 1
if [ "$COPYRIGHT_STRICT" = true ] ; then
echo "Error: 'nwa' is not available. Either install it manually or install go/docker."
exit 1
else
echo "Copyright script was not executed because the nwa package could not be installed."
fi
fi
Original file line number Diff line number Diff line change
Expand Up @@ -50,4 +50,4 @@ rm -rf "${SCRIPT_DIR}"/{dist,dts,types}

yarn run lint:fix "${GRPC_TYPES_PATH}"
yarn prettier --write "${GRPC_TYPES_PATH}"
TARGETS="$GRPC_TYPES_PATH" yarn copyright
yarn copyright "${GRPC_TYPES_PATH}"
16 changes: 16 additions & 0 deletions src/tools/openapi.test.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,19 @@
/**
* Copyright 2024 IBM Corp.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

import { OpenAPITool } from "@/tools/openapi.js";
import { verifyDeserialization } from "@tests/e2e/utils.js";
const cat_spec =
Expand Down

0 comments on commit 3dcc1e3

Please sign in to comment.