Skip to content

Commit cd93214

Browse files
committed
Sync from opensea-devtools
1 parent 2c6d660 commit cd93214

12 files changed

Lines changed: 186 additions & 28 deletions

.github/workflows/ci.yml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [main]
6+
pull_request:
7+
branches: [main]
8+
9+
jobs:
10+
build-and-test:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- uses: actions/checkout@v6
14+
- uses: actions/setup-node@v6
15+
with:
16+
node-version-file: .nvmrc
17+
- run: npm install
18+
- run: npm run build
19+
- run: npm run lint
20+
- run: npm test
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
name: Publish npm package
2+
3+
on:
4+
workflow_call:
5+
inputs:
6+
build-before-publish:
7+
description: Run build and test before publishing
8+
type: boolean
9+
default: true
10+
stub-package-dir:
11+
description: Path to stub package directory (e.g. packages/opensea-js-stub)
12+
type: string
13+
default: ""
14+
node-version-file:
15+
description: Path to node version file
16+
type: string
17+
default: .nvmrc
18+
secrets:
19+
OPENSEA_API_KEY:
20+
required: false
21+
ALCHEMY_API_KEY:
22+
required: false
23+
24+
jobs:
25+
publish-npm:
26+
runs-on: ubuntu-latest
27+
permissions:
28+
id-token: write
29+
contents: read
30+
steps:
31+
- uses: actions/checkout@v6
32+
- uses: actions/setup-node@v6
33+
with:
34+
node-version-file: ${{ inputs.node-version-file }}
35+
registry-url: https://registry.npmjs.org/
36+
37+
# Use npm install (not npm ci) because the package-lock.json may be
38+
# out of sync after the sync-package workflow resolves workspace: protocols
39+
# and updates dependencies. npm ci requires exact lockfile match.
40+
- run: npm install
41+
42+
- if: ${{ inputs.build-before-publish }}
43+
run: npm run build
44+
45+
- if: ${{ inputs.build-before-publish }}
46+
run: npm test
47+
env:
48+
OPENSEA_API_KEY: ${{ secrets.OPENSEA_API_KEY }}
49+
ALCHEMY_API_KEY: ${{ secrets.ALCHEMY_API_KEY }}
50+
51+
- run: npm publish --provenance --access public
52+
53+
- if: ${{ inputs.stub-package-dir != '' }}
54+
run: npm publish --provenance --access public
55+
working-directory: ${{ inputs.stub-package-dir }}
56+
continue-on-error: true

.github/workflows/npm-publish.yml

Lines changed: 3 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -5,19 +5,6 @@ on:
55
types: [published]
66

77
jobs:
8-
publish-npm:
9-
runs-on: ubuntu-latest
10-
permissions:
11-
id-token: write
12-
contents: read
13-
steps:
14-
- uses: actions/checkout@v6
15-
- uses: actions/setup-node@v6
16-
with:
17-
node-version: "22"
18-
registry-url: https://registry.npmjs.org/
19-
- run: npm install
20-
- run: npm run build
21-
- run: npm test
22-
# Auth via OIDC trusted publishing (id-token: write + --provenance)
23-
- run: npm publish --provenance --access public
8+
publish:
9+
uses: ./.github/workflows/npm-publish-reusable.yml
10+
secrets: inherit

.gitignore

Lines changed: 0 additions & 2 deletions
This file was deleted.

.nvmrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
24.14.1

biome.json

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
{
2+
"$schema": "node_modules/@biomejs/biome/configuration_schema.json",
3+
"files": {
4+
"includes": [
5+
"**/*.ts",
6+
"**/*.js",
7+
"**/*.json",
8+
"!**/node_modules/**",
9+
"!**/dist/**",
10+
"!**/lib/**",
11+
"!**/coverage/**",
12+
"!**/.nyc_output/**",
13+
"!packages/sdk/src/typechain/**",
14+
"!**/typechain/**",
15+
"!packages/api-types/src/generated.ts",
16+
"!**/pnpm-lock.yaml",
17+
"!**/package-lock.json"
18+
]
19+
},
20+
"formatter": {
21+
"enabled": true,
22+
"indentStyle": "space",
23+
"indentWidth": 2,
24+
"lineEnding": "lf",
25+
"lineWidth": 80
26+
},
27+
"javascript": {
28+
"formatter": {
29+
"quoteStyle": "double",
30+
"trailingCommas": "all",
31+
"semicolons": "asNeeded",
32+
"arrowParentheses": "asNeeded"
33+
}
34+
},
35+
"linter": {
36+
"enabled": true,
37+
"rules": {
38+
"recommended": true,
39+
"suspicious": {
40+
"noConsole": "off",
41+
"noExplicitAny": "off"
42+
},
43+
"correctness": {
44+
"noUnusedImports": "warn"
45+
},
46+
"style": {
47+
"noUnusedTemplateLiteral": "off"
48+
}
49+
}
50+
},
51+
"overrides": [
52+
{
53+
"includes": ["**/*.test.ts", "**/*.spec.ts", "**/test/**"],
54+
"linter": {
55+
"rules": {
56+
"correctness": {
57+
"noUnusedImports": "off"
58+
}
59+
}
60+
}
61+
}
62+
]
63+
}

tsconfig.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"extends": "./tsconfig.base.json",
2+
"extends": "./tsconfig.node-esm.json",
33
"compilerOptions": {
44
"outDir": "./dist",
55
"rootDir": "./src"

tsconfig.node-cjs.json

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
{
2+
"extends": "./tsconfig.base.json",
3+
"compilerOptions": {
4+
"lib": ["dom", "esnext"],
5+
"module": "commonjs",
6+
"moduleResolution": "node",
7+
"noImplicitReturns": true,
8+
"noErrorTruncation": true,
9+
"noImplicitThis": false,
10+
"noUnusedParameters": true,
11+
"preserveConstEnums": true,
12+
"removeComments": false,
13+
"sourceMap": true
14+
}
15+
}

tsconfig.node-esm.json

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"extends": "./tsconfig.base.json",
3+
"compilerOptions": {
4+
"moduleDetection": "force",
5+
"esModuleInterop": true,
6+
"sourceMap": true
7+
}
8+
}

tsup.config.base.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
import { defineConfig } from "tsup"
2+
3+
export default defineConfig({
4+
entry: ["src/index.ts"],
5+
format: ["esm", "cjs"],
6+
dts: true,
7+
sourcemap: true,
8+
clean: true,
9+
target: "node18",
10+
})

0 commit comments

Comments
 (0)