Skip to content

Commit

Permalink
Merge branch 'main' into mdt/ethers-v6
Browse files Browse the repository at this point in the history
  • Loading branch information
mdtanrikulu authored Jan 11, 2024
2 parents 4d77dff + b687351 commit aa3d35d
Show file tree
Hide file tree
Showing 10 changed files with 466 additions and 185 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:
runs-on: ${{ matrix.os }}
strategy:
matrix:
node: ['16.x', '18.x']
node: ['18.x', '20.x']
os: [ubuntu-latest, windows-latest, macOS-latest]

steps:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/pages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ jobs:
- name: Setup Node
uses: actions/setup-node@v3
with:
node-version: "16"
node-version: "18"
cache: ${{ steps.detect-package-manager.outputs.manager }}
- name: Setup yarn
run: npm install -g yarn
Expand Down
8 changes: 3 additions & 5 deletions example/browser.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,9 @@ const notFoundImage =
const provider = new StaticJsonRpcProvider(
`https://mainnet.infura.io/v3/${process.env.INFURA_KEY}`
);
const avt = new AvatarResolver(provider,
{ apiKey: {
opensea: process.env.OPENSEA_KEY
}}
);
const avt = new AvatarResolver(provider, {
apiKey: { opensea: process.env.OPENSEA_KEY },
});
for (let ens of ensNames) {
avt
.getMetadata(ens)
Expand Down
2 changes: 1 addition & 1 deletion example/build.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ require('esbuild')
},
outfile: 'example/dist/index.js',
define: {
"process": `{
process: `{
"env": {
"INFURA_KEY": '${process.env.INFURA_KEY}',
"OPENSEA_KEY": '${process.env.OPENSEA_KEY}'
Expand Down
2 changes: 1 addition & 1 deletion example/node.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ const IPFS = 'https://cf-ipfs.com';
const provider = new StaticJsonRpcProvider(
`https://mainnet.infura.io/v3/${process.env.INFURA_KEY}`
);
const avt = new AvatarResolver(provider, { ipfs: IPFS});
const avt = new AvatarResolver(provider, { ipfs: IPFS, apiKey: { opensea: process.env.OPENSEA_KEY }});
avt
.getMetadata(ensName)
.then(metadata => {
Expand Down
33 changes: 16 additions & 17 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"version": "0.3.5",
"version": "0.3.6",
"license": "MIT",
"main": "dist/index.js",
"module": "dist/index.esm.js",
Expand All @@ -10,15 +10,14 @@
"src"
],
"engines": {
"node": ">=16"
"node": ">=18"
},
"scripts": {
"start": "tsdx watch",
"build": "tsdx build && ./patch.sh",
"start": "rollup -c --watch",
"build": "rollup -c",
"build:demo": "node ./example/build.js",
"test": "tsdx test",
"lint": "tsdx lint src test",
"prepare": "tsdx build && ./patch.sh",
"lint": "tsdx lint",
"size": "size-limit"
},
"husky": {
Expand All @@ -39,8 +38,8 @@
"author": "Muhammed Tanrıkulu <[email protected]>",
"size-limit": [
{
"path": "dist/ens-avatar.cjs.production.min.js",
"limit": "250 KB",
"path": "dist/index.js",
"limit": "200 KB",
"ignore": [
"jsdom"
]
Expand All @@ -54,17 +53,17 @@
}
],
"devDependencies": {
"@size-limit/preset-small-lib": "^7.0.5",
"@types/dompurify": "^2.3.3",
"@types/jsdom": "^16.2.14",
"@rollup/plugin-typescript": "^11.1.5",
"@size-limit/preset-small-lib": "^11.0.1",
"@types/dompurify": "^3.0.5",
"@types/jsdom": "^21.1.6",
"@types/url-join": "^4.0.1",
"dotenv": "^16.0.0",
"dotenv": "^16.3.1",
"esbuild": "^0.14.21",
"husky": "^7.0.4",
"nock": "^13.4.0",
"size-limit": "^7.0.5",
"nock": "^13.2.2",
"rollup": "^4.9.1",
"size-limit": "^11.0.1",
"tsdx": "^0.14.1",
"tslib": "^2.3.1",
"typescript": "^4.5.5"
},
"dependencies": {
Expand All @@ -81,6 +80,6 @@
"url-join": "^4.0.1"
},
"volta": {
"node": "16.14.0"
"node": "18.14.0"
}
}
34 changes: 0 additions & 34 deletions patch.sh

This file was deleted.

51 changes: 51 additions & 0 deletions rollup.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
import fs from 'fs';
import path from 'path';
import tsPlugin from '@rollup/plugin-typescript';

export default {
input: 'src/index.ts',
output: [
{
format: 'cjs',
file: './dist/index.js',
},
{
format: 'es',
dir: 'dist',
preserveModules: true,
preserveModulesRoot: 'src',
entryFileNames: chunk => {
return `${chunk.name === 'index' ? 'index.esm' : chunk.name}.js`;
},
},
],
plugins: [
tsPlugin({
declarationDir: './dist',
sourceMap: false,
}),
removeDist(),
],
};

function removeDist(options = {}) {
const { hook = 'buildStart', buildDir = 'dist' } = options;

return {
name: 'remove-dist',
[hook]: async () => {
const folderPath = path.join(process.cwd(), buildDir);
try {
fs.accessSync(folderPath, fs.F_OK);
fs.rmSync(folderPath, { recursive: true, force: true });
} catch (err) {
if (err.code !== 'ENOENT') throw err;
try {
fs.rmSync(folderPath, { recursive: true, force: true });
} catch (innerErr) {
console.log('An error occurred while removing the folder:', innerErr);
}
}
},
};
}
14 changes: 0 additions & 14 deletions tsdx.config.js

This file was deleted.

Loading

0 comments on commit aa3d35d

Please sign in to comment.