Skip to content

Commit

Permalink
Add check for min required node version. Currently supported version …
Browse files Browse the repository at this point in the history
…19.9.0

Add check for min required node version. Currently supported version 19.9.0
  • Loading branch information
Shreyaschorge authored May 3, 2024
2 parents df15233 + 292cf12 commit b927893
Show file tree
Hide file tree
Showing 4 changed files with 46 additions and 9 deletions.
27 changes: 21 additions & 6 deletions .github/workflows/publish-to-npm.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: "Publish to NPM"
name: "Publish to npm 🚀"

on:
push:
Expand All @@ -8,9 +8,24 @@ on:
jobs:
build:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- run: npm config set //registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}
- run: npm install
- run: npm run build
- run: npm publish --access public
- name: Check out repository
uses: actions/checkout@v3

- name: Set up Node.js
uses: actions/setup-node@v3
with:
node-version: "20"

- name: Install dependencies
run: npm install

- name: Build
run: npm run build

- name: Set npm Config
run: npm config set //registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}

- name: Publish to npm
run: npm publish --access public
8 changes: 6 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@neynar/nodejs-sdk",
"version": "1.21.1",
"version": "1.21.2",
"description": "SDK to interact with Neynar APIs (https://docs.neynar.com/)",
"main": "./build/index.js",
"types": "./build/index.d.ts",
Expand All @@ -25,13 +25,17 @@
"dependencies": {
"@openapitools/openapi-generator-cli": "^2.7.0",
"axios": "^1.6.2",
"semver": "^7.6.0",
"viem": "^1.19.9"
},
"engines": {
"node": ">=19.9.0"
},
"keywords": [
"ethereum",
"optimism",
"farcaster",
"neynar",
"nodejs"
]
}
}
13 changes: 12 additions & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
@@ -1 +1,12 @@
export * from './neynar-api'
const semver = require("semver");
const requiredVersion = require("../package.json").engines.node;

// Check Node.js version before requiring/doing anything else
if (!semver.satisfies(process.version, requiredVersion)) {
console.error(
`Unsupported Node.js version! Your version: ${process.version}. Required version: ${requiredVersion}.`
);
process.exit(1);
}

export * from "./neynar-api";
7 changes: 7 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1271,6 +1271,13 @@ semver@^7.3.4:
dependencies:
lru-cache "^6.0.0"

semver@^7.6.0:
version "7.6.0"
resolved "https://registry.yarnpkg.com/semver/-/semver-7.6.0.tgz#1a46a4db4bffcccd97b743b5005c8325f23d4e2d"
integrity sha512-EnwXhrlwXMk9gKu5/flx5sv/an57AkRplG3hTK68W7FRDN+k+OWBj65M7719OkA82XLBxrcX0KSHj+X5COhOVg==
dependencies:
lru-cache "^6.0.0"

signal-exit@^3.0.2:
version "3.0.7"
resolved "https://registry.yarnpkg.com/signal-exit/-/signal-exit-3.0.7.tgz#a9a1767f8af84155114eaabd73f99273c8f59ad9"
Expand Down

0 comments on commit b927893

Please sign in to comment.