Skip to content

Commit 5d2cc90

Browse files
committed
fixup! chore(suggestion-bot): move into repo
1 parent eebb90a commit 5d2cc90

19 files changed

+59
-117
lines changed

.changeset/clean-towns-leave.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"suggestion-bot": patch
3+
---
4+
5+
Publish from rnx-kit

docsite/generate.js

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
const fs = require("node:fs");
33
const path = require("node:path");
44

5+
const UTF_8 = /** @type {const} */ ({ encoding: "utf-8" });
6+
57
const badges = [
68
"https://github\\.com/microsoft/rnx-kit/actions/workflows",
79
"https://img\\.shields\\.io",
@@ -12,6 +14,7 @@ const badgesRE = new RegExp(
1214
"g"
1315
);
1416

17+
const localImagesRE = /!\[(.*?)\]\(\.\/(.*?)\)/g;
1518
const titleRE = /# @rnx-kit\/(.*)/;
1619

1720
function copyContributing() {
@@ -33,19 +36,22 @@ function generateToolsSidebar() {
3336
continue;
3437
}
3538

36-
const content = fs.readFileSync(manifest, { encoding: "utf-8" });
37-
if (JSON.parse(content).private) {
39+
if (JSON.parse(fs.readFileSync(manifest, UTF_8)).private) {
3840
continue;
3941
}
4042

4143
const output = path.join("docs", "tools", `${pkg}.md`);
4244
if (!fs.existsSync(output)) {
43-
const content = fs.readFileSync(readme, { encoding: "utf-8" });
45+
const content = fs.readFileSync(readme, UTF_8);
4446
fs.writeFileSync(
4547
output,
4648
content
4749
.replace(titleRE, "# $1") // Remove scope from title
4850
.replace(badgesRE, "") // Remove badges
51+
.replace(
52+
localImagesRE,
53+
`![$1](${path.join("..", "..", path.dirname(readme), "$2")})`
54+
)
4955
);
5056
}
5157

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@
5151
"nx": "patch:nx@npm%3A22.5.4#~/.yarn/patches/nx-npm-22.5.4-3d43ac9c10.patch",
5252
"oxfmt": "catalog:",
5353
"oxlint": "catalog:",
54-
"suggestion-bot": "^4.0.0",
54+
"suggestion-bot": "workspace:*",
5555
"typescript": "catalog:"
5656
},
5757
"resolutions": {

packages/suggestion-bot/.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
*.d.ts
2+
*.d.ts.map

packages/suggestion-bot/README.md

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
# suggestion-bot
22

3-
[![build](https://github.com/tido64/suggestion-bot/actions/workflows/build.yml/badge.svg)](https://github.com/tido64/suggestion-bot/actions/workflows/build.yml)
3+
[![Build](https://github.com/microsoft/rnx-kit/actions/workflows/build.yml/badge.svg)](https://github.com/microsoft/rnx-kit/actions/workflows/build.yml)
44
[![npm version](https://img.shields.io/npm/v/suggestion-bot)](https://www.npmjs.com/package/suggestion-bot)
55

66
`suggestion-bot` submits code reviews with suggestions based on your diffs.
77

8-
![screenshot of code review with suggestions](docs/screenshot.png)
8+
![screenshot of code review with suggestions](./docs/screenshot.png)
99

1010
## Usage
1111

@@ -45,8 +45,7 @@ If your CI is hosted by Azure DevOps, replace `GITHUB_TOKEN` with
4545
-- or --
4646

4747
- Host your code on [Azure DevOps](https://dev.azure.com/)
48-
- An Azure DevOps
49-
[personal access token](https://docs.microsoft.com/en-us/azure/devops/organizations/accounts/use-personal-access-tokens-to-authenticate?view=azure-devops&tabs=preview-page)
48+
- An Azure DevOps [personal access token][ado-personal-access-token]
5049

5150
## Recipes
5251

@@ -73,11 +72,11 @@ If your CI is hosted by Azure DevOps, replace `GITHUB_TOKEN` with
7372
runs-on: ubuntu-latest
7473
steps:
7574
- name: Set up Node.js
76-
uses: actions/setup-node@v1
75+
uses: actions/setup-node@v6
7776
with:
78-
node-version: 18
77+
node-version: 24
7978
- name: Checkout
80-
uses: actions/checkout@v2
79+
uses: actions/checkout@v6
8180
- name: Install
8281
run: yarn
8382
- name: ClangFormat
@@ -89,9 +88,7 @@ If your CI is hosted by Azure DevOps, replace `GITHUB_TOKEN` with
8988
9089
### Using `suggestion-bot` with `clang-format`
9190

92-
Use
93-
[`clang-format-diff`](https://clang.llvm.org/docs/ClangFormat.html#script-for-patch-reformatting)
94-
to format only changed files:
91+
Use [`clang-format-diff`][] to format only changed files:
9592

9693
```sh
9794
curl --silent --show-error --remote-name https://raw.githubusercontent.com/llvm/llvm-project/release/10.x/clang/tools/clang-format/clang-format-diff.py
@@ -102,8 +99,8 @@ git diff --unified=0 --no-color @^ \
10299

103100
### Using `suggestion-bot` with Prettier
104101

105-
We must first write a script that pipes [Prettier](https://prettier.io/)'s
106-
output to `diff` so we can feed it to `suggestion-bot` later.
102+
We must first write a script that pipes [Prettier][]'s output to `diff` so we
103+
can feed it to `suggestion-bot` later.
107104

108105
```js
109106
#!/usr/bin/env node
@@ -131,3 +128,9 @@ Node:
131128
```sh
132129
node scripts/prettier-diff.mjs $(git ls-files '*.js')
133130
```
131+
132+
<!-- References -->
133+
134+
[Prettier]: https://prettier.io/
135+
[`clang-format-diff`]: https://clang.llvm.org/docs/ClangFormat.html#script-for-patch-reformatting
136+
[ado-personal-access-token]: https://docs.microsoft.com/en-us/azure/devops/organizations/accounts/use-personal-access-tokens-to-authenticate?view=azure-devops&tabs=preview-page

packages/suggestion-bot/cli.js

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,5 @@
11
#!/usr/bin/env node
22

3-
//
4-
// Copyright (c) Tommy Nguyen
5-
//
6-
// This source code is licensed under the MIT license found in the
7-
// LICENSE file in the root directory of this source tree.
8-
//
9-
103
import * as fs from "node:fs";
114
import * as path from "node:path";
125
import { fileURLToPath, URL } from "node:url";
Lines changed: 15 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "suggestion-bot",
3-
"version": "0.0.1-dev",
3+
"version": "4.0.3",
44
"description": "suggestion-bot submits code reviews with suggestions based on your diffs",
55
"keywords": [
66
"code review",
@@ -10,15 +10,16 @@
1010
"review",
1111
"suggestion"
1212
],
13-
"homepage": "https://github.com/tido64/suggestion-bot#readme",
13+
"homepage": "https://github.com/microsoft/rnx-kit/tree/main/packages/suggestion-bot#readme",
1414
"license": "MIT",
1515
"author": {
16-
"name": "Tommy Nguyen",
17-
"email": "4123478+tido64@users.noreply.github.com"
16+
"name": "Microsoft Open Source",
17+
"email": "microsoftopensource@users.noreply.github.com"
1818
},
1919
"repository": {
2020
"type": "git",
21-
"url": "https://github.com/tido64/suggestion-bot.git"
21+
"url": "https://github.com/microsoft/rnx-kit",
22+
"directory": "packages/suggestion-bot"
2223
},
2324
"bin": "cli.js",
2425
"files": [
@@ -38,12 +39,13 @@
3839
"./package.json": "./package.json"
3940
},
4041
"scripts": {
41-
"build": "yarn clean && yarn lint && tsc",
42+
"//build": "We run `tsgo` directly because we don't want to output to `lib`",
43+
"build": "yarn clean && tsgo",
4244
"clean": "git clean -dfqx -- src/ test/",
43-
"format": "oxfmt $(git ls-files '*.js' '*.json' '*.md' '*.ts' '*.yml' ':!:.yarn/**/*.cjs')",
44-
"lint": "oxlint $(git ls-files '*.js' ':!:*.config.js' ':!:.yarn/**/*.js')",
45+
"format": "rnx-kit-scripts format",
46+
"lint": "rnx-kit-scripts lint",
4547
"suggest": "suggestion-bot",
46-
"test": "node --test --experimental-test-coverage $(git ls-files 'test/*.test.js')"
48+
"test": "rnx-kit-scripts test"
4749
},
4850
"dependencies": {
4951
"@octokit/core": "^7.0.0",
@@ -52,24 +54,11 @@
5254
"parse-diff": "^0.11.0"
5355
},
5456
"devDependencies": {
55-
"@rnx-kit/oxlint-config": "^1.0.2",
56-
"@rnx-kit/tsconfig": "^3.0.0",
57-
"@types/node": "^24.0.0",
58-
"oxfmt": "^0.40.0",
59-
"oxlint": "^1.51.0",
60-
"semantic-release": "^25.0.0",
61-
"typescript": "^5.0.0"
62-
},
63-
"resolutions": {
64-
"@microsoft/eslint-plugin-sdl/eslint-plugin-n": "^17.10.3",
65-
"@microsoft/eslint-plugin-sdl/eslint-plugin-react": "^7.37.3",
66-
"@semantic-release/npm/npm": "link:."
67-
},
68-
"release": {
69-
"extends": "./.github/semantic-release.json"
57+
"@rnx-kit/scripts": "*",
58+
"@rnx-kit/tsconfig": "*",
59+
"@types/node": "^24.0.0"
7060
},
7161
"engines": {
7262
"node": ">=20.9"
73-
},
74-
"packageManager": "yarn@4.12.0"
63+
}
7564
}

packages/suggestion-bot/src/AzureDevOpsClient.js

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,3 @@
1-
//
2-
// Copyright (c) Tommy Nguyen
3-
//
4-
// This source code is licensed under the MIT license found in the
5-
// LICENSE file in the root directory of this source tree.
6-
//
71
// @ts-check
82
import * as azdevapi from "azure-devops-node-api";
93
import { makeComments } from "./makeComments.js";

packages/suggestion-bot/src/GitHubClient.js

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,3 @@
1-
//
2-
// Copyright (c) Tommy Nguyen
3-
//
4-
// This source code is licensed under the MIT license found in the
5-
// LICENSE file in the root directory of this source tree.
6-
//
71
// @ts-check
82
import * as octokit_core from "@octokit/core";
93
import { restEndpointMethods } from "@octokit/plugin-rest-endpoint-methods";

packages/suggestion-bot/src/helpers.js

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,3 @@
1-
//
2-
// Copyright (c) Tommy Nguyen
3-
//
4-
// This source code is licensed under the MIT license found in the
5-
// LICENSE file in the root directory of this source tree.
6-
//
71
// @ts-check
82

93
/**

0 commit comments

Comments
 (0)