Skip to content

Commit

Permalink
Adding prettier command and running it for the first time
Browse files Browse the repository at this point in the history
Signed-off-by: ytimocin <[email protected]>
  • Loading branch information
ytimocin committed Sep 10, 2024
1 parent 897f2aa commit fd548b4
Show file tree
Hide file tree
Showing 617 changed files with 8,016 additions and 8,613 deletions.
94 changes: 47 additions & 47 deletions .devcontainer/contributor/devcontainer.json
Original file line number Diff line number Diff line change
@@ -1,50 +1,50 @@
{
"name": "Radius - Contributor",
// For details see https://github.com/radius-project/radius/tree/main/docs/contributing/contributing-code/contributing-code-prerequisites
"image": "mcr.microsoft.com/devcontainers/base:ubuntu",
"features": {
//Git and GitHub Setup
"ghcr.io/devcontainers/features/git:1": {},
"ghcr.io/devcontainers/features/github-cli:1": {},
//Programming languages
"ghcr.io/devcontainers/features/go:1": {},
"ghcr.io/guiyomh/features/gotestsum:0.1.1": {},
"ghcr.io/devcontainers/features/node:1": {},
"ghcr.io/devcontainers-contrib/features/typescript:2": {},
"ghcr.io/devcontainers/features/python:1": {},
//Container and K8s
"ghcr.io/devcontainers/features/kubectl-helm-minikube:1": {
"minikube": "none"
},
"ghcr.io/devcontainers/features/docker-in-docker:2": {
"version": "latest",
"moby": true
},
//Tools
"ghcr.io/eitsupi/devcontainer-features/jq-likes:2": {},
"ghcr.io/mpriscella/features/kind:1": {},
"ghcr.io/dhoeric/features/stern:1": {},
//Dapr
"ghcr.io/dapr/cli/dapr-cli:0": {}
"name": "Radius - Contributor",
// For details see https://github.com/radius-project/radius/tree/main/docs/contributing/contributing-code/contributing-code-prerequisites
"image": "mcr.microsoft.com/devcontainers/base:ubuntu",
"features": {
//Git and GitHub Setup
"ghcr.io/devcontainers/features/git:1": {},
"ghcr.io/devcontainers/features/github-cli:1": {},
//Programming languages
"ghcr.io/devcontainers/features/go:1": {},
"ghcr.io/guiyomh/features/gotestsum:0.1.1": {},
"ghcr.io/devcontainers/features/node:1": {},
"ghcr.io/devcontainers-contrib/features/typescript:2": {},
"ghcr.io/devcontainers/features/python:1": {},
//Container and K8s
"ghcr.io/devcontainers/features/kubectl-helm-minikube:1": {
"minikube": "none"
},
"customizations": {
"vscode": {
"extensions": [
"redhat.vscode-yaml",
"golang.go",
"ms-python.python",
"ms-python.vscode-pylance",
"ms-azuretools.rad-vscode-bicep",
"ms-kubernetes-tools.vscode-kubernetes-tools",
"ms-azuretools.vscode-dapr",
"ms-vscode.makefile-tools"
]
}
"ghcr.io/devcontainers/features/docker-in-docker:2": {
"version": "latest",
"moby": true
},
// Prerequisite for Code Generation, see https://github.com/radius-project/radius/tree/main/docs/contributing/contributing-code/contributing-code-prerequisites#code-generation
// Adding workspace as safe directory to avoid permission issues
"postCreateCommand": "git config --global --add safe.directory /workspaces/radius && cd typespec && npm ci && npm install -g autorest && npm install -g oav && go install sigs.k8s.io/controller-tools/cmd/[email protected] && go install go.uber.org/mock/[email protected]",
"hostRequirements": {
"memory": "8gb"
},
}
//Tools
"ghcr.io/eitsupi/devcontainer-features/jq-likes:2": {},
"ghcr.io/mpriscella/features/kind:1": {},
"ghcr.io/dhoeric/features/stern:1": {},
//Dapr
"ghcr.io/dapr/cli/dapr-cli:0": {}
},
"customizations": {
"vscode": {
"extensions": [
"redhat.vscode-yaml",
"golang.go",
"ms-python.python",
"ms-python.vscode-pylance",
"ms-azuretools.rad-vscode-bicep",
"ms-kubernetes-tools.vscode-kubernetes-tools",
"ms-azuretools.vscode-dapr",
"ms-vscode.makefile-tools"
]
}
},
// Prerequisite for Code Generation, see https://github.com/radius-project/radius/tree/main/docs/contributing/contributing-code/contributing-code-prerequisites#code-generation
// Adding workspace as safe directory to avoid permission issues
"postCreateCommand": "git config --global --add safe.directory /workspaces/radius && cd typespec && npm ci && npm install -g autorest && npm install -g oav && go install sigs.k8s.io/controller-tools/cmd/[email protected] && go install go.uber.org/mock/[email protected]",
"hostRequirements": {
"memory": "8gb"
}
}
87 changes: 48 additions & 39 deletions .github/scripts/radius-bot.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,39 +15,44 @@ limitations under the License.
*/

module.exports = async ({ github, context }) => {
if (context.eventName === 'issue_comment' && context.payload.action === 'created') {
try {
await handleIssueCommentCreate({ github, context });
} catch (error) {
console.log(`[handleIssueCommentCreate] unexpected error: ${error}`);
}
if (
context.eventName === "issue_comment" &&
context.payload.action === "created"
) {
try {
await handleIssueCommentCreate({ github, context });
} catch (error) {
console.log(`[handleIssueCommentCreate] unexpected error: ${error}`);
}
}
}
};

// Handle issue comment create event.
async function handleIssueCommentCreate({ github, context }) {
const payload = context.payload;
const issue = context.issue;
const isFromPulls = !!payload.issue.pull_request;
const commentBody = payload.comment.body;
const username = context.actor;
const payload = context.payload;
const issue = context.issue;
const isFromPulls = !!payload.issue.pull_request;
const commentBody = payload.comment.body;
const username = context.actor;

if (!commentBody) {
console.log('[handleIssueCommentCreate] comment body not found, exiting.');
return;
}
if (!commentBody) {
console.log("[handleIssueCommentCreate] comment body not found, exiting.");
return;
}

const commandParts = commentBody.split(/\s+/);
const command = commandParts.shift();
const commandParts = commentBody.split(/\s+/);
const command = commandParts.shift();

switch (command) {
case '/assign':
await cmdAssign(github, issue, isFromPulls, username);
break;
default:
console.log(`[handleIssueCommentCreate] command ${command} not found, exiting.`);
break;
}
switch (command) {
case "/assign":
await cmdAssign(github, issue, isFromPulls, username);
break;
default:
console.log(
`[handleIssueCommentCreate] command ${command} not found, exiting.`,
);
break;
}
}

/**
Expand All @@ -58,18 +63,22 @@ async function handleIssueCommentCreate({ github, context }) {
* @param {*} username is the user who trigger the command
*/
async function cmdAssign(github, issue, isFromPulls, username) {
if (isFromPulls) {
console.log('[cmdAssign] pull requests not supported, skipping command execution.');
return;
} else if (issue.assignees && issue.assignees.length !== 0) {
console.log('[cmdAssign] issue already has assignees, skipping command execution.');
return;
}
if (isFromPulls) {
console.log(
"[cmdAssign] pull requests not supported, skipping command execution.",
);
return;
} else if (issue.assignees && issue.assignees.length !== 0) {
console.log(
"[cmdAssign] issue already has assignees, skipping command execution.",
);
return;
}

await github.rest.issues.addAssignees({
owner: issue.owner,
repo: issue.repo,
issue_number: issue.number,
assignees: [username],
});
await github.rest.issues.addAssignees({
owner: issue.owner,
repo: issue.repo,
issue_number: issue.number,
assignees: [username],
});
}
2 changes: 2 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# .prettierignore
pkg/validator/testdata/put-environments-invalid-json.json
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,4 @@
ARROW := \033[34;1m=>\033[0m

# order matters for these
include build/help.mk build/version.mk build/build.mk build/util.mk build/generate.mk build/test.mk build/docker.mk build/recipes.mk build/install.mk build/debug.mk
include build/help.mk build/version.mk build/build.mk build/util.mk build/generate.mk build/test.mk build/docker.mk build/recipes.mk build/install.mk build/debug.mk build/prettier.mk
15 changes: 15 additions & 0 deletions build/prettier.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
.PHONY: prettier-install prettier-check prettier-format me prettier
prettier-install:
npm install --global prettier

prettier-check:
npx prettier --check "*/**/*.{ts,js,mjs,json}"

prettier-format:
npx prettier --write "*/**/*.{ts,js,mjs,json}"

me:
@echo "🪄💄🪄💄🪄💄"

prettier:
@npx prettier --write "*/**/*.{ts,js,mjs,json}"
35 changes: 16 additions & 19 deletions deploy/devcontainer-feature/src/radcli/devcontainer-feature.json
Original file line number Diff line number Diff line change
@@ -1,21 +1,18 @@
{
"name": "Radius CLI",
"id": "radcli",
"version": "0.1.0",
"dependsOn": {
"ghcr.io/dhoeric/features/oras:1": {}
},
"description": "Installs the Radius CLI along with needed dependencies.",
"documentationURL": "https://docs.radapp.io/installation/",
"options": {
"version": {
"type": "string",
"proposals": [
"latest",
"edge"
],
"default": "latest",
"description": "Select or enter an Radius CLI version. Use 'latest' for the latest stable version, 'edge' for the latest development version, or a specific version number (e.g. 0.28.0)."
}
"name": "Radius CLI",
"id": "radcli",
"version": "0.1.0",
"dependsOn": {
"ghcr.io/dhoeric/features/oras:1": {}
},
"description": "Installs the Radius CLI along with needed dependencies.",
"documentationURL": "https://docs.radapp.io/installation/",
"options": {
"version": {
"type": "string",
"proposals": ["latest", "edge"],
"default": "latest",
"description": "Select or enter an Radius CLI version. Use 'latest' for the latest stable version, 'edge' for the latest development version, or a specific version number (e.g. 0.28.0)."
}
}
}
}
32 changes: 16 additions & 16 deletions deploy/devcontainer-feature/test/radcli/scenarios.json
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
{
"edge": {
"image": "mcr.microsoft.com/devcontainers/base:ubuntu",
"features": {
"radcli": {
"version": "edge"
}
}
},
"version": {
"image": "mcr.microsoft.com/devcontainers/base:ubuntu",
"features": {
"radcli": {
"version": "0.27.0"
}
}
"edge": {
"image": "mcr.microsoft.com/devcontainers/base:ubuntu",
"features": {
"radcli": {
"version": "edge"
}
}
}
},
"version": {
"image": "mcr.microsoft.com/devcontainers/base:ubuntu",
"features": {
"radcli": {
"version": "0.27.0"
}
}
}
}
10 changes: 3 additions & 7 deletions grafana/radius-overview-dashboard.json
Original file line number Diff line number Diff line change
Expand Up @@ -82,9 +82,7 @@
"justifyMode": "auto",
"orientation": "auto",
"reduceOptions": {
"calcs": [
"last"
],
"calcs": ["last"],
"fields": "",
"values": false
},
Expand Down Expand Up @@ -626,9 +624,7 @@
"options": {
"orientation": "vertical",
"reduceOptions": {
"calcs": [
"min"
],
"calcs": ["min"],
"fields": "",
"values": false
},
Expand Down Expand Up @@ -1511,4 +1507,4 @@
"uid": "Wh5JpyxVz",
"version": 5,
"weekStart": ""
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3527,4 +3527,4 @@
"flags": 0,
"functions": {}
}
]
]
Original file line number Diff line number Diff line change
Expand Up @@ -1166,4 +1166,4 @@
"flags": 0,
"functions": {}
}
]
]
Original file line number Diff line number Diff line change
Expand Up @@ -1288,4 +1288,4 @@
}
}
}
]
]
Original file line number Diff line number Diff line change
Expand Up @@ -666,4 +666,4 @@
}
}
}
]
]
2 changes: 1 addition & 1 deletion hack/bicep-types-radius/generated/index.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,4 +49,4 @@
"version": "latest",
"isSingleton": false
}
}
}
Loading

0 comments on commit fd548b4

Please sign in to comment.