autographed
Advanced tools
Comparing version 0.1.2 to 0.1.3
@@ -154,2 +154,3 @@ import 'jest'; | ||
hardhatProjectDir: testHardhatProject, | ||
ethereumNetwork: 'hardhat', | ||
purgeIfExists: true, | ||
@@ -156,0 +157,0 @@ }); |
@@ -109,2 +109,3 @@ "use strict"; | ||
hardhatProjectDir: testHardhatProject, | ||
ethereumNetwork: 'hardhat', | ||
purgeIfExists: true, | ||
@@ -111,0 +112,0 @@ }); |
{ | ||
"name": "autographed", | ||
"version": "0.1.2", | ||
"version": "0.1.3", | ||
"description": "The self-building, hot-reloading subgraph. The quickest way to start indexing your shit.", | ||
@@ -5,0 +5,0 @@ "main": "dist", |
@@ -37,2 +37,3 @@ #!/usr/bin/env node | ||
const subgraphTemplateDir = (0, src_1.tempPath)(`subgraphTemplateDir__${seed}`); | ||
const { ethereumNetwork } = deployParams; | ||
// Rebuild every time (source code can change). | ||
@@ -45,2 +46,3 @@ (0, src_1.createSubgraphTemplate)({ | ||
purgeIfExists: true, | ||
ethereumNetwork, | ||
}); | ||
@@ -47,0 +49,0 @@ await (0, src_1.deploy)({ |
@@ -16,3 +16,3 @@ /// <reference types="node" /> | ||
}) => void; | ||
export declare const createSubgraphTemplate: ({ sources, dir, graphProtocolTemplateDir, purgeIfExists, hardhatProjectDir, }: { | ||
export declare const createSubgraphTemplate: ({ sources, dir, graphProtocolTemplateDir, purgeIfExists, hardhatProjectDir, ethereumNetwork, }: { | ||
readonly sources: readonly Source[]; | ||
@@ -23,2 +23,3 @@ readonly dir: string; | ||
readonly hardhatProjectDir: string; | ||
readonly ethereumNetwork: string; | ||
}) => { | ||
@@ -25,0 +26,0 @@ packageJson: string; |
@@ -37,3 +37,2 @@ "use strict"; | ||
const yaml_1 = require("yaml"); | ||
const nanoid_1 = require("nanoid"); | ||
const tempPath = (name) => path_1.default.resolve(os_1.default.tmpdir(), name); | ||
@@ -62,3 +61,3 @@ exports.tempPath = tempPath; | ||
const subgraphCodegen = ({ dir: cwd }) => child_process.execSync('npm run-script codegen', { stdio: 'inherit', cwd }); | ||
const createSubgraphTemplate = ({ sources, dir, graphProtocolTemplateDir, purgeIfExists, hardhatProjectDir, }) => { | ||
const createSubgraphTemplate = ({ sources, dir, graphProtocolTemplateDir, purgeIfExists, hardhatProjectDir, ethereumNetwork, }) => { | ||
if (!fs_extra_1.default.existsSync(graphProtocolTemplateDir)) | ||
@@ -94,3 +93,3 @@ throw new Error(`Unable to find graphProtocolTemplate at "${graphProtocolTemplateDir}". `); | ||
dataSources: Array.from(dataSources) | ||
.map((e) => ({ ...e, network: 'hardhat' })) | ||
.map((e) => ({ ...e, network: ethereumNetwork })) | ||
.filter((_, i) => i > 0), | ||
@@ -151,3 +150,6 @@ })); | ||
exports.ipfs = ipfs; | ||
const postgres = ({ postgresDb, postgresPassword, postgresPort, postgresUser, dockerContainerName = (0, nanoid_1.nanoid)(), }) => new Promise(() => child_process.exec(` | ||
const postgres = ({ postgresDb, postgresPassword, postgresPort, postgresUser, dockerContainerName = 'autographed', }) => { | ||
// Stop the container if it's running. | ||
child_process.execSync(`docker stop ${dockerContainerName} || true && docker rm ${dockerContainerName} || true`, { stdio: 'inherit' }); | ||
return new Promise(() => child_process.exec(` | ||
docker run --name ${dockerContainerName} \ | ||
@@ -160,2 +162,3 @@ -p "${postgresPort}:${postgresPort}" \ | ||
`.trim())) /* forever */; | ||
}; | ||
const graphNode = async ({ graphNodeInstallationDir, postgresPassword, postgresPort, postgresUser, postgresDb, ipfsPort, ethereumNetwork, ethereumPort, }) => { | ||
@@ -162,0 +165,0 @@ // TODO: Ideally, we need to be able to wait for postgres too. Ipfs just happens to take |
{ | ||
"name": "autographed", | ||
"version": "0.1.2", | ||
"version": "0.1.3", | ||
"description": "The self-building, hot-reloading subgraph. The quickest way to start indexing your shit.", | ||
@@ -5,0 +5,0 @@ "main": "dist", |
@@ -20,3 +20,3 @@ # [`npx autographed`](https://github.com/cawfree/autographed) | ||
With these steps out of the way, you'll finally need to install these final low-level dependencies: | ||
With these steps out of the way, you'll finally need to install these last low-level dependencies: | ||
@@ -23,0 +23,0 @@ ```shell |
@@ -61,2 +61,4 @@ #!/usr/bin/env node | ||
const {ethereumNetwork} = deployParams; | ||
// Rebuild every time (source code can change). | ||
@@ -69,2 +71,3 @@ createSubgraphTemplate({ | ||
purgeIfExists: true, | ||
ethereumNetwork, | ||
}); | ||
@@ -71,0 +74,0 @@ |
@@ -8,3 +8,2 @@ import axios, {AxiosError} from "axios"; | ||
import {parse, stringify} from "yaml"; | ||
import {nanoid} from "nanoid"; | ||
@@ -73,2 +72,3 @@ import {Environment, Source} from "../@types"; | ||
hardhatProjectDir, | ||
ethereumNetwork, | ||
}: { | ||
@@ -80,2 +80,3 @@ readonly sources: readonly Source[]; | ||
readonly hardhatProjectDir: string; | ||
readonly ethereumNetwork: string; | ||
}) => { | ||
@@ -158,3 +159,3 @@ | ||
dataSources: Array.from(dataSources) | ||
.map((e: any) => ({...e, network: 'hardhat'})) | ||
.map((e: any) => ({...e, network: ethereumNetwork})) | ||
.filter((_, i) => i > 0), | ||
@@ -266,3 +267,3 @@ }), | ||
postgresUser, | ||
dockerContainerName = nanoid(), | ||
dockerContainerName = 'autographed', | ||
}: { | ||
@@ -274,5 +275,17 @@ readonly postgresPort: number; | ||
readonly dockerContainerName?: string; | ||
}) => new Promise( | ||
() => child_process.exec( | ||
` | ||
}) => { | ||
// Stop the container if it's running. | ||
child_process.execSync( | ||
`docker stop ${ | ||
dockerContainerName | ||
} || true && docker rm ${ | ||
dockerContainerName | ||
} || true`, | ||
{stdio: 'inherit'} | ||
); | ||
return new Promise( | ||
() => child_process.exec( | ||
` | ||
docker run --name ${dockerContainerName} \ | ||
@@ -285,4 +298,5 @@ -p "${postgresPort}:${postgresPort}" \ | ||
`.trim(), | ||
), | ||
) /* forever */; | ||
), | ||
) /* forever */; | ||
}; | ||
@@ -289,0 +303,0 @@ export const graphNode = async ({ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
59644
1372