Skip to content
Open

Test #102

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions bin/run.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 2 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@subsquid/cli",
"description": "squid cli tool",
"version": "3.2.1",
"version": "3.2.3",
"license": "GPL-3.0-or-later",
"repository": "git@github.com:subsquid/squid-cli.git",
"publishConfig": {
Expand Down Expand Up @@ -78,8 +78,7 @@
"@oclif/plugin-autocomplete": "3.2.2",
"@oclif/plugin-warn-if-update-available": "^3.1.13",
"@subsquid/commands": "^2.3.1",
"@subsquid/manifest": "^2.0.0-beta.18",
"@subsquid/manifest-expr": "^0.0.1",
"@subsquid/manifest": "^2.0.0-beta.20",
"@types/fast-levenshtein": "^0.0.4",
"@types/lodash": "^4.17.7",
"@types/targz": "^1.0.4",
Expand Down
11 changes: 6 additions & 5 deletions src/commands/run.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import { defaults, omit } from 'lodash';
import treeKill from 'tree-kill';

import { CliCommand } from '../command';
import { evalManifestEnv, loadManifestFile } from '../manifest';
import { loadManifestFile } from '../manifest';

const chalkColors = [chalk.green, chalk.yellow, chalk.blue, chalk.magenta, chalk.cyan];

Expand Down Expand Up @@ -180,21 +180,22 @@ export default class Run extends CliCommand {
}

const context = { secrets: process.env };
const evaluatedManifest = manifest.eval(context);

const processEnv = omit(process.env, ['PROCESSOR_PROMETHEUS_PORT']);
const env = {
FORCE_COLOR: 'true',
FORCE_PRETTY_LOGGER: 'true',
...processEnv,
...evalManifestEnv(manifest.deploy?.env ?? {}, context),
...evaluatedManifest.deploy?.env,
};

const init = manifest.deploy?.init;
if (init && init.cmd && !isSkipped({ include, exclude }, 'init')) {
const p = new SquidProcess('init', init.cmd, {
env: {
...env,
...evalManifestEnv(init.env ?? {}, context),
...init.env,
},
cwd: squidDir,
});
Expand All @@ -208,7 +209,7 @@ export default class Run extends CliCommand {
new SquidProcess('api', api.cmd, {
env: {
...env,
...evalManifestEnv(api.env ?? {}, context),
...api.env,
},
cwd: squidDir,
}),
Expand All @@ -227,7 +228,7 @@ export default class Run extends CliCommand {
new SquidProcess(processor.name, processor.cmd, {
env: {
...env,
...evalManifestEnv(processor.env ?? {}, context),
...processor.env,
},
cwd: squidDir,
}),
Expand Down
13 changes: 0 additions & 13 deletions src/manifest/manifest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import fs from 'fs';
import path from 'path';

import { Manifest } from '@subsquid/manifest';
import { Expression, Parser } from '@subsquid/manifest-expr';
import { mapValues } from 'lodash';

export function readManifest(path: string) {
Expand All @@ -13,18 +12,6 @@ export function saveManifest(path: string, manifest: string) {
fs.writeFileSync(path, manifest);
}

export function evalManifestEnv(env: Record<string, any>, context: Record<string, any>) {
const parsed = parseManifestEnv(env);

return mapValues(parsed, (value) => (value instanceof Expression ? value.eval(context) : value));
}

export function parseManifestEnv(env: Record<string, any>) {
const parser = new Parser();

return mapValues(env, (value) => (typeof value === 'string' ? parser.parse(value) : value));
}

export function loadManifestFile(
localPath: string,
manifestPath: string,
Expand Down
18 changes: 5 additions & 13 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1411,8 +1411,7 @@ __metadata:
"@oclif/plugin-autocomplete": "npm:3.2.2"
"@oclif/plugin-warn-if-update-available": "npm:^3.1.13"
"@subsquid/commands": "npm:^2.3.1"
"@subsquid/manifest": "npm:^2.0.0-beta.18"
"@subsquid/manifest-expr": "npm:^0.0.1"
"@subsquid/manifest": "npm:^2.0.0-beta.20"
"@types/async-retry": "npm:^1.4.8"
"@types/blessed": "npm:^0.1.25"
"@types/cross-spawn": "npm:^6.0.6"
Expand Down Expand Up @@ -1506,21 +1505,14 @@ __metadata:
languageName: node
linkType: hard

"@subsquid/manifest-expr@npm:^0.0.1":
version: 0.0.1
resolution: "@subsquid/manifest-expr@npm:0.0.1"
checksum: 10c0/0d35806599bcc0c7742873a0fe5f9dd1afbc51130b5ae72724c81a3d8ef2beee48239dbe24ae33f08f34ce104f27c6c3928c39b09393ea9fdda691ba99630f84
languageName: node
linkType: hard

"@subsquid/manifest@npm:^2.0.0-beta.18":
version: 2.0.0-beta.18
resolution: "@subsquid/manifest@npm:2.0.0-beta.18"
"@subsquid/manifest@npm:^2.0.0-beta.20":
version: 2.0.0-beta.20
resolution: "@subsquid/manifest@npm:2.0.0-beta.20"
dependencies:
joi: "npm:17.13.3"
js-yaml: "npm:^4.1.0"
lodash: "npm:^4.17.21"
checksum: 10c0/e7a6aba68867e0f915ee530c4829c0fe9433ef0a34922238b5f4058e9a88ef343bc5f89b28d3c7028c9b3cd2d045f8785939c3df0b69e32f498bdc76ef1f29e5
checksum: 10c0/6c0abb10089e80ae6decde8ea647bc57e249429984785fc0fb9bd57b9047ba3df4dd67521d9d858844c92c6f956fe83d8949cd5e10de2833a17412f883e6d540
languageName: node
linkType: hard

Expand Down