-
Notifications
You must be signed in to change notification settings - Fork 32
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
use chains.js instead of json (simplify rollup use)
- Loading branch information
Showing
6 changed files
with
3,128 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,11 +12,10 @@ | |
"email": "<[email protected]>" | ||
}, | ||
"scripts": { | ||
"update-chains": "node ./scripts/update-chains.js", | ||
"build": "rollup -c" | ||
}, | ||
"devDependencies": { | ||
"@babel/core": "^7.15.0", | ||
"@rollup/plugin-json": "^4.1.0", | ||
"eslint-plugin-svelte3": "^3.2.0", | ||
"release-it": "^14.11.5", | ||
"rollup": "^2.56.3", | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,9 @@ | ||
//import svelte from 'rollup-plugin-svelte'; | ||
//import resolve from '@rollup/plugin-node-resolve'; | ||
//import commonjs from '@rollup/plugin-commonjs'; | ||
import json from '@rollup/plugin-json'; | ||
import pkg from './package.json'; | ||
|
||
const name = pkg.name | ||
.replace(/^(@\S+\/)?(svelte-)?(\S+)/, '$3') | ||
.replace(/^\w/, m => m.toUpperCase()) | ||
.replace(/-\w/g, m => m[1].toUpperCase()); | ||
|
||
export default [ | ||
{ | ||
input: "./src/web3-store.js", | ||
output: [ | ||
{ file: "dist/index.mjs", format: "es" }, | ||
{ file: "dist/index.js", format: "umd", name: "web3store" }, | ||
], | ||
plugins: [json()] | ||
] | ||
}, | ||
]; | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
const util = require('util') | ||
const fetch = require('node-fetch') | ||
const { writeFile } = require('fs/promises') | ||
|
||
const run = async () => { | ||
|
||
const res = await fetch('https://chainid.network/chains.json') | ||
|
||
const chains = await res.json() | ||
|
||
if (!chains.map( c => c.name ).includes('Ethereum Mainnet')) { | ||
throw new Error('something wrong... check!') | ||
} | ||
|
||
await writeFile('./src/chains.js', ` | ||
const chains = ${util.inspect(chains, { depth: null, maxArrayLength: null })} | ||
export default chains | ||
` | ||
) | ||
|
||
} | ||
|
||
run() |
Oops, something went wrong.