@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 +8 -0
- package/dist/commands/init.js +26 -5
- package/oclif.manifest.json +1 -1
- package/package.json +1 -1
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
|
package/dist/commands/init.js
CHANGED
|
@@ -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
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
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 () => {
|
package/oclif.manifest.json
CHANGED