@graphprotocol/graph-cli 0.58.0 → 0.58.1-alpha-20230918234439-266233d

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,13 @@
1
1
  # @graphprotocol/graph-cli
2
2
 
3
+ ## 0.58.1-alpha-20230918234439-266233d
4
+
5
+ ### Patch Changes
6
+
7
+ - [#1458](https://github.com/graphprotocol/graph-tooling/pull/1458)
8
+ [`266233d`](https://github.com/graphprotocol/graph-tooling/commit/266233d45fb912fdd9ea3ebb8018e85d871ac970)
9
+ Thanks [@saihaj](https://github.com/saihaj)! - do not init a git repo if a repo already exists
10
+
3
11
  ## 0.58.0
4
12
 
5
13
  ### Minor Changes
@@ -619,6 +619,19 @@ function revalidateSubgraphName(subgraphName, { allowSimpleName }) {
619
619
  $ graph init ${subgraphName} --allow-simple-name`);
620
620
  }
621
621
  }
622
+ // source: https://github.com/graphprotocol/graph-tooling/issues/1450#issuecomment-1713992618
623
+ async function isInRepo() {
624
+ try {
625
+ const result = await gluegun_1.system.run('git rev-parse --is-inside-work-tree');
626
+ return result === 'true';
627
+ }
628
+ catch (err) {
629
+ if (err.stderr.includes('not a git repository')) {
630
+ return false;
631
+ }
632
+ throw Error(err.stderr);
633
+ }
634
+ }
622
635
  const initRepository = async (directory) => await (0, spinner_1.withSpinner)(`Initialize subgraph repository`, `Failed to initialize subgraph repository`, `Warnings while initializing subgraph repository`, async () => {
623
636
  // Remove .git dir in --from-example mode; in --from-contract, we're
624
637
  // starting from an empty directory
@@ -626,11 +639,19 @@ const initRepository = async (directory) => await (0, spinner_1.withSpinner)(`In
626
639
  if (gluegun_1.filesystem.exists(gitDir)) {
627
640
  gluegun_1.filesystem.remove(gitDir);
628
641
  }
629
- await gluegun_1.system.run('git init', { cwd: directory });
630
- await gluegun_1.system.run('git add --all', { cwd: directory });
631
- await gluegun_1.system.run('git commit -m "Initial commit"', {
632
- cwd: directory,
633
- });
642
+ if (await isInRepo()) {
643
+ await gluegun_1.system.run('git init', { cwd: directory });
644
+ await gluegun_1.system.run('git add --all', { cwd: directory });
645
+ await gluegun_1.system.run('git commit -m "Initial commit"', {
646
+ cwd: directory,
647
+ });
648
+ }
649
+ else {
650
+ await gluegun_1.system.run('git add --all', { cwd: directory });
651
+ await gluegun_1.system.run('git commit -m "Initialize subgraph"', {
652
+ cwd: directory,
653
+ });
654
+ }
634
655
  return true;
635
656
  });
636
657
  const installDependencies = async (directory, commands) => await (0, spinner_1.withSpinner)(`Install dependencies with ${commands.install}`, `Failed to install dependencies`, `Warnings while installing dependencies`, async () => {
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "0.58.0",
2
+ "version": "0.58.1-alpha-20230918234439-266233d",
3
3
  "commands": {
4
4
  "add": {
5
5
  "id": "add",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@graphprotocol/graph-cli",
3
- "version": "0.58.0",
3
+ "version": "0.58.1-alpha-20230918234439-266233d",
4
4
  "description": "CLI for building for and deploying to The Graph",
5
5
  "license": "(Apache-2.0 OR MIT)",
6
6
  "engines": {