create-ponder 0.5.1 → 0.5.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +41 -34
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -16,7 +16,7 @@ import { default as prompts } from "prompts";
|
|
|
16
16
|
// package.json
|
|
17
17
|
var package_default = {
|
|
18
18
|
name: "create-ponder",
|
|
19
|
-
version: "0.5.
|
|
19
|
+
version: "0.5.3",
|
|
20
20
|
type: "module",
|
|
21
21
|
description: "A CLI tool to create Ponder apps",
|
|
22
22
|
license: "MIT",
|
|
@@ -517,29 +517,34 @@ var subgraphProviders = [
|
|
|
517
517
|
{
|
|
518
518
|
id: "thegraph",
|
|
519
519
|
name: "The Graph",
|
|
520
|
-
|
|
520
|
+
// Used to be https://ipfs.network.thegraph.com/api/v0/cat?arg=${cid}
|
|
521
|
+
// Also used to accept GET requests for some reason
|
|
522
|
+
fetchIpfs: async (cid) => {
|
|
523
|
+
const response = await fetch(
|
|
524
|
+
`https://api.thegraph.com/ipfs/api/v0/cat?arg=${cid}`,
|
|
525
|
+
{ method: "POST" }
|
|
526
|
+
);
|
|
527
|
+
return await response.text();
|
|
528
|
+
}
|
|
521
529
|
},
|
|
522
530
|
{
|
|
523
531
|
id: "satsuma",
|
|
524
532
|
name: "Alchemy Subgraph (Satsuma)",
|
|
525
|
-
|
|
533
|
+
fetchIpfs: async (cid) => {
|
|
534
|
+
const response = await fetch(`https://ipfs.satsuma.xyz/ipfs/${cid}`);
|
|
535
|
+
return await response.text();
|
|
536
|
+
}
|
|
526
537
|
}
|
|
527
538
|
];
|
|
528
|
-
var fetchIpfsFile = async (cid, subgraphProvider) => {
|
|
529
|
-
const url = subgraphProvider.getUrl(cid);
|
|
530
|
-
const response = await fetch(url);
|
|
531
|
-
const contentRaw = await response.text();
|
|
532
|
-
return contentRaw;
|
|
533
|
-
};
|
|
534
539
|
var fromSubgraphId = async ({
|
|
535
540
|
rootDir,
|
|
536
541
|
subgraphId,
|
|
537
|
-
subgraphProvider
|
|
542
|
+
subgraphProvider
|
|
538
543
|
}) => {
|
|
539
544
|
const provider = subgraphProviders.find((p) => p.id === subgraphProvider);
|
|
540
545
|
if (!provider)
|
|
541
546
|
throw new Error(`Unknown subgraph provider: ${subgraphProvider}`);
|
|
542
|
-
const manifestRaw = await
|
|
547
|
+
const manifestRaw = await provider.fetchIpfs(subgraphId);
|
|
543
548
|
const manifest = parse(manifestRaw);
|
|
544
549
|
const contracts = {};
|
|
545
550
|
manifest.dataSources.forEach((d) => {
|
|
@@ -558,7 +563,7 @@ var fromSubgraphId = async ({
|
|
|
558
563
|
const abis = {};
|
|
559
564
|
await Promise.all(
|
|
560
565
|
abiFiles.map(async (abi) => {
|
|
561
|
-
const abiContent = await
|
|
566
|
+
const abiContent = await provider.fetchIpfs(abi.file["/"].slice(6));
|
|
562
567
|
const abiPath = path3.join(rootDir, `./abis/${abi.name}Abi.ts`);
|
|
563
568
|
writeFileSync2(
|
|
564
569
|
abiPath,
|
|
@@ -928,24 +933,26 @@ async function run({
|
|
|
928
933
|
"install",
|
|
929
934
|
packageManager === "npm" ? "--quiet" : "--silent"
|
|
930
935
|
];
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
936
|
+
if (!options.skipInstall) {
|
|
937
|
+
await oraPromise(
|
|
938
|
+
execa(packageManager, installArgs, {
|
|
939
|
+
cwd: projectPath,
|
|
940
|
+
env: {
|
|
941
|
+
...process.env,
|
|
942
|
+
ADBLOCK: "1",
|
|
943
|
+
DISABLE_OPENCOLLECTIVE: "1",
|
|
944
|
+
// we set NODE_ENV to development as pnpm skips dev
|
|
945
|
+
// dependencies when production
|
|
946
|
+
NODE_ENV: "development"
|
|
947
|
+
}
|
|
948
|
+
}),
|
|
949
|
+
{
|
|
950
|
+
text: `Installing packages with ${pico5.bold(packageManager)}. This may take a few seconds.`,
|
|
951
|
+
failText: "Failed to install packages.",
|
|
952
|
+
successText: `Installed packages with ${pico5.bold(packageManager)}.`
|
|
941
953
|
}
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
text: `Installing packages with ${pico5.bold(packageManager)}. This may take a few seconds.`,
|
|
945
|
-
failText: "Failed to install packages.",
|
|
946
|
-
successText: `Installed packages with ${pico5.bold(packageManager)}.`
|
|
947
|
-
}
|
|
948
|
-
);
|
|
954
|
+
);
|
|
955
|
+
}
|
|
949
956
|
if (!options.skipGit) {
|
|
950
957
|
await oraPromise(
|
|
951
958
|
async () => {
|
|
@@ -999,13 +1006,13 @@ async function run({
|
|
|
999
1006
|
const cli = cac(package_default.name).version(package_default.version).usage(`${pico5.green("<directory>")} [options]`).option(
|
|
1000
1007
|
"-t, --template [id]",
|
|
1001
1008
|
`Use a template. Options: ${templates.map(({ id }) => id).join(", ")}`
|
|
1002
|
-
).option("--etherscan [url]", "Use the Etherscan template").option(
|
|
1003
|
-
"--subgraph-provider [provider]",
|
|
1004
|
-
`Specify the subgraph provider. Options: ${subgraphProviders.map(({ id }) => id).join(", ")}`
|
|
1005
|
-
).option("--npm", "Use npm as your package manager").option("--pnpm", "Use pnpm as your package manager").option("--yarn", "Use yarn as your package manager").option("--skip-git", "Skip initializing a git repository").option(
|
|
1009
|
+
).option("--etherscan [url]", "Use the Etherscan template").option(
|
|
1006
1010
|
"--etherscan-api-key [key]",
|
|
1007
1011
|
"Etherscan API key for Etherscan template"
|
|
1008
|
-
).
|
|
1012
|
+
).option("--subgraph [id]", "Use the subgraph template").option(
|
|
1013
|
+
"--subgraph-provider [provider]",
|
|
1014
|
+
`Specify the subgraph provider. Options: ${subgraphProviders.map(({ id }) => id).join(", ")}`
|
|
1015
|
+
).option("--npm", "Use npm as your package manager").option("--pnpm", "Use pnpm as your package manager").option("--yarn", "Use yarn as your package manager").option("--skip-git", "Skip initializing a git repository").option("--skip-install", "Skip installing packages").help();
|
|
1009
1016
|
const _nodeVersion = process.version.split(".");
|
|
1010
1017
|
const nodeVersion = [
|
|
1011
1018
|
Number(_nodeVersion[0].slice(1)),
|