Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Standardize repository structure with other connect js packages #490

Merged
merged 15 commits into from
Dec 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
88 changes: 88 additions & 0 deletions .eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
// Copyright 2021-2023 The Connect Authors
//
// 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.

module.exports = {
env: {
browser: true,
es2021: true,
node: true,
},
root: true,
ignorePatterns: ["packages/*/dist/**"],
plugins: ["@typescript-eslint", "n", "import", "vitest"],
// Rules and settings that do not require a non-default parser
extends: ["eslint:recommended"],
rules: {
"no-console": "error",
"import/no-cycle": "error",
"import/no-duplicates": "error",
},
overrides: [
{
files: ["**/*.{ts,tsx,cts,mts}"],
parser: "@typescript-eslint/parser",
parserOptions: {
project: true,
},
settings: {
"import/resolver": {
typescript: {
project: "tsconfig.json",
},
},
},
extends: [
"plugin:@typescript-eslint/recommended",
"plugin:@typescript-eslint/recommended-requiring-type-checking",
"plugin:import/recommended",
"plugin:import/typescript",
],
rules: {
"@typescript-eslint/strict-boolean-expressions": "error",
"@typescript-eslint/no-unnecessary-condition": "error",
"@typescript-eslint/array-type": "off", // we use complex typings, where Array is actually more readable than T[]
"@typescript-eslint/switch-exhaustiveness-check": "error",
"@typescript-eslint/prefer-nullish-coalescing": "error",
"@typescript-eslint/no-unnecessary-boolean-literal-compare": "error",
"@typescript-eslint/no-invalid-void-type": "error",
"@typescript-eslint/no-base-to-string": "error",
"import/no-cycle": "error",
"import/no-duplicates": "error",
},
},
// For scripts and configurations, use Node.js rules
{
files: ["**/*.{js,mjs,cjs}"],
parserOptions: {
ecmaVersion: 13, // ES2022 - https://eslint.org/docs/latest/use/configure/language-options#specifying-environments
},
extends: ["eslint:recommended", "plugin:n/recommended"],
rules: {
"n/hashbang": "off", // this rule reports _any_ hashbang outside of an npm binary as an error
"n/prefer-global/process": "off",
"n/no-process-exit": "off",
"n/exports-style": ["error", "module.exports"],
"n/file-extension-in-import": ["error", "always"],
"n/prefer-global/buffer": ["error", "always"],
"n/prefer-global/console": ["error", "always"],
"n/prefer-global/url-search-params": ["error", "always"],
"n/prefer-global/url": ["error", "always"],
"n/prefer-promises/dns": "error",
"n/prefer-promises/fs": "error",
"n/no-unsupported-features/node-builtins": "error",
"n/no-unsupported-features/es-syntax": "error",
},
},
],
};
114 changes: 0 additions & 114 deletions .eslintrc.js

This file was deleted.

10 changes: 10 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# This is similar to the git option core.autocrlf but it applies to all
# users of the repository and therefore doesn't depend on a developers
# local configuration.
* text=auto

# Ignore generated files in GitHub diffs by default
**/*_pb.ts linguist-generated=true
**/*_connect.ts linguist-generated=true
**/*_pb.js linguist-generated=true
**/*_pb.d.ts linguist-generated=true
2 changes: 1 addition & 1 deletion .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ git push origin cool_new_feature

Then use the GitHub UI to open a pull request.

At this point, you're waiting on us to review your changes. We *try* to respond
At this point, you're waiting on us to review your changes. We _try_ to respond
to issues and pull requests within a few business days, and we may suggest some
improvements or alternatives. Once your changes are approved, one of the
project maintainers will merge them.
Expand Down
2 changes: 1 addition & 1 deletion .github/RELEASING.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
packages in this repository use the same version number.
2. Make sure you are on the latest main, and create a new git branch.
3. Set the new version for all packages within the monorepo with the following
commands:
commands:

```bash
pnpm --filter "./packages/*" exec pnpm version 1.2.3
Expand Down
97 changes: 58 additions & 39 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -1,52 +1,71 @@
name: ci

on:
push:
branches:
- main
branches: [main, "v*"]
tags: ["v*"]
pull_request:
types:
- opened
- synchronize
branches: [main, "v*"]
workflow_dispatch:

permissions:
contents: read

env:
# https://consoledonottrack.com/
DO_NOT_TRACK: 1

jobs:
build:
runs-on: ubuntu-latest
tasks:
runs-on: ubuntu-22.04
strategy:
fail-fast: false
matrix:
node-version: [18, 20]
task:
- format
- license-header
- lint
- attw
- build
include:
- task: format
diff-check: true
- task: license-header
diff-check: true
name: ${{ matrix.task }}
steps:
- name: Checkout branch
uses: actions/checkout@v4

# Slightly fragile since it runs on the default node version
# but until setup-node supports corepack (https://github.com/actions/setup-node/issues/531)
# this is our best option
- name: Enable core pack
run: |
corepack enable
pnpm --version

- name: Setup Node
uses: actions/setup-node@v4
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
cache: pnpm

- name: Install dependencies
run: pnpm install

- name: Run CI
run: pnpm run all

node-version-file: .nvmrc
cache: "npm"
- uses: actions/cache@v4
with:
path: .turbo
key: ${{ runner.os }}/${{ matrix.task }}/${{ github.sha }}
restore-keys: ${{ runner.os }}/${{ matrix.task }}
- run: npm ci
- run: npx turbo run ${{ matrix.task }}
- name: Check changed files
id: check_changed_files
run: |
if [[ -z $(git status --porcelain | tee /dev/stderr) ]]; then
echo "No changed files detected."
else
echo "::error::Formatting resulted in changed files. Please make sure this branch is up to date and run 'pnpm format'. Verify the changes are what you want and commit them."
git diff
exit 1
fi
if: ${{ matrix.diff-check }}
run: node scripts/gh-diffcheck.js
test:
runs-on: ubuntu-22.04
strategy:
fail-fast: false
matrix:
node-version: [22.7.0, 20.17.0, 18.20.4, 18.14.1]
name: "test on Node.js ${{ matrix.node-version }}"
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version-file: .nvmrc
cache: "npm"
- uses: actions/cache@v4
with:
path: .turbo
key: ${{ runner.os }}/test/${{ github.sha }}
restore-keys: ${{ runner.os }}/test
- run: npm ci
- run: npx turbo run test
4 changes: 2 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
.turbo
.wrangler
node_modules
/packages/*/dist
/packages/*/coverage
*.tsbuildinfo
.turbo
2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
20
20.17.0
13 changes: 7 additions & 6 deletions MAINTAINERS.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
Maintainers
===========
# Maintainers

## Current
* [Timo Stamm](https://github.com/timostamm), [Buf](https://buf.build)
* [Steve Ayers](https://github.com/smaye81), [Buf](https://buf.build)
* [Paul Sachs](https://github.com/paul-sachs), [Buf](https://buf.build)

- [Timo Stamm](https://github.com/timostamm), [Buf](https://buf.build)
- [Steve Ayers](https://github.com/smaye81), [Buf](https://buf.build)
- [Paul Sachs](https://github.com/paul-sachs), [Buf](https://buf.build)

## Former
* [Dimitri Mitropoulos](https://github.com/dimitropoulos)

- [Dimitri Mitropoulos](https://github.com/dimitropoulos)
3 changes: 1 addition & 2 deletions SECURITY.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
Security Policy
===============
# Security Policy

This project follows the [Connect security policy and reporting
process](https://connectrpc.com/docs/governance/security).
Loading
Loading