@graphprotocol/graph-cli 0.43.0 → 0.43.1-alpha-20230321032415-91f97ff

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/CHANGELOG.md CHANGED
@@ -1,5 +1,23 @@
1
1
  # @graphprotocol/graph-cli
2
2
 
3
+ ## 0.43.1-alpha-20230321032415-91f97ff
4
+
5
+ ### Patch Changes
6
+
7
+ - [#1201](https://github.com/graphprotocol/graph-tooling/pull/1201)
8
+ [`91f97ff`](https://github.com/graphprotocol/graph-tooling/commit/91f97ff8893d20d288e84312062f33060d5f0b4e)
9
+ Thanks [@saihaj](https://github.com/saihaj)! - read testsFolder from matchstick yaml and set the
10
+ paths based on that
11
+
12
+ - [#1201](https://github.com/graphprotocol/graph-tooling/pull/1201)
13
+ [`95edea6`](https://github.com/graphprotocol/graph-tooling/commit/95edea632dee687d18bcffa19d4108fe5da99a94)
14
+ Thanks [@saihaj](https://github.com/saihaj)! - make datasource and version optional args for test
15
+ command
16
+
17
+ - [`876bc52`](https://github.com/graphprotocol/graph-tooling/commit/876bc523e5a53db162d9b5aa79e9de76a9e92ccf)
18
+ Thanks [@saihaj](https://github.com/saihaj)! - Allow file data sources (with no network) to deploy
19
+ to the studio. File data sources don't have a network specified.
20
+
3
21
  ## 0.43.0
4
22
 
5
23
  ### Minor Changes
@@ -26,9 +26,10 @@ exports.allowedStudioNetworks = [
26
26
  ];
27
27
  const validateStudioNetwork = ({ studio, product, network, }) => {
28
28
  const isStudio = studio || product === 'subgraph-studio';
29
- const isAllowedNetwork = exports.allowedStudioNetworks.includes(
30
- // @ts-expect-error we're checking if the network is allowed
31
- network);
29
+ const isAllowedNetwork = !network ||
30
+ exports.allowedStudioNetworks.includes(
31
+ // @ts-expect-error we're checking if the network is allowed
32
+ network);
32
33
  if (isStudio && !isAllowedNetwork) {
33
34
  throw new Error(`The Subgraph Studio only allows subgraphs for these networks: ${exports.allowedStudioNetworks.join(', ')}`);
34
35
  }
@@ -16,6 +16,12 @@ describe('Version Command Helpers', () => {
16
16
  network: 'gnosis',
17
17
  })).not.toThrow(new Error(`The Subgraph Studio only allows subgraphs for these networks: ${studio_1.allowedStudioNetworks.join(', ')}`));
18
18
  });
19
+ test('And no network is passed', () => {
20
+ expect(() => (0, studio_1.validateStudioNetwork)({
21
+ studio: true,
22
+ network: undefined,
23
+ })).not.toThrow(new Error(`The Subgraph Studio only allows subgraphs for these networks: ${studio_1.allowedStudioNetworks.join(', ')}`));
24
+ });
19
25
  test("And it's NOT an allowed network", () => {
20
26
  expect(() => (0, studio_1.validateStudioNetwork)({
21
27
  product: 'subgraph-studio',
@@ -15,28 +15,16 @@ const semver_1 = __importDefault(require("semver"));
15
15
  class TestCommand extends core_1.Command {
16
16
  async run() {
17
17
  const { args: { datasource }, flags: { coverage, docker, force, logs, recompile, version }, } = await this.parse(TestCommand);
18
- const testsDir = './tests';
19
- const cachePath = path_1.default.resolve(testsDir, '.latest.json');
20
- const opts = {
21
- testsDir,
22
- cachePath,
23
- coverage,
24
- docker,
25
- force,
26
- logs,
27
- recompile,
28
- version,
29
- latestVersion: getLatestVersionFromCache(cachePath),
30
- };
18
+ let testsDir = './tests';
31
19
  // Check if matchstick.yaml config exists
32
20
  if (gluegun_1.filesystem.exists('matchstick.yaml')) {
33
21
  try {
34
22
  // Load the config
35
23
  const config = await js_yaml_1.default.load(gluegun_1.filesystem.read('matchstick.yaml', 'utf8'));
36
- // Check if matchstick.yaml and testsDir not null
37
- if (config?.testsDir) {
24
+ // Check if matchstick.yaml and testsFolder not null
25
+ if (config?.testsFolder) {
38
26
  // assign test folder from matchstick.yaml if present
39
- opts.testsDir = config.testsDir;
27
+ testsDir = config.testsFolder;
40
28
  }
41
29
  }
42
30
  catch (error) {
@@ -45,6 +33,18 @@ class TestCommand extends core_1.Command {
45
33
  });
46
34
  }
47
35
  }
36
+ const cachePath = path_1.default.resolve(testsDir, '.latest.json');
37
+ const opts = {
38
+ testsDir,
39
+ cachePath,
40
+ coverage,
41
+ docker,
42
+ force,
43
+ logs,
44
+ recompile,
45
+ version,
46
+ latestVersion: getLatestVersionFromCache(cachePath),
47
+ };
48
48
  // Fetch the latest version tag if version is not specified with -v/--version or if the version is not cached
49
49
  if (opts.force || (!opts.version && !opts.latestVersion)) {
50
50
  this.log('Fetching latest version tag...');
@@ -69,9 +69,7 @@ class TestCommand extends core_1.Command {
69
69
  exports.default = TestCommand;
70
70
  TestCommand.description = 'Runs rust binary for subgraph testing.';
71
71
  TestCommand.args = {
72
- datasource: core_1.Args.string({
73
- required: true,
74
- }),
72
+ datasource: core_1.Args.string(),
75
73
  };
76
74
  TestCommand.flags = {
77
75
  help: core_1.Flags.help({
@@ -100,7 +98,6 @@ TestCommand.flags = {
100
98
  version: core_1.Flags.string({
101
99
  summary: 'Choose the version of the rust binary that you want to be downloaded/used.',
102
100
  char: 'v',
103
- required: true,
104
101
  }),
105
102
  };
106
103
  function getLatestVersionFromCache(cachePath) {
@@ -203,7 +200,7 @@ async function runDocker(datasource, opts) {
203
200
  // Get current working directory
204
201
  const current_folder = gluegun_1.filesystem.cwd();
205
202
  // Declate dockerfilePath with default location
206
- const dockerfilePath = path_1.default.join(opts.testsDir || 'tests', '.docker/Dockerfile');
203
+ const dockerfilePath = path_1.default.join(opts.testsDir, '.docker/Dockerfile');
207
204
  // Check if the Dockerfil already exists
208
205
  const dockerfileExists = gluegun_1.filesystem.exists(dockerfilePath);
209
206
  // Generate the Dockerfile only if it doesn't exists,
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "0.43.0",
2
+ "version": "0.43.1-alpha-20230321032415-91f97ff",
3
3
  "commands": {
4
4
  "add": {
5
5
  "id": "add",
@@ -782,14 +782,12 @@
782
782
  "type": "option",
783
783
  "char": "v",
784
784
  "summary": "Choose the version of the rust binary that you want to be downloaded/used.",
785
- "required": true,
786
785
  "multiple": false
787
786
  }
788
787
  },
789
788
  "args": {
790
789
  "datasource": {
791
- "name": "datasource",
792
- "required": true
790
+ "name": "datasource"
793
791
  }
794
792
  }
795
793
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@graphprotocol/graph-cli",
3
- "version": "0.43.0",
3
+ "version": "0.43.1-alpha-20230321032415-91f97ff",
4
4
  "description": "CLI for building for and deploying to The Graph",
5
5
  "license": "(Apache-2.0 OR MIT)",
6
6
  "engines": {