Skip to content

Commit

Permalink
Changesets! (#48)
Browse files Browse the repository at this point in the history
* chore: use tsc for build, remove scripts

* chore(create-ponder): use paths

* chore(graphql): use paths

* chore: rename and update eslintrc

* chore: add changesets, update root scripts

* chore: test changeset

* chore: fix lint step

* chore: add api key to test action

* chore: add release action

* chore: fix matrix config
  • Loading branch information
0xOlias committed Jan 7, 2023
1 parent cf1d8f0 commit 79b9582
Show file tree
Hide file tree
Showing 21 changed files with 872 additions and 103 deletions.
8 changes: 8 additions & 0 deletions .changeset/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Changesets

Hello and welcome! This folder has been automatically generated by `@changesets/cli`, a build tool that works
with multi-package repos, or single-package repos to help you version and publish your code. You can
find the full documentation for it [in our repository](https://github.com/changesets/changesets)

We have a quick list of common questions to get you started engaging with this project in
[our documentation](https://github.com/changesets/changesets/blob/main/docs/common-questions.md)
10 changes: 10 additions & 0 deletions .changeset/config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"$schema": "https://unpkg.com/@changesets/[email protected]/schema.json",
"changelog": ["@changesets/changelog-github", { "repo": "0xOlias/ponder" }],
"commit": false,
"fixed": [],
"linked": [],
"access": "public",
"baseBranch": "main",
"updateInternalDependencies": "patch"
}
5 changes: 5 additions & 0 deletions .changeset/two-comics-repeat.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@ponder/graphql": patch
---

Fixed port resolution to honor PORT env var
4 changes: 2 additions & 2 deletions .eslintrc.json → .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
],
"plugins": ["@typescript-eslint", "prettier", "simple-import-sort", "import"],
"env": {
"browser": true,
"node": true
},
"rules": {
Expand All @@ -18,5 +17,6 @@
"import/newline-after-import": "error",
"@typescript-eslint/no-var-requires": "off",
"@typescript-eslint/no-explicit-any": "off"
}
},
"ignorePatterns": ["dist", "node_modules", "generated", "ethers-abitype"]
}
25 changes: 14 additions & 11 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,13 @@ jobs:
strategy:
matrix:
node-version: [16]
pnpm-version: [7]
steps:
- uses: actions/checkout@v3
- uses: pnpm/[email protected]
with:
version: 7
- name: Set up Node ${{ matrix.node-version }}
version: ${{ matrix.pnpm-version }}
- name: Set up node ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
cache: "pnpm"
Expand All @@ -44,7 +45,7 @@ jobs:
packages/**/node_modules
packages/**/dist
key: modules-${{ hashFiles('pnpm-lock.yaml') }}
- name: Install Dependencies
- name: Install dependencies
if: steps.cache-node-modules.outputs.cache-hit != 'true'
run: pnpm i

Expand All @@ -55,12 +56,13 @@ jobs:
strategy:
matrix:
node-version: [16]
pnpm-version: [7]
steps:
- uses: actions/checkout@v3
- uses: pnpm/[email protected]
with:
version: 7
- name: Set up Node ${{ matrix.node-version }}
version: ${{ matrix.pnpm-version }}
- name: Set up node ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
cache: "pnpm"
Expand All @@ -75,10 +77,8 @@ jobs:
packages/**/node_modules
packages/**/dist
key: modules-${{ hashFiles('pnpm-lock.yaml') }}
- name: Build core
run: pnpm --filter "@ponder/core" prerelease
- name: Build dependents
run: pnpm --filter \!"@ponder/core" prerelease
- name: Build
run: pnpm build
- name: Typecheck
run: pnpm typecheck
- name: Lint
Expand All @@ -91,12 +91,13 @@ jobs:
strategy:
matrix:
node-version: [16]
pnpm-version: [7]
steps:
- uses: actions/checkout@v3
- uses: pnpm/[email protected]
with:
version: 7
- name: Set up Node ${{ matrix.node-version }}
version: ${{ matrix.pnpm-version }}
- name: Set up node ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
cache: "pnpm"
Expand All @@ -115,3 +116,5 @@ jobs:
run: pnpm build
- name: Test
run: pnpm test
env:
ETHERSCAN_API_KEY: ${{ secrets.ETHERSCAN_API_KEY }}
43 changes: 43 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: Release

on:
push:
branches:
- main

jobs:
release:
name: Release
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [16]
pnpm-version: [7]
steps:
- uses: actions/checkout@v3
with:
# This makes Actions fetch all Git history so that Changesets can generate changelogs with the correct commits
fetch-depth: 0
submodules: true

- uses: pnpm/[email protected]
with:
version: ${{ matrix.pnpm-version }}
- name: Set up node ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
cache: "pnpm"
node-version: ${{ matrix.node-version }}
- name: Install dependencies
run: pnpm i
- name: Create release pull request or publish to npm
id: changesets
uses: changesets/[email protected]
with:
title: "chore: version packages"
commit: "chore: version packages"
version: pnpm changeset:version
publish: pnpm changeset:release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@ node_modules

.vercel
.DS_Store
.eslintcache
17 changes: 11 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,21 @@
"packages/*"
],
"scripts": {
"preinstall": "npx -y only-allow pnpm",
"typecheck": "pnpm --parallel typecheck",
"lint": "pnpm --parallel lint",
"build": "pnpm --filter '@ponder/core' build && pnpm --filter './packages/*' --filter '!@ponder/core' --parallel build",
"changeset:release": "pnpm build && changeset publish",
"changeset:version": "changeset version && pnpm install --lockfile-only",
"install:packages": "pnpm --filter './packages/**' install",
"install:examples": "pnpm --filter './examples/**' install",
"build": "pnpm --filter './packages/**' --parallel build",
"declarations": "pnpm --parallel declarations",
"test": "pnpm --parallel --no-bail test"
"lint": "eslint . --cache",
"lint:fix": "pnpm lint --fix",
"lint:format": "prettier --write",
"preinstall": "npx -y only-allow pnpm",
"test": "pnpm --parallel --no-bail test",
"typecheck": "pnpm --parallel typecheck"
},
"devDependencies": {
"@changesets/changelog-github": "^0.4.8",
"@changesets/cli": "^2.26.0",
"@typescript-eslint/eslint-plugin": "^5.27.1",
"@typescript-eslint/parser": "^5.27.1",
"eslint": "^8.17.0",
Expand Down
20 changes: 6 additions & 14 deletions packages/core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,24 +7,16 @@
"files": [
"dist/src"
],
"main": "./dist/src/index.js",
"types": "./dist/src/index.d.ts",
"main": "dist/src/index.js",
"types": "dist/src/index.d.ts",
"bin": {
"ponder": "./dist/src/bin/ponder"
"ponder": "dist/src/bin/ponder"
},
"scripts": {
"clean": "rm -rf dist",
"typecheck": "tsc",
"lint": "eslint src",
"format": "prettier src --write",
"replace-paths": "tsconfig-replace-paths --src .",
"esbuild": "esbuild `find . \\( -name '*.ts' -o -name '*.tsx' \\)` --platform=node --format=cjs --outdir=dist && $npm_execpath run replace-paths",
"build": "$npm_execpath run clean && $npm_execpath run esbuild && mv dist/src/bin/ponder.js dist/src/bin/ponder",
"declarations": "(tsc --noEmit false --declaration --emitDeclarationOnly || exit 0) && $npm_execpath run replace-paths",
"format-dist": "prettier dist --write --loglevel warn --ignore-path dist/src/codegen/ethers-abitype/*",
"prerelease": "$npm_execpath run build && $npm_execpath run declarations && $npm_execpath run format-dist",
"build": "rm -rf dist && tsc && tsconfig-replace-paths --src . && mv dist/src/bin/ponder.js dist/src/bin/ponder",
"release": "$npm_execpath run prerelease && VERSION=$(npm version patch) && npm publish && git add ./package.json && git commit -m \"release(@ponder/core): $VERSION\"",
"test": "jest"
"test": "jest",
"typecheck": "tsc --noEmit"
},
"dependencies": {
"@ethersproject/abi": "^5.6.4",
Expand Down
2 changes: 1 addition & 1 deletion packages/core/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"strict": true,
"esModuleInterop": true,
"skipLibCheck": true,
"noEmit": true,
"declaration": true,
"outDir": "dist",
"baseUrl": ".",
"paths": {
Expand Down
13 changes: 3 additions & 10 deletions packages/create-ponder/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,17 +11,10 @@
"create-ponder": "dist/src/bin/create-ponder"
},
"scripts": {
"clean": "rm -rf dist",
"typecheck": "tsc",
"lint": "eslint src",
"format": "prettier src --write",
"replace-paths": "tsconfig-replace-paths --src src",
"esbuild": "esbuild `find . \\( -name '*.ts' \\)` --platform=node --format=cjs --outdir=dist && $npm_execpath run replace-paths",
"build": "$npm_execpath run clean && $npm_execpath run esbuild && mv dist/src/bin/create-ponder.js dist/src/bin/create-ponder",
"format-dist": "prettier dist --write --loglevel warn",
"prerelease": "$npm_execpath run build && $npm_execpath run format-dist",
"build": "rm -rf dist && tsc && tsconfig-replace-paths --src . && mv dist/src/bin/create-ponder.js dist/src/bin/create-ponder",
"release": "$npm_execpath run prerelease && VERSION=$(npm version patch) && npm publish && git add ./package.json && git commit -m \"release(create-ponder): $VERSION\"",
"test": "$npm_execpath build && export $(grep -v '^#' .env.local | xargs) && jest"
"test": "$npm_execpath build && export $(grep -v '^#' .env.local | xargs) && jest",
"typecheck": "tsc --noEmit"
},
"dependencies": {
"@ethersproject/abi": "^5.6.4",
Expand Down
10 changes: 5 additions & 5 deletions packages/create-ponder/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@ import path from "node:path";
import pico from "picocolors";
import prettier from "prettier";

import type { CreatePonderOptions } from "./bin/create-ponder";
import { detect } from "./helpers/detectPackageManager";
import { fromBasic } from "./templates/basic";
import { fromEtherscan } from "./templates/etherscan";
import { fromSubgraph } from "./templates/subgraph";
import type { CreatePonderOptions } from "@/bin/create-ponder";
import { detect } from "@/helpers/detectPackageManager";
import { fromBasic } from "@/templates/basic";
import { fromEtherscan } from "@/templates/etherscan";
import { fromSubgraph } from "@/templates/subgraph";

export type PonderNetwork = {
kind?: string;
Expand Down
2 changes: 1 addition & 1 deletion packages/create-ponder/src/templates/basic.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import path from "node:path";
import prettier from "prettier";
import type { PartialPonderConfig } from "src/index";

import type { CreatePonderOptions } from "../bin/create-ponder";
import type { CreatePonderOptions } from "@/bin/create-ponder";

export const fromBasic = (options: CreatePonderOptions) => {
const { ponderRootDir } = options;
Expand Down
4 changes: 2 additions & 2 deletions packages/create-ponder/src/templates/etherscan.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import fetch from "node-fetch";
import prettier from "prettier";
import type { PartialPonderConfig } from "src/index";

import type { CreatePonderOptions } from "../bin/create-ponder";
import { getNetworkByEtherscanHostname } from "../helpers/getEtherscanChainId";
import type { CreatePonderOptions } from "@/bin/create-ponder";
import { getNetworkByEtherscanHostname } from "@/helpers/getEtherscanChainId";

const delay = (ms: number) => new Promise((resolve) => setTimeout(resolve, ms));

Expand Down
6 changes: 3 additions & 3 deletions packages/create-ponder/src/templates/subgraph.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@ import type {
} from "src/index";
import { parse } from "yaml";

import type { CreatePonderOptions } from "../bin/create-ponder";
import type { CreatePonderOptions } from "@/bin/create-ponder";
import {
getGraphProtocolChainId,
subgraphYamlFileNames,
} from "../helpers/getGraphProtocolChainId";
import { validateGraphProtocolSource } from "../helpers/validateGraphProtocolSource";
} from "@/helpers/getGraphProtocolChainId";
import { validateGraphProtocolSource } from "@/helpers/validateGraphProtocolSource";

export const fromSubgraph = (options: CreatePonderOptions) => {
if (!options.fromSubgraph) {
Expand Down
6 changes: 4 additions & 2 deletions packages/create-ponder/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,12 @@
"resolveJsonModule": true,
"esModuleInterop": true,
"skipLibCheck": true,
"noEmit": true,
"declaration": true,
"outDir": "dist",
"baseUrl": ".",
"paths": {}
"paths": {
"@/*": ["src/*"]
}
},
"include": ["src/**/*.ts", "test/**/*.ts"],
"exclude": ["node_modules/"]
Expand Down
18 changes: 5 additions & 13 deletions packages/graphql/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,20 +7,12 @@
"files": [
"dist"
],
"main": "./dist/index.js",
"types": "./dist/index.d.ts",
"main": "dist/index.js",
"types": "dist/index.d.ts",
"scripts": {
"clean": "rm -rf dist",
"typecheck": "tsc",
"lint": "eslint src",
"format": "prettier src --write",
"replace-paths": "tsconfig-replace-paths --src src",
"esbuild": "esbuild `find src \\( -name '*.ts' \\)` --platform=node --format=cjs --outdir=dist && $npm_execpath run replace-paths",
"build": "$npm_execpath run clean && $npm_execpath run esbuild",
"declarations": "(tsc --noEmit false --declaration --emitDeclarationOnly || exit 0) && $npm_execpath run replace-paths",
"format-dist": "prettier dist --write --loglevel warn",
"prerelease": "$npm_execpath run build && $npm_execpath run declarations && $npm_execpath run format-dist",
"release": "$npm_execpath run prerelease && VERSION=$(npm version patch) && npm publish && git add ./package.json && git commit -m \"release(@ponder/graphql): $VERSION\""
"build": "rm -rf dist && tsc && tsconfig-replace-paths --src src",
"release": "$npm_execpath run prerelease && VERSION=$(npm version patch) && npm publish && git add ./package.json && git commit -m \"release(@ponder/graphql): $VERSION\"",
"typecheck": "tsc --noEmit"
},
"dependencies": {
"@graphql-codegen/core": "^2.6.2",
Expand Down
8 changes: 4 additions & 4 deletions packages/graphql/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import type { PonderPlugin } from "@ponder/core";

import { generateSchema } from "./codegen/generateSchema";
import { generateSchemaTypes } from "./codegen/generateSchemaTypes";
import { GraphqlServer } from "./server";
import { buildGqlSchema } from "./server/buildGqlSchema";
import { generateSchema } from "@/codegen/generateSchema";
import { generateSchemaTypes } from "@/codegen/generateSchemaTypes";
import { GraphqlServer } from "@/server";
import { buildGqlSchema } from "@/server/buildGqlSchema";

export type PonderGraphqlPluginOptions = {
port?: number;
Expand Down
2 changes: 1 addition & 1 deletion packages/graphql/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"strict": true,
"esModuleInterop": true,
"skipLibCheck": true,
"noEmit": true,
"declaration": true,
"outDir": "dist",
"baseUrl": ".",
"paths": {
Expand Down
Loading

1 comment on commit 79b9582

@vercel
Copy link

@vercel vercel bot commented on 79b9582 Jan 7, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.