Skip to content

Commit

Permalink
Add Graphile plugin to sort schemas
Browse files Browse the repository at this point in the history
  • Loading branch information
psirenny authored May 18, 2024
1 parent 2145288 commit 6606cfd
Show file tree
Hide file tree
Showing 31 changed files with 10,859 additions and 1 deletion.
15 changes: 15 additions & 0 deletions .changeset/config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"$schema": "https://unpkg.com/@changesets/[email protected]/schema.json",
"access": "public",
"baseBranch": "main",
"changelog": ["@changesets/changelog-github", { "repo": "spear-ai/api" }],
"commit": false,
"fixed": [],
"ignore": [],
"linked": [],
"privatePackages": {
"version": true,
"tag": true
},
"updateInternalDependencies": "patch"
}
5 changes: 5 additions & 0 deletions .changeset/long-ducks-study.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@spear-ai/graphile-sort-schema-plugin": major
---

Added Graphile plugin to sort schemas.
20 changes: 20 additions & 0 deletions .github/dependabot.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
version: 2
updates:
- directory: /
labels:
- 🔧 maintenance
package-ecosystem: github-actions
schedule:
interval: monthly
- directory: /
labels:
- 🔧 maintenance
package-ecosystem: npm
schedule:
interval: monthly
- directory: /packages/graphile-sort-schema-plugin
labels:
- 🔧 maintenance
package-ecosystem: npm
schedule:
interval: monthly
3 changes: 3 additions & 0 deletions .github/test-events/push-release-tag.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"ref": "refs/tags/@spear-ai/[email protected]"
}
37 changes: 37 additions & 0 deletions .github/workflows/check.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: Build and check
on:
pull_request:
types:
- opened
- reopened
- synchronize
push:
branches:
- main
env:
TURBO_TEAM: ${{ vars.TURBO_TEAM }}
TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }}
jobs:
checks:
name: Build and check
runs-on: ubuntu-latest
timeout-minutes: 10
env:
TURBO_TEAM: ${{ vars.TURBO_TEAM }}
TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }}
steps:
- name: Checkout repository
uses: actions/[email protected]
with:
fetch-depth: 2
- name: Setup Node.js
uses: actions/[email protected]
with:
cache: yarn
node-version-file: .node-version
- name: Install Node.js dependencies
run: yarn install --immutable
- name: Build
run: yarn turbo run build
- name: Check
run: yarn turbo run check
61 changes: 61 additions & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
name: Release
on:
push:
branches:
- main
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
env:
TURBO_TEAM: ${{ vars.TURBO_TEAM }}
TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }}
jobs:
changesets:
name: Changesets
runs-on: ubuntu-latest
outputs:
should-deploy: ${{ steps.changesets.outputs.hasChangesets == 'false' }}
permissions: write-all
steps:
- name: Checkout repository
uses: actions/[email protected]
with:
fetch-depth: 0
- name: Setup Node.js
uses: actions/[email protected]
with:
cache: yarn
node-version-file: .node-version
- name: Install Node.js dependencies
run: yarn install
- name: Build packages
run: yarn turbo run build
- name: Import GPG key
uses: crazy-max/[email protected]
with:
git_commit_gpgsign: true
git_user_signingkey: true
gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }}
- name: Setup Git user
run: |
git config --global user.email [email protected]
git config --global user.name org-spear-ai
- name: Authenticate with NPM
env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
run: npm config set //registry.npmjs.org/:_authToken=$NPM_TOKEN
- name: Authenticate with GitHub Packages
env:
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
run: npm config set //npm.pkg.github.com/:_authToken=$GITHUB_TOKEN
- id: changesets
name: Run Changesets — Create a Release Pull Request or merge a Release Pull Request
uses: changesets/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
with:
title: Release 🚀
version: yarn run version
commit: Release 🚀
publish: yarn run publish-packages
setupGitUser: false
11 changes: 11 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
*.log
.DS_Store
.turbo
node_modules
.pnp.*
.yarn/*
!.yarn/patches
!.yarn/plugins
!.yarn/releases
!.yarn/sdks
!.yarn/versions
4 changes: 4 additions & 0 deletions .husky/commit-msg
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"

npx --no -- commitlint --edit ${1}
1 change: 1 addition & 0 deletions .node-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
20
3 changes: 3 additions & 0 deletions .npmpackagejsonlintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
.yarn
node_modules
packages
3 changes: 3 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
.yarn
node_modules
packages
894 changes: 894 additions & 0 deletions .yarn/releases/yarn-4.2.2.cjs

Large diffs are not rendered by default.

9 changes: 9 additions & 0 deletions .yarnrc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
compressionLevel: mixed

enableGlobalCache: false

nodeLinker: node-modules

npmPublishAccess: public

yarnPath: .yarn/releases/yarn-4.2.2.cjs
15 changes: 14 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1 +1,14 @@
# api
# Spear API

Spear AI’s API [monorepo](https://monorepo.tools). Packages are managed with [Turborepo](https://turbo.build/repo) and versioned with [🦋 Changesets](https://github.com/changesets/changesets).

## Requirements

- [Yarn package manager](https://yarnpkg.com)
- [Fast Node Manager](https://github.com/Schniz/fnm)

## Installation

```shell
yarn install
```
7 changes: 7 additions & 0 deletions commitlint.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import type { UserConfig } from "@commitlint/types";

const commitlintConfig: UserConfig = {
extends: ["@spear-ai/commitlint-config"],
};

export default commitlintConfig;
12 changes: 12 additions & 0 deletions eslint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import { baseEslintConfig, prettierConfig } from "@spear-ai/eslint-config";

/** @type {import("eslint").Linter.FlatConfig} */
const eslintConfig = [
{
ignores: ["packages/**"],
},
...baseEslintConfig,
prettierConfig,
];

export default eslintConfig;
8 changes: 8 additions & 0 deletions npmpackagejsonlint.config.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
module.exports = {
extends: ["@spear-ai/npm-package-json-lint-config/spear-application"],
rules: {
"prefer-absolute-version-dependencies": "off",
"prefer-absolute-version-devDependencies": "off",
"prefer-alphabetical-scripts": "off",
},
};
58 changes: 58 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
{
"name": "@spear-ai/api-monorepo",
"version": "1.0.0",
"description": "Spear API",
"author": {
"name": "Spear AI",
"email": "[email protected]",
"url": "https://spear.ai"
},
"type": "module",
"dependencies": {
"@changesets/changelog-github": "0.5.0",
"@changesets/cli": "2.27.2",
"@commitlint/cli": "19.3.0",
"@commitlint/types": "19.0.3",
"@spear-ai/commitlint-config": "3.1.1",
"@spear-ai/eslint-config": "19.0.0",
"@spear-ai/npm-package-json-lint-config": "3.1.1",
"@spear-ai/prettier-config": "2.2.0",
"@spear-ai/tsconfig": "4.0.0",
"commitlint": "19.3.0",
"eslint": "8.57.0",
"graphql": "16.8.1",
"husky": "9.0.11",
"npm-package-json-lint": "7.1.0",
"prettier": "3.2.5",
"react": "18.3.1",
"tailwindcss": "3.4.3",
"turbo": "1.13.3",
"typescript": "5.4.5"
},
"license": "UNLICENSED",
"packageManager": "[email protected]",
"private": true,
"repository": {
"type": "git",
"url": "https://github.com/spear-ai/api.git"
},
"scripts": {
"version": "changeset version && yarn workspaces foreach -A run sync-version",
"commitlint:check": "commitlint --from=HEAD^1",
"eslint:check": "eslint --max-warnings 0 .",
"eslint:fix": "yarn eslint:check --fix",
"github-actions:push": "act push -s GH_PAT=$GH_PAT -s GITHUB_TOKEN=$GH_PAT -s NPM_TOKEN=$NPM_TOKEN",
"github-actions:push:release-tag": "act push -e .github/test-events/push-release-tag.json -s GH_PAT=$GH_PAT -s GITHUB_TOKEN=$GH_PAT",
"npmpkgjsonlint:check": "npmPkgJsonLint .",
"prettier:check": "prettier --check .",
"prettier:fix": "prettier --write .",
"publish-packages": "yarn run publish-packages:npm && yarn run publish-packages:github && yarn run publish-packages:custom && yarn changeset tag",
"publish-packages:custom": "yarn workspaces foreach -A run publish-package",
"publish-packages:github": "npm_config_registry=https://npm.pkg.github.com changeset publish --no-git-tag",
"publish-packages:npm": "changeset publish --no-git-tag",
"typescript:check": "tsc --noEmit"
},
"workspaces": [
"packages/*"
]
}
2 changes: 2 additions & 0 deletions packages/graphile-sort-schema-plugin/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
dist
node_modules
2 changes: 2 additions & 0 deletions packages/graphile-sort-schema-plugin/.prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
dist
node_modules
25 changes: 25 additions & 0 deletions packages/graphile-sort-schema-plugin/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# @spear-ai/graphile-sort-schema-plugin

A [Graphile](https://www.graphile.org) plugin to lexicographically sort your schema.

## Installation

```shell
yarn add -D @spear-ai/graphile-sort-schema-plugin
```

## Usage

Add the plugin to your graphile preset:

```ts
import { sortSchemaPlugin } from "@spear-ai/graphile-sort-schema-plugin";

const createPreset: GraphileConfig.Preset = {
//
plugins: [
//
sortSchemaPlugin,
],
};
```
12 changes: 12 additions & 0 deletions packages/graphile-sort-schema-plugin/eslint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import { baseEslintConfig, prettierConfig } from "@spear-ai/eslint-config";

/** @type {import("eslint").Linter.FlatConfig} */
const eslintConfig = [
{
ignores: ["dist", "node_modules"],
},
...baseEslintConfig,
prettierConfig,
];

export default eslintConfig;
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module.exports = {
extends: ["@spear-ai/npm-package-json-lint-config/spear-library"],
};
Loading

0 comments on commit 6606cfd

Please sign in to comment.