Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2022-05-18 00:08:51 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2022-05-18 00:08:51 +0300
commit9613d93025008a5326ddb624e2909feaa87e7977 (patch)
tree0a48921271f5ad0a31433626325f54b691d10fd6 /scripts
parent6f05d35c3160e3a442b40d6af1e8e584747080b3 (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/dump_graphql_schema25
-rw-r--r--scripts/frontend/eslint.js22
2 files changed, 47 insertions, 0 deletions
diff --git a/scripts/dump_graphql_schema b/scripts/dump_graphql_schema
new file mode 100755
index 00000000000..7a8bd5652e1
--- /dev/null
+++ b/scripts/dump_graphql_schema
@@ -0,0 +1,25 @@
+#!/usr/bin/env bash
+
+GITLAB_DIR="$(cd "$(dirname "$0")/.." || exit ; pwd -P)"
+DOCKER_IMAGE="registry.gitlab.com/gitlab-org/gitlab-build-images:apollo"
+CONFIG_FILE="config/apollo.config.js"
+SCHEMA_DUMP_PATH="tmp/tests/graphql/gitlab_schema_apollo.graphql"
+
+if [ "$CI" = true ]; then
+ echo "Not dumping the GraphQL schema in CI"
+else
+ echo "Dumping GraphQL schema"
+ cd "$GITLAB_DIR" || exit 1
+ if command -v docker >/dev/null; then
+ bundle exec rake gitlab:graphql:schema:dump &&
+ docker run --rm -it \
+ -v "$GITLAB_DIR/config":/config \
+ -v "$GITLAB_DIR/tmp":/tmp \
+ -v "$GITLAB_DIR/app":/app \
+ -v "$GITLAB_DIR/ee":/ee \
+ "$DOCKER_IMAGE" client:download-schema --config="$CONFIG_FILE" "$SCHEMA_DUMP_PATH"
+ else
+ echo "Docker must be installed to run this script."
+ exit 1
+ fi
+fi
diff --git a/scripts/frontend/eslint.js b/scripts/frontend/eslint.js
new file mode 100644
index 00000000000..2ba5976d1b9
--- /dev/null
+++ b/scripts/frontend/eslint.js
@@ -0,0 +1,22 @@
+const { spawn } = require('child_process');
+
+const runEslint = () => {
+ const [, , ...args] = process.argv;
+ const child = spawn(`yarn`, ['internal:eslint', ...args], {
+ stdio: 'inherit',
+ });
+
+ child.on('exit', (code) => {
+ process.exitCode = code;
+
+ if (code === 0) {
+ return;
+ }
+ console.log(`
+If you are seeing @graphql-eslint offences, the local GraphQL schema dump might be outdated.
+Consider updating it by running \`./scripts/dump_graphql_schema\`.
+ `);
+ });
+};
+
+runEslint();